YOLOv8

New convolutions in YOLOv8

There are a series of updates and new convolutions in the YOLOv8 architecture according to the introductory post from Ultralytics:

Ancher-free Detections

Anchor-free detection is when an object detection model directly predicts the center of an object instead of the offset from a known anchor box.

Anchor boxes are a pre-defined set of boxes with specific heights and widths, used to detect object classes with the desired scale and aspect ratio. They are chosen based on the size of objects in the training dataset and are tiled across the image during detection.

The network outputs probability and attributes like background, IoU, and offsets for each tiled box, which are used to adjust the anchor boxes. Multiple anchor boxes can be defined for different object sizes, serving as fixed starting points for boundary box guesses.

The advantage of anchor-free detection is that it is more flexible and efficient, as it does not require the manual specification of anchor boxes, which can be difficult to choose and can lead to suboptimal results in previous YOLO models such as v1 and v2.

Luckily we do not need them anymore, but if you’re interested in knowing how to generate the anchor boxes yourself look at this post.

Export

  • Export to ONNX or OpenVINO for up to 3x CPU speedup.

  • Export to TensorRT for up to 5x GPU speedup.

from ultralytics import YOLO

# Load a model
model = YOLO('yolov8n.pt')  # load an official model
model = YOLO('path/to/best.pt')  # load a custom trained model

# Export the model
model.export(format='onnx')
$ yolo export model=yolov8n.pt format=onnx  # export official model
$ yolo export model=path/to/best.pt format=onnx  # export custom trained model

Last updated