[Benchmark] Add GetModelResoucesNameFromDir APIs (#1640)

This commit is contained in:
DefTruth
2023-03-17 17:05:24 +08:00
committed by GitHub
parent 4d57b62f83
commit 95820a9892
14 changed files with 207 additions and 60 deletions

View File

@@ -34,9 +34,15 @@ int main(int argc, char* argv[]) {
std::unordered_map<std::string, std::string> config_info;
benchmark::ResultManager::LoadBenchmarkConfig(FLAGS_config_path,
&config_info);
auto model_file = FLAGS_model + sep + "model.pdmodel";
auto params_file = FLAGS_model + sep + "model.pdiparams";
auto config_file = FLAGS_model + sep + "deploy.yaml";
std::string model_name, params_name, config_name;
auto model_format = fastdeploy::ModelFormat::PADDLE;
if (!UpdateModelResourceName(&model_name, &params_name, &config_name,
&model_format, config_info)) {
return -1;
}
auto model_file = FLAGS_model + sep + model_name;
auto params_file = FLAGS_model + sep + params_name;
auto config_file = FLAGS_model + sep + config_name;
if (config_info["backend"] == "paddle_trt") {
option.paddle_infer_option.collect_trt_shape = true;
}
@@ -48,7 +54,7 @@ int main(int argc, char* argv[]) {
trt_shapes[2]);
}
auto model_ppseg = vision::segmentation::PaddleSegModel(
model_file, params_file, config_file, option);
model_file, params_file, config_file, option, model_format);
vision::SegmentationResult res;
if (config_info["precision_compare"] == "true") {
// Run once at least