mirror of
https://github.com/ultralytics/yolov5.git
synced 2025-06-03 14:49:29 +08:00
Rearrange export input after checks (#1118)
img size checks are warnings rather than errors, so current implementation allows improperly formed model inputs.
This commit is contained in:
parent
d87cf7ecb9
commit
d45e349a1e
@ -29,9 +29,6 @@ if __name__ == '__main__':
|
|||||||
set_logging()
|
set_logging()
|
||||||
t = time.time()
|
t = time.time()
|
||||||
|
|
||||||
# Input
|
|
||||||
img = torch.zeros((opt.batch_size, 3, *opt.img_size)) # image size(1,3,320,192) iDetection
|
|
||||||
|
|
||||||
# Load PyTorch model
|
# Load PyTorch model
|
||||||
model = attempt_load(opt.weights, map_location=torch.device('cpu')) # load FP32 model
|
model = attempt_load(opt.weights, map_location=torch.device('cpu')) # load FP32 model
|
||||||
labels = model.names
|
labels = model.names
|
||||||
@ -40,6 +37,9 @@ if __name__ == '__main__':
|
|||||||
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
|
||||||
|
|
||||||
|
# Input
|
||||||
|
img = torch.zeros(opt.batch_size, 3, *opt.img_size) # image size(1,3,320,192) iDetection
|
||||||
|
|
||||||
# Update model
|
# Update model
|
||||||
for k, m in model.named_modules():
|
for k, m in model.named_modules():
|
||||||
m._non_persistent_buffers_set = set() # pytorch 1.6.0 compatibility
|
m._non_persistent_buffers_set = set() # pytorch 1.6.0 compatibility
|
||||||
|
Loading…
x
Reference in New Issue
Block a user