Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to predict or inference on a single figure when performing depth estimation? #6

Open
QinganZhang opened this issue May 15, 2023 · 1 comment

Comments

@QinganZhang
Copy link

I want to predict or inference on some figures instead of evaluting on NYUv2 to perform depth estimation, how should I do? I have some figures and I just hope to have a look of the performance on your model or method.

I just have a try, but I get confused when handling my own dataset(only test on dozens of figures) and meet some error.

So I wonder whether there is a convenient way or modifying least codes to do inference on a single figure? Thanks a lot.

@adam-kosinski
Copy link

adam-kosinski commented Jun 6, 2023

@QinganZhang I was able to get it to run on my own images by running one of the evaluation commands, and changing a few options, based on the GLPDepth documentation (inference section), since this test script is adapted from GLPDepth.

  • change --dataset to imagepath
  • change --data_path to the directory with your images, make sure your images end in lowercase .jpg or .png
  • add the --save_visualize option, saves visualizations in the results/ directory
  • remove the --do_evaluate option, I think it caused an error because my images didn't have depths associated

Remember to download the ckpt file (or train to get it I guess?) and put it in the ckpt directory. Also see #1 if you're having errors about multiple devices.

For example:

python3 test.py --dataset imagepath --data_path my_images --save_visualize --max_depth 10.0 --max_depth_eval 10.0  --backbone swin_base_v2 --depths 2 2 18 2 --num_filters 32 32 32 --deconv_kernels 2 2 2 --window_size 30 30 30 15 --pretrain_window_size 12 12 12 6 --use_shift True True False False --flip_test --shift_window_test --shift_size 2 --ckpt_dir ckpt/nyudepthv2_swin_base.ckpt

Though I was getting weird results where it looked like it processed cropped rectangular blocks of the image one at a time, causing abrupt transitions in the depth estimate between the blocks. Probably has something to do with the sliding window thing / batch size / some cropping thing, but I haven't figured that out yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants