This commit is contained in:
Glenn Jocher 2019-09-10 21:25:01 +02:00
parent 2a75034322
commit a31b1489a4
2 changed files with 3 additions and 2 deletions

View File

@ -48,6 +48,7 @@ def detect(save_txt=False, save_img=False, stream_img=False):
# Set Dataloader # Set Dataloader
vid_path, vid_writer = None, None vid_path, vid_writer = None, None
if streams: if streams:
stream_img = True
torch.backends.cudnn.benchmark = True # set True to speed up constant image size inference torch.backends.cudnn.benchmark = True # set True to speed up constant image size inference
dataset = LoadStreams(source, img_size=img_size, half=half) dataset = LoadStreams(source, img_size=img_size, half=half)
elif webcam: elif webcam:

View File

@ -35,7 +35,7 @@ def exif_size(img):
elif rotation == 8: # rotation 90 elif rotation == 8: # rotation 90
s = (s[1], s[0]) s = (s[1], s[0])
except: except:
None pass
return s return s
@ -190,7 +190,7 @@ class LoadStreams: # multiple IP or RTSP cameras
self.img_size = img_size self.img_size = img_size
self.half = half # half precision fp16 images self.half = half # half precision fp16 images
with open(path, 'r') as f: with open(path, 'r') as f:
sources = f.read().splitlines() sources = [x.strip() for x in f.read().splitlines() if len(x.strip())]
n = len(sources) n = len(sources)
self.imgs = [None] * n self.imgs = [None] * n