ml_tensors_info_s *in_tensors_info, *out_tensors_info;
ml_nnfw_type_e nnfw;
ml_nnfw_hw_e hw;
+ const char *fw_name;
check_feature_state ();
}
}
- switch (nnfw) {
- case ML_NNFW_TYPE_CUSTOM_FILTER:
- g_object_set (filter_obj, "framework", "custom", NULL);
- break;
- case ML_NNFW_TYPE_TENSORFLOW_LITE:
- /* We can get the tensor meta from tf-lite model. */
- g_object_set (filter_obj, "framework", "tensorflow-lite", NULL);
- break;
- case ML_NNFW_TYPE_TENSORFLOW:
- g_object_set (filter_obj, "framework", "tensorflow", NULL);
- break;
- case ML_NNFW_TYPE_MVNC:
- /** @todo Verify this! (this code is not tested) */
- g_object_set (filter_obj, "framework", "movidius-ncsdk2", NULL);
- break;
- case ML_NNFW_TYPE_NNFW:
- /* We can get the tensor meta from tf-lite model. */
- g_object_set (filter_obj, "framework", "nnfw", NULL);
- break;
- case ML_NNFW_TYPE_SNAP:
- g_object_set (filter_obj, "framework", "snap", NULL);
- break;
- case ML_NNFW_TYPE_ARMNN:
- g_object_set (filter_obj, "framework", "armnn", NULL);
- break;
- default:
- /** @todo Add other fw later. */
- ml_loge ("The given nnfw is not supported.");
- status = ML_ERROR_NOT_SUPPORTED;
- goto error;
- }
-
- /* set model files and custom option */
- g_object_set (filter_obj, "model", info->models, NULL);
+ /* set framework, model files and custom option */
+ fw_name = ml_get_nnfw_subplugin_name (nnfw);
+ g_object_set (filter_obj, "framework", fw_name, "model", info->models, NULL);
if (info->custom_option) {
g_object_set (filter_obj, "custom", info->custom_option, NULL);
break;
}
case ML_NNFW_TYPE_MVNC:
- /** @todo Need to check method for NCSDK2 */
- ml_loge ("Intel Movidius NCSDK2 is not supported.");
+ case ML_NNFW_TYPE_OPENVINO:
+ case ML_NNFW_TYPE_VIVANTE:
+ case ML_NNFW_TYPE_EDGE_TPU:
+ /** @todo Need to check method to validate model */
+ ml_loge ("Given NNFW is not supported yet.");
status = ML_ERROR_NOT_SUPPORTED;
break;
case ML_NNFW_TYPE_SNAP:
+#if !defined(__ANDROID__)
+ ml_loge ("SNAP only can be included in Android (arm64-v8a only).");
+ status = ML_ERROR_NOT_SUPPORTED;
+#endif
/* SNAP requires multiple files, set supported if model file exists. */
break;
case ML_NNFW_TYPE_ARMNN:
}
/**
+ * @brief Internal function to get the sub-plugin name.
+ */
+const char *
+ml_get_nnfw_subplugin_name (ml_nnfw_type_e nnfw)
+{
+ static const char *nnfw_subplugin_name[] = {
+ [ML_NNFW_TYPE_ANY] = "any", /* DO NOT use this name ('any') to get the sub-plugin */
+ [ML_NNFW_TYPE_CUSTOM_FILTER] = "custom",
+ [ML_NNFW_TYPE_TENSORFLOW_LITE] = "tensorflow-lite",
+ [ML_NNFW_TYPE_TENSORFLOW] = "tensorflow",
+ [ML_NNFW_TYPE_NNFW] = "nnfw",
+ [ML_NNFW_TYPE_MVNC] = "movidius-ncsdk2",
+ [ML_NNFW_TYPE_OPENVINO] = "openvino",
+ [ML_NNFW_TYPE_VIVANTE] = "vivante",
+ [ML_NNFW_TYPE_EDGE_TPU] = "edgetpu",
+ [ML_NNFW_TYPE_ARMNN] = "armnn",
+ [ML_NNFW_TYPE_SNAP] = "snap",
+ NULL
+ };
+
+ return nnfw_subplugin_name[nnfw];
+}
+
+/**
* @brief Checks the availability of the given execution environments.
*/
int
bool * available)
{
const GstTensorFilterFramework *fw;
- gchar *fw_name = NULL;
+ const char *fw_name = NULL;
check_feature_state ();
/* init false */
*available = false;
- switch (nnfw) {
- case ML_NNFW_TYPE_CUSTOM_FILTER:
- fw_name = g_strdup ("custom");
- break;
- case ML_NNFW_TYPE_TENSORFLOW_LITE:
- fw_name = g_strdup ("tensorflow-lite");
- break;
- case ML_NNFW_TYPE_TENSORFLOW:
- fw_name = g_strdup ("tensorflow");
- break;
- case ML_NNFW_TYPE_NNFW:
- fw_name = g_strdup ("nnfw");
- break;
- case ML_NNFW_TYPE_MVNC:
- /** @todo Condition to support Movidius NCSDK2 */
- fw_name = g_strdup ("movidius-ncsdk2");
- break;
- case ML_NNFW_TYPE_SNAP:
- fw_name = g_strdup ("snap");
- break;
- case ML_NNFW_TYPE_ARMNN:
- fw_name = g_strdup ("armnn");
- break;
- default:
- /* Default = "Not available!" */
- break;
- }
+ if (nnfw == ML_NNFW_TYPE_ANY)
+ return ML_ERROR_INVALID_PARAMETER;
+
+ fw_name = ml_get_nnfw_subplugin_name (nnfw);
if (fw_name) {
if ((fw = nnstreamer_filter_find (fw_name)) != NULL) {
} else {
ml_logw ("%s is not supported.", fw_name);
}
-
- g_free (fw_name);
}
return ML_ERROR_NONE;