It is important to judge the density of pear flower accurately for automatic thinning. In order to judge the density of pear flowers precisely and achieve the purpose of automatic flower thinning, a density classification of pear flower images method based on improved density peak clustering algorithm was proposed in this study. The pear flower image samples used in the experiment were taken from the research base of Hebei Agricultural University, Niugang Village, Yi County, Baoding City, Hebei Province, and the variety was three-year-old Qiuyue. In this study, the images of pear flowers in natural environment were collected on April 18, 2021, when the pear flowers were in full bloom. The pear flower recognition images with high detection accuracy were obtained by using the depth learning model to detect the pear flower. The central coordinates of the target detection frame were extracted from the recognition images to obtain the data points that needed to be clustered. Secondly, in order to achieve the density classification of pear flower images, the method of selecting the cluster center was improved according to the shortcomings of the original density peak clustering algorithm in the density classification of pear flower and the requirements of pear flower density classification. The decision graph was divided into four parts by four groups of local density and center offset distance segmentation thresholds to select the cluster centers. These four parts corresponded to four grades of high, medium and low density and no thinning treatment. The accurate classification of pear flower images with reasonable density was realized. Finally, to solve the problem of inaccurate clustering classification of pear flower distribution with only cluster distribution, sparse distribution and large-scale close-up, the calculation method of dij parameter of distance between two points was improved. The pear flower scale and density grading standard were unified, and reasonable density grading could be achieved for all distribution types of pear flower images. The experimental results showed that the proposed algorithm could adapt to pear flower images of different scales. The accuracy of scale prediction was 94.89%, and the accuracy of density classification was 94.29%. Compared with the existing methods, the proposed method could achieve the density classification of local flower clusters in natural environment. the algorithm in this paper was compared with K-means algorithm and DBSCAN algorithm, and the accuracy of density classification was 94.29% and 68.57% respectively. Although the density classification accuracy of K-Means clustering algorithm was high, it lacked the algorithm steps to automatically select the clustering centers of different density classification, and was too sensitive to noise points. The density calculation method of DBSCAN algorithm lacked continuity, and the division of density grade was not precise enough. Based on the comprehensive analysis of density classification accuracy and cluster center selection method, the improved density peak clustering algorithm in this paper had the best effect. The clustering centers of different density grade could be automatically selected and the error of random initialization of clustering centers could be reduced. The proposed algorithm was robust to noise points and could eliminate noise points effectively. The proposed algorithm adopted soft statistics method for density calculation, which had continuity and was more accurate for density classification. It provides technical support for analyzing the density of pear flower and machine intelligent flower thinning. [ABSTRACT FROM AUTHOR]