Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/tommyngx/MammoMix/llms.txt

Use this file to discover all available pages before exploring further.

MammoMix runs on Python 3.8 or later and depends on PyTorch, HuggingFace Transformers, and a handful of supporting libraries for dataset loading, augmentation, metrics, and experiment tracking. All required packages are pinned in requirements.txt and install with a single pip command. A CUDA-capable GPU is not strictly required, but training on CPU is impractical for mammography-scale datasets.

System requirements

RequirementMinimumRecommended
Python3.83.10+
GPUCUDA-capable (8 GB VRAM for YOLOS, 16 GB for Deformable DETR)
CUDA11.8 or 12.1
RAM8 GB16 GB+
Disk5 GB20 GB+ (datasets not included)

Install from source

Clone the repository and install all Python dependencies:
git clone https://github.com/tommyngx/MammoMix.git
cd MammoMix
pip install -r requirements.txt
PyTorch must match your system’s CUDA version. The torch entry in requirements.txt installs the CPU-only build by default on most platforms. If you have a GPU, install the correct CUDA build first from pytorch.org before running pip install -r requirements.txt, or pip will overwrite it with the CPU build.
# Example: CUDA 11.8
pip install torch --index-url https://download.pytorch.org/whl/cu118

# Example: CUDA 12.1
pip install torch --index-url https://download.pytorch.org/whl/cu121

Dependencies

requirements.txt contains six packages. The table below explains what each one does in MammoMix:
PackageVersion specRole in MammoMix
torchlatestCore deep learning framework. Powers model training, GPU tensor operations, and the DataLoader pipeline in loader.py.
transformers[torch]latestHuggingFace Transformers. Provides AutoModelForObjectDetection, AutoImageProcessor, and Trainer — the backbone of train.py for both YOLOS and Deformable DETR.
timmlatestPyTorch Image Models. Supplies pretrained image model components used internally by YOLOS and as a dependency of Transformers’ vision backends.
datasetslatestHuggingFace Datasets library. Used for dataset management utilities and compatibility with the Transformers training pipeline.
wandblatestWeights & Biases experiment tracking. Receives logs automatically via report_to="all" in TrainingArguments. Configured through logging.wandb_project in the YAML config.
torchmetrics[detection]latestDetection metrics. Provides MeanAveragePrecision, which computes mAP, mAP@50, mAP@75, and size-stratified mAP in evaluation.py and mocae.py.

Data augmentation dependency

loader.py uses Albumentations for training-time data augmentation, including elastic deformation, perspective distortion, horizontal flips, rotation, random scaling, affine transforms, brightness/contrast jitter, Gaussian noise, and Gaussian blur. Albumentations is not listed in requirements.txt, so install it separately:
pip install albumentations
Without this package, importing loader.py will fail with an ImportError when train.py starts.

Verify the installation

Run a quick import check to confirm the key packages are available:
import torch
import transformers
import timm
import torchmetrics
import albumentations

print(f"PyTorch:        {torch.__version__}")
print(f"CUDA available: {torch.cuda.is_available()}")
print(f"Transformers:   {transformers.__version__}")
print(f"timm:           {timm.__version__}")
print(f"torchmetrics:   {torchmetrics.__version__}")
print(f"albumentations: {albumentations.__version__}")
Expected output on a CUDA system:
PyTorch:        2.x.x+cu121
CUDA available: True
Transformers:   4.x.x
timm:           1.x.x
torchmetrics:   1.x.x
albumentations: 1.x.x
Once this runs without errors, proceed to the Quickstart to prepare a dataset and launch your first training run.

Build docs developers (and LLMs) love