Aiming at the problems that the parameters of YOLOv5s model are too large and the computing resources of development board memory are limited, a new target detection method based on deep learning YOLOv5 algorithm model is proposed. First, the light-weight module Gz-ShffleNetv2 is used to construct cotton top bud feature extraction unit, which reduces the number of parameters and improves the running speed. It can be better applied in image classification, speed up detection and meet the requirements of mobile end of development board. Secondly, in order to solve the problem of decreasing detection accuracy caused by lightweight, BotNet and C3SE attention mechanism are added to focus on specific areas of cotton terminal bud. Combined with YYG loss function XIOU boundary frame regression loss, more feature information and rich feature MAP were obtained to further improve the accuracy of target detection. Through analysis of research and experimental results, the average accuracy map reached 91.3% under the Windos system NVIDIA Geforce RTX 2060 SUPER detection. While maintaining high precision identification, the number of parameters of YOLOv6 and YOLOv7-tiny network model is reduced by 83% and 53%, respectively, and the detection accuracy is increased by 1.2% and 7.7%, respectively. Compared with YOLOv5 reasoning image, the speed of image is increased by 0.035s, and the detection accuracy of MAP_0.5:0.95 is increased by 1%. At the same time, PyQt5 and YOLOv5 target detection algorithms are used to design a cotton top bud identification system, which makes cotton top bud detection more intuitive and convenient for subsequent hardware development and use.