English | 简体中文
在开始使用之前,您需要按照以下命令安装额外的依赖包:
python -m pip install scikit-image
python -m pip install matplotlib
本模型以百度机器人与自动驾驶实验室的ICCV 2021论文 Self-supervised Monocular Depth Estimation for All Day Images using Domain Separation 为参考, 复现了基于白天和夜晚图像的自监督单目深度估计模型,其利用了白天和夜晚的图像数据互补性质,减缓了昼夜图像较大的域偏移以及照明变化对深度估计的精度带来的影响,在具有挑战性的牛津RobotCar数据集上实现了全天图像的最先进的深度估计结果。
Oxford RobotCar dataset数据下载及准备请参考Oxford RobotCar dataset数据准备
-
下载图像预训练模型resnet18.pdparams作为Backbone初始化参数,或通过wget命令下载
wget -P ./data https://videotag.bj.bcebos.com/PaddleVideo-release2.2/Resnet18_Imagenet.pdparams
-
打开
PaddleVideo/configs/estimation/adds/adds.yaml
,将下载好的权重存放路径填写到下方pretrained:
之后MODEL: #MODEL field framework: "DepthEstimator" #Mandatory, indicate the type of network, associate to the 'paddlevideo/modeling/framework/' . backbone: #Mandatory, indicate the type of backbone, associate to the 'paddlevideo/modeling/backbones/' . name: 'ADDS_DepthNet' pretrained: 将路径填写到此处
-
Oxford RobotCar dataset数据集使用单卡训练,训练方式的启动命令如下:
python3.7 main.py --validate -c configs/estimation/adds/adds.yaml --seed 20
-
ADDS-DepthNet模型在训练时同步进行验证(只对白天或者夜晚的数据进行验证),您可以通过在训练日志中查找关键字
best
获取模型测试精度,日志示例如下:Already save the best model (rmse)8.5531
-
由于模型暂时一次只能测试yaml文件中给定路径的一个白天或者夜晚的数据集,因此若要得到本文档开头处的完整测试分数,需要运行4次测试命令并分别记录下它们的指标(白天40m、白天60m、夜晚40m、夜晚60m)
-
训练好的模型下载地址:ADDS_car.pdparams
-
测试命令如下:
# 夜晚40m python3.7 main.py --test -c configs/estimation/adds/adds.yaml -w "output/ADDS/ADDS_best.pdparams" -o DATASET.test.file_path="data/oxford/splits/oxford_day/val_night_files.txt" -o MODEL.head.max_gt_depth=40 # 夜晚60m python3.7 main.py --test -c configs/estimation/adds/adds.yaml -w "output/ADDS/ADDS_best.pdparams" -o DATASET.test.file_path="data/oxford/splits/oxford_day/val_night_files.txt" -o MODEL.head.max_gt_depth=60 # 白天40m python3.7 main.py --test -c configs/estimation/adds/adds.yaml -w "output/ADDS/ADDS_best.pdparams" -o DATASET.test.file_path="data/oxford/splits/oxford_day/val_day_files.txt" -o MODEL.head.max_gt_depth=40 # 白天60m python3.7 main.py --test -c configs/estimation/adds/adds.yaml -w "output/ADDS/ADDS_best.pdparams" -o DATASET.test.file_path="data/oxford/splits/oxford_day/val_day_files.txt" -o MODEL.head.max_gt_depth=60
在Oxford RobotCar dataset的validation数据集上的测试指标如下:
python3.7 tools/export_model.py -c configs/estimation/adds/adds.yaml -p data/ADDS_car.pdparams -o inference/ADDS
上述命令将生成预测所需的模型结构文件ADDS.pdmodel
和模型权重文件ADDS.pdiparams
以及ADDS.pdiparams.info
文件,均存放在inference/ADDS/
目录下
上述bash命令中各个参数含义可参考模型推理方法
python3.7 tools/predict.py --input_file data/example.png \
--config configs/estimation/adds/adds.yaml \
--model_file inference/ADDS/ADDS.pdmodel \
--params_file inference/ADDS/ADDS.pdiparams \
--use_gpu=True \
--use_tensorrt=False
推理结束会默认以伪彩的方式保存下模型估计出的深度图。
以下是样例图片和对应的预测深度图:
- Self-supervised Monocular Depth Estimation for All Day Images using Domain Separation, Liu, Lina and Song, Xibin and Wang, Mengmeng and Liu, Yong and Zhang, Liangjun