Skip to content

Commit

Permalink
Added -find-engine option to use existing engine files by default
Browse files Browse the repository at this point in the history
  • Loading branch information
xa1on committed Aug 21, 2024
1 parent 928ba7c commit ad9d9fd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ depth-anything-tensorrt.exe -model depth_anything_vitb14.engine -input test.mp4
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
# use an existing engine file if found
depth-anything-tensorrt.exe -model depth_anything_vitb14.onnx -input test.mp4 -find-engine
```

<p align="center">
Expand Down
12 changes: 8 additions & 4 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,14 @@ int main(int argc, char** argv) {

string alternate_path = model_path.substr(0, model_path.length() - 5) + ".engine";
if (model_path.substr(model_path.find_last_of('.') + 1) == "onnx" && IsFile(alternate_path)) {
string confirm_engine = "";
cout << "\"" << alternate_path << "\" found, Override existing .engine file? (Y/N): ";
cin >> confirm_engine;
if (confirm_engine != "Y" && confirm_engine != "y"){
if (options["find-engine"].empty()) {
string confirm_engine = "";
cout << "\"" << alternate_path << "\" found, Override existing .engine file? (Y/N): ";
cin >> confirm_engine;
if (confirm_engine != "Y" && confirm_engine != "y"){
model_path = alternate_path;
}
} else {
model_path = alternate_path;
}
}
Expand Down
6 changes: 6 additions & 0 deletions run.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
echo off
echo %~1

.\"depth-anything-tensorrt.exe" -input "%~1" -preview -model depth_anything_v2_vitb.onnx -find-engine

pause

0 comments on commit ad9d9fd

Please sign in to comment.