diff --git a/detect.py b/detect.py index 25c71600..97eccd48 100644 --- a/detect.py +++ b/detect.py @@ -75,6 +75,7 @@ def detect(save_img=False): # Run inference t0 = time.time() + _ = model(torch.zeros((1, 3, img_size, img_size), device=device)) if device.type != 'cpu' else None # run once for path, img, im0s, vid_cap in dataset: img = torch.from_numpy(img).to(device) img = img.half() if half else img.float() # uint8 to fp16/32 diff --git a/test.py b/test.py index 9e03c051..164a580d 100644 --- a/test.py +++ b/test.py @@ -70,6 +70,7 @@ def test(cfg, seen = 0 model.eval() + _ = model(torch.zeros((1, 3, img_size, img_size), device=device)) if device.type != 'cpu' else None # run once coco91class = coco80_to_coco91_class() s = ('%20s' + '%10s' * 6) % ('Class', 'Images', 'Targets', 'P', 'R', 'mAP@0.5', 'F1') p, r, f1, mp, mr, map, mf1, t0, t1 = 0., 0., 0., 0., 0., 0., 0., 0., 0.