Skip to content

Introduce yolort.runtime Interface

Compare
Choose a tag to compare
@zhiqwang zhiqwang released this 03 Oct 17:43

This release improves support of ONNXRuntime by introducing the yolort.runtime interface and adding a C++ interface example. It also improves support for loading the checkpoint trained with ultralytics/yolov5.

Highlights

Intruduce the yolort.runtime Interface

We introduce the yolort.runtime interface to accelerate the application on the Python frontend. For example, you can define the runtime and do inferencing with ONNXRuntime as follows

from yolort.runtime import PredictorORT

detector = PredictorORT("best.onnx")
img_path = "bus.jpg"
scores, class_ids, boxes = detector.run_on_image(img_path)

ONNXRuntime C++ Inference Example

We adopt the dynamic shape mechanism when exporting the ONNX model, and within this, we can embed both pre-processing (letterbox) and post-processing (nms) into the model graph, which simplifies the deployment strategy. And @itsnine have provided an example on how to use it in here.

Load Checkpoint from Official YOLOv5

We now provide an interface for loading the checkpoint weights trained from the official yolov5 directly.

from yolort.models import YOLOv5

# 'yolov5s.pt' is downloaded from https://github.com/ultralytics/yolov5/releases/download/v5.0/yolov5s.pt
ckpt_path_from_ultralytics = "yolov5s.pt"
model = YOLOv5.load_from_yolov5(ckpt_path_from_ultralytics, score_thresh=0.25)

model.eval()
img_path = "test/assets/bus.jpg"
predictions = model.predict(img_path)

Backwards Incompatible Changes

  • Move common utils to yolort.v5 (#167)
  • Rename the YOLOModule to YOLOv5 (#179)
  • Move graph visualization tools to yolort.relaying (#165)

New Features

Improvement

Bugfixes

Documents