Mildew in maize kernels is typically caused by various fungi, necessitating prompt detection and treatment to minimize losses during harvest and storage. In this study, a deep learning YOLOv5s algorithm based on machine vision technology was employed to develop a maize seed surface mildew detection model and to enhance its portability for deployment on additional mobile devices. To guarantee the fruitful progression of this research, an initial experiment was conducted on maize seeds to obtain a sufficient number of images of mildewed maize kernels, which were classified into three grades (sound, mild, and severe). Subsequently, a maize seed image was extracted to create an image of a single maize seed, which was then divided to establish the data set. An enhanced YOLOv5s–ShuffleNet–CBAM model was ultimately developed. The results demonstrated that the model achieved with an mAP50 value of 0.955 and a model size of 2.4 MB. This resulted in a notable reduction in the model parameters and calculation amount while simultaneously enhancing model precision. Furthermore, K-fold cross-validation demonstrated the model stability, and Grad-CAM validated the model effectiveness. In the future, the proposed lightweight model in this study can be applied to other crops in the context of portable or online inspection systems, thus advancing effective and high-quality agricultural applications.