Skip to content

Commit

Permalink
Earlier assert for cpu and half option (#3508)
Browse files Browse the repository at this point in the history
* early assert for cpu and half option

early assert for cpu and half option

* Modified comment

Modified comment
  • Loading branch information
developer0hye committed Jun 7, 2021
1 parent 90b7895 commit 8d1ddc9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions models/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8d1ddc9

Please sign in to comment.