About the Project
This project explores whether artificial intelligence can classify breast ultrasound lesions while also providing insight into the areas influencing its prediction. The focus was not only on model performance, but also on understanding what the model was actually looking at.
Can AI not only classify a breast lesion, but also help us understand what it was looking at when making that prediction?
Project Overview
Dataset
The project uses the BUS-BRA breast ultrasound dataset, containing 1,875 ultrasound images and 1,875 corresponding lesion masks. The image-mask pairs were verified before being used for the explainability analysis.
1,875 ultrasound images • 1,875 lesion masks • 1,875 / 1,875 verified image-mask matches
Model & Approach
A single-image EfficientNet-B3 model was trained for binary classification of benign and malignant breast lesions. The final model uses 300 × 300 input images and a decision threshold of 0.52.
Grad-CAM++ was then used to visualize regions that contributed to the model's predictions. These attention maps were compared with the reference lesion masks to evaluate how closely the model's focus aligned with the lesion region.
Image-Level Results
Evaluation was performed on 309 test images.
Accuracy
88.35%Precision
81.90%Recall / Sensitivity
83.50%F1-Score
82.69%ROC-AUC
0.9364Test Images
309Case-Level Evaluation
170 Unique Cases
The test set contained 170 unique cases, including 139 cases with two ultrasound views and 31 cases with one view.
Grad-CAM++ Explainability
Grad-CAM++ was used to examine where the model was focusing when making its predictions. The resulting attention maps were compared with the reference lesion masks.
Mean IoU
0.3397Mean Dice
0.4807Attention Inside Lesion
40.24%Confidence Analysis
The average prediction confidence was 93.28%. Correct predictions had a mean confidence of 94.68%, while incorrect predictions had a mean confidence of 82.60%. The Expected Calibration Error (ECE) was 0.0570.
What I Learned From the Results
High confidence does not always mean a correct prediction. One representative failure case was classified as malignant with 99.91% confidence even though the true label was benign. This highlighted an important point: explainability and confidence analysis are valuable when evaluating AI systems, especially in medical imaging.
Interactive Application
Try the Project
The project was developed as an interactive Streamlit application where users can upload a breast ultrasound image, view the predicted class and probabilities, and explore the Grad-CAM++ visualization.
Open Live ApplicationLimitations
This project is an AI research and learning exploration using a research dataset and is not a clinically validated diagnostic system. The model performs binary classification only. A high-confidence prediction does not guarantee correctness, and Grad-CAM++ provides an attention visualization rather than a true segmentation of the lesion.
Tools & Technologies
Python • PyTorch • Torchvision • NumPy • Pillow • Streamlit • EfficientNet-B3 • Grad-CAM++ • GitHub • Hugging Face