Skip to content

Commit

Permalink
Fixed README.md and removed untested model
Browse files Browse the repository at this point in the history
  • Loading branch information
xLoSyAsHx committed Jun 8, 2020
1 parent 17b5ec2 commit 5baa60a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 57 deletions.
59 changes: 25 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# English alphabet recognizer

[![Build Status](https://travis-ci.com/xLoSyAsHx/HSE_ML_alphabet_recognition.svg?branch=master)](https://travis-ci.com/xLoSyAsHx/HSE_ML_alphabet_recognition)
[![Build Status](https://travis-ci.com/xLoSyAsHx/English_alphabet_recognizer.svg?branch=master)](https://travis-ci.com/xLoSyAsHx/English_alphabet_recognizer)


Neural Network model for English alphabet recognition. Deep learning engine - PyTorch
Expand All @@ -13,19 +13,18 @@ Table of contents


* [Current network accuracy](#current-network-accuracy)
* [Requirements](#requirements)
* [Instalation](#instalation)
* [MNIST19 Dataset](#mnist19-dataset)
* [Main requirements](#main-requirements)
* [Installation](#installation)
* [Train](#train)
* [Test](#test)
* [Demo](#demo)
* [Best models](#best-models)
* [English low letters](#english-low-letters--92.95%)
* [Model EngAlphabetRecognizer96](#model-engalphabetrecognizer96)
* [Snapshot](#snapshot)
* [Tensorboard](#tensorboard)
* [Dataset](#dataset)
* [MNIST19 preprocessed sample](#mnist1919-preprocessed-sample)
* [Graphs&Metrics](#graphs&metrics)
* [English low letters](#english-low-letters)
* [Graphs&Metrics](#graphs&metrics)
* [EngAlphabetRecognizer96](#engalphabetrecognizer96)


# Current network accuracy
Expand All @@ -35,25 +34,22 @@ Dataset | Total accuracy | Mean AUC | Std. Dev. | Epoches | Train/Test Size |
MNIST19 | 92.95% | 0.85 | 0.09 | 500 | All / 3000 | | ( 'i', 'l' ), ( 'g', 'q' ) | (0.55, 0.77), (0.78, 0.82) |


# Requirements
# MNIST19 Dataset

compress-pickle==1.1.1
imageio==2.8.0
matplotlib==3.2.1
numpy==1.18.2
opencv-python==4.2.0.34
Pillow==7.0.0
requests==2.23.0
scikit-image==0.16.2
scikit-learn==0.22.2.post1
tensorboardX==2.0
tensorflow==2.2.0rc3
termcolor==1.1.0
torch==1.5.0
torchvision==0.6.0
tqdm==4.43.0
![Samples](https://github.com/xLoSyAsHx/HSE_ML_alphabet_recognition/blob/master/misc/images/MNIST19_preprocessed_samples.png)


# Main requirements

- torch - version 1.5.0
- torchvision - version 0.6.0
- tensorboardX - version 2.0
- scikit-learn - version 0.22.2.post1
- compress-pickle - version 1.1.1

# Installation

# Instalation
Alphabet recognizer is able to download, unzip and prepare dataset for use on its own.

git clone https://github.com/xLoSyAsHx/English_alphabet_recognizer.git
cd English_alphabet_recognizer
Expand Down Expand Up @@ -108,8 +104,9 @@ Note: test.py works only with preprocessed-zipped images. Key '--use-preprocesse

# Best models

## English low letters - 92.95%
## Model EngAlphabetRecognizer96

- Accuracy - 92.95%
- Mean AUC 0.85 +- 0.09 (1 std. dev.)
- Epoches 500
- Worst predicted classes: ( 'i', 'l' ), ( 'g', 'q' )
Expand All @@ -128,15 +125,9 @@ Link to tensorboard runs folder: https://drive.google.com/drive/folders/18jtrvTQ
Link to models folder: https://drive.google.com/drive/folders/1hzrlxoFrR1zDp_1YM9eIk6m-nge-SwXW?usp=sharing


# Dataset

## MNIST19 preprocessed samples
![Samples](https://github.com/xLoSyAsHx/HSE_ML_alphabet_recognition/blob/master/misc/images/MNIST19_preprocessed_samples.png)


## Graphs&Metrics
# Graphs&Metrics

### English low letters
## EngAlphabetRecognizer96
![TrainTest_Loss](https://github.com/xLoSyAsHx/HSE_ML_alphabet_recognition/blob/master/misc/images/TrainTest_Loss_e500.png)

![confusion_matrix](https://github.com/xLoSyAsHx/HSE_ML_alphabet_recognition/blob/master/misc/images/confusion_matrix_e500.png)
Expand Down
24 changes: 1 addition & 23 deletions alphabet_recogniser/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import torch.nn.functional as F
from numpy import prod


class EngAlphabetRecognizer96(nn.Module):

def __init__(self, num_classes=26):
Expand All @@ -22,26 +23,3 @@ def forward(self, x):
x = F.relu(self.fc2(x))
x = self.fc3(x)
return x


class LeNet(nn.Module):

def __init__(self, num_classes=10):
super(LeNet, self).__init__()
self.num_classes = num_classes

self.conv1 = nn.Conv2d(3, 6, 3)
self.conv2 = nn.Conv2d(6, 16, 3)

self.fc1 = nn.Linear(16 * 6 * 6, 120) # 6*6 from image dimension
self.fc2 = nn.Linear(120, 84)
self.fc3 = nn.Linear(84, 10)

def forward(self, x):
x = F.max_pool2d(F.relu(self.conv1(x)), 2)
x = F.max_pool2d(F.relu(self.conv2(x)), 2)
x = x.view(-1, prod(list(x.shape[1:])))
x = F.relu(self.fc1(x))
x = F.relu(self.fc2(x))
x = self.fc3(x)
return x

0 comments on commit 5baa60a

Please sign in to comment.