The invention discloses a citrus recognition method based on improved YOLOv4. According to the method, a YOLOv4
network model structure is improved, an up-sampling module and a detection feature map sensitive to a
small target are added, and citruses with relatively small individuals can be better identified; sparse training, channel
pruning and layer
pruning are carried out on a
network model obtained through training, the defects of large memory consumption, long recognition time and the like caused by module addition are overcome, clustering is carried out by using a
Canopy algorithm and ak-means + +
algorithm, and a user can obtain an anchor frame parameter value more suitable for a
data set of the user. When citrus recognition is carried out, an improved YOLOv4
network structure is adopted to
train a citrus
data set, and the obtained model can recognize a target with a small individual more accurately; before a
network model is trained, through combination of layer
pruning and channel pruning, the depth and the width of the model are compressed, and the training speed is improved on the premise that the precision is not lost; citrus on trees in different periods is recognized, the recognition precision is high, the speed is high, and the requirement for real-time recognition can be met.