//Image Classification
#define IC_LABEL_PATH "/usr/share/capi-media-vision/models/IC/tflite/ic_label.txt"
#define IC_TFLITE_WEIGHT_PATH "/usr/share/capi-media-vision/models/IC/tflite/ic_tflite_model.tflite"
+#define IC_Q_LABEL_PATH \
+ "/usr/share/capi-media-vision/models/IC_Q/tflite/ic_label.txt"
+#define IC_Q_TFLITE_WEIGHT_PATH \
+ "/usr/share/capi-media-vision/models/IC_Q/tflite/ic_tflite_model.tflite"
#define IC_OPENCV_LABEL_CAFFE_PATH "/usr/share/capi-media-vision/models/IC/caffe/ic_caffe_label_squeezenet.txt"
#define IC_OPENCV_WEIGHT_CAFFE_PATH "/usr/share/capi-media-vision/models/IC/caffe/ic_caffe_model_squeezenet.caffemodel"
return err;
}
+int perform_nnfw_mobilenetv1_quant_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";
+ char *outputNodeName[1] = { "MobilenetV1/Predictions/Reshape_1" };
+
+ mv_engine_config_set_string_attribute(
+ handle, MV_INFERENCE_MODEL_WEIGHT_FILE_PATH, IC_Q_TFLITE_WEIGHT_PATH);
+
+ mv_engine_config_set_int_attribute(handle, MV_INFERENCE_INPUT_DATA_TYPE,
+ MV_INFERENCE_DATA_UINT8);
+
+ mv_engine_config_set_string_attribute(
+ handle, MV_INFERENCE_MODEL_USER_FILE_PATH, IC_Q_LABEL_PATH);
+
+ mv_engine_config_set_double_attribute(handle, MV_INFERENCE_MODEL_MEAN_VALUE,
+ 0.0);
+
+ mv_engine_config_set_double_attribute(handle, MV_INFERENCE_MODEL_STD_VALUE,
+ 1.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_NNFW);
+
+ 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[7] = { 1, 2, 3, 4, 5, 6, 7};
- const char *names[7] = { "Configuration",
+ const int options[9] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+ const char *names[9] = { "Configuration",
"TFLite(cpu + Mobilenet)",
"OpenCV(cpu + Squeezenet)",
"ARMNN(cpu + Mobilenet)",
+ "NNFW(cpu + Mobilenet_Q)",
"Prepare",
"Run",
"Back"};
err = perform_armnn_mobilenetv1_config(&engine_cfg);
}
break;
- case 5:
+ case 5:
+ {
+ // perform NNFW
+ 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_nnfw_mobilenetv1_quant_config(&engine_cfg);
+ }
+ break;
+ case 6:
{
//create - configure - prepare
if (infer) {
}
}
break;
- case 6:
+ case 7:
{
if (mvSource) {
int err2 = mv_destroy_source(mvSource);
}
break;
- case 7:
+ case 8:
{
//perform destroy
if (engine_cfg) {