developer0hye commited on
Commit
8d1ddc9
·
unverified ·
1 Parent(s): 90b7895

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

Browse files

* early assert for cpu and half option

early assert for cpu and half option

* Modified comment

Modified comment

Files changed (1) hide show
  1. models/export.py +2 -4
models/export.py CHANGED
@@ -44,15 +44,13 @@ if __name__ == '__main__':
44
 
45
  # Load PyTorch model
46
  device = select_device(opt.device)
 
47
  model = attempt_load(opt.weights, map_location=device) # load FP32 model
48
  labels = model.names
49
 
50
- # Checks
51
  gs = int(max(model.stride)) # grid size (max stride)
52
  opt.img_size = [check_img_size(x, gs) for x in opt.img_size] # verify img_size are gs-multiples
53
- assert not (opt.device.lower() == 'cpu' and opt.half), '--half only compatible with GPU export, i.e. use --device 0'
54
-
55
- # Input
56
  img = torch.zeros(opt.batch_size, 3, *opt.img_size).to(device) # image size(1,3,320,192) iDetection
57
 
58
  # Update model
 
44
 
45
  # Load PyTorch model
46
  device = select_device(opt.device)
47
+ assert not (opt.device.lower() == 'cpu' and opt.half), '--half only compatible with GPU export, i.e. use --device 0'
48
  model = attempt_load(opt.weights, map_location=device) # load FP32 model
49
  labels = model.names
50
 
51
+ # Input
52
  gs = int(max(model.stride)) # grid size (max stride)
53
  opt.img_size = [check_img_size(x, gs) for x in opt.img_size] # verify img_size are gs-multiples
 
 
 
54
  img = torch.zeros(opt.batch_size, 3, *opt.img_size).to(device) # image size(1,3,320,192) iDetection
55
 
56
  # Update model