From 7215a0fb41a90d8a0bf259fa708dff608a1f0262 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 25 Jul 2022 13:57:05 +0200 Subject: [PATCH] Avoid cv2 window init code on Windows (#8712) Resolves https://github.com/ultralytics/yolov5/issues/8642 --- detect.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/detect.py b/detect.py index bb09ce171a96..01ad797ae6f1 100644 --- a/detect.py +++ b/detect.py @@ -26,6 +26,7 @@ import argparse import os +import platform import sys from pathlib import Path @@ -173,7 +174,7 @@ def run( # Stream results im0 = annotator.result() if view_img: - if p not in windows: + if platform.system() == 'Linux' and 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])