---
title: cv_marigold_monocular-depth-estimation
canonical_url: "https://www.modelscope.cn/models/Damo_XR_Lab/cv_marigold_monocular-depth-estimation"
md_url: "https://www.modelscope.cn/models/Damo_XR_Lab/cv_marigold_monocular-depth-estimation.md"
repository: Damo_XR_Lab/cv_marigold_monocular-depth-estimation
chinese_name: "基于稳定扩散的仿射不变单目深度估计方法"
last_updated: 2024-03-07
license: "Apache License 2.0"
pipeline_tag: image-depth-estimation
tasks:
  - image-depth-estimation
parameters: 1.3B
tensor_type:
  - F32
  - I64
library_name:
  - safetensors
  - diffusers
  - pytorch
frameworks:
  - Pytorch
downloads: 398
stars: 1
tags:
  - Alibaba
  - XR
  - Depth
---

# cv_marigold_monocular-depth-estimation

> cv_marigold_monocular-depth-estimation - Damo_XR_Lab 在 ModelScope 开源的模型。一种利用pre-trained text-to-image生成模型进行单目深度估计的方法

Damo_XR_Lab/cv_marigold_monocular-depth-estimation 是 ModelScope 魔搭社区上的 1.3B 参数image-depth-estimation模型，采用 Apache License 2.0 许可。

- **Repository**: Damo_XR_Lab/cv_marigold_monocular-depth-estimation
- **License**: Apache License 2.0
- **Tasks**: image-depth-estimation
- **Parameters**: 1.3B
- **Tags**: Alibaba, XR, Depth
- **Downloads**: 398
- **Stars**: 1
- **Last updated**: 2024-03-07

Source: https://www.modelscope.cn/models/Damo_XR_Lab/cv_marigold_monocular-depth-estimation

---

###### 该模型当前使用的是默认介绍模版，处于“预发布”阶段，页面仅限所有者可见。
###### 请根据[模型贡献文档说明](https://www.modelscope.cn/docs/%E5%A6%82%E4%BD%95%E6%92%B0%E5%86%99%E5%A5%BD%E7%94%A8%E7%9A%84%E6%A8%A1%E5%9E%8B%E5%8D%A1%E7%89%87)，及时完善模型卡片内容。ModelScope平台将在模型卡片完善后展示。谢谢您的理解。
#### Clone with HTTP
```bash
 git clone https://www.modelscope.cn/Damo_XR_Lab/cv_marigold_monocular-depth-estimation.git
```

# 基于稳定扩散的仿射不变单目深度估计方法

## 任务
利用预训练的图像生成模型来调优深度估计任务，本算法可以获得SOTA的深度结果。

## 模型描述


## 效果展示
以下是在自然数据上的本方法和其他方法的深度结果对比

![performance](description/performance.png)
## 期望模型使用方式以及适用范围

本方法可以从单张图像中恢复深度结果，并通过给定相机参数，恢复对应的点云

### 运行环境
* 模型只支持GPU上运行，GPU显存要求大于等于24G
* 已在RTX4090及以上显卡上测试通过，具体效率与GPU性能相关，可能存在一些差异

### 模型局限性以及可能的偏差

## 如何使用


### 推理代码范例

使用预训练模型，按照下列代码可以进行推理
```
input_path = './data/in-the-wild_example/example_0.jpg'
output_path = './result.png'


pipe = pipeline(Tasks.image_depth_estimation,
        model='Damo_XR_Lab/cv_marigold_monocular-depth-estimation')

results = pipe(input=input_path)
depth_val = results[OutputKeys.DEPTHS]   # type: np.ndarray
print('the output depth shape is', depth_val.shape)

depth_vis = results[OutputKeys.DEPTHS_COLOR]
depth_vis.save(output_path)
print('the output image path is {}'.format(output_path))
```

### 训练代码范例
请参考[训练过程](https://github.com/prs-eth/Marigold)


## 相关论文以及引用信息

```
@misc{ke2023repurposing,
      title={Repurposing Diffusion-Based Image Generators for Monocular Depth Estimation}, 
      author={Bingxin Ke and Anton Obukhov and Shengyu Huang and Nando Metzger and Rodrigo Caye Daudt and Konrad Schindler},
      year={2023},
      eprint={2312.02145},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}
```
