mv_machine_learning: add a new feature key checking function 70/301570/9 accepted/tizen/7.0/unified/20240104.170600
authorInki Dae <inki.dae@samsung.com>
Mon, 20 Nov 2023 05:36:49 +0000 (14:36 +0900)
committerInki Dae <inki.dae@samsung.com>
Thu, 7 Dec 2023 01:39:54 +0000 (10:39 +0900)
[Version] : 0.23.51
[Issue type] : bug fix

Add a new feature key checking function for machine learning based face
recognition API.

In the previous version of face recognition API, we used below key only.
http://tizen.org/feature/vision.inference.face

However, the key is used by face detection and other API - key checking
duplicated. So add a new feature key checking function so that the face
recognition API can check four keys
- http://tizen.org/feature/vision.inference
- http://tizen.org/feature/vision.training
- http://tizen.org/feature/vision.inference.face_recognition
- http://tizen.org/feature/vision.training.face_recognition

Change-Id: I9ad4cc5e166ba0aa644a99d4891a8dd927886039
Signed-off-by: Inki Dae <inki.dae@samsung.com>
doc/mediavision_doc.h
include/mv_private.h
mv_common/src/mv_private.c
mv_machine_learning/face_recognition/src/mv_face_recognition.c
packaging/capi-media-vision.spec

index c79eb86866803bf1ba9f36a1f62778be8e3dd6f9..ef772894c41f904acf64f9bebda0bb595bb7d8b5 100644 (file)
@@ -66,6 +66,9 @@
  *  - %http://tizen.org/feature/vision.face_recognition\n
  *  - %http://tizen.org/feature/vision.image_recognition\n
  *  - %http://tizen.org/feature/vision.inference\n
+ *  - %http://tizen.org/feature/vision.training\n
+ *  - %http://tizen.org/feature/vision.inference.face_recognition\n
+ *  - %http://tizen.org/feature/vision.training.face_recognition\n
  *  - %http://tizen.org/feature/vision.inference.image\n
  *  - %http://tizen.org/feature/vision.inference.face\n
  *
  *
  * @section CAPI_MEDIA_VISION_FACE_RECOGNITION_MODULE_FEATURE Related Features
  * This API is related with the following features:\n
- *  - %http://tizen.org/feature/vision.face_recognition\n
+ *  - %http://tizen.org/feature/vision.inference\n
+ *  - %http://tizen.org/feature/vision.training\n
+ *  - %http://tizen.org/feature/vision.inference.face_recognition\n
+ *  - %http://tizen.org/feature/vision.training.face_recognition\n
  *
  * It is recommended to design feature related codes in your application for
  * reliability.\n
index 94c5a7bae13a1eb418e35e402c3df52c2030b4a7..b1a16b336212eca76a090754537b613aab583a0a 100644 (file)
@@ -66,8 +66,12 @@ bool _mv_barcode_generate_check_system_info_feature_supported(void);
 bool _mv_face_check_system_info_feature_supported(void);
 bool _mv_image_check_system_info_feature_supported(void);
 bool _mv_inference_check_system_info_feature_supported(void);
+bool _mv_inference_group_check_system_info_feature_supported(void);
+bool _mv_training_group_check_system_info_feature_supported(void);
 bool _mv_inference_image_check_system_info_feature_supported(void);
 bool _mv_inference_face_check_system_info_feature_supported(void);
+bool _mv_inference_face_recognition_check_system_info_feature_supported(void);
+bool _mv_training_face_recognition_check_system_info_feature_supported(void);
 bool _mv_roi_tracking_check_system_info_feature_supported(void);
 bool _mv_3d_all_check_system_info_feature_supported(void);
 bool _mv_3d_check_system_info_feature_supported(void);
index a4884b3ee5085ce6a4a9498d1b69e7f2c1cf30cc..f43e73a83b12a325f8f68acee3443602c25cedfa 100644 (file)
@@ -161,6 +161,85 @@ bool _mv_face_check_system_info_feature_supported(void)
        return isFaceRecognitionSupported;
 }
 
+bool _mv_inference_group_check_system_info_feature_supported(void)
+{
+       bool isInferenceSupported = false;
+
+       const int nRetVal =
+                       system_info_get_platform_bool("http://tizen.org/feature/vision.inference", &isInferenceSupported);
+
+       if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+               LOGE("SYSTEM_INFO_ERROR: vision.inference");
+               return false;
+       }
+
+       isInferenceSupported ? LOGI("system_info_get_platform_bool returned "
+                                                               "Supported inference group feature capability\n") :
+                                                  LOGE("system_info_get_platform_bool returned "
+                                                               "Unsupported inference group feature capability\n");
+
+       return (isInferenceSupported);
+}
+
+bool _mv_training_group_check_system_info_feature_supported(void)
+{
+       bool isTrainingSupported = false;
+
+       const int nRetVal = system_info_get_platform_bool("http://tizen.org/feature/vision.training", &isTrainingSupported);
+
+       if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+               LOGE("SYSTEM_INFO_ERROR: vision.training");
+               return false;
+       }
+
+       isTrainingSupported ? LOGI("system_info_get_platform_bool returned "
+                                                          "Supported training group feature capability\n") :
+                                                 LOGE("system_info_get_platform_bool returned "
+                                                          "Unsupported training group feature capability\n");
+
+       return (isTrainingSupported);
+}
+
+bool _mv_inference_face_recognition_check_system_info_feature_supported(void)
+{
+       bool isInferenceFaceSupported = false;
+
+       const int nRetVal = system_info_get_platform_bool("http://tizen.org/feature/vision.inference.face_recognition",
+                                                                                                         &isInferenceFaceSupported);
+
+       if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+               LOGE("SYSTEM_INFO_ERROR: vision.inference.face_recognition");
+               return false;
+       }
+
+       isInferenceFaceSupported ? LOGI("system_info_get_platform_bool returned "
+                                                                       "Supported inference face recognition feature capability\n") :
+                                                          LOGE("system_info_get_platform_bool returned "
+                                                                       "Unsupported inference face recognition feature capability\n");
+
+       return (_mv_inference_group_check_system_info_feature_supported() && isInferenceFaceSupported);
+}
+
+bool _mv_training_face_recognition_check_system_info_feature_supported(void)
+{
+       bool isFaceRecognitionSupported = false;
+
+       const int nRetVal = system_info_get_platform_bool("http://tizen.org/feature/vision.training.face_recognition",
+                                                                                                         &isFaceRecognitionSupported);
+
+       if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
+               LOGE("SYSTEM_INFO_ERROR: vision.training.face_recognition");
+               return false;
+       }
+
+       isFaceRecognitionSupported ? LOGI("system_info_get_platform_bool returned "
+                                                                         "Supported training face recognition feature capability\n") :
+                                                                LOGE("system_info_get_platform_bool returned "
+                                                                         "Unsupported training face recognition feature capability\n");
+
+       return (_mv_training_group_check_system_info_feature_supported() && isFaceRecognitionSupported);
+}
+
 bool _mv_image_check_system_info_feature_supported(void)
 {
        bool isImageRecognitionSupported = false;
index 1a7cd6aef9cba5e4e4914b86ea229d9cc3996b30..a6779d5b4591fa35c4a578b66b5a742cc0428fa5 100644 (file)
@@ -20,7 +20,8 @@
 
 int mv_face_recognition_create(mv_face_recognition_h *out_handle)
 {
-       MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_check_system_info_feature_supported());
+       MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_recognition_check_system_info_feature_supported());
+       MEDIA_VISION_SUPPORT_CHECK(_mv_training_face_recognition_check_system_info_feature_supported());
 
        MEDIA_VISION_NULL_ARG_CHECK(out_handle);
 
@@ -37,7 +38,8 @@ int mv_face_recognition_create(mv_face_recognition_h *out_handle)
 
 int mv_face_recognition_destroy(mv_face_recognition_h handle)
 {
-       MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_check_system_info_feature_supported());
+       MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_recognition_check_system_info_feature_supported());
+       MEDIA_VISION_SUPPORT_CHECK(_mv_training_face_recognition_check_system_info_feature_supported());
 
        MEDIA_VISION_INSTANCE_CHECK(handle);
 
@@ -54,7 +56,8 @@ int mv_face_recognition_destroy(mv_face_recognition_h handle)
 
 int mv_face_recognition_prepare(mv_face_recognition_h handle)
 {
-       MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_check_system_info_feature_supported());
+       MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_recognition_check_system_info_feature_supported());
+       MEDIA_VISION_SUPPORT_CHECK(_mv_training_face_recognition_check_system_info_feature_supported());
 
        MEDIA_VISION_INSTANCE_CHECK(handle);
 
@@ -71,7 +74,8 @@ int mv_face_recognition_prepare(mv_face_recognition_h handle)
 
 int mv_face_recognition_register(mv_face_recognition_h handle, mv_source_h source, const char *label)
 {
-       MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_check_system_info_feature_supported());
+       MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_recognition_check_system_info_feature_supported());
+       MEDIA_VISION_SUPPORT_CHECK(_mv_training_face_recognition_check_system_info_feature_supported());
 
        MEDIA_VISION_INSTANCE_CHECK(handle);
        MEDIA_VISION_INSTANCE_CHECK(source);
@@ -90,7 +94,8 @@ int mv_face_recognition_register(mv_face_recognition_h handle, mv_source_h sourc
 
 int mv_face_recognition_unregister(mv_face_recognition_h handle, const char *label)
 {
-       MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_check_system_info_feature_supported());
+       MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_recognition_check_system_info_feature_supported());
+       MEDIA_VISION_SUPPORT_CHECK(_mv_training_face_recognition_check_system_info_feature_supported());
 
        MEDIA_VISION_INSTANCE_CHECK(handle);
        MEDIA_VISION_INSTANCE_CHECK(label);
@@ -108,7 +113,8 @@ int mv_face_recognition_unregister(mv_face_recognition_h handle, const char *lab
 
 int mv_face_recognition_inference(mv_face_recognition_h handle, mv_source_h source)
 {
-       MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_check_system_info_feature_supported());
+       MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_recognition_check_system_info_feature_supported());
+       MEDIA_VISION_SUPPORT_CHECK(_mv_training_face_recognition_check_system_info_feature_supported());
 
        MEDIA_VISION_INSTANCE_CHECK(handle);
        MEDIA_VISION_INSTANCE_CHECK(source);
@@ -126,7 +132,8 @@ int mv_face_recognition_inference(mv_face_recognition_h handle, mv_source_h sour
 
 int mv_face_recognition_get_label(mv_face_recognition_h handle, const char **out_label)
 {
-       MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_check_system_info_feature_supported());
+       MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_recognition_check_system_info_feature_supported());
+       MEDIA_VISION_SUPPORT_CHECK(_mv_training_face_recognition_check_system_info_feature_supported());
 
        MEDIA_VISION_INSTANCE_CHECK(handle);
        MEDIA_VISION_INSTANCE_CHECK(out_label);
index 09c1b470f3bac7d2e2a2a90ef09f22fb88e51501..f5249e6cc5fff37292f3388aa7933b6a500c8dad 100644 (file)
@@ -1,6 +1,6 @@
 Name:        capi-media-vision
 Summary:     Media Vision library for Tizen Native API
-Version:     0.23.50
+Version:     0.23.51
 Release:     3
 Group:       Multimedia/Framework
 License:     Apache-2.0 and BSD-3-Clause