# Adaptive Detection and Classification of Brain Tumour Images Based on Photoacoustic Imaging
## 3 Results and Discussion
### Detection and Segmentation Experiment Results and Analysis  
In this experiment, the YoLov8-MedSAM model is used to achieve fast, accurate, and automatic brain tumour region detection and segmentation. The model inputs the preprocessed photoacoustic brain tumour image into the YOLOv8 target detection model,which outputs the photoacoustic brain tumour image with block diagrams, and then the output of YOLOv8 is used as the input of MedSAM to achieve faster and higher quality segmentation operation and the accurate segmentation of brain tumour regions. The corresponding photoacoustic brain tumour image segmentation map can be obtained directly after detection by the YoLov8-MedSAM model. The model is able to effectively handle variations in different sizes and tumour shapes, adapt to changing image conditions by self-adjusting the internal parameters and convolution kernel, and accurately segment the tumour region. As shown in Figure 6, the YoLov8-MedSAM detection segmentation model is able to accurately segment tumour regions with different locations, shapes, and sizes, and the model can better remove useless information from brain tumour images and identify benign and malignant brain tumours more effectively. In Figure 6a, the morphology of the malignant tumour shows tiny and irregular features, and the complexity of its edges increases significantly, showing features such as tiny lobes, irregular protrusions and tiny depressions, etc. Such morphological features reflect the heterogeneity of the internal tissues of the tumour and the complexity of its structure, and the model shows the high-resolution perception of the tumour edges and the precision localisation of the edges of the tumour by accurately identifying and segmenting these complicated features. In Figure 6b, it can be intuitively observed that the malignant tumour presents a complex edge morphology, showing irregular contours with features such as branches, sharp protrusions, and discontinuous edges. The model accurately segments these edge features and effectively retains the edge detail information, demonstrating a high degree of sensitivity and resolution to the tumour morphology. In Figure 6c,d, the morphology of benign tumours shows smooth features, and the complexity of their edges is significantly reduced with clear contours, which intuitively shows that the model better segments benign tumours, and the subsequent classification of these tumours has a good basis. In summary, the model proposed in this paper can effectively delineate the boundary between the tumour tissue and the surrounding normal tissue, has good segmentation accuracy and a sensitive recognition of microstructures, and can continuously optimise the prediction strategy according to the actual segmentation results to improve the adaptability to new samples. Figure 7 shows the confusion matrix of the trained YoLov8-MedSAM model in different categories (\"positive\" and \"negative\"), reflecting its detection performance. The model shows the best recognition performance in the \"positive\" category of brain tumours, followed by the \"negative\" category. The confusion value for the \"negative\" category is 0.09, indicating a high level of confusion with the background. The \"positive\" category has a confusion value of 0.06, indicating a relatively low level of confusion with the background. This confusion may be due to the small size of some of the tumour labels in the 'negative' category, which makes them easier to confuse with the background. By looking at the F1 confidence curve graph in Figure 8, it can be seen that the three curves represent different categories. These curves all show a trend of increasing and then decreasing, where the negative sample category curve performs well at lower confidence thresholds, but the performance gradually decreases as the threshold increases.