Abstract:In container-based vertical agricultural production systems, supplementary lighting is a key technical approach for regulating crop growth, optimizing resource utilization, and improving production efficiency. However, most existing lighting control strategies rely on fixed time cycles or empirical parameters, lacking effective perception of crop growth stages, which limits their adaptability and precision under dynamic growth conditions. To address these challenges, a lettuce growth stage recognition model named self attention based-YOLO (SAB-YOLO) was proposed to realize accurate and automated identification of crop growth periods in complex visual environments. The proposed model was developed by introducing multiple structural improvements to the YOLO v5 framework. Firstly, the conventional convolutional backbone was replaced with a Swin Transformer network based on self-attention mechanisms, which enhanced the ability of the model to capture long-range dependencies and global semantic information. Secondly, an asymptotic feature pyramid network (AFPN) with denser cross-layer connections was adopted in the Neck to strengthen multi-scale feature fusion and improve robustness to large scale variations among different growth stages. Furthermore, a convolution transformer fusion (CTF) module that integrated convolutional operations with self-attention was designed and embedded into the detection head to further enhance global contextual representation. In addition, the Inner-SIoU loss function was employed to improve bounding box regression accuracy and accelerate model convergence. Experimental results on a mixed dataset collected from open-source platforms and a container-based plant factory showed that the proposed model achieved a precision of 88.5% and an mAP_0.5 of 92.1%, outperforming the baseline YOLO v5 model. Furthermore, an intelligent supplementary lighting system based on growth stage recognition was designed and validated, demonstrating the practical applicability of the proposed method in precision agriculture.