AI • BREAST ULTRASOUND • EXPLAINABILITY

Breast Ultrasound AI Analysis

An AI-assisted project exploring breast lesion classification and model explainability using deep learning and Grad-CAM++.

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

MODEL EfficientNet-B3
DATASET BUS-BRA
TASK Benign vs Malignant
EXPLAINABILITY Grad-CAM++

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.9364

Test Images

309

Case-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.

Accuracy 90.00%
Precision 81.67%
Recall 89.09%
F1-Score 85.22%
ROC-AUC 0.9505

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.3397

Mean Dice

0.4807

Attention 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 Application

Limitations

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

← Back to Projects