Objective:

Reinforce the knowledge acquired in class on the design and programming of neural networks based on the Multilayer Perceptron as a pattern classification tool.

Definitions:

Convolutional neural networks are a type of artificial neural networks where "neurons" correspond to receptive fields in a very similar way to neurons in the primary visual cortex (V1) of a biological brain. This type of network is a variation of a multilayer perceptron, however, because its application is carried out in two-dimensional matrices, they are very effective for artificial vision tasks, such as in the classification and segmentation of images, among other applications.

How to make a convolutional network learn

Convolutional Neural Networks, CNN learn to recognize a diversity of objects within images, but for this they need to "train" in advance with a significant amount of "samples" -leave more than 10,000, in this way the neurons of the network will being able to capture the unique characteristics -of each object- and at the same time, being able to generalize it - this is what is known as the process of “learning an algorithm”. Our network will be able to recognize, for example, a certain type of cell because it has already "seen" it many times before, but it will not only look for similar cells but it will also be able to infer images that it does not know but that it relates and where similarities could exist, and this is the smart part of the recognition


Developing:

The project must be loaded and functional through a Google Colab notebook or through the BINDER tool (https://mybinder.org/). You can use your machine to train the network or use Google Colab or Kaggle. 2. The program must load the images of the given data corpus (which contains 90 categories of animals: antelope, dog, kangaroo, tiger, etc.) considering that they are color images (RGB, Red, Green and Blue) of 270 x 200 pixels (approximate).


We import the libraries that we are going to occupy


We import the package to access the unit:



For this we proceed to use cv2, this library allows us to resize the images to the desired size.
OpenCV (Open Source Computer Vision) started as a research project at Intel. It is currently the largest computer vision library in terms of functions owned.

Currently, OpenCV contains implementations of more than 2500 algorithms. It is also available free of charge for commercial and academic purposes.

This great library has interfaces to multiple languages, including Python, Java, and C ++.

The first version of OpenCV, 1.0, was released in 2006 and the OpenCV community has grown by leaps and bounds since then.
Ejemplo de Imagen con nuevo formato


  • Deberá comparar al menos dos configuraciones distintas de Red Neuronal Convolucional (CNN). Para cada red neuronal es necesario llevar a cabo el siguiente análisis: o Probar al menos 2 distintas estructuras de redes neuronales y funciones de activación, a fin de determinar cuál fue la mejor alternativa (considerando número de neuronas, número de capas y funciones de activación).



Primero Probamos con el optimizador  rmsprop:
The gist of RMSprop is to: Maintain a moving (discounted) average of the square of gradients
  • Divide the gradient by the root of this average This implementation of RMSprop uses plain momentum, not Nesterov momentum. The centered version additionally maintains a moving average of the gradients, and uses that average to estimate the variance.

Continuación probamos con el optimizador adam obteniendo:







We apply this function to save the model.





In the next image we save the model.








We design the network cnn.



Network training with 30 times.


We save the network and send the data to be viewed.





Conclusions.

The network was designed successfully since the perceptron being a neural network that has supervised learning, it was able to correctly classify all the inputs in order to have an output.

Finally we see the great utility of the perceptron since as pattern recognition and the ability to classify based on them, we can reach much more complex applications. The way this network was designed, it also has many more applications anywhere and in any form.

Recommendations

For the proper functioning of the neural network, the following considerations must be followed:

The images with which you are going to work must be very clear.

 

For good maintainability it is suggested that the network be trained every certain period of time, since current and correct information is needed for the network to function properly.

You must have a broad knowledge about the subject.


Comentarios