Skip to content

Experimental TensorRT implementation of apple ml-depth-pro for faster inference

Notifications You must be signed in to change notification settings

yuvraj108c/ml-depth-pro-tensorrt

Repository files navigation

ML-Depth-Pro TensorRT ⚡

python cuda trt



This project provides an experimental TensorRT implementation of ml-depth-pro by Apple, enabling faster inference speeds, at the cost of quality. Feel free to contribute to improve the quality of the result.

If you like the project, please give me a star! ⭐


⏱️ Performance

Note: Inference was done in FP16, with a warm-up period of 5 frames. The reported time corresponds to the last inference.

Device Model Resolution Inference Time (ms)
H100 1536 x 1536 63

🚀 Installation (onnx export + tensorrt)

git clone https://github.com/apple/ml-depth-pro
cd ./ml-depth-pro
pip install -e .
bash get_pretrained_models.sh

git clone https://github.com/yuvraj108c/ml-depth-pro-tensorrt
mv ./ml-depth-pro-tensorrt/* . && rm -r ./ml-depth-pro-tensorrt
pip install -r requirements.txt

🚀 Installation (prebuilt onnx model + tensorrt)

git clone https://github.com/yuvraj108c/ml-depth-pro-tensorrt
pip install -r requirements.txt

🛠️ Building onnx

You can download the prebuilt onnx model from here or build it yourself by running:

python export_onnx.py 

🛠️ Building tensorrt

python export_trt.py 

⚡ Inference on single image

python infer_trt.py 

📓 Notes

  • The model currently supports images with a fixed resolution of 1536 x 1536
  • There is a noticeable loss of quality, even at FP32, compared to the native pytorch implementation

🤖 Environment tested

Ubuntu 22.04 LTS, Cuda 12.4, Tensorrt 10.5.0, Python 3.10, H100 GPU

👏 Credits

About

Experimental TensorRT implementation of apple ml-depth-pro for faster inference

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages