论文复现:Unsupervised Learning of Depth and Ego-Motion from Video(SfMLearner)

期末作业最后一天,实验总算有点进展,记录下配置过程

环境

  • 项目地址:https://github.com/tinghuiz/SfMLearner
  • GPU:GTX 950M
  • 系统: Win 10
  • python:3.5
    建议使用conda 创建虚拟环境
  • tensorflow-gpu:1.2.1
    pip install tensorflow-gpu==1.2.1 -i https://mirrors.aliyun.com/pypi/simple/
    项目主页标的1.0,直接安装1.0会报错:ValueError: 'image' must be three-dimensional....
  • cuda:8.0.61 win10
    官网下载不了,点击下载总是一个42B大小的损坏文件,所以最后直接找网盘下载
  • cudnn:5.1
    最开始安装了6.0,报错:Could no t load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found...
    原来又是版本不对,虽然6.0也是对应cuda8.0,但是不对应tensorflow-gpu:1.2.1
  • numpy:1.16.4
  • scipy: 1.2.1

记录中提到的一些文件:

数据集、cuda、cudnn、和深度估计预训练模型
链接:https://pan.baidu.com/s/19ht5kgVL3ykfFM6hZurcuw 
提取码:phzi

测试Demo

测试Demo其实不用安装gpu版本tensorflow,安装对应版本的cpu版本就行

下载预训练模型

在脚本中可以看到地址:http://people.eecs.berkeley.edu/~tinghuiz/projects/SfMLearner/models/kitti_depth_model.tar
有时候网络会打不开,切换下别的网络试一试,我换成学校网络倒是可以下载了

Demo

用jupyter打开demo.ipynb
jupyter就直接conda或者pip安装,然后输入jupyter notebook,就会起点web服务
在这里插入图片描述
打开demo.ipynb

运行第一段就报错:

在这里插入图片描述
改成 fh = open('misc/sample.png', 'rb')

然后运行
在这里插入图片描述
试一试换monodepth2里的示例图:
在这里插入图片描述
效果不太好啊

这是monodepth2跑出来的结果:
请添加图片描述

数据集下载

使用的kiiti,raw data
在这里插入图片描述
百度网盘:

预处理

目录结构:
在这里插入图片描述

运行预处理程序

python data/prepare_train_data.py --dataset_dir=data/kitti/dataset/ --dataset_name='kitti_raw_eigen' --dump_root=data/resulting/formatted/data/ --seq_length=3 --img_width=416 --img_height=128 --num_threads=4

训练

出现: The TensorFlow library wasnt compiled to use SSE instructions,...

os.environ['TF_CPP_MIN_LOG_LEVEL']='2'

具体原因不知道

查看tensorflow-gpu是否正常使用gpu

import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
print(tf.test.is_gpu_available())
>>> import tensorflow as tf
>>> import os
>>> os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
>>> print(tf.test.is_gpu_available())
2020-06-27 10:34:18.152335: I c:\tf_jenkins\home\workspace\release-win\m\windows-gpu\py\35\tensorflow\core\common_runtime\gpu\gpu_device.cc:1030] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 950M, pci bus id: 0000:01:00.0)
True

直接运行出现: The TensorFlow library wasnt compiled to use SSE instructions,...提示,然后在train.py增加

os.environ['TF_CPP_MIN_LOG_LEVEL']='2'

然后又会提示内存不够…

2020-06-27 10:36:29.234645: E c:\tf_jenkins\home\workspace\release-win\m\windows-gpu\py\35\tensorflow\stream_executor\cuda\cuda_driver.cc:924] failed to allocate 160.63M (168433920 bytes) from device: CUDA_ERROR_OUT_OF_MEMORY
...
...

尝试把jupyter关了,多余命令行窗口关了,(实在不行就重启电脑),然后电脑就行了。
训练过程:

