Introduce yolort.runtime Interface
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
toYOLOv5
(#179) - Move graph visualization tools to yolort.relaying (#165)
New Features
- [PROTOTYPE] Add ncnn deployment example (#145)
- [PROTOTYPE] Train models from scratch (#115, #116, #124, #125, #128, #143)
- Support loading checkpoint from official yolov5 (#167, #168, #169, #179)
- Add ONNXRuntime C++ inference example (#171, #172, #174, #186), thanks @itsnine and @xiguadong
- Introduce
yolort.runtime
interface (#176, #178) - Add pre-commit.ci hooks (#182)
- Add CLI tool for exporting ONNX models (#175), thanks @runrunrun1994
- Add CLI tool for evaluating mAP metrics (#148, #150)
Improvement
- Add alignment with ultralytics yolov5 tutorial (#117, #118, #121), thanks @xiguadong
- Refactor graph visualization tools (#126, #127, #165), thanks @xiguadong
- Update TorchVision C++ interfaces to 0.9.0+ (#136, #138), thanks @xiguadong
- Replace cxxopts with cmdline (#137)
- Update dependencies (#161, #162, #163, #164, #181)
- Simplify the unit-test (#149, #151, #152)
- Support autoenvolved anchors from ultralytics (#120), thanks @Tomakko
- Workaround on
YOLOTransform
to support fixed size input (#109) - Unify onnx and JIT resize implementations (#105)
Bugfixes
- Fix exception (#183)
- Fix dtype in AnchorGenerator (#111, #113, #166), thanks @dkloving
- Made targets argument in
YOLOTransform
truly optional (#108), thanks @dkloving