Monday, May 2, 2016

Awesome Flyer

I returned to Awesome-Flyer to update the game. I added some stuff that connects the game to Google Leaderboards, and it seems to work well. I also corrected some screen size issues that were present if you played the game in portrait mode.

It all went reasonably well. The biggest part of the whole thing was switching from Eclipse, which I used when I started the game, to Android Studio, which is the current standard. This was all before I even started to address what was wrong with the game!

There's few if any real users of this game. Maybe I can change that in the future.

If you were a user of the game, and you update to the new version, you will have to clear the local game's cache for the new game to work. Otherwise the game will crash on you when you launch.

This is because I used 'integers' for saving the score in the old version of the game. The new version uses 'longs', and since I save the score in system preferences (application cache) and since these values changed from 'int' to 'long', the android operating system needs to be cleaned out before the new preferences can be saved over the old.

My only fear now is that the 'jni' library for the game may not work for all SDK levels. I have tried it on SDK 22, 23, and some others. I do not have many devices to test with, though, and I don't have money to buy test devices. Hopefully the native library (the 'jni') just works. If not, then only a small number of people will be able to use the game.

Monday, April 4, 2016

Awesome Tag - 2016.04.04

Awesome Tag

This is a java application for detecting faces in pictures using convolutional neural networks. It should be noted that the app doesn't work. Here is a link to the gihub project. . However facial detection is really done, it's not done like this. This will probably be the first and last post about this project.


The sources for the images was the NIST IJB-A dataset. The NIST pictures are part of a contest, but are free to download if you register with them. There are thousands of pictures, and several csv files with label data. In each picture faces are identified and this data can be used to train your program.

The software libraries used in the program are from a company called Skymind. They are nd4j, deeplearning4j, and Canova. I used the distributions 0.4-rc3.8 release extensively. My CNN model was ultimately constructed with 4 layers. The first layer was a convolutional layer. The second was a pooling layer. The third was a 'DenseLayer' and the last was a output or 'softmax' layer. I am not entirely sure that the DenseLayer supported the kind of learning I was looking for, so I experemented with other layer configurations. In the end the DenseLayer performed best so I kept it.

I used the linux operating system, java 8, and the IntelliJ IDE. Training for weights and biases for the neural network have to be re-learned every time the project is installed. This is because they are too big to save with the code. There are no weight and bias files online for this project.


You have to get a copy of the NIST IJB-A dataset. This is a 14G download. You also need to unpack the tar g-zip file, so you need something like 28G free. Then make sure InteliJ-IDE is installed. Download the 'awesome-tag' java repository from and open the project using the IDE. You should launch the GUI launcher, the file called You can also try launching the `` file. You may be able to launch the file this way without the IDE.

When opening the GUI for the first time you have to set the values for the program's operation. For example, you need to tell it where to find the IJB-A images and csv files. When this is done you can select a picture to view. The picture will probably be in the csv database, and the csv database is loaded automatically when the GUI is started, so if you want to you can click the 'Add Lines' button and see the boxes that identify the faces in the picture. This is the basic information that is provided by the IJB-A dataset.

At this stage you also identify what 'split' you want to start with and what 'split' you want to end with. Because there are so many images it is sufficient to choose 'split' 1 to start and also 'split' 1 to end. Setting these initial values creates a file in the user's home folder called `.atag`. This folder holds all the info that the GUI uses in its regular operation.

The next step is to build your own csv file. This file would contain the boxes mentioned above and also empty boxes without faces in them. These empty boxes are used by the program to train the cnn. For every box with a face there is another box with no face of the same size. You create this second csv file by clicking the 'Mod And Save' button. This process can take an hour or more just for one 'split'. If you have chosen different splits for start and finish the program will try to cycle through the set you have chosen and will process all of them. There are ten splits in the IJB-A dataset, and trying to process all ten could take a long time.

After setting up your csv file you can start training. Click the 'Reset Cursor' button to make sure that your input data cursor is starting with a zero value. Bye the way, yuo can also choose to erase all weights and biases when you click the 'Reset Cursor' button. Click the 'Train CNN' button once. This will start training. Training is very time consuming, so a mechanism is provided for saving your weights and biases, so that you can stop training and restart the process where you left off.

Loading and saving the neural network takes from five to ten minutes. When you click the 'Train CNN' button once the program will attempt to load the model. Then it will automatically start the training process. If you click the button again the neural network will stop training and will start the save process. You will see a dialog box on screen with a cycling progress bar until the save process has stopped. Again, this takes five to ten minutes. After it has stopped you can close the app or move on to testing or prediction. It takes several hours of training to get any results at all. The idea here is to let you do that training in smaller segments. You can force the program to stop during the save operation, but you are likely to corrupt your weight and bias files and thereby loose any learning that you have completed up to that point.

Clicking the 'Test CNN' button will allow you to test the accuracy of you CNN against your own csv file data. Clicking the 'Predict' button will attempt to find faces in the currently selected image. Both these operations take time. Though you may be able to train your network to the level of 75 or 80 percent, the process employed by the 'Predict' mechanism does not identify images properly. This is the reason that the project will not be developed further.


The current 'Prediction' scheme is a two stage operation. First you click the "Prediction" button and choose the "EVEN" option from the two options presented. Then you wait for the first stage, the "EVEN" stage to complete. When it's done you see the image on the screen with some superimposed boxes on it. This is stage 1. Then click the "Prediction" button again and choose the "IMPROVE" option. Again you must wait a long time. After this is done you see the final result on the screen.

