facebookresearch / consistent_depth

We estimate dense, flicker-free, geometrically consistent depth from monocular video, for example hand-held cell phone video.
MIT License
1.62k stars 235 forks source link

implement docker support #14

Open timmh opened 4 years ago

timmh commented 4 years ago

This PR adds a Dockerfile (and .dockerignore). The image can be built using docker build -t consistent_depth .. An example invokation is:

docker run --rm --gpus all \
    -v $INPUT_DIR:/opt/consistent_depth/input \
    -v $OUTPUT_DIR:/opt/consistent_depth/output \
    consistent_depth python main.py \
    --video_file input/ayush.mp4 --path output --make_video

Please let me know if I should add some documentation to the readme.

mattclifford1 commented 3 years ago

I've noticed that this uses cuda 10.2. Does this work with colmap and the pytorch dependency used (torch==1.4.0+cu100)? I'm happy to test things on my machine also if you need.

timmh commented 3 years ago

I've noticed that this uses cuda 10.2. Does this work with colmap and the pytorch dependency used (torch==1.4.0+cu100)? I'm happy to test things on my machine also if you need.

Yes, it does work, you can test it by running the commands above.

Makio64 commented 3 years ago

Hi, I got this error when I execute the image :

ERROR conda.cli.main_run:execute(33): Subprocess for 'conda run ['python', 'main.py', '--video_file', 'input/ayush.mp4', '--path', 'output', '--make_video']' command failed.  (See above for error)
Traceback (most recent call last):
  File "main.py", line 4, in <module>
    from params import Video3dParamsParser
  File "/opt/consistent_depth/params.py", line 6, in <module>
    from monodepth.depth_model_registry import get_depth_model, get_depth_model_list
  File "/opt/consistent_depth/monodepth/depth_model_registry.py", line 5, in <module>
    from .mannequin_challenge_model import MannequinChallengeModel
  File "/opt/consistent_depth/monodepth/mannequin_challenge_model.py", line 10, in <module>
    from .mannequin_challenge.models import pix2pix_model
ModuleNotFoundError: No module named 'monodepth.mannequin_challenge.models'
timmh commented 3 years ago

@Makio64 this may happen if the monodepth git submodules are missing. Please make sure to git clone --recursive initially or git submodule update --init --recursive in your existing git repo, then rebuild the docker image

BarRozenman commented 2 years ago

I tried to use the docker file on mu system but i get:

Traceback (most recent call last):
  File "main.py", line 13, in <module>
    dp.process(params)
  File "/opt/consistent_depth/process.py", line 117, in process
    return self.pipeline(params)
  File "/opt/consistent_depth/process.py", line 60, in pipeline
    ft.save_depth(initial_depth_dir)
  File "/opt/consistent_depth/depth_fine_tuning.py", line 190, in save_depth
    depth = self.model.forward(stacked_images, metadata)
  File "/opt/consistent_depth/monodepth/depth_model.py", line 23, in forward
    depth = self.estimate_depth(images)
  File "/opt/consistent_depth/monodepth/mannequin_challenge_model.py", line 60, in estimate_depth
    self.model.prediction_d, _ = self.model.netG.forward(images)
  File "/opt/miniconda/envs/consistent_depth/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 150, in forward
    return self.module(*inputs[0], **kwargs[0])
  File "/opt/miniconda/envs/consistent_depth/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in __call__
    result = self.forward(*input, **kwargs)
  File "/opt/consistent_depth/monodepth/mannequin_challenge/models/hourglass.py", line 176, in forward
    pred_feature = self.seq(input_)
  File "/opt/miniconda/envs/consistent_depth/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in __call__
    result = self.forward(*input, **kwargs)
  File "/opt/miniconda/envs/consistent_depth/lib/python3.6/site-packages/torch/nn/modules/container.py", line 100, in forward
    input = module(input)
  File "/opt/miniconda/envs/consistent_depth/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in __call__
    result = self.forward(*input, **kwargs)
  File "/opt/miniconda/envs/consistent_depth/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 345, in forward
    return self.conv2d_forward(input, self.weight)
  File "/opt/miniconda/envs/consistent_depth/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 342, in conv2d_forward
    self.padding, self.dilation, self.groups)
RuntimeError: cuDNN error: CUDNN_STATUS_EXECUTION_FAILED

when running:


sudo docker run --gpus all -it --entrypoint /bin/bash\
 -v /mydata/consistent_depth:/mnt/  consistentdepth

and then inside the docker terminal:

conda run -n consistent_depth python main.py     --video_file input/vid1_snippet.mp4 --path output --make_video

my system: Ubuntu 18.02 GPU: NVIDIA GeForce RTX 3060 Ti/PCIe/SSE2 I have installed NVIDIA Container Toolkit (https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html) and I successfully run CUDA on other docker containers

did anyone stable across this issue? please help