pytorch代码地址
代码有两个版本,不过因为现在大环境下,大家都用pytorch,所以贴出pytorch的地址,我也是fork别人的。这儿坑不多,用的数据集也是常用的UCF101。后面会总结之前复现TensorFlow遇到的坑,也会贴出比较好的那个大佬的代码讲解。
下载代码
git clone https://github.com/jfzhang95/pytorch-video-recognition.git
cd pytorch-video-recognition
OpenCV
conda install opencv
pip install tqdm scikit-learn tensorboardX
下载预训练模型
https://pan.baidu.com/s/1saNqGBkzZHwZpG-A5RDLVw
修改路径
这位大佬写的非常详细,用的tensorflow版本比较低,虽然我成功运行了,但是还是出现了一直accuracy=0.00,不知道怎么解决,所以用专转战pytorch。
TensorFlow的坑
TensorFlow的版本最好低一点:
No module named ‘cv2’:
pip install opencv-contrib-python
module ‘tensorflow’ has no attribute ‘app’
:TensorFlow版本不匹配
解决办法:用tf.compat.v1.flags替换tf.app.flags(会有一系列的问题,最后还是通过降低版本解决)
在py3.5下运行 ,产生错误。解决办法是?
varlist1 = list( set(weights.values() + biases.values()) - set(varlist2) )
TypeError: unsupported operand type(s) for +: ‘dict_values’ and ‘dict_values’
版本原因:https://blog.csdn.net/tream733/article/details/78789277
TypeError: ‘range’ object does not support item assignment
解决办法:把range内容转为list video_indices = list(range(len(lines)))
ValueError:Cannot feed value of shape(10,0)for Tensor u’Placeholder:0
解决:so I solved the problem by removing ‘list/’ from the original ‘filename’. filename=‘train.list’-------line215 filename=‘test.list’--------line241