Skip to content


YOLOv8 is an open-source computer vision model by Ultralytics, the creators of YOLOv5. You can use autodistill to train a YOLOv8 object detection model on a dataset of labelled images generated by the base models that autodistill supports.

View our YOLOv8 Instance Segmentation page for information on how to train instance segmentation models.


To use the YOLOv8 target model, you will need to install the following dependency:

pip3 install autodistill-yolov8


from autodistill_yolov8 import YOLOv8
target_model = YOLOv8("")

# train a model
target_model.train("./context_images_labeled/data.yaml", epochs=200)

# export weights for future use
saved_weights = target_model.export(format="onnx")

# show performance metrics for your model
metrics = target_model.val()

# run inference on the new model
pred = target_model.predict("./context_images_labeled/train/images/dog-7.jpg", conf=0.01)