From: Inki Dae Date: Tue, 14 Jan 2020 08:55:22 +0000 (+0900) Subject: test: add ARMNN test case X-Git-Tag: submit/tizen/20200423.063253~47 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5a71dbdba410f46976eb469fca5fe9667ad8c96b;p=platform%2Fcore%2Fapi%2Fmediavision.git test: add ARMNN test case Change-Id: If842e093de3990e4ff5eb782c33d2cb52e5cca3f Signed-off-by: Inki Dae --- diff --git a/test/testsuites/inference/inference_test_suite.c b/test/testsuites/inference/inference_test_suite.c index bb3f169c..f4162b5f 100644 --- a/test/testsuites/inference/inference_test_suite.c +++ b/test/testsuites/inference/inference_test_suite.c @@ -566,6 +566,80 @@ int perform_tflite_mobilenetv1_config(mv_engine_config_h *engine_cfg) return err; } +int perform_armnn_mobilenetv1_config(mv_engine_config_h *engine_cfg) +{ + int err = MEDIA_VISION_ERROR_NONE; + + mv_engine_config_h handle = NULL; + err = mv_create_engine_config(&handle); + if (err != MEDIA_VISION_ERROR_NONE) { + printf("Fail to create engine configuration handle.\n"); + if (handle) { + int err2 = mv_destroy_engine_config(handle); + if (err2 != MEDIA_VISION_ERROR_NONE) { + printf("Fail to destroy engine cofniguration.\n"); + } + } + return err; + } + + char *inputNodeName = "input_2"; + char *outputNodeName[1] = {"dense_3/Softmax"}; + + mv_engine_config_set_string_attribute(handle, + MV_INFERENCE_MODEL_WEIGHT_FILE_PATH, + IC_TFLITE_WEIGHT_PATH); + + mv_engine_config_set_string_attribute(handle, + MV_INFERENCE_MODEL_USER_FILE_PATH, + IC_LABEL_PATH); + + mv_engine_config_set_double_attribute(handle, + MV_INFERENCE_MODEL_MEAN_VALUE, + 127.0); + + mv_engine_config_set_double_attribute(handle, + MV_INFERENCE_MODEL_STD_VALUE, + 127.0); + + mv_engine_config_set_double_attribute(handle, + MV_INFERENCE_CONFIDENCE_THRESHOLD, + 0.6); + + mv_engine_config_set_int_attribute(handle, + MV_INFERENCE_BACKEND_TYPE, + MV_INFERENCE_BACKEND_ARMNN); + + mv_engine_config_set_int_attribute(handle, + MV_INFERENCE_TARGET_TYPE, + MV_INFERENCE_TARGET_CPU); + + mv_engine_config_set_int_attribute(handle, + MV_INFERENCE_INPUT_TENSOR_WIDTH, + 224); + + mv_engine_config_set_int_attribute(handle, + MV_INFERENCE_INPUT_TENSOR_HEIGHT, + 224); + + mv_engine_config_set_int_attribute(handle, + MV_INFERENCE_INPUT_TENSOR_CHANNELS, + 3); + + mv_engine_config_set_string_attribute(handle, + MV_INFERENCE_INPUT_NODE_NAME, + inputNodeName); + + mv_engine_config_set_array_string_attribute(handle, + MV_INFERENCE_OUTPUT_NODE_NAMES, + outputNodeName, + 1); + + + *engine_cfg = handle; + return err; +} + int perform_opencv_caffe_squeezenet_config(mv_engine_config_h *engine_cfg) { int err = MEDIA_VISION_ERROR_NONE; @@ -650,10 +724,11 @@ int perform_image_classification() int err = MEDIA_VISION_ERROR_NONE; int sel_opt = 0; - const int options[6] = { 1, 2, 3, 4, 5, 6}; + const int options[6] = { 1, 2, 3, 4, 5, 6, 7}; const char *names[6] = { "Configuration", "TFLite(cpu + Mobilenet)", "OpenCV(cpu + Squeezenet)", + "ARMNN(cpu + Mobilenet)", "Prepare", "Run", "Back"}; @@ -706,6 +781,18 @@ int perform_image_classification() } break; case 4: + { + // perform ARMNN + if (engine_cfg) { + int err2 = mv_destroy_engine_config(engine_cfg); + if (err2 != MEDIA_VISION_ERROR_NONE) + printf("Fail to destroy engine_cfg [err:%i]\n", err2); + } + + err = perform_armnn_mobilenetv1_config(&engine_cfg); + } + break; + case 5: { //create - configure - prepare if (infer) { @@ -738,7 +825,7 @@ int perform_image_classification() } } break; - case 5: + case 6: { if (mvSource) { int err2 = mv_destroy_source(mvSource); @@ -774,7 +861,7 @@ int perform_image_classification() err = mv_inference_image_classify(mvSource, infer, NULL, _image_classified_cb, NULL); } break; - case 6: + case 7: { //perform destroy if (engine_cfg) {