Refactor new model.warmup() method (#5810)

* Refactor new `model.warmup()` method

* Add half
This commit is contained in:
Glenn Jocher authored and GitHub committed 2021-11-27 12:29:45 +01:00
1 parent 7c6bae0ae6
commit fcd180d336
3 files changed
+9 -4

No files matched your search

+1 -2
View File
@@ -97,8 +97,7 @@ def run(weights=ROOT / 'yolov5s.pt', # model.pt path(s)
vid_path, vid_writer = [None] * bs, [None] * bs
# Run inference
if pt and device.type != 'cpu':
model(torch.zeros(1, 3, *imgsz).to(device).type_as(next(model.model.parameters()))) # warmup
model.warmup(imgsz=(1, 3, *imgsz), half=half) # warmup
dt, seen = [0.0, 0.0, 0.0], 0
for path, im, im0s, vid_cap, s in dataset:
t1 = time_sync()