--- /dev/null
+/*
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TIZEN_MEDIAVISION_MV_FACE_RECOGNITION_INTERNAL_H__
+#define __TIZEN_MEDIAVISION_MV_FACE_RECOGNITION_INTERNAL_H__
+
+#include <mv_common.h>
+#include <mv_face_recognition_type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @brief Gets confidences after a given face image is recognized.
+ * @details Use this function to get the confidences calling @ref mv_face_recognition_inference().
+ *
+ * @since_tizen 8.0
+ *
+ * @remarks The @a num_of_confidences and @a confidences must NOT be released using free()
+ *
+ * @param[in] handle The handle to the face recognition object.
+ * @param[out] confidences The array pointer to the confidence table which contains a confidence value of each class.
+ * This function returns memory pointer containing actual confidence values to @a confidences.
+ * And please note that @a confidences is valid only while handle is alive.
+ * @param[out] num_of_confidences A number of confidences to the classes registered.
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #MEDIA_VISION_ERROR_NONE Successful
+ * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_VISION_ERROR_INVALID_OPERATION Invalid operation
+ *
+ * @pre Request an inference by calling @ref mv_face_recognition_inference()
+ */
+int mv_face_recognition_get_confidence(mv_face_recognition_h handle, const float **confidences,
+ size_t *num_of_confidences);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __TIZEN_MEDIAVISION_MV_FACE_RECOGNITION_INTERNAL_H__ */
#include "face_recognition_adapter.h"
#include "facenet_adapter.h"
#include "mv_face_recognition.h"
+#include "mv_face_recognition_internal.h"
using namespace std;
using namespace mediavision::common;
return MEDIA_VISION_ERROR_NONE;
}
+
+int mv_face_recognition_get_confidence(mv_face_recognition_h handle, const float **confidences,
+ size_t *num_of_confidences)
+{
+ lock_guard<mutex> lock(g_face_recognition_mutex);
+
+ MEDIA_VISION_SUPPORT_CHECK(_mv_inference_face_check_system_info_feature_supported());
+
+ MEDIA_VISION_INSTANCE_CHECK(handle);
+ MEDIA_VISION_NULL_ARG_CHECK(confidences);
+ MEDIA_VISION_NULL_ARG_CHECK(num_of_confidences);
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ try {
+ auto context = static_cast<Context *>(handle);
+ auto face_recognition_task = static_cast<FaceRecognitionTask *>(context->__tasks["face_recognition"]);
+
+ *confidences = face_recognition_task->getOutput().raw_data.data();
+ *num_of_confidences = face_recognition_task->getOutput().raw_data.size();
+ } catch (const BaseException &e) {
+ LOGE("%s", e.what());
+ return e.getError();
+ }
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return MEDIA_VISION_ERROR_NONE;
+}
\ No newline at end of file
#include "ImageHelper.h"
#include "mv_face_recognition.h"
+#include "mv_face_recognition_internal.h"
#include "face_recognition_test_util.h"
#define TRAINING_IMAGE_PATH "/home/owner/media/res/face_recognition/res/test/training/"
ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
+ size_t num_of_confidences = 0;
+ const float *confidences = nullptr;
+
+ ret = mv_face_recognition_get_confidence(handle, &confidences, &num_of_confidences);
+ ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
+
+ for (unsigned int idx = 0; idx < num_of_confidences; ++idx)
+ cout << confidences[idx] << " ";
+ cout << endl;
+
string label_str(out_label);
if (answers[image_idx++] == label_str)