return err;
}
+int perform_armnn_mobilenetv1ssd_face(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 = "normalized_input_image_tensor";
+ char *outputNodeName[4] = {"TFLite_Detection_PostProcess",
+ "TFLite_Detection_PostProcess:1",
+ "TFLite_Detection_PostProcess:2",
+ "TFLite_Detection_PostProcess:3"};
+
+ mv_engine_config_set_string_attribute(handle,
+ MV_INFERENCE_MODEL_WEIGHT_FILE_PATH,
+ FD_TFLITE_WEIGHT_PATH);
+
+ mv_engine_config_set_double_attribute(handle,
+ MV_INFERENCE_MODEL_MEAN_VALUE,
+ 127.5);
+
+ mv_engine_config_set_double_attribute(handle,
+ MV_INFERENCE_MODEL_STD_VALUE,
+ 127.5);
+
+ mv_engine_config_set_double_attribute(handle,
+ MV_INFERENCE_CONFIDENCE_THRESHOLD,
+ 0.3);
+
+ 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,
+ 300);
+
+ mv_engine_config_set_int_attribute(handle,
+ MV_INFERENCE_INPUT_TENSOR_HEIGHT,
+ 300);
+
+ 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,
+ 4);
+
+ *engine_cfg = handle;
+ return err;
+}
+
int perform_face_detection()
{
int err = MEDIA_VISION_ERROR_NONE;
int sel_opt = 0;
- const int options[5] = {1, 2, 3, 4, 5};
+ const int options[5] = {1, 2, 3, 4, 5, 6};
const *names[5] = { "Configuration",
"TFLite(CPU) + MobileNetV1 + SSD",
+ "ARMNN(CPU) + MobileNetV1 + SSD",
"Prepare",
"Run",
"Back"};
}
break;
case 3:
+ {
+ //perform TF Lite Mobilenetssd config
+ 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_mobilenetv1ssd_face(&engine_cfg);
+ }
+ break;
+ case 4:
{
// create - configure - prepare
if (infer) {
}
}
break;
- case 4:
+ case 5:
{
if (mvSource) {
int err2 = mv_destroy_source(mvSource);
err = mv_inference_face_detect(mvSource, infer, _face_detected_cb, NULL);
}
break;
- case 5:
+ case 6:
{
//perform destroy
if (engine_cfg) {