Repository navigation
Running Scripts Manually
This guide explains how to extract, configure, and manually execute the Python runner scripts (predict.py and train.py) provided by DiGi.YOLO.
Before running the scripts, ensure Python (3.10+) is installed and install the required dependencies:
pip install -r requirements.txt(Dependencies: ultralytics, torch)
Call Modify.WriteScripts(targetDirectory) to export all runner scripts (train.py, predict.py, utils.py, requirements.txt) and configuration (conf.yaml) to your working directory:
using DiGi.YOLO;
string targetDirectory = @"C:\Path\To\WorkingDir";
bool success = Modify.WriteScripts(targetDirectory);predict.py uses argparse to allow explicit control over input image sources, model weights, confidence thresholds, and output bounding box result files (.bbrf).
| Flag | Default Value | Description |
|---|---|---|
--model |
YOLO/models/model.pt |
Path to trained YOLO model weights (.pt). Defaults to best checkpoint in runs/detect/train*/weights/best.pt if default does not exist. |
--source |
YOLO/input |
Path to single input image file or directory containing .jpg, .jpeg, or .png images. |
--conf |
0.1 |
Confidence threshold float value for detection filtering. |
--output |
YOLO/output/results.bbrf |
Destination path for output bounding box result file (.bbrf). Written in "w" mode to prevent duplicate rows. |
python predict.pypython predict.py --model YOLO/models/model.pt --source "C:/Data/Images" --conf 0.25 --output "C:/Data/Output/results.bbrf"train.py trains or fine-tunes a YOLO model using dataset configuration defined in conf.yaml.
Keep Python scripts and configuration files in the root execution directory, with dataset files structured under a common training/ folder:
.
βββ conf.yaml
βββ predict.py
βββ requirements.txt
βββ train.py
βββ utils.py
βββ training/
βββ images/
β βββ train/
β βββ val/
βββ labels/
βββ train/
βββ val/
path: training
train: images/train
val: images/train
names:
0: buildingRun training with default hyperparameters (150 epochs, imgsz=640):
python train.pyThe training process outputs model checkpoints to runs/detect/train*/weights/best.pt.