A mnist handwritten dataset classifier which uses a neural network as its brain. The CNN weights act as the genes of each individual who are trained using genetic algorithm to produce new individuals. Similarly the training process goes on.
Each individual is trained for 1 epoch and then a new generation is produced. To get better the results, keep changing the hyper parameters using hid and trial.
What things you need to install the software and how to install them
cv2
numpy
random
tensorflow==2.2
Download a python interpeter preferable a version beyond 3.0. Install the prerequisute libraries given above,and make sure you have the correct version of TensorFlow. Also certain hardware and software requirements like good Nvidia GPU and (CUDA+CUDNN) respectively are required. Then run genetic.py in your system to train the model and save it. Then run predict.py to see the output in the format given below.
$ genetic.py
$ predict.py
$ git clone https://github.com/Shaashwat05/mnist_GA
The output of the classifier can be seen.
- python3 - The software used
The whole working of the code and explanation of it as well as the concepts can be viewed in this medium website, do visit. https://medium.com/@shaas2000/mnist-classifier-using-genetic-cnn-e1e860ecc2e9