Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug: End2End Support Only Detection Model. #383

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions export.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ def export_onnx(model, im, file, opset, dynamic, simplify, prefix=colorstr('ONNX

@try_export
def export_onnx_end2end(model, im, file, simplify, topk_all, iou_thres, conf_thres, device, labels, prefix=colorstr('ONNX END2END:')):
if not isinstance(model, DetectionModel) or isinstance(model, SegmentationModel):
raise RuntimeError("Model not supported. Only Detection Models can be exported with End2End functionality.")
# YOLO ONNX export
check_requirements('onnx')
import onnx
Expand Down Expand Up @@ -579,11 +581,8 @@ def run(
if onnx or xml: # OpenVINO requires ONNX
f[2], _ = export_onnx(model, im, file, opset, dynamic, simplify)
if onnx_end2end:
if isinstance(model, DetectionModel):
labels = model.names
f[2], _ = export_onnx_end2end(model, im, file, simplify, topk_all, iou_thres, conf_thres, device, len(labels))
else:
raise RuntimeError("The model is not a DetectionModel.")
labels = model.names
f[2], _ = export_onnx_end2end(model, im, file, simplify, topk_all, iou_thres, conf_thres, device, len(labels))
if xml: # OpenVINO
f[3], _ = export_openvino(file, metadata, half)
if coreml: # CoreML
Expand Down