To efficiently detect and count maize seedlings in complex field conditions, this study first developed a sample dataset under diverse backgrounds and lighting scenarios and introduced a data augmentation technique called “M_AUG.” YOLOv5s was selected as the base model, enhanced with the Swin Transformer (Swin TR)to improve feature extraction across various scales and complex environments. The model also incorporated multi-scale attention (EMA)to enhance the representation of small samples and positive/negative samples, along with the Asymptotic Feature Pyramid Network (AFPN)to integrate seedling features at different levels. The results showed that the proposed SEA-YOLOv5 achieved mAP 0.5 of 98.6 %, mAP 0.5–0.95 of 73.2 %. and F1 of 97.1 %, with the parameters count of 5.55 million and a weight size of 11.7 MB. Compared to YOLOv5, SEA-YOLOv5 improved mAP 0.5 by 5.8 %, mAP 0.5–0.95 by 9.9 %, and F1 by 5.4 %, while reducing the parameter count by 1.46 million and weight size by 2.7 MB. SEA-YOLOv5 was compared with YOLOv7, YOLOv8s, Faster R-CNN, RetinaNet, YOLOv10s, DNE-YOLO, and YOLOv11s, and the results indicated that SEA-YOLOv5 outperformed the comparison models in overall performance. Upon deploying SEA-YOLOv5 on the Jetson Orin NX and conducting seedling detection and counting trials across eight plots, the model achieved a miss rate of just 0.63 % and a frame rate of 74.6 FPS. Thus, it can be concluded that the SEA-YOLOv5 model developed in this study provides high accuracy, a compact design, and strong portability, making it well-suited for real-time detection and counting applications in the field.