The range of diagnostic equipment has been widened and improved by the quick development of biomedical research technologies. The creation of multifunctional instruments that become essential for biomedical operations has been discovered by several research organizations to be made possible by optical imaging, acoustic image analysis, and magnetic resonance imaging. One of the most crucial tools is hyperspectral photoacoustic (PA) imaging, which combines optical and ultrasonic technology. In this study, the reconstruction of the PA pictures employs a new deployment of deep learning methods. This enabled us to train and evaluate our deep-learning approach under several imaging situations in addition to firmly establishing the contextual information. This study presents an optimization approach that blends multispectral optical acoustic imaging with detailed transfer learning-based diagnostic imaging. The particle swarm-convolutional neural network (PS-CNN) technique aims to reconstruct and categorize the presence of cancer using ultrasonic pictures. In image processing, the technique of bilateral filtration (BF) is commonly employed to remove noise. Additionally, the biological images are separated using portable LED Net frameworks. It is also possible to employ a feature extraction technique with the PS optimization methodology. Last but not least, biological images employ a CNN model to assign suitable classification. Using a standard dataset, the PS-CNN technology’s efficacy is confirmed, and testing findings revealed that it performs superior to other methods.