Vision Transformers for Dense Prediction——代码实践

相关申明

源代码地址

@article{Ranftl2021,
	author    = {Ren\'{e} Ranftl and Alexey Bochkovskiy and Vladlen Koltun},
	title     = {Vision Transformers for Dense Prediction},
	journal   = {ArXiv preprint},
	year      = {2021},
}
@article{Ranftl2020,
	author    = {Ren\'{e} Ranftl and Katrin Lasinger and David Hafner and Konrad Schindler and Vladlen Koltun},
	title     = {Towards Robust Monocular Depth Estimation: Mixing Datasets for Zero-shot Cross-dataset Transfer},
	journal   = {IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI)},
	year      = {2020},
}

 小赵在ubuntu18.04系统下进行论文的代码实践,简单流程如下:

1.下载github项目到本地

git clone https://github.com/isl-org/DPT.git

2.根据提示,下载model weights——Monodepth & Segmentation,并将下载的.pt文件放置到DPT项目的weights文件夹内

3. 通过anaconda3创建相关环境

conda create -n DPT python=3.7
source activate DPT
cd DPT
conda install --yes --file requirements.txt
或
pip3 install -r requirements.txt

Python 3.7, PyTorch 1.8.0, OpenCV 4.5.1, and timm 0.4.5 均通过requirements.txt完成安装

4.运行

  • 将image(单张或多张)放置
  • 执行单目深度估计模型
python run_monodepth.py
  • 执行语义分割模型
python run_segmentation.py

 5.结果

结果分别放置在对应的output_monodepth 和 output_semseg 

Vision Transformers for Dense Prediction——代码实践_第1张图片

Vision Transformers for Dense Prediction——代码实践_第2张图片

Vision Transformers for Dense Prediction——代码实践_第3张图片

6.拓展 

将Monodepth微调后作用在KITTI,下载对应.pt文件,放置到weights

将Monodepth微调后作用在NYUv2,下载对应.pt文件,放置到weights 

执行

python run_monodepth -t [dpt_hybrid_kitti|dpt_hybrid_nyu] 

python run_monodepth.pt -t dpt_hybrid_kitti

python run_monodepth.pt -t dpt_hybrid_nyu

kitti

Vision Transformers for Dense Prediction——代码实践_第4张图片

nyu

Vision Transformers for Dense Prediction——代码实践_第5张图片

你可能感兴趣的:(【论文研读-图像处理】,python,计算机视觉,图像处理)