--- /dev/null
+{
+ "inputmetadata" :
+ {
+ "tensor_info" : [
+ {
+ "name" : "sub_2",
+ "shape_type" : 1,
+ "shape_dims" : [ 1, 257, 257, 3],
+ "data_type" : 0,
+ "color_space" : "RGB888"
+ }
+ ],
+ "preprocess" : [
+ {
+ "normalization" : [
+ {
+ "mean" : [0.0, 0.0, 0.0],
+ "std" : [255.0, 255.0, 255.0]
+ }
+ ]
+ }
+ ]
+ },
+ "outputmetadata" :
+ {
+ "score" : [
+ {
+ "name" : "MobilenetV1/heatmap_2/BiasAdd",
+ "index" : [-1, 1, 1, 1],
+ "top_number" : 1,
+ "threshold" : 0.65,
+ "score_type" : 1
+ }
+ ],
+ "landmark" : [
+ {
+ "name" : "MobilenetV1/heatmap_2/BiasAdd",
+ "index" : [-1, 1, 1, 1],
+ "landmark_type" : 1,
+ "decoding_type" : 2,
+ "decoding_info" :
+ {
+ "heatmap" :
+ {
+ "shape_type" : 1,
+ "nms_radius" : 50.0
+ }
+ }
+ }
+ ],
+ "offset" : [
+ {
+ "name" : "MobilenetV1/offset_2/BiasAdd",
+ "index" : [-1, 1, 1, 1],
+ "shape_type" : 1,
+ "dim_type" : 2
+ }
+ ],
+ "displacement" : [
+ {
+ "name" : "MobilenetV1/displacement_fwd_2/BiasAdd",
+ "index" : [-1, 1, 1, 1],
+ "shape_type" : 1,
+ "dim_type" : 2,
+ "type" : 0
+ },
+ {
+ "name" : "MobilenetV1/displacement_bwd_2/BiasAdd",
+ "index" : [-1, 1, 1, 1],
+ "shape_type" : 1,
+ "dim_type" : 2,
+ "type" : 1
+ }
+ ],
+ "edgemap" : [
+ {
+ "parent": 0,
+ "child": 1
+ },
+ {
+ "parent": 1,
+ "child": 3
+ },
+ {
+ "parent": 0,
+ "child": 2
+ },
+ {
+ "parent": 2,
+ "child": 4
+ },
+ {
+ "parent": 0,
+ "child": 5
+ },
+ {
+ "parent": 5,
+ "child": 7
+ },
+ {
+ "parent": 7,
+ "child": 9
+ },
+ {
+ "parent": 5,
+ "child": 11
+ },
+ {
+ "parent": 11,
+ "child": 13
+ },
+ {
+ "parent": 13,
+ "child": 15
+ },
+ {
+ "parent": 0,
+ "child": 6
+ },
+ {
+ "parent": 6,
+ "child": 8
+ },
+ {
+ "parent": 8,
+ "child": 10
+ },
+ {
+ "parent": 6,
+ "child": 12
+ },
+ {
+ "parent": 12,
+ "child": 14
+ },
+ {
+ "parent": 14,
+ "child": 16
+ }
+ ]
+ }
+}
#define PLD_MOTION_CAPTURE_MAPPING_FILE_PATH \
"/usr/share/capi-media-vision/models/PLD/mocap/example-mocap-mapping.txt"
+/*
+ * Hosted models
+ */
+#define PLD_TFLITE_WEIGHT_CPM_192_PATH \
+ "/usr/share/capi-media-vision/models/PLD/tflite/pld_cpm_192x192.tflite"
+
+#define PLD_TFLITE_WEIGHT_MOBILENET_V1_POSENET_257_PATH \
+ "/usr/share/capi-media-vision/models/PLD/tflite/pld_mobilenet_v1_posenet_multi_257x257.tflite"
+#define PLD_LABEL_MOBILENET_V1_POSENET_257_PATH \
+ "/usr/share/capi-media-vision/models/PLD/tflite/pld_mobilenet_v1_posenet_multi_label.txt"
+
/******
* Public model:
* IC: mobilenet caffe, tf?
return err;
}
+int perform_hosted_tflite_cpm_192_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 configuration.\n");
+ }
+ }
+ return err;
+ }
+
+ mv_engine_config_set_string_attribute(
+ handle, MV_INFERENCE_MODEL_WEIGHT_FILE_PATH,
+ PLD_TFLITE_WEIGHT_CPM_192_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_mobilenet_v1_posenet_257_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 configuration.\n");
+ }
+ }
+ return err;
+ }
+
+ mv_engine_config_set_string_attribute(
+ handle, MV_INFERENCE_MODEL_WEIGHT_FILE_PATH,
+ PLD_TFLITE_WEIGHT_MOBILENET_V1_POSENET_257_PATH);
+
+/*
+ mv_engine_config_set_string_attribute(
+ handle, MV_INFERENCE_MODEL_USER_FILE_PATH,
+ PLD_LABEL_MOBILENET_V1_POSENET_257_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_pose_landmark_detection()
{
int err = MEDIA_VISION_ERROR_NONE;
int sel_opt = 0;
- const int options[] = { 1, 2, 3, 4, 5 };
+ const int options[] = { 1, 2, 3, 4, 5, 6, 7 };
const char *names[] = { "Configuration",
"TFLITE(CPU) + CPM",
+ "Hosted: TFLITE(CPU) + CPM",
+ "Hosted: TFLITE(CPU) + MOBILENET_V1_POSENET",
"Prepare",
"Run",
"Back" };
err = perform_configuration(&engine_cfg);
} break;
case 2: {
- //perform SRID TweakCNN config
+ //perform TweakCNN config
if (engine_cfg) {
int err2 = mv_destroy_engine_config(engine_cfg);
if (err2 != MEDIA_VISION_ERROR_NONE)
err = perform_armnn_cpm_config(&engine_cfg);
} break;
case 3: {
+ //perform cpm 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_cpm_192_config(&engine_cfg);
+ } break;
+ case 4: {
+ //perform mobilenet-v1 posenet 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_mobilenet_v1_posenet_257_config(&engine_cfg);
+ } break;
+ case 5: {
// create - configure - prepare
if (infer) {
int err2 = mv_inference_destroy(infer);
break;
}
} break;
- case 4: {
+ case 6: {
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 5: {
+ case 7: {
//perform destroy
if (engine_cfg) {
err = mv_destroy_engine_config(engine_cfg);