Logo Lanfrica

abdoul-gambo/Deep-Learning-examples-Keras

Creator:
abd
Host:
## Deep Learning Demo In this post, I show an example of using deep learning techniques to identify objects on images. The example assume that you are familiar with the theory of the neural networks and Python. I will use Convolutional Neural Networks (CNN or Conv Net) algorithm which are very similar to ordinary Neural Networks and CIFAR-10 dataset (60000 32x32 colour images in 10 classes, with 6000 images per class). In `src` folder, you can find more examples for: - Regression and supervised learning using Multilayer Perceptron (MLP) - Image classification with advanced features (image augmentation, ...) using Convolutional Neural Networks (CNN or Conv Net) - Time series or text generation using Recurrent Neural Networks (RNN ans specialy LSTM) All input datasets are ind `data` folder or Keras package (so you need internet access for Keras dataset like CIFAR-10) ### Overview - Requirements - Load Python modules and datasets - Prepare data - Model architecture - Model Training - Model evaluation ### 1- Requirements - Python 2.7 - Numpy - Matplotlib - keras - TensorFlow or Theano - Internet ### 2- Load Python modules and datasets ```python # import modules import os import numpy as np from keras.datasets import cifar10 from keras.models import Sequential from keras.layers import Dense from keras.layers import Dropout from keras.layers import Flatten from keras.constraints import maxnorm from keras.optimizers import SGD from keras.layers.convolutional import Convolution2D from keras.layers.convolutional import MaxPooling2D from keras.utils import np_utils from keras import backend as K from keras.preprocessing.image import ImageDataGenerator from matplotlib import pyplot ``` Using Theano backend. ```python # change some package default options %matplotlib inline pyplot.switch_backend('agg') #os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' K.set_image_dim_ordering('th') ``` ```python # fix random seed for reproducibility seed = 7 np.random.seed(seed) ``` ` …