Abstract:Aiming at image perspective distortion and surface defect detection of solar photovoltaic cells, a method based on a virtual camera for perspective correction and an improved YOLOv5s neural network model for defect detection are proposed. Firstly, a virtual camera with a horizontal orientation is constructed based on camera extrinsics to establish a perspective mapping relationship between the original image and the virtual camera, by which perspective correction of the original image is achieved. Secondly, a dynamic head is employed to enhance the representation capacity of the YOLOv5s head, and a receptive field expansion (RFI) module is added into the bottleneck of the C3 module to enhance the receptive field for small targets. Finally, the localization loss of YOLOv5s is fused with the normalized weighted distance (NWD) loss to compensate for the positional deviation of small targets. Experimental results demonstrate that the perspective correction based on the virtual camera can achieve significant improvements in correction effectiveness with shorter runtime. Moreover, the average accuracy of the improved YOLOv5s model can be increased up to 6.1%, 27.7%, and 1.1% than YOLOv5s, YOLOv7, and YOLOv8 respectively, which exhibits the practical value in surface quality inspection of solar photovoltaic cells.