Upload 372 files
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +3 -0
- LICENSE +21 -0
- README.md +103 -0
- __pycache__/depth_anything_utils.cpython-310.pyc +0 -0
- assets/depth_teaser2.pdf +3 -0
- assets/depth_teaser2_00.png +3 -0
- assets/teaser.jpg +3 -0
- config/infer.yaml +19 -0
- config/test.yaml +71 -0
- datasets/M3D.py +135 -0
- datasets/__init__.py +4 -0
- datasets/__pycache__/M3D.cpython-310.pyc +0 -0
- datasets/__pycache__/M3D.cpython-311.pyc +0 -0
- datasets/__pycache__/M3D.cpython-312.pyc +0 -0
- datasets/__pycache__/__init__.cpython-310.pyc +0 -0
- datasets/__pycache__/__init__.cpython-311.pyc +0 -0
- datasets/__pycache__/__init__.cpython-312.pyc +0 -0
- datasets/__pycache__/blendedmvsfordistance.cpython-310.pyc +0 -0
- datasets/__pycache__/blendedmvsfordistance.cpython-311.pyc +0 -0
- datasets/__pycache__/blendedmvsfordistance.cpython-312.pyc +0 -0
- datasets/__pycache__/blendedmvsfordistance_.cpython-310.pyc +0 -0
- datasets/__pycache__/blendedmvsfordistance_.cpython-311.pyc +0 -0
- datasets/__pycache__/blendedmvsfordistance_.cpython-312.pyc +0 -0
- datasets/__pycache__/deep360.cpython-310.pyc +0 -0
- datasets/__pycache__/deep360.cpython-311.pyc +0 -0
- datasets/__pycache__/deep360.cpython-312.pyc +0 -0
- datasets/__pycache__/deep360_dis.cpython-310.pyc +0 -0
- datasets/__pycache__/deep360_dis.cpython-312.pyc +0 -0
- datasets/__pycache__/haoran_6w.cpython-310.pyc +0 -0
- datasets/__pycache__/inference_dataset.cpython-310.pyc +0 -0
- datasets/__pycache__/insta23k.cpython-310.pyc +0 -0
- datasets/__pycache__/insta23k.cpython-311.pyc +0 -0
- datasets/__pycache__/insta23k.cpython-312.pyc +0 -0
- datasets/__pycache__/insta23k_dis.cpython-310.pyc +0 -0
- datasets/__pycache__/insta23k_dis.cpython-312.pyc +0 -0
- datasets/__pycache__/matterport3d.cpython-310.pyc +0 -0
- datasets/__pycache__/matterport3d.cpython-311.pyc +0 -0
- datasets/__pycache__/matterport3d.cpython-312.pyc +0 -0
- datasets/__pycache__/matterport3d_robust.cpython-310.pyc +0 -0
- datasets/__pycache__/matterport3d_robust.cpython-311.pyc +0 -0
- datasets/__pycache__/matterport3d_robust.cpython-312.pyc +0 -0
- datasets/__pycache__/npy_dataset.cpython-310.pyc +0 -0
- datasets/__pycache__/real_world30w.cpython-310.pyc +0 -0
- datasets/__pycache__/real_world_indoor.cpython-310.pyc +0 -0
- datasets/__pycache__/simdupano.cpython-310.pyc +0 -0
- datasets/__pycache__/sintelfordistance.cpython-310.pyc +0 -0
- datasets/__pycache__/sintelfordistance.cpython-311.pyc +0 -0
- datasets/__pycache__/sintelfordistance.cpython-312.pyc +0 -0
- datasets/__pycache__/sintelfordistance_.cpython-310.pyc +0 -0
- datasets/__pycache__/sintelfordistance_.cpython-311.pyc +0 -0
.gitattributes
CHANGED
|
@@ -36,3 +36,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 36 |
DAP-main-2/assets/depth_teaser2_00.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
DAP-main-2/assets/depth_teaser2.pdf filter=lfs diff=lfs merge=lfs -text
|
| 38 |
DAP-main-2/assets/teaser.jpg filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
DAP-main-2/assets/depth_teaser2_00.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
DAP-main-2/assets/depth_teaser2.pdf filter=lfs diff=lfs merge=lfs -text
|
| 38 |
DAP-main-2/assets/teaser.jpg filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
assets/depth_teaser2_00.png filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
assets/depth_teaser2.pdf filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
assets/teaser.jpg filter=lfs diff=lfs merge=lfs -text
|
LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2025 Insta360 Research Team
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<h1 align="center">
|
| 2 |
+
Depth Any Panoramas:<br>
|
| 3 |
+
A Foundation Model for Panoramic Depth Estimation
|
| 4 |
+
</h1>
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
<p align="center">
|
| 8 |
+
<a href="https://linxin0.github.io"><b>Xin Lin</b></a> ·
|
| 9 |
+
<a href="#"><b>Meixi Song</b></a> ·
|
| 10 |
+
<a href="#"><b>Dizhe Zhang</b></a> ·
|
| 11 |
+
<a href="#"><b>Wenxuan Lu</b></a> ·
|
| 12 |
+
<a href="https://haodong2000.github.io"><b>Haodong Li</b></a>
|
| 13 |
+
<br>
|
| 14 |
+
<a href="#"><b>Bo Du</b></a> ·
|
| 15 |
+
<a href="#"><b>Ming-Hsuan Yang</b></a> ·
|
| 16 |
+
<a href="#"><b>Truong Nguyen</b></a> ·
|
| 17 |
+
<a href="http://luqi.info"><b>Lu Qi</b></a>
|
| 18 |
+
</p>
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
<p align="center">
|
| 23 |
+
<a href='https://arxiv.org/abs/2512.16913'><img src='https://img.shields.io/badge/arXiv-Paper-red?logo=arxiv&logoColor=white' alt='arXiv'></a>
|
| 24 |
+
<a href='https://insta360-research-team.github.io/DAP_website/'><img src='https://img.shields.io/badge/Project_Page-Website-green?logo=insta360&logoColor=white' alt='Project Page'></a>
|
| 25 |
+
<a href=''><img src='https://img.shields.io/badge/%F0%9F%93%88%20Hugging%20Face-Dataset-yellow'></a>
|
| 26 |
+
<a href='https://huggingface.co/spaces/Insta360-Research/DAP'><img src='https://img.shields.io/badge/🚀%20Hugging%20Face-Demo-orange'></a>
|
| 27 |
+
</p>
|
| 28 |
+
|
| 29 |
+

