AdelaiDepth is an open source toolbox for monocular depth prediction.

Overview

AdelaiDepth

AdelaiDepth is an open source toolbox for monocular depth prediction. All works from our group are open-sourced here.

AdelaiDepth contains the following algorithms:

Results:

  • LeReS

You may want to check this video which provides a very brief introduction to the work:

RGB Depth Point Cloud

Depth

BibTeX

@inproceedings{Yin2019enforcing,
  title={Enforcing geometric constraints of virtual normal for depth prediction},
  author={Yin, Wei and Liu, Yifan and Shen, Chunhua and Yan, Youliang},
  booktitle= {The IEEE International Conference on Computer Vision (ICCV)},
  year={2019}
}

@article{yin2020diversedepth,
  title={Diversedepth: Affine-invariant depth prediction using diverse data},
  author={Yin, Wei and Wang, Xinlong and Shen, Chunhua and Liu, Yifan and Tian, Zhi and Xu, Songcen and Sun, Changming and Renyin, Dou},
  journal={arXiv preprint arXiv:2002.00569},
  year={2020}
}

@inproceedings{Wei2021CVPR,
  title     =  {Learning to Recover 3D Scene Shape from a Single Image},
  author    =  {Wei Yin and Jianming Zhang and Oliver Wang and Simon Niklaus and Long Mai and Simon Chen and Chunhua Shen},
  booktitle =  {Proc. IEEE Conf. Comp. Vis. Patt. Recogn. (CVPR)},
  year      =  {2021}
}

License

The LeReS project is under a non-commercial license from Adobe Research. See the LICENSE file for details.

Other depth prediction projects are licensed under the 2-clause BSD License - see the LICENSE file for details. For commercial use, please contact Chunhua Shen.

