#define FD_OPENCV_CONFIG_CAFFE_PATH \
"/usr/share/capi-media-vision/models/FD/caffe/fd_caffe_model_resnet10ssd.prototxt"
+/*
+ * Hosted models
+ */
+#define FD_LABEL_MOBILENET_V1_SSD_300_PATH \
+ "/usr/share/capi-media-vision/models/FD/tflite/fd_mobilenet_v1_ssd_postop_label.txt"
+#define FD_TFLITE_WEIGHT_MOBILENET_V1_SSD_300_PATH \
+ "/usr/share/capi-media-vision/models/FD/tflite/fd_mobilenet_v1_ssd_postop_300x300.tflite"
+#define FD_LABEL_BLAZEFACE_128_PATH \
+ "/usr/share/capi-media-vision/models/FD/tflite/fd_blazeface_front_label.txt"
+#define FD_TFLITE_WEIGHT_BLAZEFACE_128_PATH \
+ "/usr/share/capi-media-vision/models/FD/tflite/fd_blazeface_front_128x128.tflite"
+
//Facial LandmarkDetection
#define FLD_TFLITE_WEIGHT_PATH \
"/usr/share/capi-media-vision/models/FLD/tflite/fld_tflite_model1.tflite"
return err;
}
+int perform_hosted_tflite_mobilenetv1ssd_300_config_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 configuration.\n");
+ }
+ }
+ return err;
+ }
+
+ mv_engine_config_set_string_attribute(
+ handle, MV_INFERENCE_MODEL_WEIGHT_FILE_PATH,
+ FD_TFLITE_WEIGHT_MOBILENET_V1_SSD_300_PATH);
+
+ mv_engine_config_set_int_attribute(
+ handle, MV_INFERENCE_BACKEND_TYPE,
+ MV_INFERENCE_BACKEND_TFLITE);
+
+ mv_engine_config_set_int_attribute(
+ handle, MV_INFERENCE_TARGET_TYPE,
+ MV_INFERENCE_TARGET_CPU);
+
+ *engine_cfg = handle;
+ return err;
+}
+
+int perform_hosted_tflite_blazeface_128_config_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 configuration.\n");
+ }
+ }
+ return err;
+ }
+
+ mv_engine_config_set_string_attribute(
+ handle, MV_INFERENCE_MODEL_WEIGHT_FILE_PATH,
+ FD_TFLITE_WEIGHT_BLAZEFACE_128_PATH);
+
+ mv_engine_config_set_int_attribute(
+ handle, MV_INFERENCE_BACKEND_TYPE,
+ MV_INFERENCE_BACKEND_TFLITE);
+
+ mv_engine_config_set_int_attribute(
+ handle, MV_INFERENCE_TARGET_TYPE,
+ MV_INFERENCE_TARGET_CPU);
+
+ *engine_cfg = handle;
+ return err;
+}
+
int perform_face_detection()
{
int err = MEDIA_VISION_ERROR_NONE;
int sel_opt = 0;
- const int options[] = { 1, 2, 3, 4, 5, 6, 7 };
+ const int options[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
const char *names[] = { "Configuration",
"TFLite(CPU) + MobileNetV1 + SSD",
"OPENCV(CPU) + Resnet10 + SSD",
"ARMNN(CPU) + MobileNetV1 + SSD",
+ "Hosted: TFLite(cpu + MobilenetV1+SSD)",
+ "Hosted: TFLite(cpu + BlazeFace)",
"Prepare",
"Run",
"Back" };
err = perform_configuration(&engine_cfg);
} break;
case 2: {
- //perform TF Mobilenetssd config
+ //perform TFlit Mobilenetv1ssd config
if (engine_cfg) {
int err2 = mv_destroy_engine_config(engine_cfg);
if (err2 != MEDIA_VISION_ERROR_NONE)
err = perform_tflite_mobilenetv1ssd_face(&engine_cfg);
} break;
case 3: {
- //perform TF Lite Mobilenetssd config
+ //perform Opencv resenet10ssd config
if (engine_cfg) {
int err2 = mv_destroy_engine_config(engine_cfg);
if (err2 != MEDIA_VISION_ERROR_NONE)
err = perform_opencv_resnet10ssd_face(&engine_cfg);
} break;
case 4: {
- //perform TF Lite Mobilenetssd config
+ //perform Armnn Mobilenetv1ssd config
if (engine_cfg) {
int err2 = mv_destroy_engine_config(engine_cfg);
if (err2 != MEDIA_VISION_ERROR_NONE)
err = perform_armnn_mobilenetv1ssd_face(&engine_cfg);
} break;
case 5: {
+ //perform hosted TFlite Mobilenetv1ssd 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);
+ engine_cfg = NULL;
+ }
+
+ err = perform_hosted_tflite_mobilenetv1ssd_300_config_face(&engine_cfg);
+ } break;
+ case 6: {
+ //perform hosted TFlite blazeface 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);
+ engine_cfg = NULL;
+ }
+
+ err = perform_hosted_tflite_blazeface_128_config_face(&engine_cfg);
+ } break;
+ case 7: {
// create - configure - prepare
if (infer) {
int err2 = mv_inference_destroy(infer);
break;
}
} break;
- case 6: {
+ case 8: {
if (mvSource) {
int err2 = mv_destroy_source(mvSource);
if (err2 != MEDIA_VISION_ERROR_NONE)
unsigned long timeDiff = gettotalmillisec(diffspec);
printf("elapsed time : %lu(ms)\n", timeDiff);
} break;
- case 7: {
+ case 9: {
//perform destroy
if (engine_cfg) {
err = mv_destroy_engine_config(engine_cfg);