Skip to content

Commit ad71c5d

Browse files
committed
updates & cleanup & refactoring
1 parent 1d138a1 commit ad71c5d

File tree

20 files changed

+55
-35
lines changed

20 files changed

+55
-35
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ modules.order
5050
Module.symvers
5151
Mkfile.old
5252
dkms.conf
53+
54+
55+
C_digit_recognition*.AppImage
-7.83 MB
Binary file not shown.

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ install_tools:
55
sudo apt install patchelf
66
sudo apt install libopenblas-dev
77

8+
#sudo apt install doxygen
9+
#sudo apt install graphviz
10+
#sudo npm install moxygen -g
11+
812

913
release:
1014
cd ./src && $(MAKE) main
@@ -26,3 +30,4 @@ clean:
2630
rm -f ./build/usr/lib/*
2731
rm -f ./build/usr/bin/*
2832
rm -f ./build/AppRun
33+
rm -f C_digit_recognition-*.AppImage

README.md

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
# C-digit-recognition
2-
Handwritten digits recognition in C using neural network trained using [MNIST database](http://yann.lecun.com/exdb/mnist/)
2+
Handwritten digits recognition in C using neural network trained using [MNIST database](http://yann.lecun.com/exdb/mnist/).
33

44

55
# Installation
66

77
## Linux
8-
- `sudo apt install libopenblas-dev`
9-
- `sudo apt install libgtk-3-dev`
10-
- `make`
118

12-
## Windows
13-
🤷‍♂️
9+
### Binary package
10+
`.AppImage` file is available under release section.
11+
12+
### Compilation from source
13+
- `sudo apt install libopenblas-dev` - installs OpenBLAS library
14+
- `sudo apt install libgtk-3-dev` - installs
15+
- compilation:
16+
- use `cd src && make clean && make main && ./main` to run normal compilation
17+
- use `make clean && make release` to generate AppImage binary (you have to install `linuxdeploy` and other dependecies using `make install_tools` first)
1418

1519

1620
# Libraries
@@ -19,12 +23,17 @@ Dependency of the libraries is in this order: `GUI -> ceural -> lag`
1923
- `ceural` - [C neural network library](#Ceural)
2024

2125
## Lag
26+
Library supports many operations but more development is needed because currently uses [OpenBLAS](https://github.com/xianyi/OpenBLAS) only for matrix multiplication and matrix transposition.
27+
28+
### Naming
2229
- `mat` - stands for matrix
2330
- `ew` - stands for element wise
31+
32+
### Notes
2433
- Matrix part of the library automatically checks if destination and source is same where shouldn't be same and warns using `assert()`.
2534

2635
## Ceural
27-
Ceural library is created for multi-layer networks for MNIST dataset but with small modifications it can be used for other datasets.
36+
Ceural library is created for multi-layer networks trained using MNIST dataset but with small modifications it can be used for other datasets too. See [Accuracy](#Accuracy) for more info.
2837

2938
# GUI
3039

@@ -46,26 +55,28 @@ Preprocessing used in [MNIST](http://yann.lecun.com/exdb/mnist/) database: *The
4655
8. **neural network forward propagation** - this preprocessed image is fed to the neural network
4756

4857
# Accuracy
49-
After training the test set accuracy is `94.49 %`. This accuracy not bad considering the test error rate in [MNIST database website](http://yann.lecun.com/exdb/mnist/) of the 2-layer NN. Sadly accuracy is not as good in practice as it's in the test data set.
58+
After `10` epochs of training with batch size `32` the test set accuracy is `97.47 %` which is not bad considering the test error rate in [MNIST database website](http://yann.lecun.com/exdb/mnist/) of the 2-layer NN. Sadly accuracy is not as good in practice as it's in the test data set 🥺.
5059

5160
Accuracy is calculated using formula [`accuracy = (TP+TN)/(TP+TN+FP+FN)`](https://en.wikipedia.org/wiki/Accuracy_and_precision) which is `accuracy = correct/total`
5261

5362

5463
# Performance
55-
Even though Python is much slower than C, Python-digit-recognition is much faster. The reason behind it is that Python version uses great library NumPy, which is written in C and uses BLAS implementation of matrix operations.
64+
Even though Python is much slower than C, Python-digit-recognition is faster. The reason behind it is that Python version uses great library NumPy, which is perfectly optimized.
5665

5766

5867
# ToDo
59-
- [ ] Cleanup & document `lag` library
60-
- [ ] Cleanup & document `ceural` library
68+
- [ ] add `lag` tests
69+
- [ ] add `ceural` tests
70+
- [x] Cleanup & document `lag` library
71+
- [x] Cleanup & document `ceural` library
6172
- [ ] Cleanup & document `gui`
6273
- [ ] Add icons into `gui`
6374
- [ ] Add command line options to train & test & save & load NN
6475
- [x] Check NN definition during the NN weights & biases load process
6576
- [ ] Create documentation
66-
- [ ] Write everything into README
77+
- [x] Write everything into README
6778
- [ ] Choose license
68-
- [ ] Finish top-level 'Makefile' to create final binary for linux
79+
- [x] Finish top-level 'Makefile' to create final binary for linux
6980
- [ ] Create Windows compilation script & test it on Windows
7081
- [x] Center digit by center of mass of the pixels before feeding it to the neural network from GUI input
7182
- [ ] Use BLAS (for example [OpenBLAS](https://github.com/xianyi/OpenBLAS)) library for linear algebra to improve speed

build/.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
*.AppImage
22
AppRun
3-
.DirIcon
3+
.DirIcon
4+
C-digit-recognition.desktop
5+
C-digit-recognition_icon.png

build/AppRun

Lines changed: 0 additions & 1 deletion
This file was deleted.

build/C-digit-recognition.desktop

Lines changed: 0 additions & 9 deletions
This file was deleted.

build/C-digit-recognition_icon.png

Lines changed: 0 additions & 1 deletion
This file was deleted.

build/usr/bin/crecog

8 Bytes
Binary file not shown.

data/data.ceural

795 KB
Binary file not shown.

0 commit comments

Comments
 (0)