Loading [MathJax]/jax/output/CommonHTML/fonts/TeX/fontdata.js

Project IA Deep Learning - Supervised

DataSet MNIST Fashion.

Philippe Jadoul - february 2020

Fashion MNIST - Network CNN - Convolution Neural Network

Reseau neuronal convoluty - Wikipedia

https://fr.wikipedia.org/wiki/Réseau_neuronal_convolutif

Imports

library.jpg

Import my_fonctions

Tests All

train-test-set.jpg

Load the dataset: Fashion MNIST

dataset-cover.png

Convert dataset Train - Test to float

Shuffle dataset Train

validation-set.jpg

Create Validation Dataset

List targets_names - Labels og Classes

To verify that the data is in the correct format and that you're ready to build and train the network, let's display the first 25 images from the training set and display the class name below each image.

normalization.jpg

plot images

Normalization - StandardScater - z=(X¯U)σ

Distribution Data

reshape-convolution.jpg

in a convolution model the datas must be tensors - Data img (x,y,z) - z=1 for image grey - z=3 for image RGB

one-hot-encoding.jpg

one-hot encoding

batch-dataset.jpg

Create the training dataset - Batch

Test Iter in dataset with epoch and batch size

create-model.jpg

Model Draph

model-graph.jpg

Create the CNN model

Model Summary

compile-model.jpg

Compiling the sequentail model - CNN

Function Compile Model

Compile Model

Function Save Model

Save the Compiled Model

train-set.jpg

train set with batch dataset

History model fit

history = model.fit(X_train_images.batch(100), epochs=50, verbose=False)

Graph - fig-1

train-evaluate.jpg

Reload the Compiled Model Base - mnist_cnn2_base.h5

validation_data with fit function

history model fit - (BT=32, EP=50, SP=None, callback_list=None)

history = model.fit(X_train_images.batch(BT), epochs=EP, validation_data=X_train_images_validate.batch(BT), validation_steps=SP, callbacks=Callback_list , verbose=True)

Graph - fig-2

Reload the Compiled Model Base - mnist_cnn2_base.h5

history model fit - (BT=128, EP=50, SP=None, callback_list=None)

history = model.fit(X_train_images.batch(BT), epochs=EP, validation_data=X_train_images_validate.batch(BT), validation_steps=SP, callbacks=Callback_list , verbose=True)

Graph - fig-3

Re-Load the Compiled Model Base - mnist_cnn2_base.h5

Optimization With Max Accuracy & Save Model - mnist_cnn2_acc.h5

Callback_list - val_accuracy , max

ModelCheckpoint allow us to extract the best end-of-epoch model. Under different circumstance, we might monitor val_loss or val_acc

history model fit with callbacks (BT=128, EP=50, SP=None, callback_list)

history = model.fit(X_train_images.batch(BT), epochs=EP, validation_data=X_train_images_validate.batch(BT), validation_steps=SP, callbacks=Callback_list , verbose=True)

function plotting the metrics of train dataset accuracy & loss

Graph - Best Acc

Re-Load the Compiled Model Base - mnist_cnn2_base.h5

Optimization With Min Loss & Save Model - mnist_cnn2_loss.h5

Callback_list - val_loss , min

ModelCheckpoint allow us to extract the best end-of-epoch model. Under different circumstance, we might monitor val_loss or val_acc

history model fit with callbacks (BT=128, EP=50, SP=None, callback_list)

history = model.fit(X_train_images.batch(BT), epochs=EP, validation_data=X_train_images_validate.batch(BT), validation_steps=SP, callbacks=Callback_list , verbose=True)

function plotting the metrics of train dataset accuracy & loss

Graph - Best Loss

evaluate-model.jpg

Delete the model

Load the Model

Model Summary

Evaluate the Models' Performance with the best current metrics - model mnist_cnn2_acc.h5

compare how the model performs on the test dataset:

Make predictions

With the model trained, you can use it to make predictions about some images.

accuracy of the prediction in % - img 23

import fonction plotresults - my library

Let's plot several images with their predictions. Note that the model can be wrong even when very confident.

Where Does the Model Make Mistakes ? - Statistics -

Delete the model

Load the Model

Model Summary

Evaluate the Models' Performance with the best current metrics - model mnist_cnn2_loss.h5

compare how the model performs on the test dataset:

Make predictions

With the model trained, you can use it to make predictions about some images.

accuracy of the prediction in %

import fonction plotresults - my library

Let's plot several images with their predictions. Note that the model can be wrong even when very confident.

Where Does the Model Make Mistakes ? - Statistics -