Solar panels play a crucial role in producing renewable electricity power for the grid, and this role grows more significant each year. However, defects in solar panels can significantly drop power output, leading to grid instability. Therefore, employing an efficient Artificial Intelligence (AI) algorithm to autonomously detect defects in solar panels is crucial. In this study, we employ the You Only Look Once (YOLO) v9, v10, and v11 algorithms to detect defects in solar panels. To this end, we examined their performance results via training on three datasets. The first dataset includes 191 thermal images with an image size of 200 × 160 pixels to identify a cell, multi-cell levels, and shadow defects. The second dataset consists of 792 optical images of solar panels with an image size of 244 × 244 to identify dust, snow, bird droppings, physical damage, and electrical defects. The third dataset includes 316 thermal images with an image size of 200 × 160 pixels, an enhanced version of the first dataset. Moreover, we examined the training and test performance results of YOLO v5, v9, v10, and v11. We achieved improved performance in detecting defects in solar panels compared to existing solutions by using the YOLO v10 and v11 algorithms. Additionally, we compared their performance results against Support Vector Machine (SVM) and Faster Region-based Convolutional Neural Network (R-CNN) to demonstrate the efficiency of the YOLO v10 algorithm. In conclusion, YOLO v11-X delivered the best performance among the algorithms tested. It reached a precision rate, recall rate, mean average precision, and F1 score of about 89.7%, 87.7%, 92.7%, and 90%, respectively.