Abstract:Solanum rostratum Dunal( SrD )is a globally harmful invasive weed, that has spread widely in many countries, and poses a serious threat to local agriculture and ecosystem security. A deep learning network model, TrackSolunam, was designed to realize real-time detection, localization, and counting for SrD. The TrackSolanum network model consisted of three parts :a detection module, a tracking module, and a localization and counting module. The main body of the detection module consisted of YOLO v8 with the added EMA attention mechanism, which can detect SrD plants in real time. The main body of the tracking module was based on DeepSort, which enabled multi-object tracking based on the output of the detection module. It can identify the same SrD plant in consecutive video frames, avoiding repeated identification and counting. The localization module located the plants of SrD that were detected by searching for their centroids and can output the specific coordinates of the centroids in each frame, facilitating subsequent removal processes. The counting module avoided the issue of repeated counts by specific processing that the target ID was invalid after it crossed the detection line. The YOLO_EMA model achieved precision, recall, AP and FPS of 93.7%, 93.6%, 97.8% and 91 f/s, respectively, demonstrating its effectiveness in real-time detection tasks for SrD in the field. To further validate the detection performance of the YOLO_EMA network, an ablation study comparing the original YOLO v8, YOLO_EMA and the previously designed YOLO_CBAM was conducted. Additionally, the impact of different growth stages of SrD on detection performance was discussed. During the seedling stage, the TrackSolanum model achieved precision, recall, AP, and FPS of 95.9%, 96.4%, 98.6% and 74 f/s, respectively. In the growth stage, the TrackSolanum model′s precision, recall, AP, and FPS were 96.3%, 95.4%, 97.0% and 71 f/s, respectively, all demonstrating good detection results. The field test results showed that for the video acquired by UAV flight at 2 m height, the precision and recall of the TrackSolanum model reached 94.2% and 96.5%, respectively, and the MOTA and IDF1 reached 80.6%and 95.4%, respectively, with the counting error rate of only 3.215%. The TrackSolanum model can be used for real-time detection of SrD in the field, providing crucial technical support for hazard assessment and precise management of SrD invasion.