README.md 3.9 KB
Newer Older
Gangwei Xu's avatar
Gangwei Xu 已提交
1
# IGEV-Stereo & IGEV-MVS (CVPR 2023)
Gangwei Xu's avatar
Gangwei Xu 已提交
2

Gangwei Xu's avatar
Gangwei Xu 已提交
3
This repository contains the source code for our paper:
Gangwei Xu's avatar
Gangwei Xu 已提交
4

Gangwei Xu's avatar
Gangwei Xu 已提交
5
[Iterative Geometry Encoding Volume for Stereo Matching](https://arxiv.org/pdf/2303.06615.pdf)<br/>
Gangwei Xu's avatar
Gangwei Xu 已提交
6
Gangwei Xu, Xianqi Wang, Xiaohuan Ding, Xin Yang<br/>
Gangwei Xu's avatar
Gangwei Xu 已提交
7

Gangwei Xu's avatar
Gangwei Xu 已提交
8
9
<img src="IGEV-Stereo/IGEV-Stereo.png">

Gangwei Xu's avatar
Gangwei Xu 已提交
10
11
12
## Demos
Pretrained models can be downloaded from [google drive](https://drive.google.com/drive/folders/1SsMHRyN7808jDViMN1sKz1Nx-71JxUuz?usp=share_link)

Gangwei Xu's avatar
Gangwei Xu 已提交
13
14
We assume the downloaded pretrained weights are located under the pretrained_models directory.

Gangwei Xu's avatar
Gangwei Xu 已提交
15
16
17
18
You can demo a trained model on pairs of images. To predict stereo for Middlebury, run
```
python demo.py --restore_ckpt ./pretrained_models/sceneflow/sceneflow.pth
```
Gangwei Xu's avatar
Gangwei Xu 已提交
19
20

<img src="IGEV-Stereo/demo-imgs.png" width="90%">
Gangwei Xu's avatar
Gangwei Xu 已提交
21

Gangwei Xu's avatar
Gangwei Xu 已提交
22
23
24
25
26
27
28
29
## Comparison with RAFT-Stereo

| Method | KITTI 2012 <br> (3-noc) | KITTI 2015 <br> (D1-all) | Memory (G) | Runtime (s) |
|:-:|:-:|:-:|:-:|:-:|
| RAFT-Stereo | 1.30 % | 1.82 % | 1.02 | 0.38 |
| IGEV-Stereo | 1.12 % | 1.59 % | 0.66 | 0.18 |


Gangwei Xu's avatar
Gangwei Xu 已提交
30
## Environment
Gangwei Xu's avatar
Gangwei Xu 已提交
31
* NVIDIA RTX 3090
Gangwei Xu's avatar
Gangwei Xu 已提交
32
33
34
35
36
37
* Python 3.8
* Pytorch 1.12

### Create a virtual environment and activate it.

```
Gangwei Xu's avatar
Gangwei Xu 已提交
38
39
conda create -n IGEV_Stereo python=3.8
conda activate IGEV_Stereo
Gangwei Xu's avatar
Gangwei Xu 已提交
40
41
42
43
44
45
46
47
48
49
50
51
```
### Dependencies

```
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch -c nvidia
pip install opencv-python
pip install scikit-image
pip install tensorboard
pip install matplotlib 
pip install tqdm
pip install timm==0.5.4
```
Gangwei Xu's avatar
Gangwei Xu 已提交
52

Gangwei Xu's avatar
Gangwei Xu 已提交
53
54
## Required Data
To evaluate/train IGEV-Stereo, you will need to download the required datasets. 
Gangwei Xu's avatar
Gangwei Xu 已提交
55
* [Scene Flow](https://lmb.informatik.uni-freiburg.de/resources/datasets/SceneFlowDatasets.en.html)
Gangwei Xu's avatar
Gangwei Xu 已提交
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
* [KITTI](http://www.cvlibs.net/datasets/kitti/eval_scene_flow.php?benchmark=stereo)
* [Middlebury](https://vision.middlebury.edu/stereo/data/)
* [ETH3D](https://www.eth3d.net/datasets#low-res-two-view-test-data)

By default `stereo_datasets.py` will search for the datasets in these locations. 

```
├── /data
    ├── sceneflow
        ├── frames_finalpass
        ├── disparity
    ├── KITTI
        ├── KITTI_2012
            ├── training
            ├── testing
            ├── vkitti
        ├── KITTI_2015
            ├── training
            ├── testing
            ├── vkitti
    ├── Middlebury
        ├── trainingH
        ├── trainingH_GT
    ├── ETH3D
        ├── two_view_training
        ├── two_view_training_gt
Gangwei Xu's avatar
Gangwei Xu 已提交
82
83
84
    ├── DTU_data
        ├── dtu_train
        ├── dtu_test
Gangwei Xu's avatar
Gangwei Xu 已提交
85
86
87
88
```

## Evaluation

Gangwei Xu's avatar
Gangwei Xu 已提交
89
90
To evaluate on Scene Flow or Middlebury or ETH3D, run

Gangwei Xu's avatar
Gangwei Xu 已提交
91
92
93
```Shell
python evaluate_stereo.py --restore_ckpt ./pretrained_models/sceneflow/sceneflow.pth --dataset sceneflow
```
Gangwei Xu's avatar
Gangwei Xu 已提交
94
95
96
97
98
99
100
101
or
```Shell
python evaluate_stereo.py --restore_ckpt ./pretrained_models/sceneflow/sceneflow.pth --dataset middlebury_H
```
or
```Shell
python evaluate_stereo.py --restore_ckpt ./pretrained_models/sceneflow/sceneflow.pth --dataset eth3d
```
Gangwei Xu's avatar
Gangwei Xu 已提交
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122

## Training

To train on Scene Flow, run

```Shell
python train_stereo.py
```

To train on KITTI, run
```Shell
python train_stereo.py --restore_ckpt ./pretrained_models/sceneflow/sceneflow.pth --dataset kitti
```

## Submission

For submission to the KITTI benchmark, run
```Shell
python save_disp.py
```

Gangwei Xu's avatar
Gangwei Xu 已提交
123
124
125
126
127
128
129
130
131
132
133
134
135
136
## MVS training and evaluation

To train on DTU, run

```Shell
python train_mvs.py
```

To evaluate on DTU, run

```Shell
python evaluate_mvs.py
```

Gangwei Xu's avatar
Gangwei Xu 已提交
137
138
139
140
## Citation

If you find our work useful in your research, please consider citing our paper:

Gangwei Xu's avatar
Gangwei Xu 已提交
141
142
```bibtex
@inproceedings{xu2023iterative,
Gangwei Xu's avatar
Gangwei Xu 已提交
143
144
  title={Iterative Geometry Encoding Volume for Stereo Matching},
  author={Xu, Gangwei and Wang, Xianqi and Ding, Xiaohuan and Yang, Xin},
Gangwei Xu's avatar
Gangwei Xu 已提交
145
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
Gangwei Xu's avatar
Gangwei Xu 已提交
146
  pages={21919--21928},
Gangwei Xu's avatar
Gangwei Xu 已提交
147
148
149
150
151
  year={2023}
}
```


Gangwei Xu's avatar
Gangwei Xu 已提交
152
153
154
155
# Acknowledgements

This project is heavily based on [RAFT-Stereo](https://github.com/princeton-vl/RAFT-Stereo), We thank the original authors for their excellent work.