From e82f2015782127d07be335eaac285f8ea52a510d Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 1 Aug 2019 18:20:47 +0200 Subject: [PATCH] updates --- README.md | 2 +- detect.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 16c63888..f57cfcf8 100755 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ V100 x2 | 64 (64x1) | 0.30 s | 18 min | $0.46 ## Webcam -`detect.py` with `webcam=True` shows a live webcam feed. +`python3 detect.py --webcam` shows a live webcam feed. # Pretrained Weights diff --git a/detect.py b/detect.py index b58eb353..8ba06756 100644 --- a/detect.py +++ b/detect.py @@ -17,8 +17,7 @@ def detect(cfg, conf_thres=0.5, nms_thres=0.5, save_txt=False, - save_images=True, - webcam=False): + save_images=True): # Initialize device = torch_utils.select_device() torch.backends.cudnn.benchmark = False # set False for reproducible results @@ -58,7 +57,7 @@ def detect(cfg, # Set Dataloader vid_path, vid_writer = None, None - if webcam: + if opt.webcam: save_images = False dataloader = LoadWebcam(img_size=img_size, half=opt.half) else: @@ -101,7 +100,7 @@ def detect(cfg, print('Done. (%.3fs)' % (time.time() - t)) - if webcam: # Show live webcam + if opt.webcam: # Show live webcam cv2.imshow(weights, im0) if save_images: # Save image with detections @@ -139,6 +138,7 @@ if __name__ == '__main__': parser.add_argument('--fourcc', type=str, default='mp4v', help='fourcc output video codec (verify ffmpeg support)') parser.add_argument('--output', type=str, default='output', help='specifies the output path for images and videos') parser.add_argument('--half', action='store_true', help='half precision FP16 inference') + parser.add_argument('--webcam', action='store_true', help='use webcam') opt = parser.parse_args() print(opt)