An AI To Identify the Bill or Coin

Updated: Mar 15

Mission Close your eyes and imagine you are visually impaired. As you approach the counter with your ice cream and bubble gum, you pull out your wallet from your right pocket. Then you realize you have a big problem; you don’t know what the value of the coins and dollar bills you have. The goal of this AI service is to provide an easy way for the visually impaired to identify the type of bill or coin.

The Images I searched for bills on coins of Google Images, but unfortunately, there wasn’t a sufficient amount of images for each category. Instead, I decided to take the pictures myself and upload them to Navigator. Although this took time, I was able to have around 20 pictures for each category (1 dollar bill, 5 dollar bill, 10 dollar bill, 20 dollar bill, penny, dime, quarter, and nickel).

Training (1) After the first round of testing, I got an accuracy of 67. This means the AI service is correctly answering ⅔ of the testing images. This accuracy was better than random guessing, but not satisfactory enough. Even after I played around with the hyperparameters the accuracy did not change by much. I then knew that I would have to add more images for my AI to identify patterns in bills and coins.

Training (2) The next step was to add more images. I decided to have a variety of images in various locations. In addition, the images were taken on both sides of the bill or coin. I used the default hyperparameters and trained the AI service. The accuracy was 85%. I knew that if I used different hyperparameters, I might be able to get a better accuracy. After experimenting with different hyperparameters, I was able to bring the accuracy up to 94.375%.

Hyperparameters There are multiple hyperparameters in MLP Classifier. Adjusting them can increase or decrease the accuracy. When training data is split into small batches, each batch is jargoned into a mini-batch. The mini_batch_size is one of the hyperparameters. I found that adjusting the mini-batch size didn’t make a big difference on the accuracy, so in all of my training, I left it as 40. The amount that the weights are updated during training is referred to as the step size or the learning rate. The learning rate is a configurable hyperparameter used in the training of neural networks that has a small positive value, often in the range between 0.0 and 1.0. I tried various values ranging from 0.01 to 0.4. For my service, I found that 0.02 was the best learning rate. In terms of neural networks, an epoch refers to one cycle through the full training dataset. After trying different values in between 20 and 40, the epoch value I used to get 94% was 40. The number of layers in a neural network Layer is a general term that applies to a collection of 'nodes' operating together at a specific depth within a neural network. The number of layers refers to how many hidden layers the neural network will have. At first, I falsely assumed that the number of layers would affect my accuracy. I kept using the same value (101) for the number of hidden layers in my network. At one point, I tried 152, and my accuracy flew up 10%.