Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
xa1on committed Aug 21, 2024
1 parent fa093d2 commit 928ba7c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
37 changes: 28 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="left">

Depth Anything TensorRT
Depth Anything TensorRT CLI
===========================

[![python](https://img.shields.io/badge/python-3.10.12-green)](https://www.python.org/downloads/release/python-31012/)
Expand All @@ -24,6 +24,7 @@ Depth estimation is the task of measuring the distance of each pixel relative to


## News
* **2024-08-20:** Added CLI (xa1on)
* **2024-06-20:** Added support for TensorRT 10.
* **2024-06-17:** [Depth Anything V2](https://github.com/DepthAnything/Depth-Anything-V2) has been integrated.
* **2024-01-23:** The Depth Anything [TensorRT](https://github.com/spacewalk01/depth-anything-tensorrt) version has been created.
Expand All @@ -45,25 +46,43 @@ The inference time includes the pre-preprocessing and post-processing stages:

#### C++

- **Usage 1**: Create an engine from an onnx model and save it:
- **Step 1**: Create an engine from an onnx model and save it:
``` shell
depth-anything-tensorrt.exe <onnx model> <input image or video>
depth-anything-tensorrt.exe -model <onnx model>
```
- **Usage 2**: Deserialize an engine. Once you've built your engine, the next time you run it, simply use your engine file:
- **Step 2**: Deserialize an engine. Once you've built your engine, the next time you run it, simply use your engine file:
``` shell
depth-anything-tensorrt.exe <engine> <input image or video>
depth-anything-tensorrt.exe -model <engine file> -input <input image or video>
```
- Alternatively, you can skip immediately to running the model with just an onnx file, however, it will still generate a engine file.
``` shell
depth-anything-tensorrt.exe -model <onnx model> -input <input image or video>
```

Example:
``` shell
# infer image
depth-anything-tensorrt.exe depth_anything_vitb14.engine test.jpg
# infer folder(images)
depth-anything-tensorrt.exe depth_anything_vitb14.engine data
depth-anything-tensorrt.exe -model depth_anything_vitb14.engine -input test.jpg
# infer folder(images/videos)
depth-anything-tensorrt.exe -model depth_anything_vitb14.engine -input data # folder containing videos/images
# infer video
depth-anything-tensorrt.exe depth_anything_vitb14.engine test.mp4 # the video path
depth-anything-tensorrt.exe -model depth_anything_vitb14.engine -input test.mp4 # the video path
# specify output location
depth-anything-tensorrt.exe -model depth_anything_vitb14.engine -input test.mp4 -output result # rendered depth maps will go into the "results" directory
# display progress in one line rather than multiple
depth-anything-tensorrt.exe -model depth_anything_vitb14.engine -input test.mp4 -one-line
# modify prefix of generated files (default: "depth_")
depth-anything-tensorrt.exe -model depth_anything_vitb14.engine -input test.mp4 -prefix "depthify_" # rendered depth map will have the name "depthify_test.mp4"
# show preview including before and after (may slow down performance)
depth-anything-tensorrt.exe -preview -model depth_anything_vitb14.engine -input test.mp4
# modify fps of footage (does not interpolate, will speed up or slow down footage if original video file has a different fps value)
depth-anything-tensorrt.exe -model depth_anything_vitb14.engine -input test.mp4 -fps 60
```

<p align="center">
<img src="assets/usage-example.png"/>
</p>

#### Python

```
Expand Down
Binary file added assets/usage-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ int main(int argc, char** argv) {
if (options["one-line"].empty()) {
cout << endl;
} else {
cout << setw(20) << " \r";
cout << "\t\r" << flush;
}
if (!options["preview"].empty()) {
cv::Mat show_frame;
Expand Down

0 comments on commit 928ba7c

Please sign in to comment.