Thinning is an important agronomic process in pear production, thus the detection of pear inflorescence is an important technology for intelligentization of blossom thinning. In this paper, images of buds and flowers were collected under different natural conditions for model training, and the images were augmented by data augmentation methods. Model training was performed based on the YOLOv5s network with coordinate attention mechanism added to the backbone network and compared with the native YOLOv5s, YOLOv3, SSD 300, and Faster-RCNN algorithms. The mAP, F1 score and recall of the algorithm reached 93.32%, 91.10%, and 91.99%. The model size only took up 14.1 MB, and the average detection time was 27 ms, which are suitable for application in actual intelligent blossom thinning equipment.