# atifamjad707/breast-cancer-yolov9-detection architecture

> Architecture diagram of the GitHub repository atifamjad707/breast-cancer-yolov9-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/atifamjad707/breast-cancer-yolov9-detection
- Repository: https://github.com/atifamjad707/breast-cancer-yolov9-detection

## Overview

This repository is a command-line research pipeline for detecting Normal and Breast-cancer regions in mammograms. The user downloads the Roboflow dataset, preprocesses its splits with CLAHE, trains a YOLOv9 model, then evaluates its metrics or runs inference on new images. The scripts are separate entry points coordinated by the user and by files passed between runs, rather than one runtime orchestrator. The README documents the stages and results; the sampled source confirms the script behavior and Ultralytics calls.

Main entry points: [`src/evaluate.py`](https://github.com/atifamjad707/breast-cancer-yolov9-detection/blob/main/src/evaluate.py) (Model evaluation), [`src/predict.py`](https://github.com/atifamjad707/breast-cancer-yolov9-detection/blob/main/src/predict.py) (Image prediction), [`src/download_dataset.py`](https://github.com/atifamjad707/breast-cancer-yolov9-detection/blob/main/src/download_dataset.py) (Dataset downloader), [`src/preprocess.py`](https://github.com/atifamjad707/breast-cancer-yolov9-detection/blob/main/src/preprocess.py) (CLAHE preprocessing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_acquisition["Dataset acquisition"]
  node_download["Dataset downloader"]
  node_rawdata[("YOLO dataset")]
end

subgraph group_preparation["Data preparation"]
  node_preprocess["CLAHE preprocessing<br/>[preprocess.py]"]
  node_processed[("Processed dataset")]
end

subgraph group_modeling["Training and evaluation"]
  node_train["YOLO training<br/>[train.py]"]
  node_weights[("Trained weights")]
  node_evaluate["Model evaluation<br/>[evaluate.py]"]
  node_evalresults["Metrics and plots"]
end

subgraph group_inference["Inference"]
  node_mammograms["Input mammograms"]
  node_predict["Image prediction<br/>[predict.py]"]
  node_detections["Annotated detections"]
end

node_user(("Researcher / CLI user"))
node_roboflow["Roboflow service"]
node_ultralytics["Ultralytics YOLO"]

node_user -->|"runs"| node_download
node_download -->|"downloads from"| node_roboflow
node_download -->|"writes"| node_rawdata
node_user -->|"runs"| node_preprocess
node_preprocess -->|"reads"| node_rawdata
node_preprocess -->|"writes"| node_processed
node_user -->|"runs"| node_train
node_train -->|"reads"| node_processed
node_train -->|"trains with"| node_ultralytics
node_ultralytics -->|"saves"| node_weights
node_user -->|"runs"| node_evaluate
node_evaluate -->|"loads"| node_weights
node_evaluate -->|"reads"| node_processed
node_evaluate -->|"validates with"| node_ultralytics
node_ultralytics -->|"produces"| node_evalresults
node_user -->|"runs"| node_predict
node_predict -->|"loads"| node_weights
node_user -->|"provides"| node_mammograms
node_predict -->|"passes to inference"| node_mammograms
node_predict -->|"predicts with"| node_ultralytics
node_ultralytics -->|"saves annotations"| node_detections

click node_download "https://github.com/atifamjad707/breast-cancer-yolov9-detection/blob/main/src/download_dataset.py"
click node_preprocess "https://github.com/atifamjad707/breast-cancer-yolov9-detection/blob/main/src/preprocess.py"
click node_train "https://github.com/atifamjad707/breast-cancer-yolov9-detection/blob/main/src/train.py"
click node_evaluate "https://github.com/atifamjad707/breast-cancer-yolov9-detection/blob/main/src/evaluate.py"
click node_predict "https://github.com/atifamjad707/breast-cancer-yolov9-detection/blob/main/src/predict.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_download,node_rawdata,node_user toneBlue
class node_preprocess,node_processed toneAmber
class node_train,node_weights,node_evaluate,node_evalresults toneMint
class node_mammograms,node_predict,node_detections toneRose
class node_roboflow,node_ultralytics toneIndigo
```

## Components

### Dataset acquisition

- [Dataset downloader](https://github.com/atifamjad707/breast-cancer-yolov9-detection/blob/main/src/download_dataset.py): `src/download_dataset.py`
- **YOLO dataset**

### Data preparation

- [CLAHE preprocessing](https://github.com/atifamjad707/breast-cancer-yolov9-detection/blob/main/src/preprocess.py): `src/preprocess.py`
- **Processed dataset**

### Training and evaluation

- [YOLO training](https://github.com/atifamjad707/breast-cancer-yolov9-detection/blob/main/src/train.py): `src/train.py`
- **Trained weights**
- [Model evaluation](https://github.com/atifamjad707/breast-cancer-yolov9-detection/blob/main/src/evaluate.py): `src/evaluate.py`
- **Metrics and plots**

### Inference

- **Input mammograms**
- [Image prediction](https://github.com/atifamjad707/breast-cancer-yolov9-detection/blob/main/src/predict.py): `src/predict.py`
- **Annotated detections**

### Other components

- **Researcher / CLI user**
- **Roboflow service**
- **Ultralytics YOLO**

## Connections

- Researcher / CLI user → Dataset downloader: runs
- Dataset downloader → Roboflow service: downloads from
- Dataset downloader → YOLO dataset: writes
- Researcher / CLI user → CLAHE preprocessing: runs
- CLAHE preprocessing → YOLO dataset: reads
- CLAHE preprocessing → Processed dataset: writes
- Researcher / CLI user → YOLO training: runs
- YOLO training → Processed dataset: reads
- YOLO training → Ultralytics YOLO: trains with
- Ultralytics YOLO → Trained weights: saves
- Researcher / CLI user → Model evaluation: runs
- Model evaluation → Trained weights: loads
- Model evaluation → Processed dataset: reads
- Model evaluation → Ultralytics YOLO: validates with
- Ultralytics YOLO → Metrics and plots: produces
- Researcher / CLI user → Image prediction: runs
- Image prediction → Trained weights: loads
- Researcher / CLI user → Input mammograms: provides
- Image prediction → Input mammograms: passes to inference
- Image prediction → Ultralytics YOLO: predicts with
- Ultralytics YOLO → Annotated detections: saves annotations
