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

AMP check image download backup (#7936)

上级 cee5959c
...@@ -511,7 +511,14 @@ def check_amp(model): ...@@ -511,7 +511,14 @@ def check_amp(model):
if next(model.parameters()).device.type == 'cpu': # get model device if next(model.parameters()).device.type == 'cpu': # get model device
return False return False
prefix = colorstr('AMP: ') prefix = colorstr('AMP: ')
im = cv2.imread(ROOT / 'data' / 'images' / 'bus.jpg')[..., ::-1] # OpenCV image (BGR to RGB) file = ROOT / 'data' / 'images' / 'bus.jpg' # image to test
if file.exists():
im = cv2.imread(file)[..., ::-1] # OpenCV image (BGR to RGB)
elif check_online():
im = 'https://ultralytics.com/images/bus.jpg'
else:
LOGGER.warning(emojis(f'{prefix}checks skipped ⚠️, not online.'))
return True
m = AutoShape(model, verbose=False) # model m = AutoShape(model, verbose=False) # model
a = m(im).xyxy[0] # FP32 inference a = m(im).xyxy[0] # FP32 inference
m.amp = True m.amp = True
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论