The "EVEN" operation devides the picture into evenly spaced boxes and runs them through the neural network. When this is done you get separate "areas of interest". These areas of interest are the boxes you see superimposed on the screen after the first "Prediction" phase.

The "IMPROVE" operation takes the areas of interest and searches for a box size that most clearly looks like a face. It takes each area-of-interest box seperately and in that location tries out eight boxes of different sizes to see which produces the best score.

Wednesday, February 17, 2016

awesome-cnn-android ABOUT

This text was taken from the 'ABOUT' file in the awesome-cnn-android github project. The complete project can be found here:

This program uses convolutional neural networks to try to figure out what letter you are drawing on the screen and feed it to a android program as input. The neural networks used are of the 'LeNet' type, pioneered by Yann LeCun.

Implementation of neural networks in this project use Skymind Ink's 'deeplearning4j' package, which is licensed under the Apache 2 license. Most Skymind code can be found in the files '' and '' in the folder 'app/src/main/java/org/davidliebman/android/ime/'.

Tuesday, February 16, 2016

awesome-cnn-android INSTRUCTIONS

I have been working on a new project. It uses a convolutional neural network in java. It runs on the android phone and allows you to draw letters and numbers and output them to the text area that you are using. I will post more about it shortly. Right now it is a repository on github. You cannot get it on the Play store.

See this link for the actual project:
  1.  Load the app into your device.
  2. Wait for the text view to change from "LOADING" to a blank area. There should also be a progress spinner. Wait until it disappears. When this has happened the network biases have loaded. This can take five minutes.
  3. Draw a character on the screen. Use the gray square at the bottom of the screen to draw your character.
  4. Press the button marked "ENTER". The CNN should try to figure out the letter you drew.
  5. You can select from the categories 'UPPER-case', 'LOWER-case', and 'NUM-bers' by pressing the toggle button above the gray character input area. In 'UPPER' mode only upper case characters will be correctly identified at the input. Similarly in 'LOWER' mode only lower case characters will be detected.
  6. You can also choose 'WRITE' or 'ERASE' from another toggle button above the gray input area. This allows you to edit the character you are drawing with more precision.
  7. Special buttons have been provided for 'Backspace' (labeled 'BACK') and 'Carriage-Return' (labeled 'GO'). There are also buttons for navigation that will allow you to move forward and back in the text area. These are labeled with arrows.
  8. If you cannot get the neural network to recognise your drawings, there is a set of drop-down menus that will allow you to pick any character that is displayed on the normal keyboard and send it to the text-area. There are four of these dropdowns, for (a) numbers, (b) symbols, (c) upper-case letters, and (d) lower-case letters. They are located just to the right and left of the input area at the bottom of the screen. To use them, touch the drop-down menu and select the character you want. When you do this that character will appear on the label of the 'ENTER' key. Press the enter key at this time to send the selected character to the text area.

Wednesday, February 3, 2016

Awesome Guy 02.03.2016

The latest update fixes a bug that kept scores from being saved correctly. Another bug kept the player from winning on level 11. Both bugs were fixed (I think). I need to play until I accumulate a very high score to test out the score saving bug.  I'll do that over the next few weeks. The funny thing is that I think no-one is playing the game, so it doesn't matter if the scoring isn't saving properly. I do believe I have fixed the problem though.

Monday, January 18, 2016

Awesome Guy Update 01.17.2016

I updated Awesome Guy. The changes include a new level that I would call a BOSS level. There's no single bad guy, but it is the last level (level 11) and it is in some ways harder than all the other levels. Because not many people play the game I will describe what the level contains here. Spoiler alert.

There's no exit and no keys. What you have to do is to get each of the four 'seeds' one after the other and then deposit them in the spinning circle at the center of the level. You can tell that you've gotten one of the seeds because your character is transformed. Now it has a spinning circle around it. Yes, many spinning circles on screen at once. Now, to maneuver you must hold down the jump key while pressing the arrow keys. This will allow you to move over to the center of the screen to get rid of the seed. If you don't do anything when you are transformed you will float upward and eventually hit the top of the level. If you let this happen you will die.

The monsters can still kill you, so watch out.

There are four seeds on the boss level. If you get all four seeds into the goal at the center of the screen you can tell all your friends that you won. The game does allow you to start at any level you like, though, so you need not play all ten of the first 'normal' levels in order to get to the boss. You can go to the options menu on the Players page and simply select level 11 and you can play (and win) the boss.

There are some other changes to the game. Most important is the Google Leaderboard. The leaderboard has been part of the game since the 12.27.2015 release, but now the leaderboard has been enabled by default. When you first open the app it will ask you for an account to use for the leaderboard. You can disable this, and re-enable it later if you want, from the options menu on the Players page.

Monday, December 28, 2015

Awesome Guy Update 12.27.2015

I updated and re-released Awesome Guy. The most important change is a small one to the rules of game play. Now, when you want to exit the level and go to the next level you need the key that you find somewhere on the level. Only if you have the key is the crystal enabled. The crystal -- the marker on the screen to exit the level -- is white if you don't have the key, and blue if you do have the key.

If the level has a key, the crystal starts out white. When you get the key the level the crystal turns blue. Touching the white crystal does nothing. Touching the blue crystal takes you to the next level. If there's no key on the level, the crystal starts out blue.

There are some other changes to the app also. First off, the game now uses Google Leaderboards to keep track of scores. Also the button layout in landscape view has changed to something more intuitive.

The updated version was released December 27, 2015.