Unverified 提交 8d1ddc93 authored 作者: Yonghye Kwon's avatar Yonghye Kwon 提交者: GitHub

Earlier `assert` for cpu and half option (#3508)

* early assert for cpu and half option early assert for cpu and half option * Modified comment Modified comment
上级 90b7895d
...@@ -44,15 +44,13 @@ if __name__ == '__main__': ...@@ -44,15 +44,13 @@ if __name__ == '__main__':
# Load PyTorch model # Load PyTorch model
device = select_device(opt.device) device = select_device(opt.device)
assert not (opt.device.lower() == 'cpu' and opt.half), '--half only compatible with GPU export, i.e. use --device 0'
model = attempt_load(opt.weights, map_location=device) # load FP32 model model = attempt_load(opt.weights, map_location=device) # load FP32 model
labels = model.names labels = model.names
# Checks # Input
gs = int(max(model.stride)) # grid size (max stride) gs = int(max(model.stride)) # grid size (max stride)
opt.img_size = [check_img_size(x, gs) for x in opt.img_size] # verify img_size are gs-multiples opt.img_size = [check_img_size(x, gs) for x in opt.img_size] # verify img_size are gs-multiples
assert not (opt.device.lower() == 'cpu' and opt.half), '--half only compatible with GPU export, i.e. use --device 0'
# Input
img = torch.zeros(opt.batch_size, 3, *opt.img_size).to(device) # image size(1,3,320,192) iDetection img = torch.zeros(opt.batch_size, 3, *opt.img_size).to(device) # image size(1,3,320,192) iDetection
# Update model # Update model
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论