top of page

An AI To Identify the Bill or Coin

Updated: Jul 15, 2021

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

Learning During the process of improving my AI, I learned about how basic neural networks work. I also learned about different algorithms. Here is a general idea of how neural networks work. An input is given to the first layer of a neural network in neurons of information. That information is passed on to the next layer in the network. This layer is multiplied by a weight, added up, and sent to the neurons in the next layer and so on. These layers are called hidden layers where the AI does its “thinking”.

How can I make my AI better? I definitely feel that I should increase the number of images in my dataset to around 100 for each category (800 total). This way my AI will be able to create more accurate models and identify patterns in images. I didn’t have a 100 dollar bill, but in the future, I will plan to add a category for it.

Further development In the future, I would like to create an app, so that my AI is accessible for the visually impaired. I also want to expand my AI to identify different currencies from all across the world. I hope my app will benefit the sightless so that no one has to go through the struggles of identifying a bill or coin.

63 views0 comments


bottom of page