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

使用网络摄像头的rtsp获取视频流进行人员行为识别推理,推了50帧后自动结束了 #9243

Open
1 task done
cskkx1 opened this issue Dec 13, 2024 · 1 comment
Assignees

Comments

@cskkx1
Copy link

cskkx1 commented Dec 13, 2024

问题确认 Search before asking

  • 我已经搜索过问题,但是没有找到解答。I have searched the question and found no related answer.

请提出你的问题 Please ask your question

我使用网络摄像头的rtsp获取视频流用cpu进行推理,推理的命令为python deploy/pipeline/pipeline.py --config deploy/pipeline/config/infer_cfg_pphuman.yml --rtsp rtsp://admin:[email protected] --device=cpu
这里的rstp是我自己的网络摄像头的信息,在用人员行为识别检测的时候,跑了50帧左右就自动结束了,之后我加了一些日志代码
def capturevideo(self, capture, queue):
frame_id = 0
logging.info("开始捕获视频流")
while (1):
if queue.full():
time.sleep(0.1)
else:
ret, frame = capture.read()
if not ret:
err_code = capture.get(cv2.CAP_PROP_POS_MSEC)
logging.error(f"无法从视频流中读取帧,错误代码:{err_code}")
# 检查是否到达视频流的末尾
if err_code == 0:
logging.error("可能已到达视频流的末尾")
else:
logging.error("视频流读取错误,可能是网络问题或视频源问题")
break # 或者根据需要处理错误
frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
queue.put(frame_rgb)
logging.debug(f"成功读取帧 {frame_id}")
frame_id += 1
发现最后会报"可能已到达视频流的末尾"这行字,然后视频会正常保存,所以这是程序的问题还是摄像头的问题呢?

@cskkx1 cskkx1 changed the title 使用网络摄像头的rstp获取视频流进行人员行为识别推理,推了50帧后自动结束了 使用网络摄像头的rtsp获取视频流进行人员行为识别推理,推了50帧后自动结束了 Dec 16, 2024
@leo-q8
Copy link
Collaborator

leo-q8 commented Dec 20, 2024

cpu推理比较慢,会导致丢帧或者爆显存的问题,建议确认一下cpu上每帧推理的时间,根据这个时间进行抽帧预测

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants