Taillight recognition is the key to predicting the intention of the vehicle ahead, but the current detection algorithms still have problems in small target and taillight matching. In order to solve the above problems, this paper analyzes the characteristics of automobile taillight signal, combines the image processing algorithm with the object detection technology, and puts forward a taillight signal recognition model based on image processing. Firstly, the characteristics of automobile taillight signal are analyzed, and the taillight is extracted by using HSV color space and corrosion expansion algorithm, and then the taillight is matched by artificial preset experience value to solve the problem of matching headlight. Secondly, P2 small target detection model is added to the YOLOv8s model to improve the recognition ability of small targets, and CA(coordinate attention) is inserted to reduce the interference of other light sources. Finally, EIOU Loss was added to solve the problem of sample imbalance caused by a small number of motorcycles. In this paper, the actual scene video is used for ablation experiments to verify the effectiveness of the improved algorithm. The experimental results show that the mAP value of the model is 9.3% higher than that of the YOLOv8s model.