In the task of classifying massive celestial data, the accurate classification of galaxies, stars, and quasars usually relies on spectral labels. However, spectral data account for only a small fraction of all astronomical observation data, and the target source classification information in vast photometric data has not been accurately measured. To address this, we propose a novel deep learning-based algorithm, YL8C4Net, for the automatic detection and classification of target sources in photometric images. This algorithm combines the YOLOv8 detection network with the Conv4Net classification network. Additionally, we propose a novel magnitude-based labeling method for target source annotation. In the performance evaluation, the YOLOv8 achieves impressive performance with average precision scores of 0.824 for AP@0.5 and 0.795 for AP@0.5:0.95. Meanwhile, the constructed Conv4Net attains an accuracy of 0.8895. Overall, YL8C4Net offers the advantages of fewer parameters, faster processing speed, and higher classification accuracy, making it particularly suitable for large-scale data processing tasks. Furthermore, we employed the YL8C4Net model to conduct target source detection and classification on photometric images from 20 sky regions in SDSS-DR17. As a result, a catalog containing about 9.39 million target source classification results has been preliminarily constructed, thereby providing valuable reference data for astronomical research.