diff --git a/README.md b/README.md index 6adef0dcd..867d2ea22 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,11 @@ Demo for video: ```shell python tools/demo.py video -n yolox-s -c /path/to/your/yolox_s.pth --path /path/to/your/video --conf 0.25 --nms 0.45 --tsize 640 --save_result --device [cpu/gpu] ``` +Demo for webcam: +```shell +python tools/demo.py webcam -n yolox-s -c /path/to/your/yolox_s.pth --camid "rtsp://account:passward@your_rtsp_address" --conf 0.25 --nms 0.45 --tsize 640 --device [cpu/gpu] +``` + @@ -233,4 +238,4 @@ It is hoped that every AI practitioner in the world will stick to the concept of
没有孙剑博士的指导,YOLOX也不会问世并开源给社区使用。 孙剑博士的离去是CV领域的一大损失,我们在此特别添加了这个部分来表达对我们的“船长”孙老师的纪念和哀思。 -希望世界上的每个AI从业者秉持着“持续创新拓展认知边界,非凡科技成就产品价值”的观念,一路向前。 \ No newline at end of file +希望世界上的每个AI从业者秉持着“持续创新拓展认知边界,非凡科技成就产品价值”的观念,一路向前。 diff --git a/tools/demo.py b/tools/demo.py index b16598d5f..ce11286f6 100644 --- a/tools/demo.py +++ b/tools/demo.py @@ -30,7 +30,11 @@ def make_parser(): parser.add_argument( "--path", default="./assets/dog.jpg", help="path to images or video" ) - parser.add_argument("--camid", type=int, default=0, help="webcam demo camera id") + parser.add_argument( + "--camid", + default=0, + help="camera id for webcam or usb, support rtsp and other formats, default for USB camera" + ) parser.add_argument( "--save_result", action="store_true", @@ -218,8 +222,10 @@ def imageflow_demo(predictor, vis_folder, current_time, args): os.makedirs(save_folder, exist_ok=True) if args.demo == "video": save_path = os.path.join(save_folder, os.path.basename(args.path)) - else: + elif args.demo == "webcam": save_path = os.path.join(save_folder, "camera.mp4") + else: + logger.info("video demo type is not specified") logger.info(f"video save_path is {save_path}") vid_writer = cv2.VideoWriter( save_path, cv2.VideoWriter_fourcc(*"mp4v"), fps, (int(width), int(height))