A console/terminal pipeline for training and running a YOLO26 oriented-bounding-box (OBB) detection model on Windows 11 and Ubuntu Linux 24.04. Unlike an ordinary axis-aligned box, an OBB carries a rotation angle, which suits aerial imagery, medical imaging and any scene where objects are not upright. The ultralytics source and an annotation web server are bundled, so annotation, format conversion, training and inference are all covered by one set of launchers.
[Folder Structure]
- CLAUDE.md / AGENT.md: program specification (identical content).
- CHANGELOG.md: change log.
- copyright.txt: copyright notice.
- data/{dataset}/: the datasets, with images, labels and annotations under train/ and val/, plus test/images, label.names and voc.yaml.
- model/{dataset}/: the starting weights (yolo26x-obb.pt) and the training output (best.pt, last.pt and the run artifacts).
- tool/tools.py: shared utility helpers (delete_ipynb_checkpoints, project_root, resolve_device).
- src/annotation/: the bundled aiohttp annotation web server (main.py, routes.py, views.py, API.py, config/ and the image-annotation/ browser UI). It is launched by src/annotation.py and runs on both Windows and Linux with the venv Python.
- src/: the source code and the launcher scripts.
- src/requirements.txt: the Python dependencies installed by 01_venv_create.
- src/ultralytics/: the bundled ultralytics source, imported directly, with no PyPI install needed.
- venv/: Python virtual environment, created by 01_venv_create and removed by 99_venv_clear.
[Prerequisites]
- Operating system: Windows 11 (the .bat launchers) or Ubuntu Linux 24.04 (the .sh launchers).
- Python 3.10 or newer on PATH.
- Optional: an NVIDIA GPU with a matching CUDA build of PyTorch.
- Annotation (step 3) uses the bundled src/annotation/ web server, which runs on Windows and Linux with the venv Python and needs no external binary; webcam inference (step 8) needs a display and a camera.
[Instructions]
Step 1: Create the virtual environment
Recreate the venv and install the packages listed in src/requirements.txt.
Windows: src\01_venv_create.bat
Linux: bash src/01_venv_create.sh
Step 2: Activate the virtual environment (optional)
Activate the venv in the current shell so you can run python directly. On Linux, source the script. Steps 3 to 8 activate the venv automatically, so this step is optional.
Windows: src\02_venv_activate.bat
Linux: source src/02_venv_activate.sh
Step 3: Annotate the images
Launch the LabelMe JSON annotation web server and draw the oriented boxes in a browser.
Windows: src\03_annotation.bat
Linux: bash src/03_annotation.sh
Step 4: Convert the dataset format
Convert the LabelMe JSON annotations into YOLO OBB labels and write voc.yaml.
Windows: src\04_convert_yolo_format.bat --dataset CT
Linux: bash src/04_convert_yolo_format.sh --dataset CT
Step 5: Train the model
Train the OBB detection model. The converter from step 4 runs automatically when voc.yaml is missing.
Windows: src\05_train.bat --dataset CT --epochs 100 --device 0
Linux: bash src/05_train.sh --dataset CT --epochs 100 --device 0
Step 6: Single-image inference
Run inference on a single image. Add --show to display the result window, or --save to write it to disk.
Windows: src\06_inference.bat --dataset CT --source data\CT\test\images\liver-1.png --show
Linux: bash src/06_inference.sh --dataset CT --source data/CT/test/images/liver-1.png --save
Step 7: Folder inference
Run inference on a whole folder of images.
Windows: src\07_inference_folder.bat --dataset CT --source data\CT\test\images --save
Linux: bash src/07_inference_folder.sh --dataset CT --source data/CT/test/images --save
Step 8: Webcam inference
Run inference on a live webcam stream. This needs a display and a camera.
Windows: src\08_inference_webcam.bat
Linux: bash src/08_inference_webcam.sh
Step 9: Remove the virtual environment
Delete the venv/ folder.
Windows: src\99_venv_clear.bat
Linux: bash src/99_venv_clear.sh
[Python Entry Points]
- src/annotation.py: launch the bundled src/annotation/ web server. Arguments: --dataset, --port, --split.
- src/convert_yolo_format.py: LabelMe JSON to YOLO OBB labels plus voc.yaml. Arguments: --dataset.
- src/train.py: train the YOLO26 OBB model. Arguments: --dataset, --batch-size, --image-size, --epochs, --workers, --device, --weights.
- src/inference.py: single-image or folder inference. Arguments: --dataset, --source, --image-size, --device, --threshold, --weights, --show, --save.
- src/inference_webcam.py: webcam inference. Arguments: --dataset, --webcam-id, --image-size, --device, --threshold, --weights, --save.
[References]
- YOLO paper (Redmon et al. 2016): https://arxiv.org/abs/1506.02640
- DOTA paper (oriented-object dataset, Xia et al. 2018): https://arxiv.org/abs/1711.10398
- Ultralytics source: https://github.com/ultralytics/ultralytics
- Ultralytics docs: https://docs.ultralytics.com/
- OBB task reference: https://docs.ultralytics.com/tasks/obb/
- OBB dataset format: https://docs.ultralytics.com/datasets/obb/
- PyTorch install selector: https://pytorch.org/get-started/locally/
This SDK is built in AppForAI - AI Dev Tools.
Purchase license separately: USD 600, permanent authorization, single APP authorization, single machine authorization, one-year activation, one-year download, one-year update, one-year email technical support.