ultralytics 8.1.34 Inference API robust imgsz checks (#9274)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
dcb953bc41
commit
5be2ffbd13
3 changed files with 24 additions and 12 deletions
|
|
@ -142,6 +142,8 @@ def check_imgsz(imgsz, stride=32, min_dim=1, max_dim=2, floor=0):
|
|||
imgsz = [imgsz]
|
||||
elif isinstance(imgsz, (list, tuple)):
|
||||
imgsz = list(imgsz)
|
||||
elif isinstance(imgsz, str): # i.e. '640' or '[640,640]'
|
||||
imgsz = [int(imgsz)] if imgsz.isnumeric() else eval(imgsz)
|
||||
else:
|
||||
raise TypeError(
|
||||
f"'imgsz={imgsz}' is of invalid type {type(imgsz).__name__}. "
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue