linux死磕Flownet2
有一说一,对新手极其不友好,bug多的离谱!
先给出当前所有配置及环境:
NVIDIA gtx 750 显卡(算力5.0,低于3.0可能有bug)
ubuntu18.04
anoconda3
cuda10.0(版本太高有bug)
torch1.2(版本太高有bug,太低功能不全)
下载
- 下载源代码和权重(Pretrain models):https://github.com/NVIDIA/flownet2-pytorch
- 下载MPI-Sintel数据集:http://sintel.is.tue.mpg.de/
环境配置
anoconda和cuda下载过程不再赘述,相关博文很详细。
安装过程遇到的典型bug不少,但百度很容易查到。
建议新建虚拟环境,避免以后各种疑难杂症:
conda create -n flownet2 python=3.6
#flownet2是环境名,3.6指定环境的python版本
激活进入:
conda activate flownet2
然后在此环境安装torch1.2
修改代码
使用pycharm
networks/channelnorm_package、
networks/resample2d_package、
networks/correlation_package
三个文件夹里的setup.py文件:c++11改为c++14
datasets.py中
from scipy.misc import imread, imresize
替换成
from imageio import imread
运行
-
编译
在虚拟环境用cd进入下载的flownet2-pytorch文件夹,即install.sh所在文件夹。
运行: ./install.sh或者bash install.sh -
测试
python main.py -h
#缺什么包就pip install 什么包 -
运行
python main.py --inference --model FlowNet2 --save_flow --inference_dataset MpiSintelClean --inference_dataset_root MPI-Sintel-complete/training/ --resume FlowNet2_checkpoint.pth.tar --save ./test/output3/ -
光流.flo文件生成.png图片
https://blog.youkuaiyun.com/sinat_33718563/article/details/79950310
bug汇总,按需取用!
CUDA error: no kernel image is available for execution on the device
上图三个pachage下都有setup.py文件,将其中nvcc_args添加一行,数字改为自己显卡算力(50)。
/bin/bash^M: 解释器错误: 没有那个文件或目录
https://blog.youkuaiyun.com/petpig0312/article/details/79797727
调试没有及时记录bug,想到再更…
终于
注:
百度/谷歌搜不到的bug,建议看issues:https://github.com/NVIDIA/flownet2-pytorch/issues
多数bug根源于:conda、torch、显卡之间的版本兼容性。