This commit is contained in:
Glenn Jocher 2019-09-19 19:09:59 +02:00
parent fdfc4a5e63
commit 0e52b8f361
2 changed files with 4 additions and 2 deletions

View File

@ -47,7 +47,7 @@ def detect(save_txt=False, save_img=False):
# Set Dataloader
vid_path, vid_writer = None, None
if webcam:
view_img = True
# view_img = True
torch.backends.cudnn.benchmark = True # set True to speed up constant image size inference
dataset = LoadStreams(source, img_size=img_size, half=half)
else:
@ -131,7 +131,7 @@ if __name__ == '__main__':
parser.add_argument('--cfg', type=str, default='cfg/yolov3-spp.cfg', help='cfg file path')
parser.add_argument('--data', type=str, default='data/coco.data', help='coco.data file path')
parser.add_argument('--weights', type=str, default='weights/yolov3-spp.weights', help='path to weights file')
parser.add_argument('--source', type=str, default='data/samples', help='source') # input file/folder, 0 for webcam
parser.add_argument('--source', type=str, default='rtsp://170.93.143.139/rtplive/470011e600ef003a004ee33696235daa', help='source') # input file/folder, 0 for webcam
parser.add_argument('--output', type=str, default='output', help='output folder') # output folder
parser.add_argument('--img-size', type=int, default=416, help='inference size (pixels)')
parser.add_argument('--conf-thres', type=float, default=0.3, help='object confidence threshold')

View File

@ -193,6 +193,8 @@ class LoadStreams: # multiple IP or RTSP cameras
if os.path.isfile(sources):
with open(sources, 'r') as f:
sources = [x.strip() for x in f.read().splitlines() if len(x.strip())]
else:
sources = [sources]
n = len(sources)
self.imgs = [None] * n