Grape clusters detection using Deep Learning and synthetic images

November 18, 2022

| Juan Felipe Montenegro Torres

In large-scale agriculture, the quantification of products becomes an arduous task that ends up being replaced by the counting of packages, however, in crops such as grapes which a large variable is the number of bunches that come out of each grape plant that is planted, it is necessary to count these to predict the final product obtained.

At present, this is a task that is generally not carried out because it is very expensive or, failing that, it is done by the same people who prune and fertilize the crops. Therefore, it is necessary to perform a non-invasive automated count that allows cluster counting and continuous monitoring, for this task the use of cameras and Deep Learning is proposed.

This article shows the use of data-centric convolutional neural networks for the count of grape clusters from images of vineyards at 1 or 1.5 meters from the clusters found in Embrapa Wine Grape Instance Segmentation Dataset — Embrapa WGISD, however, there are only 300 images in total in this dataset, so Python’s Flip library was used to create synthetic images with bunches of grapes that increase the size of the data set.

For this task, the Faster RCNN model with ResNet 50 backbone presented by PyTorch was used with pre-trained weights and 2 classes called background and cluster, additionally, the SGD optimizer was used, a learning rate of 0.005 and a decrease in the Learning Rate when it reached the stability. of loss. On the other hand, 260 synthetic images were created with the backgrounds and objects presented in the following figure, and to increase the variability of the images, rotation on the y-axis of both the objects and the backgrounds and a change in brightness were allowed. of 70%, keeping the parameter “force” in False so that these changes are random.

Finally, the histogram equalization was performed to highlight the clusters and increase the number of both original and synthetic images as recommended in the work presented by Santos, et. al.

Backgrounds used for synthetic images

Objects used for synthetic images

40 images were taken from the original data set without any processing to evaluate the final performance of the models, leaving a total of 540 original images to train, a total number that would be maintained for all experiments with synthetic images to make the results obtained in each comparable experiment and the number of original images will be varied to observe scenarios in which there are fewer original images and the data set is completed with synthetic images.

250 epochs were trained for 5 different data sets

The results obtained are presented in the following table together with examples of the qualitative results of each one, the metric presented is the average of the absolute difference of the detected clusters over the total of clusters present in the image.

Results with predictions in red and annotations in blue.

As seen in the results, the original model performs very well in the cluster count in the test dataset, on the other hand, the results of the dataset with 100% synthetic images get an error 3 times greater than the original. However, in experiments where a 50% relationship between the images or a greater number of synthetic images is handled, a mean error is obtained that is quite close to the original. Finally, the experiment with 30% synthetic images obtained a lower error than the original model, that is, better performance in the cluster count in the test data set.

Therefore, it is possible to conclude a great contribution of synthetic data in the performance of Deep Learning models since in cases where you have a small data set, you can increase its size and maintain an error close to a large data set of original images plus, better performance is possible with a suitable combination of original and synthetic images.

Final results with predictions in red and annotations in blue.

Exploring Generative AI: Use Cases in Computer Vision and Beyond
Thursday, February 22, and Friday, February 23
Register Free

Follow Us

Copyright © 2024 Linked AI, Inc. All rights reserved.