This is a tutorial article explaining how to use object detection application of Deep Block.
In this tutorial, we are going to create an AI model that automatically finds boreal digging frogs.
Boreal digging frog is an endangered species native to Korea.
And as people destroy their habitat, their number is decreasing and face danger.
Let’s find them and save them.
- Sign in, and click “TRY DEEP BLOCK” button on the top right corner.
- At the Console page, click “Create” button on the top right corner.
- Click Computer Vision, and Click Object Detection, and choose “NOT FOR REAL-TIME INFERENCE” option. Set the project name without space characters and click the “Create” button to create the project.
- And open the project.
In this project, we will only find boreal digging frogs.
- Therefore, you only need to create one category. But if you want to find multiple types of objects, you can add more to the categories pane.
Anyway, click creating a category button to create a new class.
And rename the class.
In this project, we want to build an AI model to detect boreal digging frog. Thus, our target class can be named as “Boreal_Digging_Frog”.
You can also change the color of each class by clicking on each class's color picker for a better visibility of the box.
- Now we need to prepare training dataset to train the AI model.
For this project, we prepared about 120 pictures of the frogs.
But we recommend you to prepare as many images as possible to train your AI model. At least several thousand object instances for each class. Select all images you prepared, and upload files by dragging them to the Manual pane.
- Let’s start preparing the training data.
Choose the category you want to draw and click Draw mode.
And draw a bounding box on the object you want to detect.
Don't draw the box too big or too small, draw it to fit the object.
- After you're done drawing boxes on each image, right click the filename and move the file to Done pane.
It is also possible to select multiple files in the Manual pane and move them all at once with right click action.
- If objects overlap, separate the two objects by drawing the boxes carefully.
And repeat this process until you draw boxes on all images.
- When you have finished drawing the boxes and moving the images to Done pane, you can start the model training. Click Run and set the epoch value, and click TRAIN button. start the model training.
In this case, we set the value as 5,000. However, this epoch value is not absolute. If there is a lot of training data, it is sometimes better to reduce the epoch value, and if you set too many epochs, an over-fitting problem may occur. Therefore, train the model with different epoch values, and you can find which value is the optimal epoch value.
- While training the AI model, you can see the remaining time, and metrics like loss.
It will take some time, so you can close the project and reopen it after some time.
- After the training, check if the training score increases as the epoch increases.
- If it looks okay, then proceed to the PREDICT tab.
- Now let's use our AI model. Prepare the images for the model inference. Select images for inference, and drag and drop images to Predict pane.
- Set a low threshold score for the inference. We usually set it around 30 at the first inference.
Click PREDICT button to start the inference.
- It will not take long time. In this case, the model detects the frog well even though the threshold value was low.
However, when the threshold value is low, the AI model usually detects wrong or draws many boxes on the same object. Therefore, the threshold value must be adjusted after the inference with a low threshold value. If the AI model recognizes something strange as the object you are looking for, check the probability of the weird box in the Boxes tab.
Usually, the probability value of a box that is incorrectly detected will be lower than that of a box that is correctly detected.
Therefore, set the threshold score higher than the maximum score value of false positive cases. Then the AI model will correctly detect the objects.
If the largest threshold score of false positive cases is quite big, it means that the AI model needs more optimization like preparing more training data.
In addition to this, if you set a low threshold score, you may find that multiple boxes are drawn on a single object. For this case, you have to increase the threshold value so that only one box with the highest threshold score is detected.
Like the first case, if the AI model can't even find the object after increasing the threshold score, your AI model may need to optimize your AI model.
- But keep in mind. It's not easy for an AI model to be perfect even if you put a lot of training data. For example, detecting objects in dark photos or detection of small objects is still quite difficult for modern object detection AI.
- If you are having trouble with optimization, contact us and we will help you.