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;
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"};
}
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) {
}
}
break;
- case 5:
+ case 6:
{
if (mvSource) {
int err2 = mv_destroy_source(mvSource);
err = mv_inference_image_classify(mvSource, infer, NULL, _image_classified_cb, NULL);
}
break;
- case 6:
+ case 7:
{
//perform destroy
if (engine_cfg) {