Skip to content

Commit 4febf0b

Browse files
committed
validate
1 parent 3e3a6a8 commit 4febf0b

File tree

1 file changed

+4
-3
lines changed
  • model_api/python/openvino/model_api/models

1 file changed

+4
-3
lines changed

model_api/python/openvino/model_api/models/yolo.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -834,11 +834,13 @@ def postprocess(self, outputs, meta):
834834
if 1 != len(outputs):
835835
self.raise_error("expect 1 output")
836836
prediction = next(iter(outputs.values()))
837+
if "f32" != prediction.precision:
838+
self.raise_error("the output must be of precision f32")
837839
out_shape = prediction.shape
838840
if 3 != len(out_shape):
839-
raise RuntimeError("expect the output of rank 3")
841+
raise RuntimeError("the output must be of rank 3")
840842
if 1 != out_shape[0]:
841-
raise RuntimeError("expect 1 as the first dim of the output")
843+
raise RuntimeError("the first dim of the output must be 1")
842844
boxes = non_max_suppression(
843845
prediction, self.confidence_threshold, self.iou_threshold
844846
)
@@ -882,5 +884,4 @@ def postprocess(self, outputs, meta):
882884

883885
class YOLOv8(YOLOv5):
884886
"""YOLOv5 and YOLOv8 are identical in terms of inference"""
885-
886887
__model__ = "YOLOv8"

0 commit comments

Comments
 (0)