This guide walks you through cloning MammoMix, installing its dependencies, preparing a mammography dataset, launching a YOLOS training run, and reading the evaluation results that print automatically when training completes.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 trains on GPU by default.
train.py sets CUDA_VISIBLE_DEVICES=0 and enables fp16 automatically when a CUDA device is detected. A machine with at least one CUDA-capable GPU is strongly recommended.Install dependencies
torchmetrics[detection]. See Installation for a full breakdown of each dependency and CUDA version notes.Prepare your dataset
MammoMix expects datasets to be split into Then run the script:The script reads raw images and XML annotations from
train/, val/, and test/ subdirectories, each containing images/ and labels/ folders with VOC-format XML annotations. The splitting.py script handles this for all three supported datasets at once.Open splitting.py and set the path variables at the bottom of the file:RAW_DATA_DIR, cross-validates them against each dataset’s bbox_annotations.csv, and writes split manifests (train.txt, val.txt, test.txt) to SPLITS_DIR. The validation split (20% by default) is carved from the training set using a fixed random seed of 42 for reproducibility.Once splitting is done, update splits_dir in your chosen config to point at SPLITS_DIR:Train a YOLOS model
Pass the config file and a dataset name to Training loads
train.py. The --dataset flag overrides the dataset.name field in the config:hustvl/yolos-base from HuggingFace Hub and fine-tunes it for 30 epochs using a cosine-with-restarts learning rate schedule, gradient accumulation over 2 steps, and per-epoch warmup. The best checkpoint by eval_map_50 is kept. When the run finishes, the model is saved to a timestamped directory:Evaluate on the test set
Evaluation runs automatically at the end of The metric names follow the
train.py — no separate command needed. Results are printed directly to the console:torchmetrics MeanAveragePrecision output format. test_map_50 is the primary metric used for model selection during training.