Photovoltaic (PV) cell modules are the core components of PV power generation systems, and defects in these modules can significantly affect photovoltaic conversion efficiency and lifespan. Electroluminescence (EL) testing is a method used to detect defects during the production process of these modules. To address the issue of low defect detection accuracy caused by the complex background and large-scale variations of EL images, we propose an object detection network named C2DEM-YOLO to improve the accuracy of defect detection. Firstly, a deep-shallow feature extraction module called C2Dense is designed to replace the C2f module in the YOLOv8's backbone. Secondly, a cross-space multi-scale attention(EMA) is introduced after C2Dense to apply pixel-level attention to the extracted features, which suppresses background information while enhancing useful features for defect detection. Finally, by replacing CIoU with Inner-CIoU, we introduce auxiliary regression boxes to improve the accuracy of detection and the generalisation ability of the model. Experimental results show that C2DEM-YOLO achieves an average precision of 92.31% on the PVEL-AD dataset, which has 2.41%, 1.93%, and 1.56% improvement compared to YOLOv5s, YOLOv8n, YOLOv8s, respectively. Moreover, on our self-built dataset, the mAP@0.5 and mAP@0.5:0.95 of C2DEM-YOLO are improved by 1.42% and 1.46% compared to YOLOv8n, reaching 84.07%.