在进行运行ST-GCN Demo时遇到问题:
demo_offline调试:
python main.py demo_offline --video E:/Ruan/torch/st-gcn-master/st-gcn-master/resource/media/clean_and_jerk.mp4 --openpose E:/Ruan/openpose-master/openpose-master/build/python/openpose/Release
报如下错误:
(pytorch) E:\Ruan\torch\st-gcn-master\st-gcn-master>python main.py demo_offline --video E:/Ruan/torch/st-gcn-master/st-gcn-master/resource/media/clean_and_jerk.mp4 --openpose E:/Ruan/openpose-master/openpose-master/build/python/openpose/Release
Can not find Openpose Python API.
Traceback (most recent call last):
File "main.py", line 33, in <module>
p.start()
File "E:\Ruan\torch\st-gcn-master\st-gcn-master\processor\demo_offline.py", line 31, in start
video, data_numpy = self.pose_estimation()
TypeError: 'NoneType' object is not iterable
按照网上教程修改demo_offline文件后,报错依旧存在
本人修改如下:
def pose_estimation(self):
# load openpose python api
if self.arg.openpose is not None:
sys.path.append('{}/build/python/openpose/Release'.format(self.arg.openpose))
os.environ['PATH'] = os.environ['PATH'] + ';' + 'E:/Ruan/openpose-master/openpose-master/build/x64/Release/;' + 'E:/Ruan/openpose-master/openpose-master/build/bin;'
# sys.path.append('{}/python'.format(self.arg.openpose))
# sys.path.append('{}/build/python'.format(self.arg.openpose))
try:
# from openpose import pyopenpose as op
import pyopenpose as op
except:
print('Can not find Openpose Python API.')
return
基于new bing的回答参考:
从错误信息来看,不能找到 Openpose Python API 。
您可以确认一下下面这些问题是否存在:
python main.py demo_offline --video E:/st-gcn/st-gcn-master/st-gcn-master/resource/media/clean_and_jerk.mp4 --openpose E:/st-gcn/openpose-master/openpose-master
报错如下:
错误1:
video, data_numpy = self.pose_estimation() TypeError: ‘NoneType’ object is not iterable
解决办法:
更改demo_offline里的文件内容如下:
将pose_estimation()函数更改如下
def pose_estimation(self):
# load openpose python api
if self.arg.openpose is not None:
sys.path.append('{}/build/python/openpose/Release'.format(self.arg.openpose))
os.environ['PATH'] = os.environ['PATH'] + ';' + 'E:/st-gcn/openpose-master/openpose-master/build/x64/Release/;' + 'E:/st-gcn/openpose-master/openpose-master/build/bin;'
# sys.path.append('{}/python'.format(self.arg.openpose))
# sys.path.append('{}/build/python'.format(self.arg.openpose))
try:
# from openpose import pyopenpose as op
import pyopenpose as op
except:
print('Can not find Openpose Python API.')
return
错误2:
opWrapper.emplaceAndPop([datum])
TypeError: emplaceAndPop(): incompatible function arguments. The following argument types are supported:
1. (self: pyopenpose.WrapperPython, arg0: std::vector<std::shared_ptrop::Datum,std::allocator<std::shared_ptrop::Datum > >) -> bool
Invoked with: <pyopenpose.WrapperPython object at 0x00000263AFEEA8F0>, [<pyopenpose.Datum object at 0x00000263AFF05F10>]
解决办法:
更改demo_offline里的文件内容如下:
将opWrapper.emplaceAndPop([datum])更改如下:
opWrapper.emplaceAndPop(op.VectorDatum([datum]))
错误3:
Check failed: error == cudaSuccess (2 vs. 0) out of memory
解决办法:
更改网络分辨率
更改demo_offline里的文件内容如下:
将params = dict(model_folder='./models', model_pose='COCO')更改如下:
params = dict(model_folder='./models', model_pose='COCO', net_resolution='320x176')
结果如下:
根据你的错误信息:
Traceback (most recent call last):
File "main.py", line 33, in <module>
p.start()
File "E:\Ruan\torch\st-gcn-master\st-gcn-master\processor\demo_offline.py", line 31, in start
video, data_numpy = self.pose_estimation()
TypeError: 'NoneType' object is not iterable
可以知道, self.pose_estimation()这个方法的返回是None;根据你贴出来的代码,发现这个方法在执行
import pyopenpose as op
的时候失败,所以抛出了exception。你先确认下你是不是安装了pyopenpose, 并确保这个包是可以被import的。