depth.py
is for generating .depthviewer
files so that it can be opened with the DepthViewer.
Also check the MiDaS github page.
- Install Python3. The version I use is
3.9.6
. By default the program callspython
, assuming it is on PATH. This can be changed in the options menu. - Install OpenCV and Numpy.
pip install opencv-python numpy
- (Optional but recommended) Install CUDA. You may want to get the version 11.7; see below.
- Install Pytorch that matches your environment from here. For me (win64 cuda11.7) it is
pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu117
- Install timm for MiDaS.
pip install timm
- Go to the directory
depthpy
and run
python depth.py --help
and see if it prints the manual without any error. - Get
dpt_hybrid_384
model (and others) from here and locate them indepthpy/weights
. Do not change the filenames. (Other models can be loaded by adding the-t
argument, see--help
for more.) - Place any image in the
depthpy
directory, rename it totest.jpg
(ortest.png
) and run
python depth.py test.jpg out.depthviewer -i
See if it generates an output. Also check ifdepth.py
is using CUDA by checkingdevice: cuda
line.
- Check the installed CUDA version and if the installed Pytorch version supports that.
- Uninstall Pytorch
pip uninstall torch torchvision
and reinstall it.
- Install Flask
pip install Flask
- Run
python depthserver.py
to open the server and connect to it via the option menu. If it's connected all image inputs will be processed by calling the server.
See ../../README.md