In light of the prevalent pest and disease issues faced by greenhouse cucumbers, a staple vegetable during winter, this study introduces a detection method based on the enhanced YOLOv8s model. This method aims to provide technical support for detecting and classifying pests and diseases in cucumber agricultural production. The model integrates the 'MultiCat' module for multiscale feature fusion and employs the 'C2fe' and 'ADC2f'modules to strengthen spatial and channel attention. The 'Block2d' function also facilitates the choice between average pooling and attention-based spatial pooling. Channel fusion is achieved through additive and multiplicative operations, allowing the model to delve deeper into feature learning. Experimental results confirm that our approach outperforms the original YOLOv8s model in pest detection, particularly excelling in the identification of small-scale and overlapping afflictions.