glenn-jocher commited on
Commit
d45e349
1 Parent(s): d87cf7e

Rearrange export input after checks (#1118)

Browse files

img size checks are warnings rather than errors, so current implementation allows improperly formed model inputs.

Files changed (1) hide show
  1. models/export.py +3 -3
models/export.py CHANGED
@@ -29,9 +29,6 @@ if __name__ == '__main__':
29
  set_logging()
30
  t = time.time()
31
 
32
- # Input
33
- img = torch.zeros((opt.batch_size, 3, *opt.img_size)) # image size(1,3,320,192) iDetection
34
-
35
  # Load PyTorch model
36
  model = attempt_load(opt.weights, map_location=torch.device('cpu')) # load FP32 model
37
  labels = model.names
@@ -40,6 +37,9 @@ if __name__ == '__main__':
40
  gs = int(max(model.stride)) # grid size (max stride)
41
  opt.img_size = [check_img_size(x, gs) for x in opt.img_size] # verify img_size are gs-multiples
42
 
 
 
 
43
  # Update model
44
  for k, m in model.named_modules():
45
  m._non_persistent_buffers_set = set() # pytorch 1.6.0 compatibility
 
29
  set_logging()
30
  t = time.time()
31
 
 
 
 
32
  # Load PyTorch model
33
  model = attempt_load(opt.weights, map_location=torch.device('cpu')) # load FP32 model
34
  labels = model.names
 
37
  gs = int(max(model.stride)) # grid size (max stride)
38
  opt.img_size = [check_img_size(x, gs) for x in opt.img_size] # verify img_size are gs-multiples
39
 
40
+ # Input
41
+ img = torch.zeros(opt.batch_size, 3, *opt.img_size) # image size(1,3,320,192) iDetection
42
+
43
  # Update model
44
  for k, m in model.named_modules():
45
  m._non_persistent_buffers_set = set() # pytorch 1.6.0 compatibility