From 999e5ede969c31dfc42afd05da79a4076ff85f8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AF=85?= Date: Tue, 19 Feb 2019 15:07:28 +0800 Subject: [PATCH] Fix mace tool interface bugs --- .gitlab-ci.yml | 6 ++++++ docs/user_guide/advanced_usage.rst | 3 ++- mace/benchmark/benchmark_model.cc | 4 ++-- .../macelibrary/src/main/cpp/image_classify.cc | 3 ++- mace/examples/cli/example.cc | 4 ++-- mace/tools/validation/mace_run.cc | 12 ++++++------ 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3d6ad0cc..06928c94 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -146,6 +146,12 @@ model_tests: python tools/converter.py convert --config=${CONF_FILE} --target_socs=$TARGET_SOCS --model_graph_format=file --model_data_format=file || exit 1; python tools/converter.py run --config=${CONF_FILE} --target_socs=$TARGET_SOCS --round=1 --validate --model_graph_format=file --model_data_format=file || exit 1; python tools/converter.py run --config=${CONF_FILE} --target_socs=$TARGET_SOCS --example --round=1 --validate --model_graph_format=file --model_data_format=file || exit 1; + python tools/converter.py benchmark --config=${CONF_FILE} --target_socs=$TARGET_SOCS --round=5 --model_graph_format=file --model_data_format=file || exit 1; + python tools/converter.py convert --config=${CONF_FILE} --target_socs=$TARGET_SOCS --model_graph_format=code --model_data_format=file || exit 1; + python tools/converter.py run --config=${CONF_FILE} --target_socs=$TARGET_SOCS --round=1 --validate --model_graph_format=code --model_data_format=file || exit 1; + python tools/converter.py run --config=${CONF_FILE} --target_socs=$TARGET_SOCS --example --round=1 --validate --model_graph_format=code --model_data_format=file || exit 1; + python tools/converter.py benchmark --config=${CONF_FILE} --target_socs=$TARGET_SOCS --round=5 --model_graph_format=code --model_data_format=file || exit 1; + - rm -rf mace-models quantization_tests: diff --git a/docs/user_guide/advanced_usage.rst b/docs/user_guide/advanced_usage.rst index bea02160..58c0f935 100644 --- a/docs/user_guide/advanced_usage.rst +++ b/docs/user_guide/advanced_usage.rst @@ -252,7 +252,8 @@ Convert model(s) to C++ code // Create Engine from compiled code create_engine_status = CreateMaceEngineFromCode(model_name.c_str(), - model_data_file, // empty string if model_data_format is code + model_data_ptr, // nullptr if model_data_format is code + model_data_size, // 0 if model_data_format is code input_names, output_names, device_type, diff --git a/mace/benchmark/benchmark_model.cc b/mace/benchmark/benchmark_model.cc index e23c3a02..4bd44ada 100644 --- a/mace/benchmark/benchmark_model.cc +++ b/mace/benchmark/benchmark_model.cc @@ -292,8 +292,8 @@ int Main(int argc, char **argv) { #ifdef MODEL_GRAPH_FORMAT_CODE create_engine_status = CreateMaceEngineFromCode(FLAGS_model_name, - model_weights_data.data(), - model_weights_data.size(), + model_weights_data, + model_weights_data_size, input_names, output_names, config, diff --git a/mace/examples/android/macelibrary/src/main/cpp/image_classify.cc b/mace/examples/android/macelibrary/src/main/cpp/image_classify.cc index 661da75c..442e3a1a 100755 --- a/mace/examples/android/macelibrary/src/main/cpp/image_classify.cc +++ b/mace/examples/android/macelibrary/src/main/cpp/image_classify.cc @@ -158,7 +158,8 @@ Java_com_xiaomi_mace_JniMaceUtils_maceMobilenetCreateEngine( mace::MaceStatus create_engine_status = CreateMaceEngineFromCode(mace_context.model_name, - std::string(), + nullptr, + 0, input_names, output_names, config, diff --git a/mace/examples/cli/example.cc b/mace/examples/cli/example.cc index 15ab0780..97d36081 100644 --- a/mace/examples/cli/example.cc +++ b/mace/examples/cli/example.cc @@ -285,8 +285,8 @@ bool RunModel(const std::vector &input_names, // to model_data_file parameter. create_engine_status = CreateMaceEngineFromCode(FLAGS_model_name, - model_weights_data.data(), - model_weights_data.size(), + model_weights_data, + model_weights_data_size, input_names, output_names, config, diff --git a/mace/tools/validation/mace_run.cc b/mace/tools/validation/mace_run.cc index c4d30765..7ea06f08 100644 --- a/mace/tools/validation/mace_run.cc +++ b/mace/tools/validation/mace_run.cc @@ -268,8 +268,8 @@ bool RunModel(const std::string &model_name, #ifdef MODEL_GRAPH_FORMAT_CODE create_engine_status = CreateMaceEngineFromCode(model_name, - model_weights_data.data(), - model_weights_data.size(), + model_weights_data, + model_weights_data_size, input_names, output_names, config, @@ -349,8 +349,8 @@ bool RunModel(const std::string &model_name, #ifdef MODEL_GRAPH_FORMAT_CODE create_engine_status = CreateMaceEngineFromCode(model_name, - model_weights_data.data(), - model_weights_data.size(), + model_weights_data, + model_weights_data_size, input_names, output_names, config, @@ -392,8 +392,8 @@ bool RunModel(const std::string &model_name, #ifdef MODEL_GRAPH_FORMAT_CODE create_engine_status = CreateMaceEngineFromCode(model_name, - model_weights_data.data(), - model_weights_data.size(), + model_weights_data, + model_weights_data_size, input_names, output_names, config, -- GitLab