ST-GCN网络:https://github.com/yysijie/st-gcn
在安装完环境和依赖,准备运行demo程序时,报错:
VideoCapture (IP camera/video) could not be opened for path: 'examples/media/video.avi'.
由于ST-GCN在运行时,先要调用运行OpenPose,所以这个问题其实是OpenPose报错的。这里也有人提出了类似的问题https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/41
本质上是因为OpenPose在调用OpenCV时,OpenCV打开视频失败,cvCreateFileCapture和VideoCapture无法读入视频。这是系统里的OpenCV在编译安装时没有联合编译ffmpeg库导致的。
只能重新编译安装OpenCV库,别无他法。首先,完整安装ffmpeg库,参考(https://blog.csdn.net/Jacky_Ponder/article/details/53490992)。我安装的版本是ffmpeg官网上下载的ffmpeg_3.4.2.orig.tar.xz,系统是Ubuntu18.04 LTS 64位
但是,我发现在我重新安装OpenCV(版本3.4.5)时,cmake后打印出的log里面,ffmpeg处是NO,而不是想要的YES!
解决办法是把FFMPEG库对应的pgkconfig文件夹下的.pc文件放到pkg-config的查找路径下。
比如,对于我的系统来说,就是把/usr/local/ffmpeg/lib/pkgconfig下的.pc文件复制到/usr/lib/x86_64-linux-gnu/pkgconfig
在安装ST-GCN网络成功后,准备运行如下demo时报错:
root@a421-HP-Z840-Workstation:~/YuWentao/huawei_fatigue_driving_detection/st-gcn# python main.py demo --openpose /home/a421/YuWentao/huawei_fatigue_driving_detection/openpose/build/ --video ./video.avi --device 0 1
Starting OpenPose demo...
Configuring OpenPose...
Starting thread(s)...
Auto-detecting all available GPUs... Detected 2 GPU(s), using 2 of them starting at GPU 0.
F0225 12:56:18.533463 34969 syncedmem.cpp:71] Check failed: error == cudaSuccess (2 vs. 0) out of memory
*** Check failure stack trace: ***
@ 0x7f49b7ed30cd google::LogMessage::Fail()
@ 0x7f49b7ed4f33 google::LogMessage::SendToLog()
@ 0x7f49b7ed2c28 google::LogMessage::Flush()
@ 0x7f49b7ed5999 google::LogMessageFatal::~LogMessageFatal()
@ 0x7f49b7a5b338 caffe::SyncedMemory::mutable_gpu_data()
@ 0x7f49b7a10b02 caffe::Blob<>::mutable_gpu_data()
@ 0x7f49b7988b48 caffe::BaseConvolutionLayer<>::forward_gpu_gemm()
@ 0x7f49b7aade26 caffe::ConvolutionLayer<>::Forward_gpu()
@ 0x7f49b7a43f51 caffe::Net<>::ForwardFromTo()
@ 0x7f49b9d37736 op::NetCaffe::forwardPass()
@ 0x7f49b9d572ba op::PoseExtractorCaffe::forwardPass()
@ 0x7f49b9d513c5 op::PoseExtractor::forwardPass()
@ 0x7f49b9d4e26b op::WPoseExtractor<>::work()
@ 0x7f49b9d89da9 op::Worker<>::checkAndWork()
@ 0x7f49b9d89f4b op::SubThread<>::workTWorkers()
@ 0x7f49b9d929eb op::SubThreadQueueInOut<>::work()
@ 0x7f49b9d8ce0b op::Thread<>::threadFunction()
@ 0x7f49b90628f0 (unknown)
@ 0x7f49b87846db start_thread
@ 0x7f49b8abd88f clone
Aborted (core dumped)
Can not find pose estimation results.
GPU显存不够。本系统配有2个GTX1080显卡,显存8G,但还是不够。应该是输入的视频文件过大。虽然我输入的是OpenPose官方提供的示例视频video.avi(时长5s,1.4MB),但还是过大。
我输入一个更小的视频(mp4文件, 时长3s,497KB),可以成功运行