Skip to content

Commit a5748e4

Browse files
authored
Updated Segmentation and Classification usage (#9607)
* Updated Segmentation and Classification usage Signed-off-by: Glenn Jocher <[email protected]> * Update export.py Signed-off-by: Glenn Jocher <[email protected]> * Update export.py Signed-off-by: Glenn Jocher <[email protected]> * Update export.py Signed-off-by: Glenn Jocher <[email protected]> Signed-off-by: Glenn Jocher <[email protected]>
1 parent c4c0ee8 commit a5748e4

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

export.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,13 +560,20 @@ def run(
560560
# Finish
561561
f = [str(x) for x in f if x] # filter out '' and None
562562
if any(f):
563+
tp = type(model)
564+
dir = Path('segment' if tp is SegmentationModel else 'classify' if tp is ClassificationModel else '')
565+
predict = 'detect.py' if tp is DetectionModel else 'predict.py'
563566
h = '--half' if half else '' # --half FP16 inference arg
564567
LOGGER.info(f'\nExport complete ({time.time() - t:.1f}s)'
565568
f"\nResults saved to {colorstr('bold', file.parent.resolve())}"
566-
f"\nDetect: python detect.py --weights {f[-1]} {h}"
567-
f"\nValidate: python val.py --weights {f[-1]} {h}"
569+
f"\nDetect: python {dir / predict} --weights {f[-1]} {h}"
570+
f"\nValidate: python {dir / 'val.py'} --weights {f[-1]} {h}"
568571
f"\nPyTorch Hub: model = torch.hub.load('ultralytics/yolov5', 'custom', '{f[-1]}')"
569572
f"\nVisualize: https://netron.app")
573+
if tp is ClassificationModel:
574+
LOGGER.warning("WARNING ⚠️ ClassificationModel not yet supported for PyTorch Hub AutoShape inference")
575+
if tp is SegmentationModel:
576+
LOGGER.warning("WARNING ⚠️ SegmentationModel not yet supported for PyTorch Hub AutoShape inference")
570577
return f # return list of exported files/dirs
571578

572579

0 commit comments

Comments
 (0)