Abstract:Tomato yield is affected by diseases, weather and other factors, among which leaf disease is the most critical factor affecting tomato yield. However, in the field of leaf disease detection, the existing models generally have the problem of insufficient generalization ability and high detection rate of small lesions. In this paper, an improved tomato disease early detection algorithm is proposed to improve these problems by optimizing the YOLOv5s network in various aspects, while keeping the model lightweight. Firstly, Mosaic9 data enhancement technology is used to strengthen the detection ability of the model for minor lesions, increase the complexity of the image back-ground, and improve the generalization ability of the model. Secondly, GSConv and Slim-Neck networks are used to lightweight the model and reduce the computational burden while maintaining the accuracy of the model. At the same time, the SimAM attention mechanism was used to capture the features of small lesions on the leaves more accurately, thus reducing the missed detection rate. In addition, in order to further enhance the detection ability of multi-scale targets, adaptive spatial feature fusion is introduced to effectively integrate features of different scales, and improve the detection accuracy of multi-scale targets, especially small targets. The experimental results showed that the model had excellent perfor-mance in early detection of leaf diseases, and the average recognition accuracy, recall rate, F1 score and mAP of leaf mold, early disease, late disease and healthy leaf disease reached 0.951%, 0.918%, 0.934% and 0.948%, respectively. It can be seen that this method has a good detection performance for minor lesions, and improves the problem of insufficient generalization ability of the model and missing detection in the detection process of minor lesions, and further improves the detection effect.