Skip to content

Commit

Permalink
add trt shape file to table and layout model
Browse files Browse the repository at this point in the history
  • Loading branch information
WenmuZhou committed Sep 19, 2022
1 parent a166e54 commit 43838e3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 1 addition & 2 deletions deploy/cpp_infer/include/structure_layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ class StructureLayoutRecognizer {

// post-process
PicodetPostProcessor post_processor_;

}; // class StructureTableRecognizer
};

} // namespace PaddleOCR
5 changes: 5 additions & 0 deletions deploy/cpp_infer/src/structure_layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ void StructureLayoutRecognizer::LoadModel(const std::string &model_dir) {
precision = paddle_infer::Config::Precision::kInt8;
}
config.EnableTensorRtEngine(1 << 20, 10, 3, precision, false, false);
if (!Utility::PathExists("./trt_layout_shape.txt")) {
config.CollectShapeRangeInfo("./trt_layout_shape.txt");
} else {
config.EnableTunedTensorRtDynamicShape("./trt_layout_shape.txt", true);
}
}
} else {
config.DisableGpu();
Expand Down
5 changes: 5 additions & 0 deletions deploy/cpp_infer/src/structure_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ void StructureTableRecognizer::LoadModel(const std::string &model_dir) {
precision = paddle_infer::Config::Precision::kInt8;
}
config.EnableTensorRtEngine(1 << 20, 10, 3, precision, false, false);
if (!Utility::PathExists("./trt_table_shape.txt")) {
config.CollectShapeRangeInfo("./trt_table_shape.txt");
} else {
config.EnableTunedTensorRtDynamicShape("./trt_table_shape.txt", true);
}
}
} else {
config.DisableGpu();
Expand Down

0 comments on commit 43838e3

Please sign in to comment.