Anti-islanding detection (AILD) for distributed power sources plays an important role on the stable operation of power grid systems and the safety of electrical systems. In order to improve the detection accuracy, we propose neural network architecture search (NAS) based approach for anti-islanding image detection and optimization of distributed power sources. It combines the fast region-based convolutional neural network (Faster-R-CNN) with the differentiable architecture search (Darts), utilizing electrical signal image data acquired from cameras or photovoltaic (PV) inverters, thereby enhancing the accuracy and efficiency of detection. We conduct a comparative analysis of two methods for obtaining distributed power supply (DPS) anti-islanding image data: camera-based acquisition and PV inverter-based acquisition. Our observation reveals that the image data acquired through cameras is more conducive for the learning process of DCNN. The proposed algorithm was compared with other convolutional neural network (CNN) models, validating its performance superiority. This provides a novel perspective and methodology for the advancement of AILD for distributed power sources, and enhances the security and stability of DPS.