All Projects → frereit → Tensorflowhandwritingrecognition

frereit / Tensorflowhandwritingrecognition

Licence: gpl-3.0
Using Tensorflow to classify the NIST Dataset 19 (Handwriting)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Tensorflowhandwritingrecognition

Livianet
This repository contains the code of LiviaNET, a 3D fully convolutional neural network that was employed in our work: "3D fully convolutional networks for subcortical segmentation in MRI: A large-scale study"
Stars: ✭ 143 (+266.67%)
Mutual labels:  convolutional-neural-networks, neural-networks, convolutional-networks
Easy Deep Learning With Keras
Keras tutorial for beginners (using TF backend)
Stars: ✭ 367 (+841.03%)
Mutual labels:  convolutional-neural-networks, neural-networks, convolutional-networks
Teacher Student Training
This repository stores the files used for my summer internship's work on "teacher-student learning", an experimental method for training deep neural networks using a trained teacher model.
Stars: ✭ 34 (-12.82%)
Mutual labels:  convolutional-neural-networks, neural-networks
Layer
Neural network inference the Unix way
Stars: ✭ 539 (+1282.05%)
Mutual labels:  convolutional-neural-networks, neural-networks
Neurec
Next RecSys Library
Stars: ✭ 731 (+1774.36%)
Mutual labels:  convolutional-neural-networks, neural-networks
Artificio
Deep Learning Computer Vision Algorithms for Real-World Use
Stars: ✭ 326 (+735.9%)
Mutual labels:  convolutional-neural-networks, neural-networks
Fire Detection Cnn
real-time fire detection in video imagery using a convolutional neural network (deep learning) - from our ICIP 2018 paper (Dunnings / Breckon) + ICMLA 2019 paper (Samarth / Bhowmik / Breckon)
Stars: ✭ 340 (+771.79%)
Mutual labels:  convolutional-neural-networks, convolutional-networks
Caffenet Benchmark
Evaluation of the CNN design choices performance on ImageNet-2012.
Stars: ✭ 700 (+1694.87%)
Mutual labels:  convolutional-neural-networks, convolutional-networks
Pytorch Image Classification
Tutorials on how to implement a few key architectures for image classification using PyTorch and TorchVision.
Stars: ✭ 272 (+597.44%)
Mutual labels:  convolutional-neural-networks, convolutional-networks
Tf cnnvis
CNN visualization tool in TensorFlow
Stars: ✭ 769 (+1871.79%)
Mutual labels:  convolutional-neural-networks, convolutional-networks
Sincnet
SincNet is a neural architecture for efficiently processing raw audio samples.
Stars: ✭ 764 (+1858.97%)
Mutual labels:  convolutional-neural-networks, neural-networks
Deepmedic
Efficient Multi-Scale 3D Convolutional Neural Network for Segmentation of 3D Medical Scans
Stars: ✭ 809 (+1974.36%)
Mutual labels:  convolutional-neural-networks, neural-networks
Cs231
Complete Assignments for CS231n: Convolutional Neural Networks for Visual Recognition
Stars: ✭ 317 (+712.82%)
Mutual labels:  convolutional-neural-networks, neural-networks
Komputation
Komputation is a neural network framework for the Java Virtual Machine written in Kotlin and CUDA C.
Stars: ✭ 295 (+656.41%)
Mutual labels:  convolutional-neural-networks, neural-networks
Braindecode
Outdated, see new https://github.com/braindecode/braindecode
Stars: ✭ 284 (+628.21%)
Mutual labels:  convolutional-neural-networks, convolutional-networks
Tensorflow 101
TensorFlow 101: Introduction to Deep Learning for Python Within TensorFlow
Stars: ✭ 642 (+1546.15%)
Mutual labels:  convolutional-neural-networks, neural-networks
Traffic Sign Classifier
Udacity Self-Driving Car Engineer Nanodegree. Project: Build a Traffic Sign Recognition Classifier
Stars: ✭ 12 (-69.23%)
Mutual labels:  convolutional-neural-networks, neural-networks
Netket
Machine learning algorithms for many-body quantum systems
Stars: ✭ 256 (+556.41%)
Mutual labels:  convolutional-neural-networks, neural-networks
Deeplearning.ai Assignments
Stars: ✭ 268 (+587.18%)
Mutual labels:  convolutional-neural-networks, neural-networks
Tensorflow Tutorial
TensorFlow and Deep Learning Tutorials
Stars: ✭ 748 (+1817.95%)
Mutual labels:  convolutional-neural-networks, neural-networks

Handwriting Recognition

NOT MAINTAINED!

Introduction

In this repository I used the NIST Special Database 19 and Tensorflow to create a convolutional neural network, which recognizes handwritten digits. It differentiates between 47 classes: All uppercase letters, all numbers and a few lower case letters.I was able to achieve an accuracy of about 87%. If you have any questions, please feel free to open an issue, I will respond to all issues and do my best to help.

Preprocessing the data

I downloaded the database by_merge.zip then used a small python script to put them all in the same folder and renamed them in the format class_[class]_index_[index].jpeg. I then used opencv to convert these images into 2 arrays. One array contains the images, rescaled to 32x32 and greyscale with the shape (num_images, 32, 32, 1). The other array contains the label using one hot encoding, so the array has the shape (num_labels, 47). The script to convert the images can be found in data_handler.main(). After conversion, the arrays are saved as nist_labels_32x32.npy and nist_images_32x32.npy. The data is now preprocessed and can be fed into the neural network.

The Graph

Now it's time to define the tensorflow graph. If you are not familiar with tensorflow, I can recommend this course on udemy.com. I based this AI on that course. I have found that a graph like this works very well:

  1. Convolutional Layer: filter_size: 4x4, filters: 16
  2. Pooling Layer 2x2
  3. Convolutional Layer: filter_size: 4x4, filters: 32
  4. Pooling Layer 2x2
  5. Convolutional Layer: filter_size: 4x4, filters: 64
  6. Pooling Layer 2x2
  7. Densely Connected Layer: neurons: 512
  8. Dropout
  9. Output Layer: neurons: 47

We use the helper functions to define this graph. Please refer to training_32x32.py for further information.

Data Helper

I have also defined a class NIST_Handler which holds the train and test data and returns batches of this data with the functions get_batch(batch_size) and test_batch(batch_size). It simply loops through the arrays and returns the next batch size images and labels. Before I supply the Class with the images , I shuffled them with a unison shuffle.

Training

As loss function I used cross entropy and I chose the Adam Optimizer. I used a learning rate of 0.002, but I did not experiment much, so other values might yield better results. I then trained for 10,000-20,000 epochs, but the accuracy didn't increase much after 10,000 anymore. Every 200 epochs, a test batch with size 200 is used to evalute accuracy. These values are arbitrary and can be changed to preference. If you want to train as fast as possible, only evaluate accuracy very rarely and with small batches, but if you want to get a feel for how your AI is doing and don't mind slightly longer training times, evaluate accuracy often and use big batches. When training is completed, the model is saved.

Predictions

First I reconstruct the same graph that I used for training, then load the saved Variables. The predictions is one-hot encoded, thus I made a dictionary that simply has the letter or number as value for each label. Refer to predict.py for more information.

Notes

This Readme doesn't go into very much detail on how the code works. I will answer issues as detailed as I can if you have specific questions, but if you don't know anything about Tensorflow, I can't help you that much. Again, I can really recommend this course on udemy.com. I am not affiliated with udemy or the creator of this course, but I acquired most of mz know-how from that course.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].