Comments
  • RuntimeError: stack expects a non-empty TensorList

    RuntimeError: stack expects a non-empty TensorList

    Hi, When I configure the environment as required, I can run sh train_demo.sh with the code that has not been updated before, but running sh train.sh for a period of time will report an error:“AttributeError:‘NoneType’ object has no attribute ‘lower’”。

    Download the latest code to run the training code (sh train_demo.sh/sh train.sh). The error display: "runtimeerror: stack expectations a non empty tensorlist". How to solve this problem?

    opened by lw0210 10
  • 'NoneType' object is not subscriptable

    'NoneType' object is not subscriptable

    processing (0000)-th image... ./test_images/.ipynb_checkpoints
    Traceback (most recent call last):
      File "./tools/test_shape.py", line 111, in <module>
        rgb_c = rgb[:, :, ::-1].copy()
    TypeError: 'NoneType' object is not subscriptable
    

    Though I have I uploaded the images in the test_images folder but I am getting "None Type" error.

    I am facing the above error while I am executing the Test 3D reconstruction from a single image. Can anyone help me to sort out this issue.

    Thanks in Advance.

    opened by srikanth-midde 8
  • Some questions about train data

    Some questions about train data

    Thanks for your great work, I have some questions about the train dataset:

    1. what dataset did you used to train the pretained model which you provided, are DIML and 3D Ken Burns which in your paper used?
    2. In the dataset you provide on github, I didn't see DIML and 3D Ken Burns dataset, are they in DiverseDepth or they are not provided? If so, how should I prepare these two datasets?
    3. In your paper, relative depth of Holopix50K are generated using FlowNet, how can I generate relative depth of my own stereo data?
    opened by erzhu222 6
  • Test_shape failed with torchsparse 1.2

    Test_shape failed with torchsparse 1.2

    Good work! I manged to get the shape using Test_shape.py but when using test_shape.py, I faced this error: processing (0000)-th image... LeReS/test_images/5.jpg Traceback (most recent call last): File "LeReS/tools/test_shape.py", line 123, in shift, focal_length, depth_scaleinv = reconstruct3D_from_depth(rgb, pred_depth_ori, File "LeReS/tools/test_shape.py", line 76, in reconstruct3D_from_depth shift_1 = refine_shift(pred_depth_norm, shift_model, predicted_focal_1, cam_u0, cam_v0) File "/home/adelai_ws/AdelaiDepth/LeReS/lib/test_utils.py", line 124, in refine_shift shift = refine_shift_one_step(depth_wshift_tmp, model, focal, u0, v0) File "/home/adelai_ws/AdelaiDepth/LeReS/lib/test_utils.py", line 108, in refine_shift_one_step outputs = model(inputs) File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/home/trainer/adelai_ws/AdelaiDepth/LeReS/lib/spvcnn_classsification.py", line 148, in forward x2 = self.stage2(x1) File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/container.py", line 141, in forward input = module(input) File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/home/trainer/adelai_ws/AdelaiDepth/LeReS/lib/spvcnn_classsification.py", line 23, in forward out = self.net(x) File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/container.py", line 141, in forward input = module(input) File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/usr/local/lib/python3.8/dist-packages/torchsparse/nn/modules/conv.py", line 72, in forward return conv3d(inputs, File "/usr/local/lib/python3.8/dist-packages/torchsparse/nn/functional/conv.py", line 118, in conv3d idx_query = list(convert_neighbor_map_gpu(idx_query)) File "/usr/local/lib/python3.8/dist-packages/torchsparse/nn/functional/convert_neighbor_map.py", line 9, in forward idx_batch, idx_point = torch.where(neighbor_map != -1) ValueError: not enough values to unpack (expected 2, got 1)

    opened by bingting1022 5
  • Test_shape failed with torchsparse 1.2

    Test_shape failed with torchsparse 1.2

    Good work! I manged to get the shape using Test_shape.py but when using test_shape.py, I faced this error:

    root@PC:/home/adelai_ws/AdelaiDepth# python3 LeReS/tools/test_shape.py --load_ckpt res101.pth --backbone resnext101
    No protocol specified
    processing (0000)-th image... LeReS/test_images/5.jpg
    Traceback (most recent call last):
      File "LeReS/tools/test_shape.py", line 123, in <module>
        shift, focal_length, depth_scaleinv = reconstruct3D_from_depth(rgb, pred_depth_ori,
      File "LeReS/tools/test_shape.py", line 76, in reconstruct3D_from_depth
        shift_1 = refine_shift(pred_depth_norm, shift_model, predicted_focal_1, cam_u0, cam_v0)
      File "/home/adelai_ws/AdelaiDepth/LeReS/lib/test_utils.py", line 124, in refine_shift
        shift = refine_shift_one_step(depth_wshift_tmp, model, focal, u0, v0)
      File "/home/adelai_ws/AdelaiDepth/LeReS/lib/test_utils.py", line 108, in refine_shift_one_step
        outputs = model(inputs)
      File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl
        return forward_call(*input, **kwargs)
      File "/home/trainer/adelai_ws/AdelaiDepth/LeReS/lib/spvcnn_classsification.py", line 148, in forward
        x2 = self.stage2(x1)
      File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl
        return forward_call(*input, **kwargs)
      File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/container.py", line 141, in forward
        input = module(input)
      File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl
        return forward_call(*input, **kwargs)
      File "/home/trainer/adelai_ws/AdelaiDepth/LeReS/lib/spvcnn_classsification.py", line 23, in forward
        out = self.net(x)
      File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl
        return forward_call(*input, **kwargs)
      File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/container.py", line 141, in forward
        input = module(input)
      File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl
        return forward_call(*input, **kwargs)
      File "/usr/local/lib/python3.8/dist-packages/torchsparse/nn/modules/conv.py", line 72, in forward
        return conv3d(inputs,
      File "/usr/local/lib/python3.8/dist-packages/torchsparse/nn/functional/conv.py", line 118, in conv3d
        idx_query = list(convert_neighbor_map_gpu(idx_query))
      File "/usr/local/lib/python3.8/dist-packages/torchsparse/nn/functional/convert_neighbor_map.py", line 9, in forward
        idx_batch, idx_point = torch.where(neighbor_map != -1)
    ValueError: not enough values to unpack (expected 2, got 1)
    
    

    I tried another version (1.4) but there is a change in the API. Any suggestions? Thanks!

    opened by YoushaaMurhij 5
  • Question about the multi-scale gradient loss

    Question about the multi-scale gradient loss

    Thanks for the good work! I have some questions about the multi-scale gradient loss used in the paper. Here is the code of MegaDepth [24], but I think it is different from the grad_loss used in this method.

    def GradientLoss(self, log_prediction_d, mask, log_gt):
            N = torch.sum(mask)
            log_d_diff = log_prediction_d - log_gt
            log_d_diff = torch.mul(log_d_diff, mask)
    
            v_gradient = torch.abs(log_d_diff[0:-2, :] - log_d_diff[2:, :])
            v_mask = torch.mul(mask[0:-2, :], mask[2:, :])
            v_gradient = torch.mul(v_gradient, v_mask)
    
            h_gradient = torch.abs(log_d_diff[:, 0:-2] - log_d_diff[:, 2:])
            h_mask = torch.mul(mask[:, 0:-2], mask[:, 2:])
            h_gradient = torch.mul(h_gradient, h_mask)
    
            gradient_loss = torch.sum(h_gradient) + torch.sum(v_gradient)
            gradient_loss = gradient_loss / N
    
            return gradient_loss
    

    Should I use depth with 'log' without any constraint to make 'prediction_d'>0?

    opened by ewrfcas 5
  • module 'torchsparse_backend' has no attribute 'hash_forward

    module 'torchsparse_backend' has no attribute 'hash_forward

    Hi!

    I'm having this problem here with and import statement from Torchsparse(version 1.2.0 as fixed in the last commit): module 'torchsparse_backend' has no attribute 'hash_forward I tried to ask the solution on Torchsparse repo, but they ask to update to 1.4.0, but that version breaks a lot of other import statements.

    Does anyone know the solution?

    Thanks in advance!

    opened by LeonardoCBoar 5
  • KeyError: 'model_state_dict'

    KeyError: 'model_state_dict'

    Thanks for the great repository. I ran the Train.sh file for fine tuning with the original data from the res50.pth file and got the following error. How can I solve this error?

    Thank you

    Traceback (most recent call last): File "../tools/train.py", line 290, in main() File "../tools/train.py", line 286, in main main_worker(0, ngpus_per_node, train_args, val_args) File "../tools/train.py", line 221, in main_worker load_ckpt(train_args, model, optimizer.optimizer, scheduler, val_err) File "/home/robotics/AdelaiDepth/LeReS/Train/lib/utils/net_tools.py", line 44, in load_ckpt checkpoint_state_dict_noprefix = strip_prefix_if_present(checkpoint['model_state_dict'], "module.") KeyError: 'model_state_dict'

    opened by 283pm 4
  • AttributeError: 'NoneType' object has no attribute 'lower'

    AttributeError: 'NoneType' object has no attribute 'lower'

    Dear, I download your dataset (taskeconomy, diversedepth, hwrsi and holopix50k) by running sh Download_ data. sh, and run your recently updated code. I can run sh train_ demo. sh, but cannot run sh train.sh. I modify the parameter dataset_ list in train.sh (only HWRSI is left,others are not allowed), you can run for a while and then report an error:

    AttributeError: 'NoneType' object has no attribute 'lower'

    I think it is the lack of content in the datasets.Can you check your dataset?Thanks!

    opened by lw0210 4
  • FileNotFoundError

    FileNotFoundError

    Dear,where is the 'Holopix50k/annotations/val_annotations.json'? I only get Holopix50k/annotations/all_annotations.json after I run the command 'sh download_data.sh'.

    opened by lw0210 4
  • Depth recovery issue

    Depth recovery issue

    Thank you for your contribution. In the same scene, the change of camera attitude will lead to the scale recovery parameter a, and b will also change accordingly. Is it possible to recover more robust scale parameters for the same scene?

    opened by jing98tian 4
  • No locally scaled-aligned (lwlr_depth ) code found

    No locally scaled-aligned (lwlr_depth ) code found

    Hi, Have you uploaded the code about recovering depth metric from locally scale-aligned weight. I didn't found the code in project. Please kindly share them. Thanks a lot

    opened by hwdddd 1
  • #@title Download results

    #@title Download results

    /content/AdelaiDepth/LeReS/test_images

    zip error: Nothing to do! (result.zip)

    FileNotFoundError Traceback (most recent call last) in 3 get_ipython().run_line_magic('cd', '/content/AdelaiDepth/LeReS/test_images/') 4 get_ipython().system('find outputs/ -name "*-depth_raw.png" | zip -r result.zip -@') ----> 5 files.download("result.zip")

    /usr/local/lib/python3.7/dist-packages/google/colab/files.py in download(filename) 207 if not _os.path.exists(filename): 208 msg = 'Cannot find file: {}'.format(filename) --> 209 raise FileNotFoundError(msg) # pylint: disable=undefined-variable 210 211 comm_manager = _IPython.get_ipython().kernel.comm_manager

    FileNotFoundError: Cannot find file: result.zip

    opened by anupkumarmridha 1
  • cannot import name 'sparse_collate_fn' from 'torch_sparse.utils'

    cannot import name 'sparse_collate_fn' from 'torch_sparse.utils'

    hello ,I can't find those two function in torch_sparse.utils and pytorch official doc. I have checked this file,I've looked into this file, but there are none of these two functions 2022-10-19 10-11-11 的屏幕截图

    2022-10-19 10-08-38 的屏幕截图

    Could you help me, what should I do?

    opened by wty3515 1
  • Strange size of output files for train

    Strange size of output files for train

    Hello, I tried to use your train_demo.sh script. After 200 epoch I don't have any progress on test dataset. I attached files with my environment, log and output folder. Could you help me, what I'm doing wrong? Oct11-14-37-36_MSISPlap03.txt Untitled env.txt image

    opened by ori30ffs 1
  • 360 point cloud animation video

    360 point cloud animation video

    Hi,

    Thanks for the great work!

    Is there a visualization script to generate the 360 point cloud animation video or did you use a specific tool for this?

    Thanks!

    opened by jaykar21 1
Owner
Adelaide Intelligent Machines (AIM) Group
Adelaide Intelligent Machines (AIM) Group
Monocular Depth Estimation Using Laplacian Pyramid-Based Depth Residuals

LapDepth-release This repository is a Pytorch implementation of the paper "Monocular Depth Estimation Using Laplacian Pyramid-Based Depth Residuals" M

Minsoo Song 205 Dec 30, 2022
Code for Transformers Solve Limited Receptive Field for Monocular Depth Prediction

Official PyTorch code for Transformers Solve Limited Receptive Field for Monocular Depth Prediction. Guanglei Yang, Hao Tang, Mingli Ding, Nicu Sebe,

stanley 152 Dec 16, 2022
Code and datasets for the paper "Combining Events and Frames using Recurrent Asynchronous Multimodal Networks for Monocular Depth Prediction" (RA-L, 2021)

Combining Events and Frames using Recurrent Asynchronous Multimodal Networks for Monocular Depth Prediction This is the code for the paper Combining E

Robotics and Perception Group 69 Dec 26, 2022
Beyond Image to Depth: Improving Depth Prediction using Echoes (CVPR 2021)

Beyond Image to Depth: Improving Depth Prediction using Echoes (CVPR 2021) Kranti Kumar Parida, Siddharth Srivastava, Gaurav Sharma. We address the pr

Kranti Kumar Parida 33 Jun 27, 2022
Categorical Depth Distribution Network for Monocular 3D Object Detection

CaDDN CaDDN is a monocular-based 3D object detection method. This repository is based off of [OpenPCDet]. Categorical Depth Distribution Network for M

Toronto Robotics and AI Laboratory 289 Jan 5, 2023
Official implementation of the network presented in the paper "M4Depth: A motion-based approach for monocular depth estimation on video sequences"

M4Depth This is the reference TensorFlow implementation for training and testing depth estimation models using the method described in M4Depth: A moti

Michaël Fonder 76 Jan 3, 2023
Boosting Monocular Depth Estimation Models to High-Resolution via Content-Adaptive Multi-Resolution Merging

Boosting Monocular Depth Estimation Models to High-Resolution via Content-Adaptive Multi-Resolution Merging This repository contains an implementation

Computational Photography Lab @ SFU 1.1k Jan 2, 2023
[CVPR 2021] Monocular depth estimation using wavelets for efficiency

Single Image Depth Prediction with Wavelet Decomposition Michaël Ramamonjisoa, Michael Firman, Jamie Watson, Vincent Lepetit and Daniyar Turmukhambeto

Niantic Labs 205 Jan 2, 2023
[ICCV 2021] Excavating the Potential Capacity of Self-Supervised Monocular Depth Estimation

EPCDepth EPCDepth is a self-supervised monocular depth estimation model, whose supervision is coming from the other image in a stereo pair. Details ar

Rui Peng 110 Dec 23, 2022
Advancing Self-supervised Monocular Depth Learning with Sparse LiDAR

Official implementation for paper "Advancing Self-supervised Monocular Depth Learning with Sparse LiDAR"

Ziyue Feng 72 Dec 9, 2022
This repo is for Self-Supervised Monocular Depth Estimation with Internal Feature Fusion(arXiv), BMVC2021

DIFFNet This repo is for Self-Supervised Monocular Depth Estimation with Internal Feature Fusion(arXiv), BMVC2021 A new backbone for self-supervised d

Hang 3 Oct 22, 2021
Apply our monocular depth boosting to your own network!

MergeNet - Boost Your Own Depth Boost custom or edited monocular depth maps using MergeNet Input Original result After manual editing of base You can

Computational Photography Lab @ SFU 142 Dec 17, 2022
the official code for ICRA 2021 Paper: "Multimodal Scale Consistency and Awareness for Monocular Self-Supervised Depth Estimation"

G2S This is the official code for ICRA 2021 Paper: Multimodal Scale Consistency and Awareness for Monocular Self-Supervised Depth Estimation by Hemang

NeurAI 4 Jul 27, 2022
SimpleDepthEstimation - An unified codebase for NN-based monocular depth estimation methods

SimpleDepthEstimation Introduction This is an unified codebase for NN-based monocular depth estimation methods, the framework is based on detectron2 (

null 8 Dec 13, 2022
ONNX-GLPDepth - Python scripts for performing monocular depth estimation using the GLPDepth model in ONNX

ONNX-GLPDepth - Python scripts for performing monocular depth estimation using the GLPDepth model in ONNX

Ibai Gorordo 18 Nov 6, 2022
ONNX-PackNet-SfM: Python scripts for performing monocular depth estimation using the PackNet-SfM model in ONNX

Python scripts for performing monocular depth estimation using the PackNet-SfM model in ONNX

Ibai Gorordo 14 Dec 9, 2022
Repository for "Toward Practical Monocular Indoor Depth Estimation" (CVPR 2022)

Toward Practical Monocular Indoor Depth Estimation Cho-Ying Wu, Jialiang Wang, Michael Hall, Ulrich Neumann, Shuochen Su [arXiv] [project site] DistDe

Meta Research 122 Dec 13, 2022
The implemention of Video Depth Estimation by Fusing Flow-to-Depth Proposals

Flow-to-depth (FDNet) video-depth-estimation This is the implementation of paper Video Depth Estimation by Fusing Flow-to-Depth Proposals Jiaxin Xie,

null 32 Jun 14, 2022
Python script for performing depth completion from sparse depth and rgb images using the msg_chn_wacv20. model in ONNX

ONNX msg_chn_wacv20 depth completion Python script for performing depth completion from sparse depth and rgb images using the msg_chn_wacv20 model in

Ibai Gorordo 19 Oct 22, 2022