测试seetaface人脸识别引擎

本文档描述了如何测试SeetaFace人脸识别引擎,测试文件需放在FaceIdentification/src/test目录下,编译前需完成facedetection, facealignment, faceidentification模块的编译。测试结果显示,在350张图片的图像库和摄像头输入下,8位同事的人脸比对全部成功。此外,facedetection模块在处理2K图片时,i5 CPU单核耗时约0.2秒。" 119414560,10754170,Ajax技术详解与实践,"['前端开发', 'Ajax', 'JSON', '跨域']
摘要由CSDN通过智能技术生成

该测试文件需要放置在FaceIdentification/src/test目录下,为方便编译,代码预处理部分跟文件夹中test_face_verification.cpp相同。编译该文件之前,需要先完成facedetection,facealignment,faceidentification三个模块的编译。

代码如下:

#include<iostream>
using namespace std;

#ifdef _WIN32
#pragma once
#include <opencv2/core/version.hpp>

#define CV_VERSION_ID CVAUX_STR(CV_MAJOR_VERSION) CVAUX_STR(CV_MINOR_VERSION) \
  CVAUX_STR(CV_SUBMINOR_VERSION)

#ifdef _DEBUG
#define cvLIB(name) "opencv_" name CV_VERSION_ID "d"
#else
#define cvLIB(name) "opencv_" name CV_VERSION_ID
#endif //_DEBUG

#pragma comment( lib, cvLIB("core") )
#pragma comment( lib, cvLIB("imgproc") )
#pragma comment( lib, cvLIB("highgui") )

#endif //_WIN32

#if defined(__unix__) || defined(__APPLE__)

#ifndef fopen_s

#define fopen_s(pFile,filename,mode) ((*(pFile))=fopen((filename),(mode)))==NULL

#endif //fopen_s

#endif //__unix

#include <opencv/cv.h>
#include <opencv/highgui.h>
#include "face_identification.h"
#include "recognizer.h"
#include "face_detection.h"
#include "face_alignment.h"
#include <dirent.h>
#include "math_functions.h"
#include <time.h> 
#include <unistd.h>
#include <stdlib.h>

#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <thread>
#include <mutex>

using namespace seeta;

#define TEST(major, minor) major##_##minor##_Tester()
#define EXPECT_NE(a, b) if ((a) == (b)) std::cout << "ERROR: "
#define EXPECT_EQ(a, b) if ((a) != (b)) std::cout << "ERROR: "
//声明变量==============================================================================
    cv::Mat frame;  
    std::vector<std::string> file_name;
    float temp_fea[2048];
    std::mutex mtx;
    bool get_face=false;

    struct st_a{
    std::string name;
    float fea[2048];
    float sim;
    };

    struct st_b{
    std::string name;
    float sim;
    };

    st_a * fea;
//声明函数=============================================================================

    void extract_from_file(std::vector<seeta::FaceInfo> &,int n );
    std::vector<std::string> read_name_from_file(const char* filepath);
    void extract_from_cam(seeta::FaceDetection & ,seeta::FaceAlignment & ,FaceIdentification & ,std::vector<seeta::FaceInfo> & );

    void show_video(cv::VideoCapture & cap);
    void show_picture(std::string filename,std::string win_name,int h_position,int v_position);

//main main main==============================================================================================
int main(){

    const char* filepath = "/home/wd/seeta/image_storehouse";
    const char* image_path = 
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值