This folder contains the complete data, training, and NCNN export workflow used by AimBuddy.
The model contract is fixed to yolo26n.pt with single-class detection (enemy, class id 0).
- Python 3.10 to 3.12
- Windows 10 or 11 (64-bit)
- Installed dependencies from
requirements.txt
Recommended hardware:
- CPU: 8+ cores
- RAM: 16 GB+
- Disk: 30 GB+ free
- GPU: NVIDIA with CUDA 12.1
Minimum supported hardware:
- CPU: 4 cores
- RAM: 8 GB
- Disk: 15 GB free
- GPU: optional
training/
config/
dataset/
outputs/
reports/
runs/
export/
raw_frames/
scripts/
01_setup_environment.bat
02_extract_frames.bat
03_validate_dataset.bat
04_train_adaptive.bat
05_train_manual.bat
06_export_ncnn.bat
07_run_full_pipeline.bat
08_auto_label.bat (teacher-driven auto-labelling)
09_mine_negatives.bat (empty-label samples to suppress FPs)
10_active_learning.bat (find frames worth labelling next)
src/
videos/
requirements.txt
yolo26n.pt
Python entrypoints auto-create missing required folders, including output and deployment targets.
Run in this order when executing manually:
scripts\01_setup_environment.bat(creates.venv, installs deps, and ensuresyolo26n.pt)scripts\02_extract_frames.bat(optional if starting from videos)scripts\08_auto_label.bat(optional but recommended - skip 90%+ of manual labelling)scripts\09_mine_negatives.bat(optional - drop no-enemy frames inraw_frames\negatives\first)scripts\03_validate_dataset.batscripts\04_train_adaptive.batorscripts\05_train_manual.batscripts\06_export_ncnn.batscripts\10_active_learning.bat(after first training - surfaces frames worth labelling next)
One-command path:
cd training
scripts\07_run_full_pipeline.batPipeline flags (passed to src/run_pipeline.py):
--manualor--adaptive--skip-export--non-strict-preflight--config <path>
Example:
scripts\07_run_full_pipeline.bat --manual --skip-exportPreflight strictness behavior:
01_setup_environment.batuses non-strict preflight (--non-strict).04_train_adaptive.batand05_train_manual.batuse strict preflight.07_run_full_pipeline.batis strict by default, optional non-strict via--non-strict-preflight.
Config file: training/config/config.ini
[paths]: model, dataset, outputs, deployment paths[training]: manual hyperparameters[adaptive]: dataset-size adaptive training rules[export]: NCNN export options
Adaptive dataset thresholds resolved in src/training_config.py:
- Small (
<300train images): epochs around 260, batch constrained to 8-12 - Medium (
300 to <1200): epochs around 180, batch constrained to 12-20 - Large (
>=1200): epochs around 120, batch constrained to 16-32
Resolved values are written to training/outputs/reports/selected_training_config.json.
Required YOLO label format:
class_id x_center y_center width height
Rules:
- values normalized to
[0,1] - class id must be
0 - no cross-split leakage between train, valid, and test
Expected dataset paths:
training/dataset/data.yamltraining/dataset/train/imagestraining/dataset/train/labelstraining/dataset/valid/imagestraining/dataset/valid/labelstraining/dataset/test/imagestraining/dataset/test/labels
- Reports:
training/outputs/reports - Weights:
training/outputs/runs/detect/train/weights - Exported NCNN artifacts (working copy):
training/outputs/export - Deployment target for app runtime:
app/src/main/assets/models
The export script writes both locations and keeps filenames aligned with runtime constants:
models/yolo26n-opt.parammodels/yolo26n-opt.bin
Preflight verifies Python version, CPU cores, RAM, disk space, and CUDA availability.
Review these files after each run:
training/outputs/reports/preflight_report.jsontraining/outputs/reports/dataset_report.jsontraining/outputs/reports/selected_training_config.jsontraining/outputs/reports/pipeline_last_run.jsontraining/outputs/reports/pipeline_last_run.log
Model contract validation before export:
cd training
python src\check_model_contract.py --weights outputs\runs\detect\train\weights\best.pt- NVIDIA GPU detected but no CUDA in torch: reinstall CUDA-enabled torch and verify Python 3.10 to 3.12.
- Validation errors: fix dataset labels before retraining.
- Export completes but runtime fails to load model: verify files in
app/src/main/assets/models.
For end-to-end training context, see docs/Training.md.