From 8d1ddc93c717c0708f9478636b7647a774e07521 Mon Sep 17 00:00:00 2001 From: Yonghye Kwon Date: Tue, 8 Jun 2021 01:56:41 +0900 Subject: [PATCH] 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 --- models/export.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/models/export.py b/models/export.py index 6e3e1207f659..c03770178829 100644 --- a/models/export.py +++ b/models/export.py @@ -44,15 +44,13 @@ # Load PyTorch model 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 labels = model.names - # Checks + # Input 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 - 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 # Update model