Boilerplate code for extending the Ultralytics YOLOv8 codebase and CLI, using the Ultralytics repository as an external dependency.
The most common method for adding custom code to the Ultralytics codebase, is by editing the Ultralytics repository, and adding the custom functionality into the existing codebase. Compared to this method, I suggest adding custom code on top of the Ultralytics codebase, using the Ultralytics repository as an external dependency.
- Reduced code clutter
- Changes are more visible
- Easily update the base Ultralytics version
The boilerplate code contains a simple extension, that includes adding a textual indication whenever the epoch has currently achieved the best fitness score. This is done by printing (*) best
while training.
The functionality depends on a PR currently pending in the Ultralytics repository. These changes can be previewed here:
git clone -b extend-cli https://github.com/deanmark/ultralytics.git
Install the current repo, and the modified ultralytics code by runnning pip install .
in both directories.
Use the Ultralytics CLI as usual, but using the new yolo-custom
command.
For example:
yolo-custom train data=coco128.yaml model=yolov8n.pt epochs=10 lr0=0.01