Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Glenn Jocher 2019-08-31 21:19:02 +02:00
parent 516ca6c4fa
commit 7ea0178a6c
1 changed files with 8 additions and 0 deletions

View File

@ -54,6 +54,14 @@ def detect(save_txt=False, save_img=True, stream_img=False):
else: else:
dataloader = LoadImages(opt.source, img_size=img_size, half=opt.half) dataloader = LoadImages(opt.source, img_size=img_size, half=opt.half)
# Attempt stream_img:
if stream_img:
try:
cv2.imshow('', np.zeros((480, 640, 3)))
cv2.destroyAllWindows()
except:
stream_img = False # Possible SSH connection, do not stream
# Get classes and colors # Get classes and colors
classes = load_classes(parse_data_cfg(opt.data)['names']) classes = load_classes(parse_data_cfg(opt.data)['names'])
colors = [[random.randint(0, 255) for _ in range(3)] for _ in range(len(classes))] colors = [[random.randint(0, 255) for _ in range(3)] for _ in range(len(classes))]