Skip to content

detecting hand written digits and letters from images (+camera) (EMNIST) (tensorflow)

License

Notifications You must be signed in to change notification settings

0000xFFFF/cnn-emnist-cam

 
 

Repository files navigation

Detecting hand written digits and letters from images.

Python 3.12.5

Requirements

  • python
  • python-virtualenv
  • curl

Requirements - pip

  • pandas
  • numpy
  • matplotlib
  • flask
  • flask_cors
  • opencv-python
  • ipykernel
  • tensorflow
  • torch

Download the EMNIST dataset

./dldataset.sh

after the command finishes you should have the gzip.zip file in the datasets folder
the script will also extract the zip file
if the script fails consider downloading the dataset manually:

example chars image 3

Analyse the downloaded set

cd py_stats
./analysis.py       # graph char counts
./checkdupes.py     # check for duplicates
./grid.py           # draw grids for first couple of images

char count image

TensorFlow

before running anything, setup the virtual environment with:

cd py_tensorflow
./setup-env.sh
source p3env/bin/activate

Training the convolutional neural network

run the following command if you want to train the network on the entire EMNIST set (train+test)

./train.py

run the following commands if you want to train the network on 80% of the set and test on the remaining 20%

./proper_train_test_split.py
./train_80p.py
./test_20p.py

Testing the convolutional neural network - drawing input

Test the trained network with

./test_draw.py

this will run a flask server web page on http://localhost:5000/index that will allow you to draw characters and test the accuracy of the convolutional neural network

draw test image

Testing the convolutional neural network - camera input

single character detection

./test_camera.py

camera test image

multiple character detection, newer version (needs some work)

./test_camera2.py

camera2 test image

PyTorch

cd py_torch
./setup-env.sh
source p3env/bin/activate

TODO: remake this proj in pytorch

Releases

No releases published

Packages

No packages published

Languages

  • Python 82.9%
  • HTML 9.9%
  • Shell 7.2%