YOLO26 object detection (PyTorch), supporting Windows 11 and Ubuntu Linux 24.04, using the vendored ultralytics engine (8.4.16, AGPL/GPL, in src/ultralytics). The pipeline covers annotating images in a browser with the bundled annotation server, converting the Pascal VOC XML annotations to YOLO labels, training YOLO26x, and running detection on images, folders or a webcam. Two datasets ship with trained weights: plate (steel-surface defects: inclusion, patches, rolled_in_scale, scratches) and tumor. Training needs an NVIDIA GPU; inference also runs on CPU.
[Folder Structure]
- CLAUDE.md / AGENT.md: program specification (identical content).
- CHANGELOG.md: change log.
- data/{dataset}/: label.names, voc.yaml, and the train, val and test splits, each with images/, annotations/ (VOC XML) and labels/ (YOLO, written by the convert step). plate holds 40 / 8 / 8 images; tumor holds 10 / 3 / 10.
- model/{dataset}/: best.pt (the trained weights) and yolo26x.pt (the base weights); train/ holds the training results and predict/ the inference outputs.
- src/ultralytics/: the vendored ultralytics 8.4.16 engine.
- src/annotation/: the bundled aiohttp annotation web server.
- src/*.py: the four wrappers (annotation, convert, train, inference).
- venv/: Python virtual environment, created by step 01.
[Prerequisites]
- Operating system: Windows 11 or Ubuntu Linux 24.04.
- Python 3 and pip.
- An NVIDIA GPU is required for training; inference also runs on CPU.
- Webcam detection (step 10) needs a display and a camera.
[Instructions]
Step 1: Create the virtual environment (CPU)
Create a fresh venv and install the CPU requirements. The script aborts loudly if pip fails.
Windows: src\01_venv_create.bat
Linux: bash src/01_venv_create.sh
Step 2: Create the virtual environment (GPU)
Same as step 1, but swaps torch for the CUDA 12.8 build. Training needs this one.
Windows: src\01_venv_create_gpu.bat
Linux: bash src/01_venv_create_gpu.sh
Step 3: Activate the virtual environment
Activate the venv. On Linux, source the script.
Windows: src\02_venv_activate.bat
Linux: source src/02_venv_activate.sh
Step 4: Annotate the images
Launch the annotation web server on port 8801 and open the browser.
Windows: src\03_annotation.bat
Linux: bash src/03_annotation.sh
Step 5: Convert the annotations
Convert the VOC XML annotations of train and val into YOLO labels.
Windows: src\04_convert_yolo_format.bat
Linux: bash src/04_convert_yolo_format.sh
Step 6: Train the model
Train YOLO26x with batch size 16, image size 512 and 300 epochs. The results land in model/{dataset}/train/, and the shipped best.pt is not overwritten.
Windows: src\05_train.bat
Linux: bash src/05_train.sh
Step 7: Watch the training curves
Open the logs under model/ with TensorBoard, on port 6066.
Windows: src\06_tensorboard.bat
Linux: bash src/06_tensorboard.sh
Step 8: Detect in a single image
Detect objects in the example image (inclusion-2.png for the plate dataset).
Windows: src\07_inference.bat
Linux: bash src/07_inference.sh
Step 9: Detect in a whole folder
Detect objects in data/plate/test/images at a threshold of 0.3.
Windows: src\08_inference_folder.bat
Linux: bash src/08_inference_folder.sh
Step 10: Webcam detection
Detect objects on webcam 0 with a live window, at a threshold of 0.25.
Windows: src\09_inference_webcam.bat
Linux: bash src/09_inference_webcam.sh
Step 11: Remove the virtual environment
Delete the venv/ folder.
Windows: src\99_venv_clear.bat
Linux: bash src/99_venv_clear.sh
[Usage Notes]
- All wrappers take --dataset plate|tumor and forward any extra arguments; the GPU is detected automatically.
- Do not pip-install ultralytics into the venv, because it would shadow the vendored engine.
- After retraining, pass --weights model/{dataset}/train/weights/best.pt to the inference launchers to use the new model.
- The annotated inference results are saved to model/{dataset}/predict/.
- Full pipeline: step 4 annotate, step 5 convert, step 6 train, step 7 TensorBoard, then steps 8 to 10 for inference.
[References]
- ultralytics (the engine vendored in src/ultralytics): https://github.com/ultralytics/ultralytics
- Ultralytics docs: https://docs.ultralytics.com/
- PyTorch install: 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.