This repo contains the project files for the course 'Computational Intelligence' at the University of Applied Science Erfurt. The goal is to programm a neural network that recognizes arabic numbers from 0 to 9 in small pixel graphics (5x7).
- have Python version 3.9 or later installed
- make sure the Pip package manger is installed as well (comes together with python)
- install Pipenv, which handles all additional dependencies:
pip install pipenv
- now go to the project directory and run:
pipenv install
Now all dependencies were installed and you are ready to go.
There are two applications: the training script and the demo app.
Note: The scripts have to be run from pipenv
, otherwise the dependencies will not be available.
The training script is at src/main.ipynb
. It is a jupyter notebook, so it can hold data, result and text cells. This is very nice for executing just some of the code parts. The result of a code cell is also displayed directly underneath. Also, the results of more complex calculations in this script are stored in src/cache/
. There are code cells to load these cached files, so calculations do not have to be run again and again all the time.
This is how to start the Jupyter Notebook:
- first execute on the command line:
pipenv run jupyter notebook
- then go to your browser and open: http://localhost:8888
The demo app is at src/app.py
. It will start in an interactive window and load the final neural network from the cache directory (see above). There is a pixel grid on the left. By clicking a pixel it can be toggled (empty/filled). Next to the grid, the results from the calculations on the neural network are shown. Here you can see, which digit the algorithm did recognize.
To start the programm, execute the following command: pipenv run python src/app.py
data/
cache/
: stores the data generated by the main scriptdigits/
: the digits to be recognized by the network in CSV format
docs/
: the documentation of the project in germanDokumentation.pdf
: the final report that was gradedVerteidigung.pdf
: slides for the final presentation
src/
app.py
: the demo appdigits.py
: loads and exposes the digits fromdata/digits/
main.ipynb
: the training script as a jupyter notebooknet/
: the implementation of a neural network as a flexible library
All files except the demo app and the main script in src/
contain a testing section at the end of the file. These tests check if the software behaves as it should.
The tests are executed when a file is run as a main script. If you use a bash shell, you can execute all test by running the following command:
files=(src/digits.py src/net/[^_]*.py)
for f in $files; do PYTHONPATH=src pipenv run python $f; done
To run only a single file's tests, execute:
PYTHONPATH=src pipenv run python <path-to-file>.py