| Pear flower thinning can effectively regulate the nutrient supply of pear trees,maintain stable yield in the orchard and improve fruit quality.At present,traditional flower thinning models have been unable to meet the needs of large-scale orchards for flower thinning.Traditional thinning methods include artificial thinning and chemical thinning.Artificial flower thinning has the problems of low efficiency,long flower thinning period,and high cost;Due to the inability to distinguish the density of pear flowers,chemical flower thinning uses the same concentration of chemicals to spray the entire orchard.This method has problems such as large area environmental pollution,excessive or insufficient thinning.The realization of automatic detection of pear flowers can timely obtain the number of pear flowers and estimate the fruit yield.At the same time,the realization of pear flower density detection can effectively judge the density of pear flowers,providing intuitive judgment basis for flower thinning.This has important significance for the development of intelligent flower thinning technology.Therefore,this paper studied pear flower recognition method based on improved YOLOv5s and pear flower density classification method based on improved density peak clustering algorithm.The main work is as follows:(1)Build a pear flower image dataset.Aiming at the problems of small target size,small pixel size,and severe occlusion in pear flower images,this paper adopted a random cropping method for data enhancement.In this study,pear flower images were randomly cropped to 608 pixels × 608 pixels and 1024 pixels × 1024 pixels.This method could reduce the compression degree of the input feature map and achieve efficient recognition of small targets using the YOLOv5s network model.(2)Construct and improve pear flower recognition model.Aiming at the problems of dense pear blossoms,severe occlusion,and low recall caused by too small targets,this paper proposed a pear blossom recognition method based on improved YOLOv5s.First,the method added a small target detection layer.This method increased the shallow output feature layer of the backbone feature extraction network,and enhanced the feature fusion of the shallow feature layer in the PANet feature extraction network.This method increased the ability to extract shallow features and detailed information.Secondly,the CBAM attention module was introduced to improve the ability to express important features.The experimental results showed that the improved YOLOv5s-P-CBAM model could reduce the missed recognition rate.The improved accuracy rate,recall rate,F1 value,and mAP were 91.62%,83.05%,87.12%,and 94.06%,respectively,which were 0.16%,1.55%,0.93%,and 0.61%higher than the original model.Moreover,it could achieve good recognition results for the pear flower images of Xueqing,Yali,and Qiuyue,with strong generalization.(3)Construct and improve the pear flower density grading model.In order to better judge pear flower density,this study proposed a pear flower density grading method based on an improved density peak clustering algorithm.This method first extracted the position coordinates of pear flowers and obtained the data points to be clustered.Secondly,in order to achieve the density classification of pear flower images,in view of the shortcomings of the original density peak clustering algorithm in pear flower density classification,and in combination with the requirements of pear flower density classification,the selection method of clustering centers was improved.The decision graph was divided into four parts by using four sets of local density and center offset distance segmentation thresholds to select the clustering centers.These four parts corresponded to four levels of high,medium,and low density,as well as no need for thinning treatment.Accurate grading of pear flower images with reasonable density was achieved.Finally,in order to solve the problem of inaccurate clustering and grading of pear flower distribution with only cluster distribution,sparse distribution,and large scale close-ups,the calculation method of the distance between two points dij parameter was improved.The pear flower scale size and density grading standards were unified to achieve reasonable density grading for all distribution types of pear flower images.The experimental results showed that the algorithm could adapt to pear flower images of different scales.The prediction accuracy rate was 94.89%,and the density classification accuracy rate was 94.29%.It could achieve density classification of local flower clusters in natural environments.The pear flower recognition method and density estimation method proposed in this paper can identify and classify pear flowers in complex natural environments,providing technical support for yield estimation and intelligent thinning by machines. |