C:\ProgramData\Miniconda3\envs\SfMLearner\python.exe C:/Users/59610/Desktop/AI/Code/cnn/SfMLearner/train.py --dataset_dir=data/kitti/resulting/formatted/data/ --checkpoint_dir=/where/to/store/checkpoints/ --img_width=416 --img_height=128 --batch_size=4
{'batch_size': 4,
 'beta1': 0.9,
 'checkpoint_dir': '/where/to/store/checkpoints/',
 'continue_train': False,
 'dataset_dir': 'data/kitti/resulting/formatted/data/',
 'explain_reg_weight': 0.0,
 'img_height': 128,
 'img_width': 416,
 'init_checkpoint_file': None,
 'learning_rate': 0.0002,
 'max_steps': 200000,
 'save_latest_freq': 5000,
 'seq_length': 3,
 'smooth_weight': 0.5,
 'summary_freq': 100}
Trainable variables: 
depth_net/cnv1/weights:0
depth_net/cnv1/biases:0
depth_net/cnv1b/weights:0
depth_net/cnv1b/biases:0
depth_net/cnv2/weights:0
depth_net/cnv2/biases:0
depth_net/cnv2b/weights:0
depth_net/cnv2b/biases:0
depth_net/cnv3/weights:0
depth_net/cnv3/biases:0
depth_net/cnv3b/weights:0
depth_net/cnv3b/biases:0
depth_net/cnv4/weights:0
depth_net/cnv4/biases:0
depth_net/cnv4b/weights:0
depth_net/cnv4b/biases:0
depth_net/cnv5/weights:0
depth_net/cnv5/biases:0
depth_net/cnv5b/weights:0
depth_net/cnv5b/biases:0
depth_net/cnv6/weights:0
depth_net/cnv6/biases:0
depth_net/cnv6b/weights:0
depth_net/cnv6b/biases:0
depth_net/cnv7/weights:0
depth_net/cnv7/biases:0
depth_net/cnv7b/weights:0
depth_net/cnv7b/biases:0
depth_net/upcnv7/weights:0
depth_net/upcnv7/biases:0
depth_net/icnv7/weights:0
depth_net/icnv7/biases:0
depth_net/upcnv6/weights:0
depth_net/upcnv6/biases:0
depth_net/icnv6/weights:0
depth_net/icnv6/biases:0
depth_net/upcnv5/weights:0
depth_net/upcnv5/biases:0
depth_net/icnv5/weights:0
depth_net/icnv5/biases:0
depth_net/upcnv4/weights:0
depth_net/upcnv4/biases:0
depth_net/icnv4/weights:0
depth_net/icnv4/biases:0
depth_net/disp4/weights:0
depth_net/disp4/biases:0
depth_net/upcnv3/weights:0
depth_net/upcnv3/biases:0
depth_net/icnv3/weights:0
depth_net/icnv3/biases:0
depth_net/disp3/weights:0
depth_net/disp3/biases:0
depth_net/upcnv2/weights:0
depth_net/upcnv2/biases:0
depth_net/icnv2/weights:0
depth_net/icnv2/biases:0
depth_net/disp2/weights:0
depth_net/disp2/biases:0
depth_net/upcnv1/weights:0
depth_net/upcnv1/biases:0
depth_net/icnv1/weights:0
depth_net/icnv1/biases:0
depth_net/disp1/weights:0
depth_net/disp1/biases:0
pose_exp_net/cnv1/weights:0
pose_exp_net/cnv1/biases:0
pose_exp_net/cnv2/weights:0
pose_exp_net/cnv2/biases:0
pose_exp_net/cnv3/weights:0
pose_exp_net/cnv3/biases:0
pose_exp_net/cnv4/weights:0
pose_exp_net/cnv4/biases:0
pose_exp_net/cnv5/weights:0
pose_exp_net/cnv5/biases:0
pose_exp_net/pose/cnv6/weights:0
pose_exp_net/pose/cnv6/biases:0
pose_exp_net/pose/cnv7/weights:0
pose_exp_net/pose/cnv7/biases:0
pose_exp_net/pose/pred/weights:0
pose_exp_net/pose/pred/biases:0
parameter_count = 33187568
Epoch: [ 1] [  100/ 1208] time: 0.6989/it loss: 0.967
Epoch: [ 1] [  200/ 1208] time: 0.6371/it loss: 1.032
...
...
...
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章