Unverified 提交 799e3d0c authored 作者: Glenn Jocher's avatar Glenn Jocher 提交者: GitHub

Add SegmentationModel unsupported warning (#9632)

* Add SegmentationModel unsupported warning Signed-off-by: 's avatarGlenn Jocher <glenn.jocher@ultralytics.com> * Update hubconf.py Signed-off-by: 's avatarGlenn Jocher <glenn.jocher@ultralytics.com> * Update hubconf.py Signed-off-by: 's avatarGlenn Jocher <glenn.jocher@ultralytics.com> Signed-off-by: 's avatarGlenn Jocher <glenn.jocher@ultralytics.com>
上级 2373d547
...@@ -30,7 +30,7 @@ def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbo ...@@ -30,7 +30,7 @@ def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbo
from models.common import AutoShape, DetectMultiBackend from models.common import AutoShape, DetectMultiBackend
from models.experimental import attempt_load from models.experimental import attempt_load
from models.yolo import ClassificationModel, DetectionModel from models.yolo import ClassificationModel, DetectionModel, SegmentationModel
from utils.downloads import attempt_download from utils.downloads import attempt_download
from utils.general import LOGGER, check_requirements, intersect_dicts, logging from utils.general import LOGGER, check_requirements, intersect_dicts, logging
from utils.torch_utils import select_device from utils.torch_utils import select_device
...@@ -47,8 +47,11 @@ def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbo ...@@ -47,8 +47,11 @@ def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbo
model = DetectMultiBackend(path, device=device, fuse=autoshape) # detection model model = DetectMultiBackend(path, device=device, fuse=autoshape) # detection model
if autoshape: if autoshape:
if model.pt and isinstance(model.model, ClassificationModel): if model.pt and isinstance(model.model, ClassificationModel):
LOGGER.warning('WARNING ⚠️ YOLOv5 v6.2 ClassificationModel is not yet AutoShape compatible. ' LOGGER.warning('WARNING ⚠️ YOLOv5 ClassificationModel is not yet AutoShape compatible. '
'You must pass torch tensors in BCHW to this model, i.e. shape(1,3,224,224).') 'You must pass torch tensors in BCHW to this model, i.e. shape(1,3,224,224).')
elif model.pt and isinstance(model.model, SegmentationModel):
LOGGER.warning('WARNING ⚠️ YOLOv5 SegmentationModel is not yet AutoShape compatible. '
'You will not be able to run inference with this model.')
else: else:
model = AutoShape(model) # for file/URI/PIL/cv2/np inputs and NMS model = AutoShape(model) # for file/URI/PIL/cv2/np inputs and NMS
except Exception: except Exception:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论