Ubuntu下NNStreamer无法链接tensortransform与tensorfilter问题求助
问题
在Ubuntu系统中运行修改后的NNStreamer姿态估计GStreamer管道时遇到两个核心问题:
- 管道链接失败,提示
could not link tensortransform0 to tensorfilter0,同时无法识别libnnstreamer_filter_tensorflow1-lite.so框架 nnstreamer-check输出显示子插件损坏、无任何Filter/Decoder/Converter注册,关键错误信息包括:nnstreamer_subplugin of cpp(/usr/lib/nnstreamer/filters/libnnstreamer_filter_cpp.so) is brokenCannot open tensor_region(...) undefined symbol: gst_tensor_meta_info_append_header- 注册子插件列表为空
使用的管道命令:
gst-launch-1.0 filesrc location=test_mp4/department_store_shopping.mp4 ! decodebin ! videoconvert ! videoscale ! video/x-raw,width=640,height=480,format=RGB ! tee name=t_raw t_raw. ! queue leaky=2 max-size-buffers=2 ! videoscale ! video/x-raw,width=257,height=257,foramt=RGB ! tensor_converter ! tensor_transform mode=arithmetic option=typecast:float32,add:-127.5,div:127.5 ! tensor_filter framework=libnnstreamer_filter_tensorflow1-lite model=tflite_model/posenet_mobilenet_v1_100_257x257 ! tensor_decoder mode=pose_estimation option1=640:480 option2=257:257 option3=tflite_model/point_labels.txt option4=heatmap-offset ! compositor name=mix sink_0::zorder=1 sink_1::zorder=0 ! videoconvert ! ximagesink t_raw. ! queue ! mix
解决方案
1. 修正管道命令中的拼写错误
管道中video/x-raw,width=257,height=257,foramt=RGB的foramt是拼写错误,改为format,否则会导致Caps不匹配,引发链接失败。同时修正tensor_filter的framework参数:
gst-launch-1.0 filesrc location=test_mp4/department_store_shopping.mp4 ! decodebin ! videoconvert ! videoscale ! video/x-raw,width=640,height=480,format=RGB ! tee name=t_raw t_raw. ! queue leaky=2 max-size-buffers=2 ! videoscale ! video/x-raw,width=257,height=257,format=RGB ! tensor_converter ! tensor_transform mode=arithmetic option=typecast:float32,add:-127.5,div:127.5 ! tensor_filter framework=tensorflow-lite model=tflite_model/posenet_mobilenet_v1_100_257x257 ! tensor_decoder mode=pose_estimation option1=640:480 option2=257:257 option3=tflite_model/point_labels.txt option4=heatmap-offset ! compositor name=mix sink_0::zorder=1 sink_1::zorder=0 ! videoconvert ! ximagesink t_raw. ! queue ! mix
2. 修复NNStreamer子插件注册问题
(1)修正子插件路径
从nnstreamer-check输出看,主库libnnstreamer.so位于/usr/local/lib/x86_64-linux-gnu/gstreamer-1.0,但子插件路径配置为/usr/lib/nnstreamer/filters/,可能路径不匹配。设置环境变量指定正确的子插件路径:
# 替换为实际的子插件安装路径,比如/usr/local/lib/nnstreamer export NNSTREAMER_FILTERS=/usr/local/lib/nnstreamer/filters export NNSTREAMER_DECODERS=/usr/local/lib/nnstreamer/decoders export NNSTREAMER_CONVERTERS=/usr/local/lib/nnstreamer/converters
设置后重新运行nnstreamer-check,确认子插件是否正常注册。
(2)重新安装NNStreamer及子插件
当前子插件损坏、缺失,建议重新安装NNStreamer及其TensorFlow Lite插件:
- 若使用包管理器:安装
nnstreamer和nnstreamer-tensorflow-lite包 - 若从源码编译:确保编译时启用TensorFlow Lite支持,编译完成后执行
make install,确保所有子插件被正确安装到对应路径
3. 修正tensor_filter的framework参数
tensor_filter的framework参数应使用插件标识名tensorflow-lite,而非完整的库文件名libnnstreamer_filter_tensorflow1-lite.so,这是导致框架无法识别的直接原因。
内容的提问来源于stack exchange,提问作者JGRyu
相关产品推荐
相关产品推荐

