文档疑问如下:
1.步骤2 本项目需要使用 mxpi_opencvosd 插件,使用前需要生成所需的模型文件。执行MindX SDK开发套件包安装目录下 operators/opencvosd/generate_osd_om.sh 脚本生成所需模型文件。 生成后的模型文件是要如何操作?
2.步骤3 按照第3节模型转换中的步骤获得om模型文件,放在models/目录下。注意检查om模型文件名是否和pipeline/rtmOpenpose.pipeline中的mxpi_tensorinfer0 插件 modelPath 属性值相同,若不同需改为一致。
"mxpi_tensorinfer0":{
"next":"mxpi_rtmopenposepostprocess0",
"factory":"mxpi_tensorinfer",
"props":{
"dataSource": "mxpi_imageresize0",
"modelPath":"./models/openpose_pytorch_512.om" //检查om模型文件名是否正确
}
},
这里说的om模型文件指的是 operators/opencvosd/generate_osd_om.sh 脚本生成所需模型文件还是指 第3节模型转换中的步骤获得openpose_pytorch_512.om模型文件
3.按照3.3小结第三方软件依赖安装live555和ffmpeg,按照 Live555离线视频转RTSP说明文档将mp4视频转换为h264格式,并配置rtsp流地址,然后修改RTMHumanKeypointsDetection/pipeline目录下的rtmOpenpose.pipeline文件中mxpi_rtspsrc0的内容。
"mxpi_rtspsrc0": {
"factory": "mxpi_rtspsrc",
"props": {
"rtspUrl":"rtsp://xxx.xxx.xxx.xxx:xxxx/xxx.264", // 修改为自己所使用的的服务器和文件名
"channelId": "0"
},
"next": "mxpi_videodecoder0"
},
这一步中我将ffmpeg安装在windows端生成h264文件,再将它传输到程序运行的系统,是否有误。请问怎么配置rtsp流地址,是像rtsp文档所说创建一个文件么。 "rtspUrl":"rtsp://xxx.xxx.xxx.xxx:xxxx/xxx.264", // 修改为自己所使用的的服务器和文件名 这个我服务器就是程序运行的系统,请问我是要在服务器里开启什么东西才能连上rtsp流,还是只要像文档里说的去
"rtspUrl":"rtsp://xxx.xxx.xxx.xxx:xxxx/xxx.264", // 修改为自己所使用的的服务器和文件名这样就好了
按照文档步骤执行到运行出现问题
bash run.sh
-- env MX_SDK_HOME: /usr/local/Ascend/mxVision-5.0.RC3
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mindxsdk-referenceapps-master/contrib/RTMHumanKeypointsDetection/build
make: Entering directory '/home/mindxsdk-referenceapps-master/contrib/RTMHumanKeypointsDetection/build'
make[1]: Entering directory '/home/mindxsdk-referenceapps-master/contrib/RTMHumanKeypointsDetection/build'
make[2]: Entering directory '/home/mindxsdk-referenceapps-master/contrib/RTMHumanKeypointsDetection/build'
Consolidate compiler generated dependencies of target main
make[2]: Leaving directory '/home/mindxsdk-referenceapps-master/contrib/RTMHumanKeypointsDetection/build'
[100%] Built target main
make[1]: Leaving directory '/home/mindxsdk-referenceapps-master/contrib/RTMHumanKeypointsDetection/build'
make: Leaving directory '/home/mindxsdk-referenceapps-master/contrib/RTMHumanKeypointsDetection/build'
Begin to initialize Log.
The output directory of logs file exist.
WARNING: Logging before InitGoogleLogging() is written to STDERR
I20240310 20:04:46.398773 85730 FileUtils.cpp:331] The input file is empty
I20240310 20:04:46.398866 85730 FileUtils.cpp:475] Check Other group permission: Current permission is 4, but required no greater than 0.
Save logs information to specified directory.
E20240310 20:04:47.628330 85730 ModelInferenceProcessorDptr.hpp:174] Failed to load offline model data from file. (Calling Function = aclmdlLoadFromFile, Code = 545002, Message = "ACL error, please refer to the document of CANN.")
E20240310 20:04:47.629129 85730 ModelInferenceProcessor.cpp:42] Failed to init model, the model path is invalidate. (Code = -1, Message = "ACL: general failure")
E20240310 20:04:47.629210 85730 MxpiTensorInfer.cpp:163] Failed to init model inference. (Code = -1, Message = "ACL: general failure")
E20240310 20:04:47.629266 85730 MxpiTensorInfer.cpp:96] Init configs failed. (Code = -1, Message = "ACL: general failure")
E20240310 20:04:47.629323 85730 MxGstBase.cpp:631] Plugin initialize failed. (Code = -1, Message = "ACL: general failure")
E20240310 20:04:47.643533 85730 MxsmStream.cpp:884] Failed to set the state of the Stream, named: Video+Openpose. (Code = 6003, Message = "stream change state fail")
E20240310 20:04:47.643651 85730 MxsmStream.cpp:914] Creates Video+Openpose Stream failed. (Code = 6003, Message = "stream change state fail")
E20240310 20:04:47.643714 85730 MxStreamManagerDptr.cpp:548] Create stream(Video+Openpose) failed. (Code = 6003, Message = "stream change state fail")
E20240310 20:04:47.650529 85730 main.cpp:64] Failed to create Stream, ret = 6003.
推流可以尝试用live555等工具,rtsp是类似直播的流地址。
也可以使用部分直播工具
好像我连接离线模型出现了问题,我是自己的虚拟机上完成这一步
本项目主要用到了用于人体关键点检测的OpenPose模型,OpenPose模型相关文件可以点击此处下载。本项目在MindX SDK中需要使用om模型,我们需要对模型进行转换。首先需要将pytorch模型转换为onnx模型,然后使用ATC模型转换工具将onnx模型转换为om模型。
本项目提供了输入尺寸为(512,512)的onnx模型,点击此处下载,如不需要修改模型输入尺寸,可直接执行步骤二。
步骤一 pth模型转onnx模型
获取“lightweight-human-pose-estimation.pytorch”代码包文件 方法一:通过git方式获取 在服务器上,进入指定目录,执行以下命令:
git clone https://github.com/Daniil-Osokin/lightweight-human-pose-estimation.pytorch.git
将在当前目录下生成“lightweight-human-pose-estimation.pytorch”目录及目录中的相关文件;
方法二:通过网页获取 点击访问pytorch 参考项目,通过下载zip文件方式下载“lightweight-human-pose-estimation.pytorch”代码压缩包,上传至服务器指定位置后解压得到“lightweight-human-pose-estimation.pytorch-master”目录及目录中的相关文件; 注:模型转换后续步骤采用“通过网页获取”得到的文件目录进行说明。
安装相关依赖 进入“lightweight-human-pose-estimation.pytorch-master”目录,执行以下命令安装相关依赖:
pip install -r requirements.txt
代码预处理 进入“lightweight-human-pose-estimation.pytorch-master/scripts/”目录下,对“convert_to_onnx.py”文件做以下修改:
def convert_to_onnx(net, output_name):
input = torch.randn(1, 3, 512, 512) # 模型输入宽高,可自定义,此处修改为"512,512"
input_names = ['data']
output_names = ['stage_0_output_1_heatmaps', 'stage_0_output_0_pafs',
'stage_1_output_1_heatmaps', 'stage_1_output_0_pafs']
torch.onnx.export(net, input, output_name, verbose=True, opset_version=11, input_names=input_names, output_names=output_names) # 使用pytorch将pth导出为onnx,此处增加ATC转换工具支持的ONNX算子库版本(如opset_version=11)
onnx模型转换
通过pth模型链接下载获取“checkpoint_iter_370000.pth”模型文件并拷贝至“lightweight-human-pose-estimation.pytorch-master”目录下,并在拷贝目标目录下执行以下命令将pth模型转换成onnx模型:
python scripts/convert_to_onnx.py --checkpoint-path=checkpoint_iter_370000.pth
注: 1)"--checkpoint-path"为下载的pth模型文件所在目录;若想指定输出的 onnx 模型文件名称,可增加"--output-name"参数,若不指定,则默认输出"human-pose-estimation.onnx"; 2)若服务器不存在"GPU"卡,可参考“6 常见问题”中的相关解决方法。
然后我把生成的onnx文件传到开发者套件atlas200idka2上进行onnx转om这样会出现问题吗
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
登录 后才可以发表评论