---
title: cv_casmvs_multi-view-depth-estimation_general
canonical_url: "https://www.modelscope.cn/models/iic/cv_casmvs_multi-view-depth-estimation_general"
md_url: "https://www.modelscope.cn/models/iic/cv_casmvs_multi-view-depth-estimation_general.md"
repository: iic/cv_casmvs_multi-view-depth-estimation_general
chinese_name: "级联结构的多视图深度估计"
last_updated: 2023-04-03
license: "Apache License 2.0"
pipeline_tag: image-multi-view-depth-estimation
tasks:
  - image-multi-view-depth-estimation
model_type:
  - roberta
library_name:
  - pytorch
frameworks:
  - pytorch
domain:
  - cv
downloads: 4582
stars: 7
tags:
  - Alibaba
  - XR
  - "Multi-View Stereo"
  - "3D Vision"
  - "Cascaded Cost Volume"
  - "Depth Estimation"
---

# cv_casmvs_multi-view-depth-estimation_general

> cv_casmvs_multi-view-depth-estimation_general - iic 在 ModelScope 开源的模型。提出了一种节省显存和同时提升精度的cascaded cost volume。 多阶段的预测方式，通过前一阶段预测的深度值来缩小当前阶段的采样深度范围，能够建立离散采样值更少的cost volume，从而达到节省显存的目的。 通过这种方式，可以建立空间分辨率更高的cost volume，恢复出高分辨的深度图，提升精度

iic/cv_casmvs_multi-view-depth-estimation_general 是 ModelScope 魔搭社区上的image-multi-view-depth-estimation模型，采用 Apache License 2.0 许可。

- **Repository**: iic/cv_casmvs_multi-view-depth-estimation_general
- **License**: Apache License 2.0
- **Tasks**: image-multi-view-depth-estimation
- **Tags**: Alibaba, XR, Multi-View Stereo, 3D Vision, Cascaded Cost Volume, Depth Estimation
- **Downloads**: 4582
- **Stars**: 7
- **Last updated**: 2023-04-03

Source: https://www.modelscope.cn/models/iic/cv_casmvs_multi-view-depth-estimation_general

---

#  级联结构的多视图深度估计 介绍
任务：输入一堆已知相机位姿的图片，预测每张图的深度图以及深度图融合，输出融合后的点云


## 模型描述

提出了一种节省显存和同时提升精度的cascaded cost volume。
多阶段的预测方式，通过前一阶段预测的深度值来缩小当前阶段的采样深度范围，能够建立离散采样值更少的cost volume，从而达到节省显存的目的。
通过这种方式，可以建立空间分辨率更高的cost volume，恢复出高分辨的深度图，提升精度。


该模型在DTU数据集上进行训练，可以用于multi-view stereo任务中。


## 期望模型使用方式以及适用范围
本模型主要用于多视图深度估计。用户可以自行尝试各种输入的模型效果。具体调用方式请参考代码示例


### 如何使用
在ModelScope里可以比较方便的使用

注意点：
目前只支持在GPU模式下使用


### 代码范例

```python
import os
from modelscope.outputs import OutputKeys
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
from modelscope.hub.snapshot_download import snapshot_download

estimator = pipeline(task=Tasks.image_multi_view_depth_estimation, model='damo/cv_casmvs_multi-view-depth-estimation_general')

model_dir = snapshot_download('damo/cv_casmvs_multi-view-depth-estimation_general')
input_location = os.path.join(model_dir, "test_data") # download `test_data` from current repo
# input_location = "./casmvs_test_data"

result = estimator(input_location)
pcd = result[OutputKeys.OUTPUT]
pcd.write('./pcd_fusion.ply')
print("end")
```

注意点：

1、输入必须是文件夹，包含 images 和 sparse 两个子文件夹， images文件夹里面存放图片， sparse文件夹里面存放稀疏重建的结果(COLMAP格式)。可参考上述代码示例中的test data (存放在本仓库中test_data文件夹)

2、images 和 sparse文件夹，可以通过开源软件COLMAP生成，示例代码如下：

```
DATASET_PATH=$1

colmap feature_extractor \
 --database_path $DATASET_PATH/database.db \
 --image_path $DATASET_PATH/images

colmap exhaustive_matcher \
 --database_path $DATASET_PATH/database.db

mkdir $DATASET_PATH/sparse

colmap mapper \
  --database_path $DATASET_PATH/database.db \
  --image_path $DATASET_PATH/images \
  --output_path $DATASET_PATH/sparse

mkdir $DATASET_PATH/dense

colmap image_undistorter \
  --image_path $DATASET_PATH/images \
  --input_path $DATASET_PATH/sparse/0 \
  --output_path $DATASET_PATH/dense \
  --output_type COLMAP \
  --max_image_size 2000
```
把**DATASET_PATH/dense**下面的 **images** 和 **sparse** 文件夹拿出来，再调用本接口，这里的**images** 和 **sparse** 两文件夹是存放undistort后的图片和稀疏重建结果，效果更好



### 模型局限性以及可能的偏差
该模型在DTU数据集上训练，有可能产生一些偏差，请用户自行评测后决定如何使用。

## 训练数据介绍
DTU是一个MVS数据集，由124个不同的场景组成，在7种不同的光照条件下在49或64个位置扫描，提供了图片、相应的相机位姿以及深度图。

## 模型训练流程
暂时不支持通过ModelScope接口进行训练，敬请期待。


## 数据评估及结果

### Results on DTU
| Acc.   | Comp.  | Overall. |
|--------|--------|----------|
| 0.325  | 0.385  | 0.355    |

### Results on Tanks and Temples benchmark

| Mean   | Family | Francis | Horse  | Lighthouse | M60    | Panther | Playground | Train |
|--------|--------|---------|--------|------------|--------|---------|------------|-------|
| 56.42  | 76.36  | 58.45   | 46.20  | 55.53	  | 56.11  | 54.02   | 58.17	  | 46.56 |


## 相关论文以及引用信息
如果你觉得这个该模型对有所帮助，请考虑引用下面的相关的论文：
```
@inproceedings{gu2020cascade,
  title={Cascade cost volume for high-resolution multi-view stereo and stereo matching},
  author={Gu, Xiaodong and Fan, Zhiwen and Zhu, Siyu and Dai, Zuozhuo and Tan, Feitong and Tan, Ping},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={2495--2504},
  year={2020}
}
```
该项目中一些代码来自于：[MVSNet_pytorch](https://github.com/xy-guo/MVSNet_pytorch)和[MVSNet](https://github.com/YoYo000/MVSNet)，非常感谢他们开源了相关的工作。
