
Citation: Cao, Z.; Yuan, R. Real-Time
Detection of Mango Based on
Improved YOLOv4. Electronics 2022,
11, 3853. https://doi.org/
10.3390/electronics11233853
Academic Editor: Silvia Liberata Ullo
Received: 27 September 2022
Accepted: 5 November 2022
Published: 23 November 2022
Publisher’s Note: MDPI stays neutral
with regard to jurisdictional claims in
published maps and institutional affil-
iations.
Copyright: © 2022 by the authors.
Licensee MDPI, Basel, Switzerland.
This article is an open access article
distributed under the terms and
conditions of the Creative Commons
Attribution (CC BY) license (https://
creativecommons.org/licenses/by/
4.0/).
Article
Real-Time Detection of Mango Based on Improved YOLOv4
Zhipeng Cao and Ruibo Yuan *
Faculty of Mechanical and Electrical Engineering, Kunming University of Science and Technology,
Kunming 650031, China
* Correspondence: kmust_yrb@163.com
Abstract:
Agricultural mechanization occupies a key position in modern agriculture. Aiming at the
fruit recognition target detection part of the picking robot, a mango recognition method based on an
improved YOLOv4 network structure is proposed, which can quickly and accurately identify and
locate mangoes. The method improves the recognition accuracy of the width adjustment network,
then reduces the ResNet (Residual Networks) module to adjust the neck network to improve the
prediction speed, and finally adds CBAM (Convolutional Block Attention Module) to improve the
prediction accuracy of the network. The newly improved network model is YOLOv4-LightC-CBAM.
The training results show that the mAP (mean Average Precision) obtained by YOLOV4-LightC-
CBAM is 95.12%, which is 3.93% higher than YOLOv4. Regarding detection speed, YOLOV4-LightC-
CBAM is up to 45.4 frames, which is 85.3% higher than YOLOv4. The results show that the modified
network can recognize mangoes better, faster, and more accurately.
Keywords:
object detection; YOLOv4; width reduction; convolutional block attention module;
feature extraction
1. Introduction
China is a major fruit producer and consumer in the world. With the development of
society, fewer and fewer people are engaged in the management and picking of orchards,
and the labor force shortage will lead to a lack of productivity. However, robots can
significantly reduce the labor force shortage. The research on picking robots was first
carried out in the 1980s. Research has been conducted on machine vision, agricultural
robots, remote sensing analysis, and fruit quality detection. Target detection and fruit
recognition based on deep learning and computer image processing have the advantages
of high efficiency, high precision, and low labor cost. In recent years, visual technology
has been gradually applied to fruit identification and inspection in China. In other words,
the image collected by the robot identifies and locates the fruit in the image through
the object detection algorithm, and transmits the position information to the subsequent
acquisition work.
With the development of technology, the performance of GPU has been dramatically
improved, the neural network recognition technology has been iterated and updated, and
the target recognition network has been updated continuously. More and more scholars
also use a neural network to identify fruits. Faster R-CNN is a two-stage target recognition
neural network proposed by Microsoft, which can achieve better recognition accuracy. Line
et al. [
1
] applied Faster R-CNN to strawberry flower recognition, which could achieve
a better recognition effect in different scenes of strawberry flowers. They could provide
a reference for outdoor strawberry yield. Wan et al. [
2
] proposed an improved version
of Faster R-CNN, which optimized the convolution layer and pooling layer structure,
detected multiple kinds of fruits, and obtained a higher accuracy than the original algorithm.
Parvathi et al. [
3
] proposed using ResNet-50 Faster R-CNN to see two critical ripening
stages of coconuts in a complex background, which can identify young coconuts and
mature coconuts, respectively. Zhao et al. [
4
] proposed a new Faster R-CNN to detect
strawberry crop diseases and obtained an mAP of 92.18%.
Electronics 2022, 11, 3853. https://doi.org/10.3390/electronics11233853 https://www.mdpi.com/journal/electronics