How khao0/hida-baa works
HiDA-BAA adapts a provided source model to a researcher’s preprocessed target-domain hand X-rays, then predicts continuous bone age using image and sex inputs. Training reads annotations, creates age-and-sex-stratified folds, warms up the regression head, fine-tunes the backbone, evaluates folds, and saves adapted models and metrics. Separate documented workflows support single-image inference and test-folder re-evaluation. Preprocessing is external; the re-evaluation implementation was not sampled, so its internal wiring is omitted.
Main entry points: train.py Fold Trainer · load_source_model.py Source Model Loader · inference.py Inference CLI · predict.py Prediction Functions
Components 19
Target Adaptation
- Training CLI
scripts/train.py - Fold Trainer
hida_baa/trainers/train.py - Head Warm-up
hida_baa/trainers/train.py - Backbone Fine-tuning
hida_baa/trainers/train.py - Source Model Loader
hida_baa/models/load_source_model.py - Source Checkpoint
checkpoints/SourceModel - Adapted Models
checkpoints/AdaptedModel - Training Metrics
hida_baa/trainers/utils.py
Dataset Handling
- Dataset Loader
hida_baa/datasets/bone_age_dataset.py - Train and Test CSVs
data
Prediction and Evaluation
- Inference CLI
scripts/inference.py - Prediction Functions
hida_baa/predict.py - Re-evaluation CLI
scripts/test.py - Training Evaluation
hida_baa/trainers/utils.py - Bone Age Prediction
External Inputs
- Hugging Face
- Preprocessed X-rays
- Hand X-ray Preprocessing
Other components
- Researcher
Connections 23
- Researcher → Training CLI: starts training
- Training CLI → Fold Trainer: runs
- Fold Trainer → Dataset Loader: loads and splits
- Train and Test CSVs → Dataset Loader: provides metadata
- Preprocessed X-rays → Dataset Loader: provides images
- Researcher → Hand X-ray Preprocessing: prepares images
- Hand X-ray Preprocessing → Preprocessed X-rays: produces 600x600
- Fold Trainer → Source Model Loader: loads each fold
- Source Model Loader → Source Checkpoint: checks local
- Source Model Loader → Hugging Face: downloads if absent
- Fold Trainer → Head Warm-up: trains frozen backbone
- Fold Trainer → Backbone Fine-tuning: fine-tunes upper layers
- Fold Trainer → Adapted Models: saves fold models
- Fold Trainer → Training Evaluation: evaluates test folds
- Training Evaluation → Training Metrics: writes metrics
- Researcher → Inference CLI: requests prediction
- Inference CLI → Prediction Functions: calls
- Inference CLI → Adapted Models: selects model
- Prediction Functions → Preprocessed X-rays: reads image
- Prediction Functions → Bone Age Prediction: returns age
- Researcher → Re-evaluation CLI: requests re-evaluation
- Re-evaluation CLI → Train and Test CSVs: uses test metadata
- Re-evaluation CLI → Adapted Models: selects model