Wednesday, November 11, 2015

Hacking Awesome CNN

I have been working on making it so that the average hacker can duplicate the creation of the 'AwesomeCNN' app, and thereby change and enhance it if they want. Below is the list of items interesting to those interested in reproducing the app.

The basic usage scenario follows. First you download the project and the project's dependencies. Then you get access to the training data sets. Then you train the neural networks to obtain weights and biases for your app. These weights and biases are what will allow your app to recognise letters and numbers. Then you copy those weights and biases to the proper folder in the project directory. Then, making sure that you have 'python-for-android' installed and running properly, you build the android app.

  • The code is available on github at the following URL: https://github.com/radiodee1/awesome-cnn It is largely based on the code at another site on github, at the following URL: https://github.com/andersbll/nnet
  • Both projects use 'scikit-learn' which can be downloaded easily using pip. Simply type 'sudo pip install scikit-learn' (without quotes) and the package will install on the typical ubuntu system. This will allow the programs to train on your desktop using the mnist image set. This is important for numerical character recognition.
  • The awesome-cnn project also trains on the alpha-numeric images found in SD-19, which you must obtain on your own if you want to try out recognition of alphabetic characters.
  • Training works as follows. Download the project to a workspace directory. This would be a directory in your home folder called 'workspace'. After downloading you should have the project in a folder called '~/workspace/awesome-cnn' and you should change directory to that folder. ('cd ~/workspace/awesome-cnn' without the quotes.) The python module is located in a folder called 'module'. change directory to that folder. Here there are several scripts for training your set of weights and biases. Run the scripts 'cnn_alpha_train.sh' and 'cnn_mnist_train.sh' . These scripts take parameters, so take note of the 'usage' output that is shown when you run the scripts without params, and modify your usage accordingly.
  • Training on all this data can take days. After training is complete you should have weights and biases for your app. Build the app using the script for that purpose found in the project folder. There are two scripts, one using the old python-for-android toolchain, and one using the new toolchain. As of this writing only the old toolchain script works. Running the old toolchain script takes ten minutes or so. It is called 'set_build_old.sh'. After that you should have a working android app.

The project is, obviously, still under development. When the app can be built using the new toolchain more information will be posted.

No comments:

Post a Comment