#
Creating a model for detecting 7 types of candy bars
Creating a model to detect seven types of candy bars is a detailed process that requires careful planning and execution. This article not only discusses the creation of a high-quality dataset but also outlines the steps involved in building a model capable of accurately identifying these candies on a conveyor belt.
Before starting data collection, it is necessary to clearly define goals. Our aim was to develop a model capable of recognizing candy bars such as Bounty, Knoppers, Lion, Lion Coconut, Mars, Prince Polo, and Snickers, which could be used to automate inventory management in factories.
We decided to take the pictures ourselves using a Basler daA2448-70uc from dart camera modules, which resulted in about 6000 images of candy bars. Our approach was to take a picture of each type of candy bar from both the front and back, centered in the frame. In addition, we used a dataset manipulator to generate multiple images in the cloud based on the input dataset. This allowed us to obtain images of different sizes, angles, brightness, and contrast. The process also involved capturing the candy bars in various positions, locations within the frame, against different backgrounds, and under different lighting conditions.
After collecting the data, we thoroughly reviewed and cleaned the datasets, removing duplicate and blurred images. We then proceeded to label each candy bar.
The problem we encountered in this process was accurately defining the bounding boxes, especially when the candy bars were placed diagonally or in close proximity to each other on the conveyor belt. Through trial and error, we found that labeling the entire bar and ensuring minimal overlap between bounding boxes were effective strategies for avoiding inaccuracies.
Once all the images were labeled, we trained several models, selecting the Darknet framework and the yolov4-tiny.conv29 pretrained model for their flexibility and accuracy in detecting small objects.
The final model, developed from multiple datasets, including individual datasets for each candy bar and a dataset of mixed candy bars, demonstrated excellent performance on a moving conveyor belt. This model has significant potential for real-world applications, particularly in manufacturing environments, where it can be used to automate inventory management processes, optimize workflow efficiency, and improve overall productivity. By accurately identifying different candy bars in real time, this technology has the potential to revolutionize inventory management across industries, from manufacturing to retail.