Photovoltaic systems are increasingly gaining popularity for rooftop installations in urban areas. These devices contribute to the self-sufficiency of electricity supply and reduce greenhouse gas emissions in urban settings. In this study, we implement deep learning techniques and compare the U-Net and Attention U-Net architectures to detect rooftops in the city of Sidi Bel Abbes (North Africa) for the installation of solar panels. Contrary to trends observed in the literature and previous research, our results show that U-Net achieved a higher accuracy of 90.49%, while Attention U-Net achieved an accuracy of 89.96%. Using the U-Net method, we identified a 1.9-square-kilometer area of rooftops suitable for solar panel installation in the southern part of the town of Sidi Bel Abbes. This discovery represents a potential electrical capacity of 89 MVA, capable of largely satisfying the energy needs of the studied region. This work is a novelty, being the first study of its kind undertaken in Algeria.