Allow detect.py to use video size for initial window size (#8330)
* fixed initial window size of detect.py being tiny * cleanup Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
5c990e3674
commit
0537e8dd13
|
|
@ -106,7 +106,7 @@ def run(
|
||||||
|
|
||||||
# Run inference
|
# Run inference
|
||||||
model.warmup(imgsz=(1 if pt else bs, 3, *imgsz)) # warmup
|
model.warmup(imgsz=(1 if pt else bs, 3, *imgsz)) # warmup
|
||||||
dt, seen = [0.0, 0.0, 0.0], 0
|
seen, windows, dt = 0, [], [0.0, 0.0, 0.0]
|
||||||
for path, im, im0s, vid_cap, s in dataset:
|
for path, im, im0s, vid_cap, s in dataset:
|
||||||
t1 = time_sync()
|
t1 = time_sync()
|
||||||
im = torch.from_numpy(im).to(device)
|
im = torch.from_numpy(im).to(device)
|
||||||
|
|
@ -173,7 +173,10 @@ def run(
|
||||||
# Stream results
|
# Stream results
|
||||||
im0 = annotator.result()
|
im0 = annotator.result()
|
||||||
if view_img:
|
if view_img:
|
||||||
cv2.namedWindow(str(p), cv2.WINDOW_NORMAL | cv2.WINDOW_KEEPRATIO) # allow window resize (Linux)
|
if p not in windows:
|
||||||
|
windows.append(p)
|
||||||
|
cv2.namedWindow(str(p), cv2.WINDOW_NORMAL | cv2.WINDOW_KEEPRATIO) # allow window resize (Linux)
|
||||||
|
cv2.resizeWindow(str(p), im0.shape[1], im0.shape[0])
|
||||||
cv2.imshow(str(p), im0)
|
cv2.imshow(str(p), im0)
|
||||||
cv2.waitKey(1) # 1 millisecond
|
cv2.waitKey(1) # 1 millisecond
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue