PwcNet 是一個光流訓練網絡,目前網絡上還沒有相關的公開的教程,我 是在Anaconda3下面進行配置:
1. 建立虛拟環境:
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
5 運作結果
