- Depth Pro: Sharp Monocular Metric Depth in Less Than a Second
- Depth Pro official GitHub
- 2d image -> depth & focal length
- set up a virtual environment.
cd Depth_Pro
git clone https://github.com/apple/ml-depth-pro
cd ml-depth-pro
conda create -n depth-pro -y python=3.9
conda activate depth-pro
pip install -e .
pip install onnx
pip install onnxsim
pip install onnxscript
- download pretrained checkpoints.
source get_pretrained_models.sh # Files will be downloaded to `checkpoints` directory.
- run the original pytorch model on a single test image.
depth-pro-run -i ./data/example.jpg -o ./results
- check pytorch model inference performance
cd ..
python infer.py
- 1536 x 1536 input
- see results/example_Torch.jpg
- 20 iterations time: 124.4491 [sec]
- Average FPS: 0.16 [fps]
- Average inference time: 6222.46 [msec]
- generate onnx file
python onnx_export.py
// a file 'depth_pro_dynamo.onnx' will be generated in onnx directory.
conda activate trte
2-1. build tensorrt model and run single image process
python onnx2trt.py
// a file 'depth_pro_dynamo_fp16.engine' will be generated in engine directory.
- 1536 x 1536 input
- see results/example_TRT.jpg
- 20 iterations time: 14.1636 [sec]
- Average FPS: 1.41 [fps]
- Average inference time: 708.18 [msec]
2-2. build tensorrt model and run video process
python onnx2trt_video.py
2-3. build tensorrt model and run wabcam process
python onnx2trt_webcam.py
2-4. build tensorrt model and generate point cloud file process
python onnx2trt_pointcloud.py