PwcNet 是一个光流训练网络,目前网络上还没有相关的公开的教程,我 是在Anaconda3下面进行配置:
1. 创建虚拟环境:
conda create --name=pwcnet python=3.6
2 下载代码,Pwcnet有tensorflow 和Pytorch两个版本,我配置的是Tensorflow版本的环境:
https://github.com/philferriere/tfoptflow/tree/master/tfoptflow
3 配置虚拟环境,tensorflow可以是GPU版本的也可以是CPU的,都是可以的.
如果是CPU的话,修改pwcnet_predict_from_img.pairs.py文件:
# Here, we're using a GPU (use '/device:CPU:0' to run inference on the CPU)
gpu_devices = ['/device:CPU:0'] # 改成CPU
controller = '/device:CPU:0'
下面是配置anaconda的虚拟环境
conda activate pwcnet ## 激活虚拟环境
## 安装如下的pip安装包
pip install
- absl-py==0.4.1
- astor==0.7.1
- dask==0.19.0
- gast==0.2.0
- grpcio==1.14.2
- markdown==2.6.11
- opencv-python==3.4.2.17
- protobuf==3.6.1
- tensorboard==1.10.0
- tensorflow-gpu==1.10.1 #CPU 请安装cpu版本的tensorflow
- termcolor==1.1.0
- werkzeug==0.14.1
- cudatoolkit=9.0
- scikit-learn
- scikit-image
- tqdm
4 运行代码:
下载Tensorflow的权重文件,并修改预训练的权重文件的路径:
下载地址:
http://bit.ly/tfoptflow
# TODO: Set the path to the trained model (make sure you've downloaded it first from http://bit.ly/tfoptflow)
ckpt_path = './models/pwcnet-lg-6-2-multisteps-chairsthingsmix/pwcnet.ckpt-595000'
python pwcnet_predict_from_img_pairs.py