Skip to content
This repository has been archived by the owner on Mar 23, 2021. It is now read-only.

hd-code/digit-recognition-ci

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Digit Recognition – Computational Intelligence

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).

Installation

  • 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.

Usage

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.

Training Script

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

Demo App

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

Project Structure

  • data/
    • cache/: stores the data generated by the main script
    • digits/: the digits to be recognized by the network in CSV format
  • docs/: the documentation of the project in german
    • Dokumentation.pdf: the final report that was graded
    • Verteidigung.pdf: slides for the final presentation
  • src/
    • app.py: the demo app
    • digits.py: loads and exposes the digits from data/digits/
    • main.ipynb: the training script as a jupyter notebook
    • net/: the implementation of a neural network as a flexible library

Testing

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published