|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
## 🔨 Installation
|
| 34 |
+
|
| 35 |
+
Clone the repo first:
|
| 36 |
+
|
| 37 |
+
```Bash
|
| 38 |
+
git clone https://github.com/Insta360-Research-Team/DAP
|
| 39 |
+
cd DAP
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
(Optional) Create a fresh conda env:
|
| 43 |
+
|
| 44 |
+
```Bash
|
| 45 |
+
conda create -n dap python=3.12
|
| 46 |
+
conda activate dap
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
Install necessary packages (torch > 2):
|
| 50 |
+
|
| 51 |
+
```Bash
|
| 52 |
+
# pytorch (select correct CUDA version, we test our code on torch==2.7.1 and torchvision==0.22.1)
|
| 53 |
+
pip install torch==2.7.1 torchvision==0.22.1
|
| 54 |
+
|
| 55 |
+
# other dependencies
|
| 56 |
+
pip install -r requirements.txt
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
## 🖼️ Dataset
|
| 60 |
+
|
| 61 |
+
The training dataset will be open soon.
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
## 🤝 Pre-trained model
|
| 65 |
+
|
| 66 |
+
Please download the pretrained model: https://huggingface.co/Insta360-Research/DAP-weights
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
## 📒 Inference
|
| 70 |
+
|
| 71 |
+
```Bash
|
| 72 |
+
python test/infer.py
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
## 🚀 Evaluation
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
```Bash
|
| 80 |
+
python test/eval.py
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
## 🤝 Acknowledgement
|
| 87 |
+
|
| 88 |
+
We appreciate the open source of the following projects:
|
| 89 |
+
|
| 90 |
+
* [PanDA](https://caozidong.github.io/PanDA_Depth/)
|
| 91 |
+
* [Depth-Anything-V2](https://github.com/DepthAnything/Depth-Anything-V2)
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
## Citation
|
| 95 |
+
```
|
| 96 |
+
@article{lin2025dap,
|
| 97 |
+
title={Depth Any Panoramas: A Foundation Model for Panoramic Depth Estimation},
|
| 98 |
+
author={Lin, Xin and Song, Meixi and Zhang, Dizhe and Lu, Wenxuan and Li, Haodong and Du, Bo and Yang, Ming-Hsuan and Nguyen, Truong and Qi, Lu},
|
| 99 |
+
journal={arXiv},
|
| 100 |
+
year={2025}
|
| 101 |
+
}
|
| 102 |
+
```
|
| 103 |
+
|
__pycache__/depth_anything_utils.cpython-310.pyc
ADDED
|
Binary file (6.05 kB). View file
|
|
|
assets/depth_teaser2.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:28e8d4fecc3a5bd905ffead457d35f3602c98e78976c75e5da6317286ae4a385
|
| 3 |
+
size 1872942
|
assets/depth_teaser2_00.png
ADDED
|
Git LFS Details
|
assets/teaser.jpg
ADDED
|
Git LFS Details
|
config/infer.yaml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
model:
|
| 2 |
+
name: dap
|
| 3 |
+
args:
|
| 4 |
+
midas_model_type: vitl
|
| 5 |
+
fine_tune_type: hypersim
|
| 6 |
+
min_depth: 0.01
|
| 7 |
+
max_depth: 1.0
|
| 8 |
+
train_decoder: True
|
| 9 |
+
|
| 10 |
+
median_align: False
|
| 11 |
+
load_weights_dir: /home/tione/notebook/home/songmeixi_insta360.com/depth/panda_orgindual/ckpt_save/1111/trainw1_2_dualw1_2/weights_0
|
| 12 |
+
input:
|
| 13 |
+
height: 512
|
| 14 |
+
width: 1024
|
| 15 |
+
inference:
|
| 16 |
+
batch_size: 1
|
| 17 |
+
num_workers: 1
|
| 18 |
+
save_colormap: True
|
| 19 |
+
colormap_type: jet
|
config/test.yaml
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
test_dataset_1:
|
| 2 |
+
name: stanford2d3d
|
| 3 |
+
root_path: /home/tione/notebook/home/wenxuan/PanDA/data/stanford2d3d
|
| 4 |
+
list_path: datasets/stanford2d3d_test.txt
|
| 5 |
+
args:
|
| 6 |
+
height: 512
|
| 7 |
+
width: 1024
|
| 8 |
+
repeat: 1
|
| 9 |
+
augment_color: False
|
| 10 |
+
augment_flip: False
|
| 11 |
+
augment_rotation: False
|
| 12 |
+
batch_size: 32
|
| 13 |
+
num_workers: 64
|
| 14 |
+
|
| 15 |
+
# test_dataset_1:
|
| 16 |
+
# name: insta23k
|
| 17 |
+
# root_path: /home/tione/notebook/nfs/MLUAV_Data
|
| 18 |
+
# list_path: datasets/instadata_list_test.txt
|
| 19 |
+
# args:
|
| 20 |
+
# height: 512
|
| 21 |
+
# width: 1024
|
| 22 |
+
# repeat: 1
|
| 23 |
+
# augment_color: False
|
| 24 |
+
# augment_flip: False
|
| 25 |
+
# augment_rotation: False
|
| 26 |
+
# batch_size: 32
|
| 27 |
+
# num_workers: 64
|
| 28 |
+
|
| 29 |
+
# test_dataset_1:
|
| 30 |
+
# name: deep360
|
| 31 |
+
# root_path: /home/tione/notebook/home/wenxuan/PanDA/data/Deep360
|
| 32 |
+
# list_path: datasets/deep360_test_final.txt
|
| 33 |
+
# args:
|
| 34 |
+
# height: 512
|
| 35 |
+
# width: 1024
|
| 36 |
+
# repeat: 1
|
| 37 |
+
# augment_color: False
|
| 38 |
+
# augment_flip: False
|
| 39 |
+
# augment_rotation: False
|
| 40 |
+
# batch_size: 32
|
| 41 |
+
# num_workers: 24
|
| 42 |
+
|
| 43 |
+
# test_dataset_1:
|
| 44 |
+
# name: m3d
|
| 45 |
+
# root_path: /home/tione/notebook/home/wenxuan/PanDA/data/M3D
|
| 46 |
+
# list_path: datasets/m3d_test.txt
|
| 47 |
+
# args:
|
| 48 |
+
# height: 512
|
| 49 |
+
# width: 1024
|
| 50 |
+
# repeat: 1
|
| 51 |
+
# augment_color: False
|
| 52 |
+
# augment_flip: False
|
| 53 |
+
# augment_rotation: False
|
| 54 |
+
# batch_size: 32
|
| 55 |
+
# num_workers: 24
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
model:
|
| 59 |
+
name: dap
|
| 60 |
+
args:
|
| 61 |
+
midas_model_type: vitl
|
| 62 |
+
fine_tune_type:
|
| 63 |
+
min_depth: 0.001
|
| 64 |
+
max_depth: 1.0
|
| 65 |
+
train_decoder: True
|
| 66 |
+
|
| 67 |
+
median_align: False
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
load_weights_dir: /home/tione/notebook/home/songmeixi_insta360.com/depth/panda_orgindual/ckpt_save/1111/trainw1_2_dualw1_2/weights_0
|
datasets/M3D.py
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import print_function
|
| 2 |
+
import os
|
| 3 |
+
import cv2
|
| 4 |
+
import numpy as np
|
| 5 |
+
import random
|
| 6 |
+
import pyexr
|
| 7 |
+
import torch
|
| 8 |
+
from torch.utils import data
|
| 9 |
+
from torchvision import transforms
|
| 10 |
+
from torchvision.transforms import Compose
|
| 11 |
+
|
| 12 |
+
from PIL import Image, ImageOps, ImageFilter
|
| 13 |
+
import torch.nn.functional as F
|
| 14 |
+
from einops import rearrange
|
| 15 |
+
|
| 16 |
+
def read_list(list_file):
|
| 17 |
+
rgb_depth_list = []
|
| 18 |
+
with open(list_file) as f:
|
| 19 |
+
lines = f.readlines()
|
| 20 |
+
for line in lines:
|
| 21 |
+
rgb_depth_list.append(line.strip().split(" "))
|
| 22 |
+
return rgb_depth_list
|
| 23 |
+
|
| 24 |
+
class M3D(data.Dataset):
|
| 25 |
+
"""The M3D Dataset"""
|
| 26 |
+
|
| 27 |
+
def __init__(self, root_dir, list_file, height=504, width=1008, color_augmentation=True,
|
| 28 |
+
LR_filp_augmentation=True, yaw_rotation_augmentation=True, repeat=1, is_training=False):
|
| 29 |
+
"""
|
| 30 |
+
Args:
|
| 31 |
+
root_dir (string): Directory of the Stanford2D3D Dataset.
|
| 32 |
+
list_file (string): Path to the txt file contain the list of image and depth files.
|
| 33 |
+
height, width: input size.
|
| 34 |
+
disable_color_augmentation, disable_LR_filp_augmentation,
|
| 35 |
+
disable_yaw_rotation_augmentation: augmentation options.
|
| 36 |
+
is_training (bool): True if the dataset is the training set.
|
| 37 |
+
"""
|
| 38 |
+
self.root_dir = root_dir
|
| 39 |
+
|
| 40 |
+
self.w = width
|
| 41 |
+
self.h = height
|
| 42 |
+
|
| 43 |
+
self.max_depth_meters = 100.0
|
| 44 |
+
self.min_depth_meters = 0.01
|
| 45 |
+
|
| 46 |
+
self.color_augmentation = color_augmentation
|
| 47 |
+
self.LR_filp_augmentation = LR_filp_augmentation
|
| 48 |
+
self.yaw_rotation_augmentation = yaw_rotation_augmentation
|
| 49 |
+
|
| 50 |
+
if self.color_augmentation:
|
| 51 |
+
try:
|
| 52 |
+
self.brightness = (0.8, 1.2)
|
| 53 |
+
self.contrast = (0.8, 1.2)
|
| 54 |
+
self.saturation = (0.8, 1.2)
|
| 55 |
+
self.hue = (-0.1, 0.1)
|
| 56 |
+
self.color_aug= transforms.ColorJitter(
|
| 57 |
+
self.brightness, self.contrast, self.saturation, self.hue)
|
| 58 |
+
except TypeError:
|
| 59 |
+
self.brightness = 0.2
|
| 60 |
+
self.contrast = 0.2
|
| 61 |
+
self.saturation = 0.2
|
| 62 |
+
self.hue = 0.1
|
| 63 |
+
self.color_aug = transforms.ColorJitter(
|
| 64 |
+
self.brightness, self.contrast, self.saturation, self.hue)
|
| 65 |
+
|
| 66 |
+
self.is_training = is_training
|
| 67 |
+
|
| 68 |
+
self.to_tensor = transforms.ToTensor()
|
| 69 |
+
self.normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
|
| 70 |
+
|
| 71 |
+
self.rgb_depth_list = read_list(list_file)
|
| 72 |
+
|
| 73 |
+
def __len__(self):
|
| 74 |
+
return len(self.rgb_depth_list)
|
| 75 |
+
|
| 76 |
+
def __getitem__(self, idx):
|
| 77 |
+
|
| 78 |
+
# Read and process the image file
|
| 79 |
+
rgb_name = os.path.join(self.root_dir, self.rgb_depth_list[idx][0])
|
| 80 |
+
rgb = cv2.imread(rgb_name)
|
| 81 |
+
# cv2.imwrite('label_rgb.jpg', rgb)
|
| 82 |
+
rgb = cv2.cvtColor(rgb, cv2.COLOR_BGR2RGB)
|
| 83 |
+
rgb = cv2.resize(rgb, dsize=(self.w, self.h), interpolation=cv2.INTER_CUBIC)
|
| 84 |
+
|
| 85 |
+
# Read and process the depth file
|
| 86 |
+
depth_name = os.path.join(self.root_dir, self.rgb_depth_list[idx][1])
|
| 87 |
+
# gt_depth = cv2.imread(depth_name, -1)
|
| 88 |
+
# gt_depth = cv2.resize(gt_depth, dsize=(self.w, self.h), interpolation=cv2.INTER_NEAREST)
|
| 89 |
+
# gt_depth = gt_depth.astype(float)/4000
|
| 90 |
+
# gt_depth[gt_depth > self.max_depth_meters+1] = self.max_depth_meters + 1
|
| 91 |
+
|
| 92 |
+
gt_depth = pyexr.open(depth_name).get()
|
| 93 |
+
gt_depth = gt_depth[:, :, 0]
|
| 94 |
+
gt_depth = cv2.resize(gt_depth, dsize=(self.w, self.h), interpolation=cv2.INTER_NEAREST)
|
| 95 |
+
gt_depth[gt_depth > self.max_depth_meters+1] = self.max_depth_meters + 1
|
| 96 |
+
|
| 97 |
+
if self.is_training and self.yaw_rotation_augmentation:
|
| 98 |
+
# random yaw rotation
|
| 99 |
+
roll_idx = random.randint(0, self.w)
|
| 100 |
+
rgb = np.roll(rgb, roll_idx, 1)
|
| 101 |
+
gt_depth = np.roll(gt_depth, roll_idx, 1)
|
| 102 |
+
|
| 103 |
+
if self.is_training and self.LR_filp_augmentation and random.random() > 0.5:
|
| 104 |
+
rgb = cv2.flip(rgb, 1)
|
| 105 |
+
gt_depth = cv2.flip(gt_depth, 1)
|
| 106 |
+
|
| 107 |
+
if self.is_training and self.color_augmentation and random.random() > 0.5:
|
| 108 |
+
aug_rgb = np.asarray(self.color_aug(transforms.ToPILImage()(rgb)))
|
| 109 |
+
else:
|
| 110 |
+
aug_rgb = rgb.copy()
|
| 111 |
+
|
| 112 |
+
aug_rgb = self.to_tensor(aug_rgb.copy())
|
| 113 |
+
|
| 114 |
+
gt_depth = torch.from_numpy(np.expand_dims(gt_depth, axis=0)).to(torch.float32)
|
| 115 |
+
|
| 116 |
+
val_mask = ((gt_depth > 0) & (gt_depth <= self.max_depth_meters)& ~torch.isnan(gt_depth))
|
| 117 |
+
|
| 118 |
+
# _min, _max = torch.quantile(gt_depth[val_mask], torch.tensor([0.02, 1 - 0.02]),)
|
| 119 |
+
# gt_depth = gt_depth / 2560.0
|
| 120 |
+
gt_depth_norm = gt_depth / 100.0
|
| 121 |
+
gt_depth_norm = torch.clip(gt_depth_norm, 0.001, 1.0)
|
| 122 |
+
|
| 123 |
+
# print(gt_depth_norm.shape)
|
| 124 |
+
# Conduct output
|
| 125 |
+
inputs = {}
|
| 126 |
+
|
| 127 |
+
inputs["rgb"] = self.normalize(aug_rgb)
|
| 128 |
+
inputs["gt_depth"] = gt_depth_norm
|
| 129 |
+
inputs["val_mask"] = val_mask # 合法区域,不是全true,真把不能用的��域划出来了;其他参与训练的数据集是全true的(除了投影数据集)
|
| 130 |
+
inputs["mask_100"] = (gt_depth > 0) & (gt_depth <= 100)
|
| 131 |
+
# 对于这个数据集,mask_100设定为全true的,因为求不出来。大于100米的深度gt也有可能是玻璃镜子等物体,反正这个数据集也不参加训练
|
| 132 |
+
|
| 133 |
+
# 这个数据集中,模型预测的mask100应该是被val_mask涵盖的,所以mask100理论上没有影响
|
| 134 |
+
# val_mask控制计算指标的区域
|
| 135 |
+
return inputs
|
datasets/__init__.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .stanford2d3d import Stanford2D3D
|
| 2 |
+
from .deep360 import Deep360
|
| 3 |
+
from .insta23k import Insta23k
|
| 4 |
+
from .M3D import M3D
|
datasets/__pycache__/M3D.cpython-310.pyc
ADDED
|
Binary file (3.75 kB). View file
|
|
|
datasets/__pycache__/M3D.cpython-311.pyc
ADDED
|
Binary file (7.18 kB). View file
|
|
|
datasets/__pycache__/M3D.cpython-312.pyc
ADDED
|
Binary file (6.97 kB). View file
|
|
|
datasets/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (329 Bytes). View file
|
|
|
datasets/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (1.18 kB). View file
|
|
|
datasets/__pycache__/__init__.cpython-312.pyc
ADDED
|
Binary file (1.17 kB). View file
|
|
|
datasets/__pycache__/blendedmvsfordistance.cpython-310.pyc
ADDED
|
Binary file (6.53 kB). View file
|
|
|
datasets/__pycache__/blendedmvsfordistance.cpython-311.pyc
ADDED
|
Binary file (14.1 kB). View file
|
|
|
datasets/__pycache__/blendedmvsfordistance.cpython-312.pyc
ADDED
|
Binary file (12.9 kB). View file
|
|
|
datasets/__pycache__/blendedmvsfordistance_.cpython-310.pyc
ADDED
|
Binary file (4.18 kB). View file
|
|
|
datasets/__pycache__/blendedmvsfordistance_.cpython-311.pyc
ADDED
|
Binary file (8.29 kB). View file
|
|
|
datasets/__pycache__/blendedmvsfordistance_.cpython-312.pyc
ADDED
|
Binary file (7.88 kB). View file
|
|
|
datasets/__pycache__/deep360.cpython-310.pyc
ADDED
|
Binary file (5.46 kB). View file
|
|
|
datasets/__pycache__/deep360.cpython-311.pyc
ADDED
|
Binary file (11.7 kB). View file
|
|
|
datasets/__pycache__/deep360.cpython-312.pyc
ADDED
|
Binary file (11.6 kB). View file
|
|
|
datasets/__pycache__/deep360_dis.cpython-310.pyc
ADDED
|
Binary file (5.91 kB). View file
|
|
|
datasets/__pycache__/deep360_dis.cpython-312.pyc
ADDED
|
Binary file (13.1 kB). View file
|
|
|
datasets/__pycache__/haoran_6w.cpython-310.pyc
ADDED
|
Binary file (3.11 kB). View file
|
|
|
datasets/__pycache__/inference_dataset.cpython-310.pyc
ADDED
|
Binary file (1.59 kB). View file
|
|
|
datasets/__pycache__/insta23k.cpython-310.pyc
ADDED
|
Binary file (3.6 kB). View file
|
|
|
datasets/__pycache__/insta23k.cpython-311.pyc
ADDED
|
Binary file (7.08 kB). View file
|
|
|
datasets/__pycache__/insta23k.cpython-312.pyc
ADDED
|
Binary file (6.92 kB). View file
|
|
|
datasets/__pycache__/insta23k_dis.cpython-310.pyc
ADDED
|
Binary file (4.27 kB). View file
|
|
|
datasets/__pycache__/insta23k_dis.cpython-312.pyc
ADDED
|
Binary file (9.87 kB). View file
|
|
|
datasets/__pycache__/matterport3d.cpython-310.pyc
ADDED
|
Binary file (3.69 kB). View file
|
|
|
datasets/__pycache__/matterport3d.cpython-311.pyc
ADDED
|
Binary file (6.85 kB). View file
|
|
|
datasets/__pycache__/matterport3d.cpython-312.pyc
ADDED
|
Binary file (6.61 kB). View file
|
|
|
datasets/__pycache__/matterport3d_robust.cpython-310.pyc
ADDED
|
Binary file (2.91 kB). View file
|
|
|
datasets/__pycache__/matterport3d_robust.cpython-311.pyc
ADDED
|
Binary file (5.63 kB). View file
|
|
|
datasets/__pycache__/matterport3d_robust.cpython-312.pyc
ADDED
|
Binary file (5.27 kB). View file
|
|
|
datasets/__pycache__/npy_dataset.cpython-310.pyc
ADDED
|
Binary file (2.13 kB). View file
|
|
|
datasets/__pycache__/real_world30w.cpython-310.pyc
ADDED
|
Binary file (3.18 kB). View file
|
|
|
datasets/__pycache__/real_world_indoor.cpython-310.pyc
ADDED
|
Binary file (3.15 kB). View file
|
|
|
datasets/__pycache__/simdupano.cpython-310.pyc
ADDED
|
Binary file (4.48 kB). View file
|
|
|
datasets/__pycache__/sintelfordistance.cpython-310.pyc
ADDED
|
Binary file (6.25 kB). View file
|
|
|
datasets/__pycache__/sintelfordistance.cpython-311.pyc
ADDED
|
Binary file (13.2 kB). View file
|
|
|
datasets/__pycache__/sintelfordistance.cpython-312.pyc
ADDED
|
Binary file (12.5 kB). View file
|
|
|
datasets/__pycache__/sintelfordistance_.cpython-310.pyc
ADDED
|
Binary file (4.02 kB). View file
|
|
|
datasets/__pycache__/sintelfordistance_.cpython-311.pyc
ADDED
|
Binary file (7.88 kB). View file
|
|
|