EN10 / KerasMNIST

Keras MNIST for Handwriting Detection

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Keras MNIST

cnn.py training based on keras mnist_cnn.py
cnnPredict.py inference based on Flask app.py
cnn.h5 pretrained Keras model

TFKeras is based on simplified MNIST For ML Beginners and cnn.py.
TFKeras.py, TFKeras.h5 & TFKpredict only uses Dense and so is less accurate than CNN.
TFKpredict is a slimmed version of cnnPredict.

TFKeras is 92% accurate vs CNN 99.25%
CNN can detect digit 1 better.

Keras.js MNIST CNN Demo

Code Documentation:

  • batch_size number of images per loop step
  • epochs number of train loops
  • num_classes there are 10 digits 0-9
  • x_train.astype('float32') trains faster than int
  • x_train /= 255 from 0-255 to 0-1
  • verbose=1 1 for progress bar logging
  • imread('test3.png',mode='L') ‘L’ (8-bit pixels, black and white)

kerasDataset.py equivalent to TFKeras.py using the keras dataset rather than the tensorflow dataset.
KerasTFDataset.py simplified example of TFKeras.py
jupyter.py has matplotlib and colab examples.

Keras Documentation:

Install

Tensorflow:

sudo pip install -U pip  
sudo pip install tensorflow 

Keras:

sudo apt update 
sudo apt install python-dev 
sudo pip install keras

Save Model:

sudo pip install h5py

imread:

sudo pip install pillow 

disable "cpu_feature_guard":
export TF_CPP_MIN_LOG_LEVEL=2

About

Keras MNIST for Handwriting Detection


Languages

Language:Python 100.0%