testsuites/machine_learning/inference/test_inference_helper.cpp
testsuites/machine_learning/inference/test_image_classification.cpp
testsuites/machine_learning/inference/test_object_detection.cpp
+ testsuites/machine_learning/inference/test_face_detection.cpp
)
target_link_libraries(${PROJECT_NAME} gtest gtest_main mv_inference mv_image_helper mv_barcode_detector)
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
\ No newline at end of file
--- /dev/null
+#include <gtest/gtest.h>
+#include <string>
+#include <ImageHelper.h>
+#include "test_inference_helper.hpp"
+
+#define FD_TFLITE_WEIGHT_MOBILENET_V1_SSD_300_PATH \
+ MV_CONFIG_PATH \
+ "/models/FD/tflite/fd_mobilenet_v1_ssd_postop_300x300.tflite"
+#define FD_TFLITE_WEIGHT_BLAZEFACE_128_PATH \
+ MV_CONFIG_PATH \
+ "/models/FD/tflite/fd_blazeface_front_128x128.tflite"
+#define IMG_FACE \
+ MV_CONFIG_PATH \
+ "/res/inference/images/faceDetection.jpg"
+
+void _face_detected_cb(mv_source_h source, const int number_of_faces,
+ const float *confidences,
+ const mv_rectangle_s *locations, void *user_data)
+{
+ EXPECT_GT(number_of_faces, 0);
+}
+
+class TestFaceDetection : public TestInference
+{
+public:
+ void inferenceFace()
+ {
+ ASSERT_EQ(mv_inference_configure(infer, engine_cfg),
+ MEDIA_VISION_ERROR_NONE);
+ ASSERT_EQ(mv_inference_prepare(infer), MEDIA_VISION_ERROR_NONE);
+ ASSERT_EQ(MediaVision::Common::ImageHelper::loadImageToSource(
+ IMG_FACE, mv_source),
+ MEDIA_VISION_ERROR_NONE);
+ ASSERT_EQ(mv_inference_face_detect(mv_source, infer, _face_detected_cb,
+ NULL),
+ MEDIA_VISION_ERROR_NONE);
+ }
+};
+
+TEST_F(TestFaceDetection, CPU_TFLITE_MobilenetV1_SSD)
+{
+ engine_config_hosted_cpu_tflite(engine_cfg,
+ FD_TFLITE_WEIGHT_MOBILENET_V1_SSD_300_PATH);
+ inferenceFace();
+}
\ No newline at end of file