Description
问题确认 Search before asking
Bug组件 Bug Component
No response
Bug描述 Describe the Bug
pipeline.py在解析camera_id和rtsp参数,并运行显示时有部分问题
使用的命令如下
python deploy/pipeline/pipeline.py --config deploy/pipeline/config/examples/infer_cfg_human_attr.yml --camera_id=0 --device=gpu
python deploy/pipeline/pipeline.py --config deploy/pipeline/config/examples/infer_cfg_human_attr.yml --rtsp=rtsp://admin:[email protected]:8554/live --device=gpu
问题一:逻辑错误cv2.imshow
不会正常显示界面
-
在pipeline在
_parse_input
函数中解析出self.input=0
或self.input="rtsp://admin:[email protected]:8554/live"
; -
之后设置 predictor.filename,在
set_file_name
函数中,使predictor.filename=0
(if type(path) == int)或predictor.filename=live
(elif path is not None 经过os.path分割),并不会在 else 判断里# use camera id
-
而在cv2.imshow的两处代码之前有个判断为
if self.file_name is None: # use camera_id
这个判断会导致
cv2.imshow
不会正常运行显示
问题二:video_out_name
和out_path
命名规则在多个rtsp流数据时可能会出现相同命名
当我以下rstsp流时
- rtsp://admin:[email protected]:8553/live
- rtsp://admin:[email protected]:8554/live
- rtsp://admin:[email protected]:8555/live
在predictor_item.set_file_name
时会使用self.file_name = os.path.split(path)[-1]
,都会使self.file_name=live
,这会导致在命名规则里使用相同self.file_name
得到相同的video_out_name
,使输出文件路径重复。
问题三:rtsp流获取fps
属性,可能不准确
当我使用 IP摄像头app 传输rtsp流数据发现,我设置的帧率为30 FPS Max
,通过fps = int(capture.get(cv2.CAP_PROP_FPS))
获取到的fps为180000,导致cv2.VideoWriter
初始化失败,报错。我查资料发现似乎OpenCV与IP摄像头的RTSP流有可能存在问题,出现未正确传递FPS信息。
在我手动设置fps值后能正常使用
[mpeg4 @ 000001ba830e2180] timebase 1/180000 not supported by MPEG 4 standard, the maximum admitted value for the timebase denominator is 65535
[ERROR:[email protected]] global /build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp (2822) open Could not open codec mpeg4, error: Unspecified error
[ERROR:[email protected]] global /build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp (2839) open VIDEOIO/FFMPEG: Failed to initialize VideoWriter
问题四:视频图像队列读取逻辑问题
这个问题在 #7827 就出现过,但是issues里还是很多人出现了。当我使用摄像头长时间未检测到物体时,可能会出现消耗帧的速度比读取摄像头帧的速度快,帧队列被读空,使主线程的循环判断while (not framequeue.empty())提前终止,而capturevideo
子线程并未被设置为守护线程,导致主线程结束,而子线程继续持续运行,使进程卡死。
复现环境 Environment
- OS: Windows
- PaddlePaddle: 2.6.2
- PaddleDetection: release/2.8.1
- Python: 3.10
Bug描述确认 Bug description confirmation
- 我确认已经提供了Bug复现步骤、代码改动说明、以及环境信息,确认问题是可以复现的。I confirm that the bug replication steps, code change instructions, and environment information have been provided, and the problem can be reproduced.
是否愿意提交PR? Are you willing to submit a PR?
- 我愿意提交PR!I'd like to help by submitting a PR!