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