Skip to content

Develop a custom object detection model to identify coins within an image and add up their total value.

License

Notifications You must be signed in to change notification settings

ALF28Dev/CoinRecognition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About CoinRecognition

Screenshot 2021-12-27 at 20 58 40

During my first term at university, I spoke to a friend at a party about counting coins. He suggested it would be awesome if an app could recognise and count the coins. I immediately told him that we could attempt to develop an object detection model capable of performing such calculations. I had done some previous projects before using object detection, so I thought it would be a great challenge to attempt.

Data Collection

The first step of developing an object detection model is gathering training data. I had some spare change, so I started taking pictures of different coins in various layouts. This was one of my first ML projects, so I wasn't sure how many images I would need. I decided to start with a few pictures and then collect more over time. I started with about 35 images. At the time, I was aware that I would probably need many more pictures to develop a very good model; however, as this was the first project, I was more interested in building a functioning model.

Screenshot 2021-12-27 at 20 33 17

Data Labeling using LabelImg

Once I had collected the images, I used some software called LabelImg. It allows users to draw bounding boxes around objects within the image and save the label into an XML file.

Screenshot 2021-12-27 at 20 32 00

Model Training

Training an object detection model requires quite a lot of processing power. To make the model training process more effective, I utilised Google Colaboratory. It is ideal for me because they provide a free GPU to users. After gathering the training data and labelling the images, I placed the pictures and XML files into a folder on my google drive, and I started training the model.

Screenshot 2021-12-26 at 21 40 01

Losses

After training the model, I examined how the accuracy of its results changed during the training process. As you can see from the chart, the accuracy gradually improves over time. This is good news; however, the results are nowhere near perfect, and there is much room for improvement.

Screenshot 2021-12-27 at 20 43 47

Model Testing

After training the model, I performed some testing. I used images not in the training dataset to prevent any bias in the results. The results were nowhere near perfect; however, it can recognise 50p coins effectively. I used a hashmap to store the number of each coin detected in the image.

Screenshot 2021-12-27 at 20 55 37

Evaluation

I thought this was an exciting first project as an introduction to object detection. By using detecto, developing a model was a lot more straightforward. I could improve the model by including more labelled images within the Training and Validation datasets. The more data the model has to learn from, the better it should perform.

About

Develop a custom object detection model to identify coins within an image and add up their total value.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages