1.从litemono打包下载litemono
2.下载monodepth2,将splits中的eigen和eigen_zhou下载下来替代litemono里的splits中的内容
3.下载kitti数据集并按照下方格式进行整理放到代码根目录
kitti_data
|
├── 2011_09_26
│ ├── 2011_09_26_drive_0001_sync
│ │ ├── image_00
│ │ ├── image_01
│ │ ├── image_02
│ │ ├── image_03
│ │ ├── oxts
│ │ └── velodyne_points│
│ ├── ...
│ ├── calib_cam_to_cam.txt
│ ├── calib_imu_to_velo.txt
│ └── calib_velo_to_cam.txt
├── 2011_09_28
│ ├── 2011_09_28_drive_0001_sync
│ │ ├── image_00
│ │ ├── image_01
│ │ ├── image_02
│ │ ├── image_03
│ │ ├── oxts
│ │ └── velodyne_points
│ ├── ...│
│ ├── calib_cam_to_cam.txt
│ ├── calib_imu_to_velo.txt
│ └── calib_velo_to_cam.txt
├── 2011_09_29
│ ├── 2011_09_29_drive_0004_sync
│ │ ├── image_00
│ │ ├── image_01
│ │ ├── image_02
│ │ ├── image_03
│ │ ├── oxts
│ │ └── velodyne_points
│ ├── ...│
│ ├── calib_cam_to_cam.txt
│ ├── calib_imu_to_velo.txt
│ └── calib_velo_to_cam.txt
├── 2011_09_30
│ ├── 2011_09_30_drive_0016_sync
│ │ ├── image_00
│ │ ├── image_01
│ │ ├── image_02
│ │ ├── image_03
│ │ ├── oxts
│ │ └── velodyne_points│
│ ├── ...│
│ ├── calib_cam_to_cam.txt
│ ├── calib_imu_to_velo.txt
│ └── calib_velo_to_cam.txt
└── 2011_10_03
├── 2011_10_03_drive_0027_sync
│ ├── image_00
│ ├── image_01
│ ├── image_02
│ ├── image_03
│ ├── oxts
│ └── velodyne_points
├── ...
├── calib_cam_to_cam.txt
├── calib_imu_to_velo.txt
└── calib_velo_to_cam.txt
4.创建虚拟环境(litemono/python3.8/pytorch1.11.0/cuda10.2)
5.根据代码中显示红色缺失的包来安装依赖包
通过访问 https://github.com/saadnaeem-dev/pytorch-linear-warmup-cosine-annealing-warm-restarts-weight-decay把这个包下载下来,然后解压后把linear_warmup_cosine_annealing_warm_restarts_weight_decay这个文件夹放到你创建的虚拟环境的site-packages里
6.项目根目录创建pth文件夹,下载resnet预训练模型到pth(这一步没有也可以)
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet18-f37072fd.pth',
'resnet34': 'https://download.pytorch.org/models/resnet34-b627a593.pth',
'resnet50': 'https://download.pytorch.org/models/resnet50-0676ba61.pth',
'resnet101': 'https://download.pytorch.org/models/resnet101-63fe2227.pth',
'resnet152': 'https://download.pytorch.org/models/resnet152-394f9c45.pth',
'resnext50_32x4d': 'https://download.pytorch.org/models/resnext50_32x4d-7cdf4587.pth',
'resnext101_32x8d': 'https://download.pytorch.org/models/resnext101_32x8d-8ba56ff5.pth',
'wide_resnet50_2': 'https://download.pytorch.org/models/wide_resnet50_2-95faca4d.pth',
'wide_resnet101_2': 'https://download.pytorch.org/models/wide_resnet101_2-32ee1156.pth',
}
7.下载Imagenet预训练模型到pth当作encoder预训练模型,就是训练命令中的--mypretrain参数
8.修改options里的内容进行参数配置,以及trainer.py的152行要修改成一直使用png格式,Lite-Mono-main/kitti_utils.py中85行把np.int改成int。
9.进行训练
python train.py --data_path kitti_data --model_name mytrain --mypretrain pth/lite-mono-pretrain.pth
10.进行评估
python evaluate_depth.py --load_weights_folder path/to/your/weights/folder --data_path path/to/kitti_data/ --model lite-mono
11.进行测试
python test_simple.py --load_weights_folder path/to/your/weights/folder --image_path path/to/your/test/image
以上三个命令都可使用--load_weights_folder但是加载的目录里要有六个内容,即"encoder.pth", "depth.pth", "pose_encoder.pth", "pose.pth","adam.pth","adam_pose.pth"