Image recognition

Reference -About activation function -About the loss function

tutorial

Summary of neural network procedure for image recognition using MNIST training data.

MNIST A dataset of handwritten numbers from "0" to "9". Each number is divided into $ 28 \ times28 $ pixels, and each number is color-coded in 8bit 256 steps. It can be easily read by the API provided by keras.

>>> from keras.datasets import mnist
>>> (x_train, y_train), (x_test, y_test) = mnist.load_data()
>>> x_train[0]
array([[  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
          0,   0],
       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
          0,   0],
・ ・ ・(abridgement)
>>> y_train[0]
5

Convert the input information into a one-dimensional array.

>>> x_train = x_train.reshape(60000, 784)
>>> x_train[0]
array([  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
         0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
         0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,

Also, the correct answer data is converted to one-hot encoding (dummy variable). Since it is compared with the learning value as a probability in the final output layer, for example, if it is 5, the matrix is [0,0,0,0,0,1,0,0,0,0,]. This can also be created using the keras API.

>>> y_train = keras.utils.to_categorical(y_train, 10)
>>> y_test  = keras.utils.to_categorical(y_test, 10)

Neural network model

--Input layer --MNIST One pixel 28 × 28 = 784 pixels information is used as input information. --Hidden layer ――Tuning is required for how many layers to use --Output layer ――10 nodes corresponding to "0" to "9", the output value corresponds to the probability of that number

Image recognition

Based on the simple coding in the tutorial, we will move on to more practical image recognition. The final challenge goal is to extract the outline of the person.

Recommended Posts

Image recognition
Image recognition with keras
Pepper Tutorial (7): Image Recognition
CNN 1 Image Recognition Basics
Deep learning image recognition 1 theory
Image recognition with Keras + OpenCV
python x tensoflow x image face recognition
(Test automation) Make image recognition ambiguous
Deep learning image recognition 2 model implementation
Image recognition environment construction and basics
Image crawler
Image recognition of fruits using VGG16
Python: Basics of image recognition using CNN
Category estimation using docomo's image recognition API
Python: Application of image recognition using CNN
Image recognition model using deep learning in 2016
Image recognition using CNN Horses and deer
Deep learning image recognition 3 after model creation
I tried simple image recognition with Jupyter
[Image processing] Posterization
[Note] Image resizing
I tried image recognition of CIFAR-10 with Keras-Learning-
How to code a drone using image recognition
I tried image recognition of CIFAR-10 with Keras-Image recognition-
(Test automation) Nesting images used for image recognition
Image blur removal
Image collection method
Read & implement Deep Residual Learning for Image Recognition
Inflated learning image
Gender recognition memo
Do image recognition with Caffe model Chainer Yo!
Normalize image brightness
First image classifier
Image processing 100 knocks ①
Basic principles of image recognition technology (for beginners)
Implementation of Deep Learning model for image recognition
Image of closure
[kotlin] Create a real-time image recognition app on android
Until you can do simple image recognition with Jupyter