Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yolox webcam rtsp and other formats #1402

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
```



</details>
Expand Down Expand Up @@ -233,4 +238,4 @@ It is hoped that every AI practitioner in the world will stick to the concept of
<div align="center"><img src="assets/sunjian.png" width="200"></div>
没有孙剑博士的指导,YOLOX也不会问世并开源给社区使用。
孙剑博士的离去是CV领域的一大损失,我们在此特别添加了这个部分来表达对我们的“船长”孙老师的纪念和哀思。
希望世界上的每个AI从业者秉持着“持续创新拓展认知边界,非凡科技成就产品价值”的观念,一路向前。
希望世界上的每个AI从业者秉持着“持续创新拓展认知边界,非凡科技成就产品价值”的观念,一路向前。
10 changes: 8 additions & 2 deletions tools/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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))
Expand Down