training-and-evaluation
Use this sub-skill for BiRefNet fine-tuning, epoch scheduling, checkpoint loading/saving, metric evaluation, and best-epoch selection.
Handles
train.pyCLI:--resume,--epochs,--ckpt_dir,--dist,--use_acceleratetrain.shtask-specific epoch, validation, and save schedulestrain_test.shtrain-then-evaluate orchestrationtest.shinference plus evaluation over configured testsetseval_existingOnes.py,evaluation.metrics.evaluator,sort_and_round_scoresgen_best_ep.pycheckpoint ranking frome_results/*_eval.txt
Use the bundled script
scripts/birefnet_metric_smoke.py— create tiny mask fixtures and exerciseevaluation.metrics.evaluatorfrom an explicit or inferred repo root.
Read next
references/training-workflows.mdreferences/evaluation-workflows.mdreferences/metrics-reference.mdreferences/troubleshooting.md
Recommended operating flow
- Validate dataset layout and task/testset names with
../configuration-and-data/SKILL.mdbefore building a training or evaluation command. - Confirm backbone/weight compatibility with
../model-architecture/SKILL.md; wrongconfig.bboften appears as a checkpoint tensor-size error. - For fine-tuning, compute total epochs from the checkpoint filename epoch plus the desired additional epochs because
train.pyresumes at filename epoch + 1. - Treat full training as GPU/data/weight/budget dependent; use this sub-skill to plan commands and only execute after explicit user approval.
- Before evaluating real predictions, run
scripts/birefnet_metric_smoke.pyto confirm metric dependencies and evaluator wiring.
Done criteria
- Training commands name the run directory, GPU IDs, total epoch count, resume path, and whether Accelerate/DDP is used.
- Evaluation commands have matching
gt_root,pred_root, dataset names, and metric flags. - Checkpoint selection criteria (
sm,wfm, and DIS-onlyhce) are explicit. - Asset-heavy native runs are marked skipped unless the user provides data, weights, hardware, and time budget.
Route out
- Dataset tree and task/testset selection ->
../configuration-and-data/SKILL.md - Backbone choice, checkpoint key cleanup, and weight compatibility ->
../model-architecture/SKILL.md - Standalone image/video mask generation and foreground refinement ->
../inference-and-postprocessing/SKILL.md