CN107967461A - The training of SVM difference models and face verification method, apparatus, terminal and storage medium - Google Patents
The training of SVM difference models and face verification method, apparatus, terminal and storage medium Download PDFInfo
- Publication number
- CN107967461A CN107967461A CN201711297473.2A CN201711297473A CN107967461A CN 107967461 A CN107967461 A CN 107967461A CN 201711297473 A CN201711297473 A CN 201711297473A CN 107967461 A CN107967461 A CN 107967461A
- Authority
- CN
- China
- Prior art keywords
- positive
- face
- difference
- svm
- training
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V40/00—Recognition of biometric, human-related or animal-related patterns in image or video data
- G06V40/10—Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
- G06V40/12—Fingerprints or palmprints
- G06V40/1365—Matching; Classification
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
- G06F18/241—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
- G06F18/2411—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on the proximity to a decision surface, e.g. support vector machines
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- General Physics & Mathematics (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Evolutionary Biology (AREA)
- Evolutionary Computation (AREA)
- Bioinformatics & Computational Biology (AREA)
- General Engineering & Computer Science (AREA)
- Artificial Intelligence (AREA)
- Life Sciences & Earth Sciences (AREA)
- Human Computer Interaction (AREA)
- Multimedia (AREA)
- Image Analysis (AREA)
Abstract
Description
技术领域technical field
本发明涉及图像识别技术领域,具体涉及一种SVM差分模型训练及人脸验 证方法、装置、终端及存储介质。The present invention relates to the technical field of image recognition, in particular to a SVM differential model training and face verification method, device, terminal and storage medium.
背景技术Background technique
人脸验证(Face Verification)是人脸识别(Face recognition)的子领域,人 脸验证是判断两张人脸图片是不是同一个人,最常用的场景是判断证件是不是 本人,人脸识别则是给定一张人脸图片,然后判断这个人是谁,其实质相当于 多次的人脸验证。Face Verification is a sub-field of Face Recognition. Face Verification is to judge whether two face pictures are the same person. The most commonly used scenario is to judge whether the certificate is the person. Given a face picture and then judging who the person is, it is essentially equivalent to multiple face verifications.
由于动态环境下的人脸图片存在光照、姿态、年龄、装束等多种影响,使 得动态环境下的人脸验证难度非常大。近几年提出了很多方法来改善动态环境 下的人脸验证,这些方法大概可以分为两类。一类是基于传统特征的方法,目 标在于提取有区分性的特征,再结合欧式距离或者余弦夹角距离进行比对,经 典的人脸特征描述算子包括:方向梯度直方图(Histogram of Oriented Gradient, HOG)、局部二值模式(Local Binary Patterns,LBP特征)、尺度不变特征变换 (Scale-invariant feature transform,SIFT)、伽柏(Gabor)特征等。另一类是基 于深度学习的特征表达。Face verification in a dynamic environment is very difficult due to the influence of illumination, posture, age, and clothing on face pictures in a dynamic environment. In recent years, many methods have been proposed to improve face verification in dynamic environments, and these methods can be roughly divided into two categories. One is the method based on traditional features, the goal is to extract distinguishing features, and then combine Euclidean distance or cosine angle distance for comparison. The classic face feature description operators include: Histogram of Oriented Gradient (Histogram of Oriented Gradient) , HOG), local binary patterns (Local Binary Patterns, LBP features), scale-invariant feature transform (Scale-invariant feature transform, SIFT), Gabor (Gabor) features, etc. The other is feature expression based on deep learning.
基于传统特征的方法虽然能获得较快的速度,但是特征表达能力较弱,因 而性能较差。基于深度学习的特征表达需要非常巨大的样本来进行模型的训练, 其次,要想获得较好的表达效果需要更深的网络来保持。另外,由于证件照片 与动态情况下任意采集的照片存在年龄、光照、表情和姿态等多种区别,因而 二者之间的特征空间分布差异较大,即使采用基于深度学习的特征表达也很难 进行模型的训练。Although the traditional feature-based method can obtain faster speed, but the feature expression ability is weak, so the performance is poor. The feature expression based on deep learning requires a very large sample for model training. Secondly, to obtain a better expression effect requires a deeper network to maintain. In addition, since there are many differences in age, lighting, expression and posture between ID photos and photos collected arbitrarily under dynamic conditions, the feature space distribution between the two is quite different, even if the feature expression based on deep learning is used. Carry out model training.
发明内容Contents of the invention
鉴于以上内容,有必要提出一种SVM差分模型训练及人脸验证方法、装置、 终端及存储介质,其可以训练出适合人脸验证的分类模型,在少量样本的情况 下训练出的特征的区分能力较强,获得较佳的人脸验证效果。In view of the above, it is necessary to propose a SVM differential model training and face verification method, device, terminal and storage medium, which can train a classification model suitable for face verification, and distinguish the features trained under the situation of a small number of samples. Strong ability, get better face verification effect.
本申请的第一方面提供一种SVM差分模型训练方法,所述方法包括:The first aspect of the present application provides a kind of SVM difference model training method, described method comprises:
构造正负样本集,包括:Construct positive and negative sample sets, including:
1)提取每张证件照片上的人脸区域的第一人脸特征,提取每张动态照片上 的人脸区域的第二人脸特征;1) Extract the first facial feature of the face area on each ID photo, and extract the second facial feature of the face area on each dynamic photo;
2)对所述第一人脸特征进行归一化处理得到第一归一化人脸特征,对所述 第二人脸特征进行归一化处理得到第二归一化人脸特征;2) carrying out normalization processing to described first human face feature to obtain the first normalized human face feature, carrying out normalization processing to described second human face feature to obtain the second normalized human face feature;
3)对所述第一归一化人脸特征与第二归一化人脸特征进行做差以得到差分 人脸特征;3) performing a difference to the first normalized face feature and the second normalized face feature to obtain the difference face feature;
4)构造正负样本对,其中,所述正样本对为同一个人的动态照片和证件照 片进行人脸特征归一化并差分处理得到的特征及第一类别属性,负样本对为不 同人的动态照片和证件照片进行人脸特征归一化并差分处理得到的特征及第二 类别属性;4) Construct positive and negative sample pairs, wherein, the positive sample pair is the feature and the first category attribute obtained by normalizing and differentially processing facial features and first category attributes of the same person's dynamic photo and ID photo, and the negative sample pair is different people's The features and second category attributes obtained by normalizing face features and differential processing of dynamic photos and ID photos;
训练SVM差分模型,包括:Train the SVM difference model, including:
1):从所构造的正负样本集中生成正负样本训练集及正负样本测试集;1): Generate a positive and negative sample training set and a positive and negative sample test set from the constructed positive and negative sample set;
2):寻找惩罚参数c及核函数的参数g的最优组合;2): Find the optimal combination of the penalty parameter c and the parameter g of the kernel function;
3):保存最优参数组合及对应的SVM差分模型。3): Save the optimal parameter combination and the corresponding SVM difference model.
一种可能的实现方式中,所述从所构造的正负样本集中生成正负样本训练 集及正负样本测试集包括:In a possible implementation, the generating a positive and negative sample training set and a positive and negative sample test set from the constructed positive and negative sample set includes:
在所生成的正负样本训练集中随机选择第一预设数量的正负样本训练集参 与训练;在所生成的正负样本测试集中随机选择第二预设数量的正负样本测试 集参与测试。In the generated positive and negative sample training set, randomly select the first preset number of positive and negative sample training sets to participate in training; in the generated positive and negative sample test set, randomly select the second preset number of positive and negative sample test sets to participate in the test.
一种可能的实现方式中,所述寻找惩罚参数c及核函数的参数g的最优组 合包括:In a possible implementation, the optimal combination of the parameter g of the search penalty parameter c and kernel function includes:
将所述第一预设数量的正负样本训练集输入到SVM中,计算出第一最优组 合参数c、g;The positive and negative sample training sets of the first preset quantity are input in the SVM, and the first optimal combination parameters c, g are calculated;
逐步扩大c、g的范围并缩小步长,保存每一次的组合参数c、g;Gradually expand the range of c and g and reduce the step size, and save the combined parameters c and g for each time;
选择正负样本测试集在已保存的组合参数c、g所对应的SVM差分模型上 进行测试,准确率最高时所对应的参数为第二最优组合参数c、g。Select the positive and negative sample test set to test on the SVM difference model corresponding to the saved combination parameters c and g, and the corresponding parameters with the highest accuracy rate are the second optimal combination parameters c and g.
本申请的第二方面提供一种所述SVM差分模型训练方法训练出的SVM差 分模型进行人脸验证方法,所述方法包括:The second aspect of the present application provides a kind of SVM difference model that described SVM difference model training method trains and carries out face verification method, and described method comprises:
提取待验证人的证件照片中的人脸区域的第三人脸特征;Extract the third face feature of the face area in the ID photo of the person to be verified;
提取待验证人的场景照片中的人脸区域的第四人脸特征;Extracting the fourth face feature of the face area in the scene photo of the person to be verified;
对所述第三人脸特征进行归一化处理得到第三归一化人脸特征,对所述第 四人脸特征进行归一化处理得到第四归一化人脸特征;Carrying out normalization processing to described the 3rd human face feature obtains the 3rd normalized human face feature, carries out normalization processing to described 4th human face feature and obtains the 4th normalized human face feature;
对所述第三归一化人脸特征与第四归一化人脸特征进行做差以得到所述待 验证人的差分人脸特征;及The third normalized face feature and the fourth normalized face feature are differenced to obtain the difference face feature of the person to be verified; and
根据所述SVM差分模型计算所述差分人脸特征的相似度;Calculate the similarity of the difference facial features according to the SVM difference model;
判断所述相似度是否大于预设阈值;及judging whether the similarity is greater than a preset threshold; and
当所述相似度大于所述预设阈值时,确定所述证件照片与所述场景照片不 为同一个人;或者When the similarity is greater than the preset threshold, it is determined that the ID photo and the scene photo are not the same person; or
当所述相似度小于或等于预设阈值时,确定所述证件照片与所述场景照片 为同一个人。When the similarity is less than or equal to a preset threshold, it is determined that the ID photo and the scene photo are of the same person.
本申请的第三方面提供一种SVM差分模型训练装置,所述装置包括:A third aspect of the present application provides an SVM differential model training device, the device comprising:
构造模块,用于构造正负样本集,包括:Construction modules, used to construct positive and negative sample sets, including:
特征提取子模块,用于提取每张证件照片上的人脸区域的第一人脸特征, 提取每张动态照片上的人脸区域的第二人脸特征;The feature extraction submodule is used to extract the first facial feature of the face area on each ID photo, and extract the second facial feature of the face area on each dynamic photo;
归一化子模块,用于对所述第一人脸特征进行归一化处理得到第一归一化 人脸特征,对所述第二人脸特征进行归一化处理得到第二归一化人脸特征;A normalization sub-module, configured to perform normalization processing on the first facial feature to obtain a first normalized facial feature, and perform normalization processing on the second facial feature to obtain a second normalization facial features;
差分子模块,用于对所述第一归一化人脸特征与第二归一化人脸特征进行 做差以得到差分人脸特征;Difference sub-module, is used to carry out difference to described first normalized human face feature and second normalized human face feature to obtain differential human face feature;
构造子模块,用于构造正负样本对,其中,所述正样本对为同一个人的动 态照片和证件照片进行人脸特征归一化并差分处理得到的特征及第一类别属 性,负样本对为不同人的动态照片和证件照片进行人脸特征归一化并差分处理 得到的特征及第二类别属性;Constructing sub-modules for constructing positive and negative sample pairs, wherein the positive sample pairs are the features and first category attributes obtained by normalizing face features and differential processing of dynamic photos and ID photos of the same person, and the negative sample pairs The features and second category attributes obtained by normalizing face features and differential processing for dynamic photos and ID photos of different people;
训练模块,用于训练SVM差分模型,包括:The training module is used to train the SVM difference model, including:
生成子模块,用于从所构造的正负样本集中生成正负样本训练集及正负样 本测试集;Generate a submodule, which is used to generate a positive and negative sample training set and a positive and negative sample test set from the constructed positive and negative sample set;
寻优子模块,用于寻找惩罚参数c及核函数的参数g的最优组合;The optimization sub-module is used to find the optimal combination of the penalty parameter c and the parameter g of the kernel function;
保存子模块,用于保存最优参数组合及对应的SVM差分模型。The saving sub-module is used to save the optimal parameter combination and the corresponding SVM difference model.
一种可能的实现方式中,所述生成子模块从所构造的正负样本集中生成正 负样本训练集及正负样本测试集包括:In a possible implementation, the generating submodule generates a positive and negative sample training set and a positive and negative sample test set from the constructed positive and negative sample sets including:
在所生成的正负样本训练集中随机选择第一预设数量的正负样本训练集参 与训练;在所生成的正负样本测试集中随机选择第二预设数量的正负样本测试 集参与测试。In the generated positive and negative sample training set, randomly select the first preset number of positive and negative sample training sets to participate in training; in the generated positive and negative sample test set, randomly select the second preset number of positive and negative sample test sets to participate in the test.
一种可能的实现方式中,所述寻优子模块寻找惩罚参数c及核函数的参数g 的最优组合包括:In a possible implementation, the optimal combination of the optimization sub-module looking for the penalty parameter c and the parameter g of the kernel function includes:
将所述第一预设数量的正负样本训练集输入到SVM中,计算出第一最优组 合参数c、g;The positive and negative sample training sets of the first preset quantity are input in the SVM, and the first optimal combination parameters c, g are calculated;
逐步扩大c、g的范围并缩小步长,保存每一次的组合参数c、g;Gradually expand the range of c and g and reduce the step size, and save the combined parameters c and g for each time;
选择正负样本测试集在已保存的组合参数c、g所对应的SVM差分模型上 进行测试,准确率最高时所对应的参数为第二最优组合参数c、g。Select the positive and negative sample test set to test on the SVM difference model corresponding to the saved combination parameters c and g, and the corresponding parameters with the highest accuracy rate are the second optimal combination parameters c and g.
本申请的第四方面提供一种利用所述SVM差分模型训练装置训练出的 SVM差分模型进行人脸验证装置,所述装置包括:The fourth aspect of the present application provides a device for face verification using the SVM differential model trained by the SVM differential model training device, the device comprising:
第一提取模块,用于提取待验证人的证件照片中的人脸区域的第三人脸特 征;The first extraction module is used to extract the third face feature of the face area in the ID photo of the person to be verified;
第二提取模块,用于提取待验证人的场景照片中的人脸区域的第四人脸特 征;The second extraction module is used to extract the fourth facial feature of the human face area in the scene photo of the person to be verified;
归一化模块,用于对所述第三人脸特征进行归一化处理得到第三归一化人 脸特征,对所述第四人脸特征进行归一化处理得到第四归一化人脸特征;A normalization module, configured to perform normalization processing on the third face feature to obtain a third normalized face feature, and perform normalization processing on the fourth face feature to obtain a fourth normalized face feature. facial features;
差分模块,用于对所述第三归一化人脸特征与第四归一化人脸特征进行做 差以得到所述待验证人的差分人脸特征;及A difference module, used to make a difference between the third normalized face feature and the fourth normalized face feature to obtain the differential face feature of the person to be verified; and
验证模块,用于根据所述SVM差分模型计算所述差分人脸特征的相似度; 及A verification module, configured to calculate the similarity of the differential facial features according to the SVM differential model; and
所述验证模块,还用于判断所述相似度是否大于预设阈值;及The verification module is also used to judge whether the similarity is greater than a preset threshold; and
当所述相似度大于所述预设阈值时,所述验证模块确定所述证件照片与所 述场景照片不为同一个人;或者When the similarity is greater than the preset threshold, the verification module determines that the ID photo and the scene photo are not the same person; or
当所述相似度小于或等于预设阈值时,所述验证模块确定所述证件照片与 所述场景照片为同一个人。When the similarity is less than or equal to a preset threshold, the verification module determines that the ID photo and the scene photo are of the same person.
本申请的第五方面提供一种终端,所述终端包括处理器,所述处理器用于 执行存储器中存储的计算机程序时实现支持向量机差分模型训练方法或所述人 脸验证方法。A fifth aspect of the present application provides a terminal, the terminal includes a processor, and the processor is configured to implement a support vector machine differential model training method or the face verification method when executing a computer program stored in a memory.
本申请的第六方面提供一种计算机可读存储介质,其上存储有计算机程序, 所述计算机程序被处理器执行时实现支持向量机差分模型训练方法或所述人脸 验证方法。A sixth aspect of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, a support vector machine difference model training method or the face verification method is implemented.
本发明所述的支持向量机差分模型训练、人脸验证方法、装置、终端及存 储介质,将支持向量机和差分模型的思想相结合,将其应用在人脸验证上,能 够解决证件照片的特征空间分布与动态情况下任意采集的照片的特征空间分布 有差异的问题;在模型训练阶段只需要少量样本即可,从而解决了算法对数据 量的需求问题,增加了算法的实用性,提高了人证验证的准确率。The support vector machine difference model training, face verification method, device, terminal and storage medium described in the present invention combine the idea of support vector machine and difference model, apply it to face verification, and can solve the problem of certificate photos There is a difference between the feature space distribution and the feature space distribution of randomly collected photos under dynamic conditions; only a small number of samples are needed in the model training stage, which solves the problem of the algorithm’s demand for data volume, increases the practicability of the algorithm, and improves The accuracy of witness verification.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实 施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面 描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不 付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only It is an embodiment of the present invention, and those skilled in the art can also obtain other drawings according to the provided drawings without creative work.
图1是本发明实施例一提供的支持向量机差分模型训练方法的流程图。FIG. 1 is a flowchart of a method for training a support vector machine difference model provided by Embodiment 1 of the present invention.
图2是本发明实施例二提供的人脸验证方法的流程图。Fig. 2 is a flow chart of the face verification method provided by Embodiment 2 of the present invention.
图3是本发明实施例三提供的支持向量机差分模型训练装置的结构图。FIG. 3 is a structural diagram of a support vector machine differential model training device provided by Embodiment 3 of the present invention.
图4是本发明实施例四提供的人脸验证装置的结构图。Fig. 4 is a structural diagram of a face verification device provided in Embodiment 4 of the present invention.
图5是本发明实施例五提供的终端的示意图。FIG. 5 is a schematic diagram of a terminal provided in Embodiment 5 of the present invention.
如下具体实施方式将结合上述附图进一步说明本发明。The following specific embodiments will further illustrate the present invention in conjunction with the above-mentioned drawings.
具体实施方式Detailed ways
为了能够更清楚地理解本发明的上述目的、特征和优点,下面结合附图 和具体实施例对本发明进行详细描述。需要说明的是,在不冲突的情况下, 本申请的实施例及实施例中的特征可以相互组合。In order to more clearly understand the above objects, features and advantages of the present invention, the present invention will be described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that, in the case of no conflict, the embodiments of the present application and the features in the embodiments can be combined with each other.
在下面的描述中阐述了很多具体细节以便于充分理解本发明,所描述的 实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的 实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其 他实施例,都属于本发明保护的范围。In the following description, many specific details are set forth in order to fully understand the present invention, and the described embodiments are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
除非另有定义,本文所使用的所有的技术和科学术语与属于本发明的技 术领域的技术人员通常理解的含义相同。本文中在本发明的说明书中所使用 的术语只是为了描述具体的实施例的目的,不是旨在于限制本发明。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the technical field of the invention. The terms used herein in the description of the present invention are for the purpose of describing specific embodiments only, and are not intended to limit the present invention.
优选地,本发明的人脸验证方法应用在一个或者多个终端中。所述终端 是一种能够按照事先设定或存储的指令,自动进行数值计算和/或信息处理的 设备,其硬件包括但不限于微处理器、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程门阵列(Field-Programmable Gate Array, FPGA)、数字处理器(Digital SignalProcessor,DSP)、嵌入式设备等。Preferably, the face verification method of the present invention is applied to one or more terminals. The terminal is a device that can automatically perform numerical calculations and/or information processing according to preset or stored instructions, and its hardware includes but not limited to microprocessors, application specific integrated circuits (ASIC), Programmable gate array (Field-Programmable Gate Array, FPGA), digital processor (Digital Signal Processor, DSP), embedded devices, etc.
所述终端并不限定于个人电脑、智能手机、平板电脑、安装有摄像头的 台式机或一体机,或者桌上型计算机、笔记本、掌上电脑及云端服务器等计 算设备。所述终端可以与用户通过键盘、鼠标、遥控器、触摸板或声控设备 等方式进行人机交互。The terminal is not limited to a personal computer, a smart phone, a tablet computer, a desktop computer or an all-in-one computer equipped with a camera, or computing equipment such as a desktop computer, a notebook, a handheld computer, and a cloud server. The terminal can perform human-computer interaction with the user through keyboard, mouse, remote control, touch panel or voice control equipment.
所述支持向量机差分模型训练方法及人脸验证方法也可以应用于由终端 和通过网络与所述终端进行连接的服务器所构成的硬件环境中。网络包括但 不限于:广域网、城域网或局域网。本发明实施例的支持向量机差分模型训 练方法及人脸验证方法可以同时由服务器来执行,也可以同时由终端来执行; 还可以是由服务器和终端共同执行,比如,所述支持向量机差分模型训练方 法由服务器来执行,所述人脸验证方法由终端来执行,或者,所述人脸验证 方法由服务器来执行,所述支持向量机差分模型训练方法由终端来执行。本 申请在此不加以限制。The support vector machine difference model training method and the face verification method can also be applied to a hardware environment composed of a terminal and a server connected to the terminal through a network. Networks include, but are not limited to: Wide Area Networks, Metropolitan Area Networks, or Local Area Networks. The support vector machine difference model training method and the face verification method in the embodiment of the present invention can be executed by the server at the same time, and can also be executed by the terminal at the same time; it can also be executed by the server and the terminal, for example, the support vector machine difference The model training method is executed by the server, the face verification method is executed by the terminal, or the face verification method is executed by the server, and the support vector machine difference model training method is executed by the terminal. The application is not limited here.
对于需要进行支持向量机差分模型训练方法及人脸验证方法的终端,可 以直接在终端上集成本申请的方法所提供的支持向量机差分模型训练功能及 人脸验证功能,或者安装用于实现本申请的方法的客户端。再如,本申请所 提供的方法还可以软件开发工具包(Software Development Kit,SDK)的形 式运行在服务器等设备上,以SDK的形式提供支持向量机差分模型训练功能 及人脸验证功能的接口,终端或其他设备通过提供的接口即可实现人脸的验 证。For terminals that need support vector machine differential model training method and face verification method, the support vector machine differential model training function and face verification function provided by the method of this application can be directly integrated on the terminal, or installed to realize this application The client side of the application method. For another example, the method provided by this application can also run on devices such as a server in the form of a software development kit (Software Development Kit, SDK), and provide an interface for the support vector machine differential model training function and the face verification function in the form of an SDK. , terminals or other devices can realize face verification through the provided interface.
实施例一Embodiment one
图1是本发明实施例一提供的支持向量机差分模型训练方法的流程图。 根据不同的需求,图1所示流程图中的执行顺序可以改变,某些步骤可以省 略。FIG. 1 is a flowchart of a method for training a support vector machine difference model provided by Embodiment 1 of the present invention. According to different requirements, the execution sequence in the flowchart shown in Figure 1 can be changed, and some steps can be omitted.
101:构造正负样本集。101: Construct positive and negative sample sets.
本较佳实施例中,准备不同人的一张证件照片及同一人对应的一张动态 情况下任意采集的照片。In this preferred embodiment, prepare a photo of a certificate of different people and a photo randomly collected under a dynamic situation corresponding to the same person.
所述证件照片是指证件上用来证明身份的照片,可以是身份证照片,可 以是护照照片,还可以是各种签证照片,或者驾驶证照片、毕业证照片等。Described certificate photo refers to the photo that is used to prove identity on the certificate, can be ID card photo, can be passport photo, can also be various visa photos, or driver's license photo, graduation certificate photo etc.
本较佳实施例中,可以采用LFW数据集来构造正负样本集,所述LFW 数据集是为了研究非限制环境下的人脸识别问题而建立,其中包含了超过 13000张人脸图像,人脸图像全部来自于Internet,而不是实验室环境。In this preferred embodiment, the LFW data set can be used to construct positive and negative sample sets. The LFW data set is established to study the face recognition problem in an unrestricted environment, which contains more than 13,000 face images. The face images are all from the Internet, not a laboratory environment.
为便于下文描述,将动态情况下任意采集的照片称之为动态照片。For the convenience of the following description, the photos randomly collected under dynamic conditions are called dynamic photos.
所述构造正负样本集具体包括:The construction of positive and negative sample sets specifically includes:
1)提取每张证件照片上的人脸区域的第一人脸特征,提取每张动态照片 上的人脸区域的第二人脸特征;1) Extract the first facial feature of the face area on each ID photo, and extract the second facial feature of the face area on each dynamic photo;
本较佳实施例中,将第i个人的证件照片对应的人脸特征,即第i个人的 第一人脸特征记为xi,将第i个人的动态照片对应的人脸特征,即第i个人的 第二人脸特征记为Xi。In this preferred embodiment, the face feature corresponding to the ID photo of the i-th person, that is, the first face feature of the i-th person is denoted as xi , and the face feature corresponding to the dynamic photo of the i-th person, that is, the first face feature of the i-th person The second face feature of person i is denoted as X i .
本较佳实施例中,在提取人脸特征之前,可以采用预先存储的人脸检测 算法对证件照片上的人脸区域及动态照片上的人脸区域进行检测,然后采用 预先存储的人脸特征提取算法对检测出的人脸区域进行人脸特征提取。In this preferred embodiment, before extracting the facial features, a pre-stored face detection algorithm can be used to detect the face area on the ID photo and the face area on the dynamic photo, and then use the pre-stored face feature The extraction algorithm performs face feature extraction on the detected face area.
所述预先存储的人脸检测算法可以为以下算法中的一种或多种组合:基 于模板的人脸检测方法、基于人工神经网络的人脸检测方法、基于模型的人 脸检测方法、基于肤色的人脸检测方法或者基于特征子脸的人脸检测方法等。The pre-stored face detection algorithm can be one or more combinations of the following algorithms: template-based face detection method, artificial neural network-based face detection method, model-based face detection method, skin color-based The face detection method or the face detection method based on the feature sub-face, etc.
所述预先存储的人脸特征提取算法可以为以下算法中的一种或多种组 合:Gabor特征、方向梯度直方图(Histogram of Oriented Gradient,HOG)、 局部二值模式(LocalBinary Patterns,LBP)、主成分分析(Principal Component Analysis,PCA)、线性判别分析(Linear Discriminant Analysis,LDA)或者 独立成分分析(independent componentanalysis,ICA)等。优选地,因深度 学习特征具有较好的特征表达能力,本实施例中,采用深度学习算法来提取 证件照片及动态照片上的人脸区域的人脸特征。The face feature extraction algorithm stored in advance can be one or more combinations of the following algorithms: Gabor feature, histogram of oriented gradient (Histogram of Oriented Gradient, HOG), local binary pattern (LocalBinary Patterns, LBP), Principal component analysis (Principal Component Analysis, PCA), linear discriminant analysis (Linear Discriminant Analysis, LDA) or independent component analysis (independent component analysis, ICA), etc. Preferably, because the deep learning feature has better feature expression ability, in this embodiment, the deep learning algorithm is used to extract the face features of the face area on the ID photo and the dynamic photo.
本实施例中,所述预先存储的人脸检测算法及所述预先存储的人脸特征 提取算法不限于上述列举的,任何适应于检测出人脸区域的算法及提取人脸 区域的人脸特征的算法均可应用与此。另外,本实施例中预先存储的人脸检 测算法及人脸特征提取算法均为现有技术,本文在此不再详细介绍。In this embodiment, the pre-stored face detection algorithm and the pre-stored face feature extraction algorithm are not limited to those listed above, any algorithm suitable for detecting the face area and extracting the face features of the face area algorithm can be applied to this. In addition, the pre-stored face detection algorithm and face feature extraction algorithm in this embodiment are all existing technologies, and will not be described in detail herein.
2)对所述第一人脸特征进行归一化处理得到第一归一化人脸特征,对所 述第二人脸特征进行归一化处理得到第二归一化人脸特征;2) carrying out normalization processing to described first human face feature to obtain the first normalized human face feature, carrying out normalization processing to described second human face feature to obtain the second normalized human face feature;
本较佳实施例中,将第i个人的第一人脸特征进行归一化处理得到第一归一化人脸特征记为将第i个人的第二人脸特征进行归一化处理得到第二归一化人脸特征为 In this preferred embodiment, the first face feature of the ith person is normalized to obtain the first normalized face feature as The second face feature of the i-th person is normalized to obtain the second normalized face feature as
应当理解的是,||x||2为x向量各个元素平方和的1/2次方,即L2范数意 义下的欧式距离。It should be understood that ||x|| 2 is the 1/2 power of the sum of the squares of the elements of the x vector, that is, the Euclidean distance in the sense of the L2 norm.
3)对所述第一归一化人脸特征与第二归一化人脸特征进行做差以得到差 分人脸特征;3) performing a difference to the first normalized face feature and the second normalized face feature to obtain the differential face feature;
本较佳实施例中,第i个人的差分人脸特征记为 In this preferred embodiment, the i-th person's differential face feature is denoted as
需要说明的是,对人脸特征进行归一化处理是为了使得处理后的数据能 够在0-1之间分布,统一样本的统计分布特性不仅可以方便后续的数据处理, 还能提高算法性能使得收敛加快。其次,将同一个人的归一化人脸特征进行 差分处理,可表征该人在动态情况下任意采集的照片与证件照片由于年龄、 光照、表情、姿态等变化而引起的差异信息。It should be noted that the purpose of normalizing face features is to make the processed data distributed between 0-1, and the statistical distribution characteristics of uniform samples can not only facilitate subsequent data processing, but also improve the performance of the algorithm so that Convergence is accelerated. Secondly, the difference processing of the normalized face features of the same person can represent the difference information caused by the changes of age, illumination, expression, posture, etc. between the photos arbitrarily collected by the person in dynamic situations and the ID photos.
4)构造正负样本对。4) Construct positive and negative sample pairs.
本较佳实施例中,对所有人的动态照片和证件照片进行人脸特征归一化 并差分处理得到差分人脸特征。则第k个正样本特征为同一个人的动态照片 和证件照片进行人脸特征归一化并差分处理得到的特征,记为 正样本的类别属性为第一类别属性,记为1。第 h个负样本特征为不同人的动态照片和证件照片进行人脸特征归一化并差分 处理得到的特征,记为负样本的类别属性为第二 类别属性,记为0。即,正样本集合为多个正样本特征及第一类别属性组成 的数据对,负样本集合为多个负样本特征及第二类别属性组成的数据对。In this preferred embodiment, the face features of all the dynamic photos and ID photos are normalized and differentially processed to obtain differential face features. Then the feature of the kth positive sample is the feature obtained by normalizing face features and differential processing of the dynamic photo and ID photo of the same person, denoted as The category attribute of the positive sample is the first category attribute, denoted as 1. The hth negative sample feature is the feature obtained by normalizing face features and differential processing of dynamic photos and ID photos of different people, denoted as The category attribute of the negative sample is the second category attribute, denoted as 0. That is, the positive sample set is a data pair composed of multiple positive sample features and the first category attribute, and the negative sample set is a data pair composed of multiple negative sample features and the second category attribute.
102:训练SVM差分模型。102: Train the SVM difference model.
本较佳实施例中,采用支持向量机(Support Vector Machine,SVM)作 为分类器进行模型训练。SVM是一个有监督的学习模型,通常用来进行模式 识别、分类及回归分析。SVM的主要思想:一是针对线性可分情况进行分析, 对于线性不可分的情况,通过使用非线性映射算法将低维输入空间线性不可 分的样本转化为高维特征空间使其线性可分,从而使得高维特征空间采用线 性算法对样本的非线性特征进行线性分析成为可能。二是基于结构风险最小 化理论之上在特征空间中构建最优超平面,使得学习器得到全局最优化,并且在整个样本空间的期望以某个概率满足一定上界。简而言之,给定正负训 练样本集,在特征空间上找到一个分离超平面,将样本点分到不同的类。当 且存在唯一的分类超平面,使得样本点距离分类超平面的距离最大。找到超 平面后,对于待测点,通过计算该点相对于超平面的位置进行分类。在训练 SVM模型的过程中,最重要的就是求取参数cost、gamma的最优组合值。其 中,cost(-c)是惩罚参数,即对误差的宽容度,c值越高,对误差的宽容度越低,gamma(-g)是SVM核函数的参数,隐含地决定了数据映射到新的特 征空间后的分布。本实施例中,可以选择径向基核函数。In this preferred embodiment, a support vector machine (Support Vector Machine, SVM) is used as a classifier for model training. SVM is a supervised learning model, usually used for pattern recognition, classification and regression analysis. The main idea of SVM: one is to analyze the case of linear separability. For the case of linear inseparability, the linear non-separable samples in the low-dimensional input space are transformed into high-dimensional feature spaces by using the nonlinear mapping algorithm to make them linearly separable, so that It is possible to linearly analyze the nonlinear characteristics of samples by using linear algorithms in high-dimensional feature spaces. The second is to construct the optimal hyperplane in the feature space based on the structural risk minimization theory, so that the learner can be globally optimized, and the expectation in the entire sample space meets a certain upper bound with a certain probability. In short, given a set of positive and negative training samples, a separating hyperplane is found in the feature space to classify the sample points into different classes. When and there is a unique classification hyperplane, so that the distance between the sample point and the classification hyperplane is the largest. After finding the hyperplane, for the point to be measured, it is classified by calculating the position of the point relative to the hyperplane. In the process of training the SVM model, the most important thing is to find the optimal combination value of the parameters cost and gamma. Among them, cost(-c) is the penalty parameter, that is, the tolerance to error. The higher the value of c, the lower the tolerance to error. Gamma(-g) is the parameter of the SVM kernel function, which implicitly determines the data mapping. The distribution after entering the new feature space. In this embodiment, a radial basis kernel function may be selected.
所述训练SVM差分模型具体包括:The training SVM differential model specifically includes:
1):从所构造的正负样本集中生成正负样本训练集及正负样本测试集;1): Generate a positive and negative sample training set and a positive and negative sample test set from the constructed positive and negative sample set;
本较佳实施例中,训练SVM差分模型时可以采用交叉验证(Cross Validation)的思想,将构造的正负样本集按照合适的比例进行划分成正负样 本训练集及正负样本测试集,合适的划分比例如6:4。In this preferred embodiment, the idea of cross-validation (Cross Validation) can be used when training the SVM difference model, and the constructed positive and negative sample sets are divided into positive and negative sample training sets and positive and negative sample test sets according to appropriate proportions. The division ratio is 6:4.
所述正负样本训练集用以训练SVM差分模型,所述正负样本测试集用 以测试所训练出的SVM差分模型的性能,若测试的准确率越高,则表明所 训练出的SVM差分模型的性能越好;若测试的准确率较低,则表明所训练 出的SVM差分模型的性能较差。The positive and negative sample training set is used to train the SVM differential model, and the positive and negative sample test set is used to test the performance of the trained SVM differential model. If the accuracy of the test is higher, it indicates that the trained SVM differential model The better the performance of the model is; if the test accuracy is lower, it indicates that the performance of the trained SVM difference model is poor.
进一步地,若划分出的正负样本训练集的总数量依旧较大,即将所有的 正负样本训练集用来参与SVM差分模型的训练,将导致寻找SVM差分模型 对应的最优参数c,g代价较大,因而,所述生成正负样本训练集还可以包括: 在所生成的正负样本训练集中随机选择第一预设数量的正负样本训练集参与 训练。Furthermore, if the total number of divided positive and negative sample training sets is still large, that is, all the positive and negative sample training sets are used to participate in the training of the SVM differential model, which will lead to finding the optimal parameters c, g corresponding to the SVM differential model The cost is high, therefore, the generating the training set of positive and negative samples may further include: randomly selecting a first preset number of training sets of positive and negative samples from the generated training set of positive and negative samples to participate in the training.
本较佳实施例中,为了增加参与训练的正负样本训练集的随机性,可以 采用随机数生成算法进行随机选择。In this preferred embodiment, in order to increase the randomness of the training set of positive and negative samples participating in the training, a random number generation algorithm can be used for random selection.
本较佳实施例中,所述第一预设数量可以是一个预先设置的固定值,例 如,40,即在所生成的正负样本训练集中随机挑选出40个样本参与SVM差 分模型的训练。所述第一预设数量还可以是一个预先设置的比例值,例如, 1/10,即,即在所生成的正负样本训练集中随机挑选1/10比例的样本参与 SVM差分模型的训练。In this preferred embodiment, the first preset number can be a preset fixed value, for example, 40, that is, 40 samples are randomly selected from the generated positive and negative sample training set to participate in the training of the SVM difference model. The first preset number can also be a preset ratio value, for example, 1/10, that is, randomly select samples with a ratio of 1/10 in the generated positive and negative sample training set to participate in the training of the SVM difference model.
2):寻找参数c,g的最优组合;2): Find the optimal combination of parameters c and g;
本较佳实施例中,c为惩罚参数,表示对误分类点的惩罚权重,g是核函 数半径。所述寻找参数c,g的最优组合可以包括:将所述第一预设数量的正 负样本训练集输入到SVM中,计算出第一最优组合参数c、g;在所述第一 最优组合参数c、g的基础上,逐步扩大c、g的范围并缩小步长,保存每一 次的组合参数c、g,选择正负样本测试集在已保存的组合参数c、g所对应 的SVM差分模型上进行测试,准确率最高时所对应的参数为第二最优组合 参数c、g。In this preferred embodiment, c is a penalty parameter, which represents the penalty weight for misclassified points, and g is the radius of the kernel function. The search for the optimal combination of parameters c and g may include: inputting the first preset number of positive and negative sample training sets into the SVM, and calculating the first optimal combination parameters c and g; On the basis of the optimal combination parameters c and g, gradually expand the range of c and g and reduce the step size, save the combination parameters c and g each time, and select the positive and negative sample test set corresponding to the saved combination parameters c and g Tested on the SVM difference model, the parameters corresponding to the highest accuracy rate are the second optimal combination parameters c and g.
3):保存所述第二最优组合参数c、g及所对应的SVM差分模型。3): saving the second optimal combination parameters c, g and the corresponding SVM difference model.
进一步地,应当理解的是,当惩罚参数c过大时,易出现过拟合的情况。 当惩罚参数c过小时,导致训练出的模型的分类功能丧失。因此,选择合适 的惩罚参数c,会大大提高模型的分类性能。为了保证第二最优组合参数c、 g的高度可靠性,提高所对应的SVM差分模型的验证效果,可以进行多次寻 优,则所述选择正负样本测试集还可以包括:在所生成的正负样本测试集中 随机选择第二预设数量的正负样本测试集参与测试。Further, it should be understood that when the penalty parameter c is too large, overfitting tends to occur. When the penalty parameter c is too small, the classification function of the trained model will be lost. Therefore, choosing an appropriate penalty parameter c will greatly improve the classification performance of the model. In order to ensure the high reliability of the second optimal combination parameters c and g, improve the verification effect of the corresponding SVM differential model, multiple optimizations can be carried out, then the selection of positive and negative sample test sets can also include: in the generated Randomly select a second preset number of positive and negative sample test sets from the positive and negative sample test set to participate in the test.
本较佳实施例中,所述第二预设数量可以是一个预先设置的固定值,例 如,30,即在所生成的正负样本测试集中随机挑选出40个样本参与SVM差 分模型的测试。所述第二预设数量还可以是一个预先设置的比例值,例如, 1/5,即,即在所生成的正负样本测试集中随机挑选1/5比例的样本参与SVM 差分模型的测试。In this preferred embodiment, the second preset number can be a preset fixed value, for example, 30, that is, 40 samples are randomly selected from the generated positive and negative sample test set to participate in the test of the SVM difference model. The second preset number can also be a preset ratio value, for example, 1/5, that is, randomly select samples with a ratio of 1/5 in the generated positive and negative sample test set to participate in the test of the SVM difference model.
实施例一的支持向量机差分模型训练方法,首先构造正负样本集,然后 根据所述正负样本集训练SVM差分模型。在构造正负样本集时,对所有人 的动态照片和证件照片进行人脸特征归一化并差分处理得到差分人脸特征, 可有效表征由于年龄、光照、表情、姿态等变化而引起的人脸的差异信息。 在训练SVM差分模型时,采用支持向量机(SupportVector Machine,SVM) 作为分类器进行模型训练,支持向量机算法对二分类问题有着良好的表现效 果,同时对训练样本的数量要求不高。为了获得最优参数c、g组合,采用交 叉验证的方法,在所生成的正负样本训练集中随机选择第一预设数量的正负 样本训练集参与训练,在所生成的正负样本测试集中随机选择第二预设数量 的正负样本测试集参与测试。因此,实施例一的支持向量机差分模型训练方 法将支持向量机、交叉验证及随机数的思想结合在一起,将其应用在人脸验 证上,在样本量有限的前提下,能够训练出适合人脸验证的SVM差分模型。The support vector machine difference model training method of embodiment 1 first constructs positive and negative sample sets, and then trains the SVM difference model according to the positive and negative sample sets. When constructing the positive and negative sample sets, normalize the facial features of all the dynamic photos and ID photos and perform differential processing to obtain differential facial features, which can effectively represent the facial features caused by changes in age, illumination, expression, posture, etc. Face difference information. When training the SVM difference model, the support vector machine (Support Vector Machine, SVM) is used as the classifier for model training. The support vector machine algorithm has a good performance effect on the binary classification problem, and the number of training samples is not high. In order to obtain the optimal combination of parameters c and g, a cross-validation method is used to randomly select the first preset number of positive and negative sample training sets in the generated positive and negative sample training set to participate in training, and in the generated positive and negative sample test set Randomly select a second preset number of positive and negative sample test sets to participate in the test. Therefore, the support vector machine differential model training method in the first embodiment combines the ideas of support vector machine, cross-validation and random numbers, and applies it to face verification. Under the premise of limited sample size, it can train suitable SVM difference model for face verification.
实施例二Embodiment two
图2是本发明实施例二提供的人脸验证方法的流程图。Fig. 2 is a flow chart of the face verification method provided by Embodiment 2 of the present invention.
如图2所示,所述人脸验证方法具体包括以下步骤,根据不同的需求, 该流程图中步骤的顺序可以改变,某些步骤可以省略。As shown in FIG. 2 , the face verification method specifically includes the following steps. According to different requirements, the order of the steps in the flow chart can be changed, and some steps can be omitted.
201:提取待验证人的证件照片中的人脸区域的第三人脸特征。201: Extract the third face feature of the face area in the ID photo of the person to be verified.
在一些实施例中,可以先使用读卡器读取所述证件照片中的人脸区域, 再对所述待验证人的证件照片中的人脸区域进行检测。In some embodiments, a card reader may be used to first read the face area in the ID photo, and then detect the face area in the ID photo of the person to be verified.
202:提取待验证人的场景照片中的人脸区域的第四人脸特征。202: Extract the fourth face feature of the face area in the scene photo of the person to be verified.
为便于下文描述,将动态情况下采集的场景照片称之为场景照片。For the convenience of description below, the scene photos collected under dynamic conditions are referred to as scene photos.
本较佳实施例中,可以采用所述预先存储的人脸检测算法对待验证人的 证件照片上的人脸区域及场景图片中的人脸区域进行检测,采用预先存储的 人脸特征提取算法对检测出的人脸区域进行人脸特征提取。优选地,因深度 学习特征具有较好的特征表达能力,本实施例中,采用深度学习算法来提取 证件照片及场景照片上的人脸区域的人脸特征。本申请对人脸区域的检测及 对人脸区域的特征提取过程不做详细赘述。In this preferred embodiment, the pre-stored face detection algorithm can be used to detect the face area on the certificate photo of the person to be verified and the face area in the scene picture, and the pre-stored face feature extraction algorithm is used to detect The detected face area is subjected to face feature extraction. Preferably, because the deep learning feature has better feature expression ability, in this embodiment, the deep learning algorithm is used to extract the face features of the face area on the certificate photo and the scene photo. This application does not repeat in detail the detection of the face area and the feature extraction process of the face area.
在一些实施例中,所述步骤201和步骤202可以是并行处理的。在一些 实施例中,在利用人脸检测算法检测场景图片中的人脸区域之前,本发明所 述的人脸验证方法还可以包括:对所述场景图片进行预处理。In some embodiments, the steps 201 and 202 may be processed in parallel. In some embodiments, before using the face detection algorithm to detect the face area in the scene picture, the face verification method of the present invention may also include: preprocessing the scene picture.
本实施例中,所述对所述场景图片进行预处理可以包括,但不限于,图 像去噪,光照归一化,姿态校准,灰度归一化等。例如,可以采用高斯滤波 器对所述场景图片进行滤波,去除所述场景图片中的噪声;采用商图像技术 除去高亮光照对所述场景图片的影响;采用正弦变换对所述场景图片中的人 脸姿态进行校准。In this embodiment, the preprocessing of the scene picture may include, but not limited to, image denoising, illumination normalization, posture calibration, grayscale normalization, etc. For example, a Gaussian filter can be used to filter the scene picture to remove noise in the scene picture; use quotient image technology to remove the impact of high-brightness illumination on the scene picture; face pose calibration.
203:对所述第三人脸特征进行归一化处理得到第三归一化人脸特征,对 所述第四人脸特征进行归一化处理得到第四归一化人脸特征。203: Perform normalization processing on the third face feature to obtain a third normalized face feature, and perform normalization processing on the fourth face feature to obtain a fourth normalized face feature.
本较佳实施例中,采用L2范数意义下的欧式距离分别对所述第三人脸 特征及所述第四人脸特征进行归一化处理。具体可以参见步骤101中2)的 相应描述。In this preferred embodiment, the Euclidean distance under the L2 norm sense is used to normalize the third facial feature and the fourth facial feature respectively. For details, refer to the corresponding description of 2) in step 101.
204:对所述第三归一化人脸特征与第四归一化人脸特征进行做差以得到 所述待验证人的差分人脸特征。204: Perform a difference between the third normalized face feature and the fourth normalized face feature to obtain the differential face feature of the person to be verified.
本较佳实施例中,所述待验证人的差分人脸特征的获取过程,具体可以 参见步骤101中3)的相应描述。In this preferred embodiment, the acquisition process of the differential face features of the person to be verified can refer to the corresponding description of 3) in step 101 for details.
205:根据所述SVM差分模型计算所述差分人脸特征的相似度。205: Calculate the similarity of the differential facial features according to the SVM differential model.
本较佳实施例中,所述SVM差分模型为根据本发明实施例一提供的支 持向量机差分模型训练方法训练出的分类器模型。将所述待验证人的差分人 脸特性输入所述SVM差分模型中,经过所述SVM差分模型的映射即可计算 出所述差分人脸特征的的相似度。In this preferred embodiment, the SVM differential model is a classifier model trained according to the support vector machine differential model training method provided in Embodiment 1 of the present invention. The difference face feature of the person to be verified is input into the SVM difference model, and the similarity of the difference face feature can be calculated through the mapping of the SVM difference model.
206:判断所述相似度是否大于预设阈值。206: Determine whether the similarity is greater than a preset threshold.
当所述相似度大于预设阈值时,执行步骤207;当所述相似度小于或等 于预设阈值时,执行步骤208。所述预设阈值可以是,例如0.5。When the similarity is greater than the preset threshold, perform step 207; when the similarity is less than or equal to the preset threshold, perform step 208. The preset threshold may be, for example, 0.5.
207:确定所述证件照片与所述场景照片不为同一个人。207: Determine that the ID photo and the scene photo are not of the same person.
208:确定所述证件照片与所述场景照片为同一个人。208: Determine that the ID photo and the scene photo are of the same person.
当计算出的差分人脸特征的相似度比所述预设阈值大时,确定待验证人 的证件照片与待验证人的动态情况下采集的场景图片是同一个人的,即所述 证件照片为待验证人本人,即;当计算出的差分人脸特征的相似度比所述预 设阈值小或者相等时,确定待验证人的证件照片与待验证人的动态情况下采 集的场景图片不是同一个人,即所述证件照片不为待验证人本人。When the similarity of the calculated differential face features is greater than the preset threshold, it is determined that the ID photo of the person to be verified is the same person as the scene picture collected under the dynamic situation of the person to be verified, that is, the ID photo is The person to be verified, that is, when the similarity of the calculated differential facial features is smaller than or equal to the preset threshold, it is determined that the ID photo of the person to be verified is not the same as the scene picture collected under the dynamic situation of the person to be verified Personal, that is, the photo of the said certificate is not of the person to be verified.
需要说明的是,本发明所述的人脸验证方法可以事先提取证件照片中的 人脸区域的第三人脸特征,将所述第三人脸特征存储到预先设定的数据库中, 所述数据库中关联存储证件照片的人脸特征及证件编号。待需要验证证件照 片与场景图片是否为同一个人时,获取证件照片上的证件编号,根据所述证 件编号从所述预先设定的数据库中查找对应的人脸特征,然后根据所述SVM 差分模型计算所述差分人脸特征的相似度,从而缩短了提取证件照上的人脸 特征的时间,进一步提高了比对的效率。It should be noted that the face verification method of the present invention can extract the third face feature of the face area in the ID photo in advance, and store the third face feature in a preset database. The facial features and ID number of the ID photo are associated and stored in the database. When it is necessary to verify whether the ID photo and the scene picture are the same person, obtain the ID number on the ID photo, search for the corresponding face feature from the preset database according to the ID number, and then use the SVM differential model The similarity of the difference facial features is calculated, thereby shortening the time for extracting the facial features on the ID photo, and further improving the comparison efficiency.
综上所述,本发明所述的人脸验证方法,使用深度学习算法提取证件照 片及动态照片上的人脸区域的人脸特征(称之为深度学习特征)进行模型训 练,训练出的模型具有较强的特征区域能力;本发明对深度学习特征特征再 次进行归一化并差分处理得到差分人脸特征,可有效的表达证件照片和场景 照片的特征空间分布的差异信息;在SVM差分模型训练阶段,使用少量不 同人的证件照片和动态照片,从而减少了算法对样本量的需求,增加了算法 的实用性。本发明所述的人脸验证方法能够根据所述SVM差分模型获得较 佳的人脸验证效果。In summary, the face verification method of the present invention uses a deep learning algorithm to extract the facial features (referred to as deep learning features) of the face area on the ID photo and the dynamic photo for model training, and the trained model It has a strong feature area capability; the present invention normalizes the deep learning feature features again and performs differential processing to obtain differential face features, which can effectively express the difference information of the feature space distribution of ID photos and scene photos; in the SVM differential model In the training phase, a small number of ID photos and dynamic photos of different people are used, thereby reducing the demand for the sample size of the algorithm and increasing the practicability of the algorithm. The face verification method of the present invention can obtain a better face verification effect according to the SVM differential model.
实施例三Embodiment three
以上所述,仅是本发明的具体实施方式,但本发明的保护范围并不局限 于此,对于本领域的普通技术人员来说,在不脱离本发明创造构思的前提下, 还可以做出改进,但这些均属于本发明的保护范围。The above is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. For those of ordinary skill in the art, without departing from the inventive concept of the present invention, it is also possible to make Improvements, but these all belong to the protection scope of the present invention.
下面结合第3至5图,分别对实现上述支持向量机差分模型训练方法及 人脸验证方法的终端的功能模块及硬件结构进行介绍。The functional modules and hardware structure of the terminal implementing the above-mentioned support vector machine differential model training method and face verification method are introduced below in conjunction with Figures 3 to 5.
应该了解,所述实施例仅为说明之用,在专利申请范围上并不受此结构 的限制。It should be understood that the described embodiment is only for illustration, and is not limited by this structure on the scope of the patent application.
参阅图3所示,是本发明支持向量机差分模型训练装置40的较佳实施例 中的功能模块图。Referring to Fig. 3, it is a functional block diagram in a preferred embodiment of the support vector machine differential model training device 40 of the present invention.
在一些实施例中,所述支持向量机差分模型训练装置40运行于所述终端 6中。所述支持向量机差分模型训练装置40可以包括多个由程序代码段所组 成的功能模块。所述支持向量机差分模型训练装置40中的各个程序段的程序 代码可以存储于所述存储器61中,并由所述至少一个处理器62所执行,以 执行(详见图1描述)对支持向量机差分模型的训练。In some embodiments, the support vector machine differential model training device 40 runs in the terminal 6. The support vector machine differential model training device 40 may include a plurality of functional modules composed of program code segments. The program codes of each program segment in the support vector machine differential model training device 40 can be stored in the memory 61, and executed by the at least one processor 62 to execute (see Figure 1 for details) to support Training of the vector machine difference model.
本实施例中,所述终端1的支持向量机差分模型训练装置40根据其所执 行的功能,可以被划分为多个功能模块。所述功能模块可以包括:构造模块 400及训练模块402,其中,所述构造模块400还包括:特征提取子模块4001、 归一化子模块4002、差分子模块4003及构造子模块4004。所述训练模块402 还包括:生成子模块4021、寻优子模块4022及保存子模块4023。本发明所 称的模块是指一种能够被至少一个处理器62所执行并且能够完成固定功能 的一系列计算机程序段,其存储在所述存储器61中。在一些实施例中,关于 各模块的功能将在后续的实施例中详述。In this embodiment, the support vector machine differential model training device 40 of the terminal 1 can be divided into multiple functional modules according to the functions it performs. The functional modules may include: a construction module 400 and a training module 402, wherein the construction module 400 further includes: a feature extraction submodule 4001, a normalization submodule 4002, a difference submodule 4003 and a construction submodule 4004. The training module 402 also includes: a generating submodule 4021 , an optimization submodule 4022 and a saving submodule 4023 . The module referred to in the present invention refers to a series of computer program segments that can be executed by at least one processor 62 and can complete fixed functions, which are stored in the memory 61. In some embodiments, the functions of each module will be described in detail in subsequent embodiments.
构造模块400,用于构造正负样本集。A construction module 400, configured to construct positive and negative sample sets.
本较佳实施例中,准备不同人的一张证件照片及同一人对应的一张动态 情况下任意采集的照片。In this preferred embodiment, prepare a photo of a certificate of different people and a photo randomly collected under a dynamic situation corresponding to the same person.
所述证件照片是指证件上用来证明身份的照片,可以是身份证照片,可 以是护照照片,还可以是各种签证照片,或者驾驶证照片、毕业证照片等。Described certificate photo refers to the photo that is used to prove identity on the certificate, can be ID card photo, can be passport photo, can also be various visa photos, or driver's license photo, graduation certificate photo etc.
本较佳实施例中,可以采用LFW数据集来构造正负样本集,所述LFW 数据集是为了研究非限制环境下的人脸识别问题而建立,其中包含了超过 13000张人脸图像,人脸图像全部来自于Internet,而不是实验室环境。In this preferred embodiment, the LFW data set can be used to construct positive and negative sample sets. The LFW data set is established to study the face recognition problem in an unrestricted environment, which contains more than 13,000 face images. The face images are all from the Internet, not a laboratory environment.
为便于下文描述,将动态情况下任意采集的照片称之为动态照片。For the convenience of the following description, the photos randomly collected under dynamic conditions are called dynamic photos.
所述构造模块400构造正负样本集具体包括:The constructing module 400 constructing positive and negative sample sets specifically includes:
1)特征提取子模块4001,用于提取每张证件照片上的人脸区域的第一 人脸特征,提取每张动态照片上的人脸区域的第二人脸特征;1) feature extraction sub-module 4001, for extracting the first face feature of the face area on each ID photo, and extracting the second face feature of the face area on each dynamic photo;
本较佳实施例中,将第i个人的证件照片对应的人脸特征,即第i个人的 第一人脸特征记为xi,将第i个人的动态照片对应的人脸特征,即第i个人的 第二人脸特征记为Xi。In this preferred embodiment, the face feature corresponding to the ID photo of the i-th person, that is, the first face feature of the i-th person is denoted as xi , and the face feature corresponding to the dynamic photo of the i-th person, that is, the first face feature of the i-th person The second face feature of person i is denoted as X i .
本较佳实施例中,在提取人脸特征之前,可以采用预先存储的人脸检测 算法对证件照片上的人脸区域及动态照片上的人脸区域进行检测,然后采用 预先存储的人脸特征提取算法对检测出的人脸区域进行人脸特征提取。In this preferred embodiment, before extracting the facial features, a pre-stored face detection algorithm can be used to detect the face area on the ID photo and the face area on the dynamic photo, and then use the pre-stored face feature The extraction algorithm performs face feature extraction on the detected face area.
所述预先存储的人脸检测算法可以为以下算法中的一种或多种组合:基 于模板的人脸检测方法、基于人工神经网络的人脸检测方法、基于模型的人 脸检测方法、基于肤色的人脸检测方法或者基于特征子脸的人脸检测方法等。The pre-stored face detection algorithm can be one or more combinations of the following algorithms: template-based face detection method, artificial neural network-based face detection method, model-based face detection method, skin color-based The face detection method or the face detection method based on the feature sub-face, etc.
所述预先存储的人脸特征提取算法可以为以下算法中的一种或多种组 合:Gabor特征、方向梯度直方图(Histogram of Oriented Gradient,HOG)、 局部二值模式(LocalBinary Patterns,LBP)、主成分分析(Principal Component Analysis,PCA)、线性判别分析(Linear Discriminant Analysis,LDA)或者 独立成分分析(independent componentanalysis,ICA)等。优选地,因深度 学习特征具有较好的特征表达能力,本实施例中,采用深度学习算法来提取 证件照片及动态照片上的人脸区域的人脸特征。The face feature extraction algorithm stored in advance can be one or more combinations of the following algorithms: Gabor feature, histogram of oriented gradient (Histogram of Oriented Gradient, HOG), local binary pattern (LocalBinary Patterns, LBP), Principal component analysis (Principal Component Analysis, PCA), linear discriminant analysis (Linear Discriminant Analysis, LDA) or independent component analysis (independent component analysis, ICA), etc. Preferably, because the deep learning feature has better feature expression ability, in this embodiment, the deep learning algorithm is used to extract the face features of the face area on the ID photo and the dynamic photo.
本实施例中,所述预先存储的人脸检测算法及所述预先存储的人脸特征 提取算法不限于上述列举的,任何适应于检测出人脸区域的算法及提取人脸 区域的人脸特征的算法均可应用与此。另外,本实施例中预先存储的人脸检 测算法及人脸特征提取算法均为现有技术,本文在此不再详细介绍。In this embodiment, the pre-stored face detection algorithm and the pre-stored face feature extraction algorithm are not limited to those listed above, any algorithm suitable for detecting the face area and extracting the face features of the face area algorithm can be applied to this. In addition, the pre-stored face detection algorithm and face feature extraction algorithm in this embodiment are all existing technologies, and will not be described in detail herein.
2)归一化子模块4002,用于对所述第一人脸特征进行归一化处理得到 第一归一化人脸特征,对所述第二人脸特征进行归一化处理得到第二归一化 人脸特征;2) The normalization sub-module 4002 is used to perform normalization processing on the first facial feature to obtain the first normalized facial feature, and to perform normalization processing on the second facial feature to obtain the second facial feature. Normalized facial features;
本较佳实施例中,将第i个人的第一人脸特征进行归一化处理得到第一归一化人脸特征记为将第i个人的第二人脸特征进行归一化处理得到第二归一化人脸特征为 In this preferred embodiment, the first face feature of the ith person is normalized to obtain the first normalized face feature as The second face feature of the i-th person is normalized to obtain the second normalized face feature as
应当理解的是,||x||2为x向量各个元素平方和的1/2次方,即L2范数意 义下的欧式距离。It should be understood that ||x|| 2 is the 1/2 power of the sum of the squares of the elements of the x vector, that is, the Euclidean distance in the sense of the L2 norm.
3)差分子模块4003,用于对所述第一归一化人脸特征与第二归一化人 脸特征进行做差以得到差分人脸特征;3) difference sub-module 4003, used to make a difference between the first normalized face feature and the second normalized face feature to obtain the difference face feature;
本较佳实施例中,第i个人的差分人脸特征记为 In this preferred embodiment, the i-th person's differential face feature is denoted as
需要说明的是,对人脸特征进行归一化处理是为了使得处理后的数据能 够在0-1之间分布,统一样本的统计分布特性不仅可以方便后续的数据处理, 还能提高算法性能使得收敛加快。其次,将同一个人的归一化人脸特征进行 差分处理,可表征该人在动态情况下任意采集的照片与证件照片由于年龄、 光照、表情、姿态等变化而引起的差异信息。It should be noted that the purpose of normalizing face features is to make the processed data distributed between 0-1, and the statistical distribution characteristics of uniform samples can not only facilitate subsequent data processing, but also improve the performance of the algorithm so that Convergence is accelerated. Secondly, the difference processing of the normalized face features of the same person can represent the difference information caused by the changes of age, illumination, expression, posture, etc. between the photos arbitrarily collected by the person in dynamic situations and the ID photos.
4)构造子模块4004,用于构造正负样本对。4) Construction sub-module 4004, used to construct positive and negative sample pairs.
本较佳实施例中,对所有人的动态照片和证件照片进行人脸特征归一化 并差分处理得到差分人脸特征。则第k个正样本特征为同一个人的动态照片 和证件照片进行人脸特征归一化并差分处理得到的特征,记为 正样本的类别属性为第一类别属性,记为1。第 h个负样本特征为不同人的动态照片和证件照片进行人脸特征归一化并差分 处理得到的特征,记为记为负样本的类别属性为 第二类别属性,记为0。即,正样本集合为多个正样本特征及正样本的类别 属性组成的数据对,负样本集合为多个负样本特征及负样本的类别属性组成 的数据对。In this preferred embodiment, the face features of all the dynamic photos and ID photos are normalized and differentially processed to obtain differential face features. Then the feature of the kth positive sample is the feature obtained by normalizing face features and differential processing of the dynamic photo and ID photo of the same person, denoted as The category attribute of the positive sample is the first category attribute, denoted as 1. The feature of the hth negative sample is the feature obtained by normalizing face features and differential processing of dynamic photos and ID photos of different people, denoted as The category attribute of the negative sample is the second category attribute, denoted as 0. That is, the positive sample set is a data pair composed of multiple positive sample features and positive sample category attributes, and the negative sample set is a data pair composed of multiple negative sample features and negative sample category attributes.
训练模块402,用于训练SVM差分模型。The training module 402 is used for training the SVM difference model.
本较佳实施例中,采用支持向量机(Support Vector Machine,SVM)作 为分类器进行模型训练。In this preferred embodiment, a support vector machine (Support Vector Machine, SVM) is used as a classifier for model training.
SVM是一个有监督的学习模型,通常用来进行模式识别、分类及回归分 析。SVM的主要思想:一是针对线性可分情况进行分析,对于线性不可分的 情况,通过使用非线性映射算法将低维输入空间线性不可分的样本转化为高 维特征空间使其线性可分,从而使得高维特征空间采用线性算法对样本的非 线性特征进行线性分析成为可能。二是基于结构风险最小化理论之上在特征 空间中构建最优超平面,使得学习器得到全局最优化,并且在整个样本空间 的期望以某个概率满足一定上界。简而言之,给定正负训练样本集,在特征空间上找到一个分离超平面,将样本点分到不同的类。当且存在唯一的分类 超平面,使得样本点距离分类超平面的距离最大。找到超平面后,对于待测 点,通过计算该点相对于超平面的位置进行分类。在训练SVM模型的过程 中,最重要的就是求取参数cost、gamma的最优组合值。其中,cost(-c)是 惩罚参数,即对误差的宽容度,c值越高,对误差的宽容度越低,gamma(-g) 是SVM核函数的参数,隐含地决定了数据映射到新的特征空间后的分布。 本实施例中,可以选择径向基核函数。SVM is a supervised learning model, usually used for pattern recognition, classification and regression analysis. The main idea of SVM: one is to analyze the case of linear separability. For the case of linear inseparability, the nonlinear mapping algorithm is used to convert the linearly inseparable samples of the low-dimensional input space into a high-dimensional feature space to make them linearly separable, so that It is possible to linearly analyze the nonlinear characteristics of samples by using linear algorithms in high-dimensional feature spaces. The second is to construct the optimal hyperplane in the feature space based on the structural risk minimization theory, so that the learner can be globally optimized, and the expectation in the entire sample space can meet a certain upper bound with a certain probability. In short, given a set of positive and negative training samples, a separating hyperplane is found on the feature space to classify the sample points into different classes. If and there is a unique classification hyperplane, the distance between the sample point and the classification hyperplane is the largest. After finding the hyperplane, for the points to be measured, they are classified by calculating the position of the point relative to the hyperplane. In the process of training the SVM model, the most important thing is to find the optimal combination value of the parameters cost and gamma. Among them, cost(-c) is the penalty parameter, that is, the tolerance to errors. The higher the value of c, the lower the tolerance to errors. Gamma(-g) is the parameter of the SVM kernel function, which implicitly determines the data mapping. The distribution after entering the new feature space. In this embodiment, a radial basis kernel function may be selected.
所述训练模块402训练SVM差分模型具体包括:The training module 402 training SVM difference model specifically includes:
1)生成子模块4021,用于生成正负样本训练集及正负样本测试集;1) Generate a sub-module 4021 for generating a positive and negative sample training set and a positive and negative sample test set;
本较佳实施例中,训练SVM差分模型时可以采用交叉验证(Cross Validation)的思想,将构造的正负样本集按照合适的比例进行划分成正负样 本训练集及正负样本测试集,合适的划分比例如(6:4)。In this preferred embodiment, the idea of cross-validation (Cross Validation) can be used when training the SVM difference model, and the constructed positive and negative sample sets are divided into positive and negative sample training sets and positive and negative sample test sets according to appropriate proportions. The division ratio is (6:4).
所述正负样本训练集用以训练SVM差分模型,所述正负样本测试集用 以测试所训练出的SVM差分模型的性能,若测试的准确率越高,则表明所 训练出的SVM差分模型的性能越好;若测试的准确率较低,则表明所训练 出的SVM差分模型的性能较差。The positive and negative sample training set is used to train the SVM differential model, and the positive and negative sample test set is used to test the performance of the trained SVM differential model. If the accuracy of the test is higher, it indicates that the trained SVM differential model The better the performance of the model is; if the test accuracy is lower, it indicates that the performance of the trained SVM difference model is poor.
进一步地,若划分出的正负样本训练集的总数量依旧较大,即将所有的 正负样本训练集用来参与SVM差分模型的训练,将导致寻找SVM差分模型 对应的最优参数代价c,g较大,因而,所述生成正负样本训练集还可以包括: 在所生成的正负样本训练集中随机选择第一预设数量的正负样本训练集参与 训练。Furthermore, if the total number of divided positive and negative sample training sets is still large, that is, all the positive and negative sample training sets are used to participate in the training of the SVM difference model, which will lead to finding the optimal parameter cost c corresponding to the SVM difference model, g is relatively large, therefore, the generating the training set of positive and negative samples may further include: randomly selecting a first preset number of training sets of positive and negative samples from the generated training set of positive and negative samples to participate in training.
本较佳实施例中,为了增加参与训练的正负样本训练集的随机性,可以 采用随机数生成算法进行随机选择。In this preferred embodiment, in order to increase the randomness of the training set of positive and negative samples participating in the training, a random number generation algorithm can be used for random selection.
本较佳实施例中,所述第一预设数量可以是一个预先设置的固定值,例 如,40,即在所生成的正负样本训练集中随机挑选出40个样本参与SVM差 分模型的训练。所述第一预设数量还可以是一个预先设置的比例值,例如, 1/10,即,即在所生成的正负样本训练集中随机挑选1/10比例的样本参与 SVM差分模型的训练。In this preferred embodiment, the first preset number can be a preset fixed value, for example, 40, that is, 40 samples are randomly selected from the generated positive and negative sample training set to participate in the training of the SVM difference model. The first preset number can also be a preset ratio value, for example, 1/10, that is, randomly select samples with a ratio of 1/10 in the generated positive and negative sample training set to participate in the training of the SVM difference model.
2)寻优子模块4022,用于寻找参数c,g的最优组合;2) The optimization sub-module 4022 is used to find the optimal combination of parameters c and g;
本较佳实施例中,c为惩罚参数,表示对误分类点的惩罚权重,g是核函 数半径。所述寻优子模块4022寻找参数c,g的最优组合可以包括:将所述 随机选择的正负样本训练集输入到SVM中,计算出第一最优组合参数c、g; 在所述第一最优组合参数c、g的基础上,逐步扩大c、g的范围并缩小步长, 保存每一次的组合参数c、g,选择正负样本测试集在已保存的组合参数c、g 所对应的SVM差分模型上进行测试,直到得到第二最优组合参数c、g。In this preferred embodiment, c is a penalty parameter, which represents the penalty weight for misclassified points, and g is the radius of the kernel function. The optimization sub-module 4022 searching for the optimal combination of parameters c and g may include: inputting the randomly selected positive and negative sample training set into SVM, and calculating the first optimal combination of parameters c and g; On the basis of the first optimal combination parameters c and g, gradually expand the range of c and g and reduce the step size, save the combination parameters c and g each time, and select positive and negative sample test sets in the saved combination parameters c and g The corresponding SVM difference model is tested until the second optimal combination parameters c and g are obtained.
应当理解的是,得到的准确率最高时所对应的参数为第二最优组合参数 c、g,保存所述第二最优组合参数c、g及所对应的SVM差分模型。It should be understood that the parameters corresponding to the highest accuracy obtained are the second optimal combination parameters c, g, and the second optimal combination parameters c, g and the corresponding SVM difference model are saved.
进一步地,应当理解的是,当惩罚参数c过大时,易出现过拟合的情况。 当惩罚参数c过小时,导致训练出的模型的分类功能丧失。因此,选择合适 的惩罚参数c,会大大提高模型的分类性能。为了保证第二最优组合参数c、 g的高度可靠性,提高所对应的SVM差分模型的验证效果,可以进行多次寻 优,则所述生成子模块4021选择正负样本测试集还可以包括:在所生成的正 负样本测试集中随机选择第二预设数量的正负样本测试集参与测试。Further, it should be understood that when the penalty parameter c is too large, overfitting tends to occur. When the penalty parameter c is too small, the classification function of the trained model will be lost. Therefore, choosing an appropriate penalty parameter c will greatly improve the classification performance of the model. In order to ensure the high reliability of the second optimal combination parameters c, g, and improve the verification effect of the corresponding SVM differential model, multiple optimizations can be performed, and the selection of positive and negative sample test sets by the generating submodule 4021 can also include : Randomly select a second preset number of positive and negative sample test sets from the generated positive and negative sample test sets to participate in the test.
本较佳实施例中,所述第二预设数量可以是一个预先设置的固定值,例 如,30,即在所生成的正负样本测试集中随机挑选出40个样本参与SVM差 分模型的测试。所述第二预设数量还可以是一个预先设置的比例值,例如, 1/5,即,即在所生成的正负样本测试集中随机挑选1/5比例的样本参与SVM 差分模型的测试。In this preferred embodiment, the second preset number can be a preset fixed value, for example, 30, that is, 40 samples are randomly selected from the generated positive and negative sample test set to participate in the test of the SVM difference model. The second preset number can also be a preset ratio value, for example, 1/5, that is, randomly select samples with a ratio of 1/5 in the generated positive and negative sample test set to participate in the test of the SVM difference model.
实施例一的支持向量机差分模型训练装置40,首先构造模块400构造正 负样本集,然后训练模块402根据所述正负样本集训练SVM差分模型。在 所述构造模块400构造正负样本集时,对所有人的动态照片和证件照片进行 人脸特征归一化并差分处理得到差分人脸特征,可有效表征由于年龄、光照、 表情、姿态等变化而引起的人脸的差异信息。在所述训练模块402训练SVM 差分模型时,采用支持向量机(Support Vector Machine,SVM)作为分类器 进行模型训练,支持向量机算法对二分类问题有着良好的表现效果,同时对 训练样本的数量要求不高。为了获得最优参数c、g组合,采用交叉验证的方 法,在所生成的正负样本训练集中随机选择第一预设数量的正负样本训练集 参与训练,在所生成的正负样本测试集中随机选择第二预设数量的正负样本 测试集参与测试。因此,实施例一的支持向量机差分模型训练装置40将支持 向量机、交叉验证及随机数的思想结合在一起,将其应用在人脸验证上,在 样本量有限的前提下,能够训练出适合人脸验证的SVM差分模型。The SVM differential model training device 40 of Embodiment 1 first constructs the module 400 to construct positive and negative sample sets, and then the training module 402 trains the SVM differential model according to the positive and negative sample sets. When the construction module 400 constructs the positive and negative sample sets, the facial features of all the dynamic photos and ID photos are normalized and differentially processed to obtain differential facial features, which can effectively characterize the differences due to age, illumination, expression, posture, etc. The difference information of the face caused by the change. When described training module 402 trains SVM differential model, adopt support vector machine (Support Vector Machine, SVM) to carry out model training as classifier, support vector machine algorithm has good performance effect to binary classification problem, simultaneously to the quantity of training samples Not demanding. In order to obtain the optimal combination of parameters c and g, a cross-validation method is used to randomly select the first preset number of positive and negative sample training sets in the generated positive and negative sample training set to participate in training, and in the generated positive and negative sample test set Randomly select a second preset number of positive and negative sample test sets to participate in the test. Therefore, the support vector machine difference model training device 40 of Embodiment 1 combines the ideas of support vector machine, cross-validation and random numbers, and applies it to face verification. Under the premise of limited sample size, it can train SVM difference model suitable for face verification.
参阅图4所示,是本发明人脸验证装置50的较佳实施例中的功能模块图。Referring to FIG. 4 , it is a functional block diagram of a preferred embodiment of the face verification device 50 of the present invention.
在一些实施例中,所述人脸验证装置50运行于所述终端1中。所述人脸 验证装置50可以包括多个由程序代码段所组成的功能模块。所述人脸验证装 置50中的各个程序段的程序代码可以存储于所述存储器61中,并由所述至 少一个处理器62所执行,以执行(详见图2描述)对人脸的验证。In some embodiments, the face verification device 50 runs in the terminal 1 . The face verification device 50 may include a plurality of functional modules made up of program code segments. The program codes of each program segment in the face verification device 50 can be stored in the memory 61, and executed by the at least one processor 62 to perform (see Figure 2 for details) verification of the face .
本实施例中,所述终端1的人脸验证装置50根据其所执行的功能,可以 被划分为多个功能模块。所述功能模块可以包括:第一提取模块500、第二 提取模块502、预处理模块504、归一化模块506、差分模块508、验证模块 510。本发明所称的模块是指一种能够被至少一个处理器62所执行并且能够 完成固定功能的一系列计算机程序段,其存储在所述存储器61中。在一些实 施例中,关于各模块的功能将在后续的实施例中详述。In this embodiment, the face verification device 50 of the terminal 1 can be divided into multiple functional modules according to the functions it performs. The functional modules may include: a first extraction module 500, a second extraction module 502, a preprocessing module 504, a normalization module 506, a difference module 508, and a verification module 510. The module referred to in the present invention refers to a series of computer program segments that can be executed by at least one processor 62 and can complete fixed functions, and are stored in the memory 61. In some embodiments, the functions of each module will be described in detail in subsequent embodiments.
第一提取模块500,用于提取待验证人的证件照片中的人脸区域的第三 人脸特征。The first extraction module 500 is used to extract the third facial feature of the facial area in the ID photo of the person to be verified.
在一些实施例中,可以先使用读卡器读取所述证件照片中的人脸区域, 再对所述待验证人的证件照片中的人脸区域进行检测。In some embodiments, a card reader may be used to first read the face area in the ID photo, and then detect the face area in the ID photo of the person to be verified.
第二提取模块502,用于提取待验证人的场景照片中的人脸区域的第四 人脸特征。The second extraction module 502 is used to extract the fourth facial feature of the facial area in the scene photo of the person to be verified.
为便于下文描述,将动态情况下采集的场景照片称之为场景照片。For the convenience of description below, the scene photos collected under dynamic conditions are referred to as scene photos.
本较佳实施例中,可以采用所述预先存储的人脸检测算法对待验证人的 证件照片上的人脸区域及场景图片中的人脸区域进行检测,采用预先存储的 人脸特征提取算法对检测出的人脸区域进行人脸特征提取。优选地,因深度 学习特征具有较好的特征表达能力,本实施例中,采用深度学习算法来提取 证件照片及场景照片上的人脸区域的人脸特征。本申请对人脸区域的检测及 对人脸区域的特征提取过程不做详细赘述。In this preferred embodiment, the pre-stored face detection algorithm can be used to detect the face area on the certificate photo of the person to be verified and the face area in the scene picture, and the pre-stored face feature extraction algorithm is used to detect The detected face area is subjected to face feature extraction. Preferably, because the deep learning feature has better feature expression ability, in this embodiment, the deep learning algorithm is used to extract the face features of the face area on the certificate photo and the scene photo. This application does not repeat in detail the detection of the face area and the feature extraction process of the face area.
在一些实施例中,所述第一提取模块500和第二提取模块502可以是并 行处理的。在一些实施例中,在利用人脸检测算法检测场景图片中的人脸区 域之前,本发明所述的人脸验证装置50还可以包括预处理模块504,用于: 对所述场景图片进行预处理。In some embodiments, the first extraction module 500 and the second extraction module 502 may be processed in parallel. In some embodiments, before using the face detection algorithm to detect the face area in the scene picture, the face verification device 50 of the present invention may further include a preprocessing module 504, configured to: pre-process the scene picture deal with.
本实施例中,所述预处理模块504对所述场景图片进行预处理可以包括, 但不限于,图像去噪,光照归一化,姿态校准,灰度归一化等。例如,可以 采用高斯滤波器对所述场景图片进行滤波,去除所述场景图片中的噪声;采 用商图像技术除去高亮光照对所述场景图片的影响;采用正弦变换对所述场 景图片中的人脸姿态进行校准。In this embodiment, the preprocessing performed by the preprocessing module 504 on the scene picture may include, but is not limited to, image denoising, illumination normalization, pose calibration, grayscale normalization, and the like. For example, a Gaussian filter can be used to filter the scene picture to remove noise in the scene picture; use quotient image technology to remove the impact of high-brightness illumination on the scene picture; face pose calibration.
归一化模块506,用于对所述第三人脸特征进行归一化处理得到第三归 一化人脸特征,对所述第四人脸特征进行归一化处理得到第四归一化人脸特 征。A normalization module 506, configured to perform normalization processing on the third facial feature to obtain a third normalized facial feature, and perform normalization processing on the fourth facial feature to obtain a fourth normalized facial feature facial features.
本较佳实施例中,采用L2范数意义下的欧式距离分别对所述第三人脸 特征及所述第四人脸特征进行归一化处理。具体可以参见步骤归一化子模块 4002的相应描述。In this preferred embodiment, the Euclidean distance under the L2 norm sense is used to normalize the third facial feature and the fourth facial feature respectively. For details, please refer to the corresponding description of step normalization sub-module 4002.
差分模块508,用于对所述第三归一化人脸特征与第四归一化人脸特征 进行做差以得到所述待验证人的差分人脸特征。The difference module 508 is used to make a difference between the third normalized face feature and the fourth normalized face feature to obtain the difference face feature of the person to be verified.
本较佳实施例中,所述待验证人的差分人脸特征的获取过程,具体可以 参见差分子模块4003的相应描述。In this preferred embodiment, the acquisition process of the difference face feature of the person to be verified can refer to the corresponding description of the difference sub-module 4003 for details.
验证模块510,用于根据所述SVM差分模型计算所述差分人脸特征的相 似度。Verification module 510, is used for calculating the similarity of described difference face feature according to described SVM difference model.
本较佳实施例中,所述SVM差分模型为根据本发明实施例一提供的支 持向量机差分模型训练装置40训练出的分类器模型。将所述待验证人的差分 人脸特性输入所述SVM差分模型中,经过所述SVM差分模型的映射即可计 算出分类可得到所述差分人脸特征的的相似度。In this preferred embodiment, the SVM difference model is a classifier model trained by the support vector machine difference model training device 40 provided according to Embodiment 1 of the present invention. The differential facial features of the people to be verified are input into the SVM differential model, and the similarity of the differential facial features can be calculated for classification through the mapping of the SVM differential model.
所述验证模块510,还用于判断所述相似度是否大于预设阈值。The verification module 510 is further configured to determine whether the similarity is greater than a preset threshold.
当所述相似度大于预设阈值时,所述验证模块确定所述证件照片与所述 场景照片不为同一个人;当所述相似度小于或等于预设阈值时,所述验证模 块确定所述证件照片与所述场景照片为同一个人。所述预设阈值可以是,例 如0.5。When the similarity is greater than a preset threshold, the verification module determines that the ID photo and the scene photo are not the same person; when the similarity is less than or equal to a preset threshold, the verification module determines that the The ID photo is of the same person as the scene photo. The preset threshold may be, for example, 0.5.
当计算出的差分人脸特征的相似度比所述预设阈值大时,确定待验证人 的证件照片与待验证人的动态情况下采集的场景图片是同一个人的,即所述 证件照片为待验证人本人,即;当计算出的差分人脸特征的相似度比所述预 设阈值小或者相等时,确定待验证人的证件照片与待验证人的动态情况下采 集的场景图片不是同一个人,即所述证件照片不为待验证人本人。When the similarity of the calculated differential face features is greater than the preset threshold, it is determined that the ID photo of the person to be verified is the same person as the scene picture collected under the dynamic situation of the person to be verified, that is, the ID photo is The person to be verified, that is, when the similarity of the calculated differential facial features is smaller than or equal to the preset threshold, it is determined that the ID photo of the person to be verified is not the same as the scene picture collected under the dynamic situation of the person to be verified Personal, that is, the photo of the said certificate is not of the person to be verified.
需要说明的是,本发明所述的人脸验证装置50可以事先提取证件照片中 的人脸区域的第三人脸特征,将所述第三人脸特征存储到预先设定的数据库 中,所述数据库中关联存储证件照片的人脸特征及证件编号。待需要验证证 件照片与场景图片是否为同一个人时,获取证件照片上的证件编号,根据所 述证件编号从所述预先设定的数据库中查找对应的人脸特征,然后根据所述 SVM差分模型计算所述差分人脸特征的相似度,从而缩短了提取证件照上的 人脸特征的时间,进一步提高了比对的效率。It should be noted that the face verification device 50 of the present invention can extract the third face feature of the face area in the ID photo in advance, and store the third face feature in a preset database. The face features and the ID number of the ID photo are associated and stored in the above-mentioned database. When it is necessary to verify whether the ID photo and the scene picture are the same person, obtain the ID number on the ID photo, search for the corresponding face feature from the preset database according to the ID number, and then according to the SVM difference model The similarity of the difference facial features is calculated, thereby shortening the time for extracting the facial features on the ID photo, and further improving the comparison efficiency.
综上所述,本发明所述的人脸验证装置50,使用深度学习算法提取证件 照片及动态照片上的人脸区域的人脸特征(称之为深度学习特征)进行模型 训练,训练出的模型具有较强的特征区域能力;本发明对深度学习特征特征 再次进行归一化并差分处理得到差分人脸特征,可有效的表达证件照片和场 景照片的特征空间分布的差异信息;在SVM差分模型训练阶段,使用少量 不同人的证件照片和动态照片,从而减少了算法对样本量的需求,增加了算 法的实用性。本发明所述的人脸验证装置50能够根据所述SVM差分模型获 得较佳的人脸验证效果。In summary, the face verification device 50 of the present invention uses a deep learning algorithm to extract the facial features of the face area on the ID photo and the dynamic photo (referred to as deep learning features) for model training, and the trained The model has a strong feature area capability; the present invention normalizes the deep learning feature features again and performs differential processing to obtain differential face features, which can effectively express the difference information of the feature space distribution of ID photos and scene photos; In the model training stage, a small number of ID photos and dynamic photos of different people are used, thereby reducing the sample size requirement of the algorithm and increasing the practicability of the algorithm. The face verification device 50 of the present invention can obtain a better face verification effect according to the SVM difference model.
上述以软件功能模块的形式实现的集成的单元,可以存储在一个计算机 可读取存储介质中。上述软件功能模块存储在一个存储介质中,包括若干指 令用以使得一台计算机设备(可以是个人计算机,双屏设备,或者网络设备 等)或处理器(processor)执行本发明各个实施例所述方法的部分。The above-mentioned integrated units implemented in the form of software function modules can be stored in a computer-readable storage medium. The above-mentioned software function modules are stored in a storage medium, and include several instructions to enable a computer device (which may be a personal computer, a dual-screen device, or a network device, etc.) or a processor (processor) to execute the functions described in various embodiments of the present invention. method part.
如图5所示,是实现本发明所述SVM差分模型训练方法及/或所述人脸 验证方法的终端的硬件结构示意图。As shown in Figure 5, it is a schematic diagram of the hardware structure of a terminal that implements the SVM differential model training method and/or the face verification method of the present invention.
在本发明较佳实施例中,所述终端6包括存储器61、至少一个处理器62、 至少一条通信总线63及摄像头64。In a preferred embodiment of the present invention, the terminal 6 includes a memory 61 , at least one processor 62 , at least one communication bus 63 and a camera 64 .
本领域技术人员应该了解,图5示出的终端的结构并不构成本发明实施 例的限定,既可以是总线型结构,也可以是星形结构,所述终端6还可以包 括比图示更多或更少的其他硬件或者软件,或者不同的部件布置。Those skilled in the art should understand that the structure of the terminal shown in Figure 5 does not constitute a limitation of the embodiment of the present invention, it can be a bus structure or a star structure, and the terminal 6 can also include more terminals than shown in the figure. More or less additional hardware or software, or a different arrangement of components.
在一些实施例中,所述终端6包括一种能够按照事先设定或存储的指令, 自动进行数值计算和/或信息处理的双屏设备,其硬件包括但不限于微处理 器、专用集成电路、可编程门阵列、数字处理器、嵌入式设备等。所述终端6还可包括用户设备,所述用户设备包括但不限于任何一种可与用户通过键 盘、鼠标、遥控器、触摸板或声控设备等方式进行人机交互的电子产品,例 如,个人计算机、平板电脑、智能手机、个人数字助理(PersonalDigital Assistant,PDA)等任何具备双屏的的电子产品等。In some embodiments, the terminal 6 includes a dual-screen device that can automatically perform numerical calculation and/or information processing according to preset or stored instructions, and its hardware includes but not limited to microprocessors, application-specific integrated circuits , programmable gate arrays, digital processors, embedded devices, etc. The terminal 6 may also include user equipment, which includes but is not limited to any electronic product that can interact with the user through a keyboard, mouse, remote control, touch pad, or voice control device, for example, a personal Computers, tablet computers, smart phones, personal digital assistants (Personal Digital Assistant, PDA) and any other electronic products with dual screens.
需要说明的是,所述终端6仅为举例,其他现有的或今后可能出现的电 子产品如可适应于本发明,也应包含在本发明的保护范围以内,并以引用方 式包含于此。It should be noted that the terminal 6 is only an example, and other existing or future electronic products that may be adapted to the present invention should also be included in the protection scope of the present invention, and are included here by reference.
在一些实施例中,所述存储器61用于存储程序代码和各种数据,例如安 装在所述终端6中的信息保存系统10,并在终端6的运行过程中实现高速、 自动地完成程序或数据的存取。所述存储器61包括只读存储器(Read-Only Memory,ROM)、随机存储器(RandomAccess Memory,RAM)、可编程 只读存储器(Programmable Read-Only Memory,PROM)、可擦除可编程只 读存储器(Erasable Programmable Read-Only Memory,EPROM)、一次可编 程只读存储器(One-time Programmable Read-Only Memory,OTPROM)、电 子擦除式可复写只读存储器(Electrically-Erasable Programmable Read-Only Memory,EEPROM)、只读光盘(Compact Disc Read-Only Memory,CD-ROM) 或其他光盘存储器、磁盘存储器、磁带存储器、或者能够用于携带或存储数 据的计算机可读的任何其他介质。In some embodiments, the memory 61 is used to store program codes and various data, such as the information storage system 10 installed in the terminal 6, and realize high-speed, automatic completion of programs or Data access. Described memory 61 comprises read-only memory (Read-Only Memory, ROM), random access memory (RandomAccess Memory, RAM), programmable read-only memory (Programmable Read-Only Memory, PROM), erasable programmable read-only memory ( Erasable Programmable Read-Only Memory, EPROM), One-time Programmable Read-Only Memory (OTPROM), Electrically-Erasable Programmable Read-Only Memory, EEPROM , Compact Disc Read-Only Memory (CD-ROM) or other optical disk storage, magnetic disk storage, tape storage, or any other computer-readable medium that can be used to carry or store data.
在一些实施例中,所述至少一个处理器62可以由集成电路组成,例如可 以由单个封装的集成电路所组成,也可以是由多个相同功能或不同功能封装 的集成电路所组成,包括一个或者多个中央处理器(Central Processing unit, CPU)、微处理器、数字处理芯片、图形处理器及各种控制芯片的组合等。 所述至少一个处理器62是所述终端6的控制核心(Control Unit),利用各 种接口和线路连接整个终端6的各个部件,通过运行或执行存储在所述存储 器61内的程序或者模块,以及调用存储在所述存储器61内的数据,以执行 终端6的各种功能和处理数据,例如执行SVM差分模型训练装置40及/或人 脸验证装置50。In some embodiments, the at least one processor 62 may be composed of an integrated circuit, for example, may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits with the same function or different functions packaged, including a Or a combination of multiple central processing units (Central Processing unit, CPU), microprocessors, digital processing chips, graphics processors, and various control chips. The at least one processor 62 is the control core (Control Unit) of the terminal 6, using various interfaces and lines to connect the various components of the entire terminal 6, by running or executing programs or modules stored in the memory 61, And call the data stored in the memory 61 to execute various functions of the terminal 6 and process data, such as executing the SVM difference model training device 40 and/or the face verification device 50 .
在一些实施例中,所述至少一条通信总线63被设置为实现所述存储器 61、所述至少一个处理器62及所述摄像头64等之间的连接通信。In some embodiments, the at least one communication bus 63 is configured to realize connection and communication between the memory 61, the at least one processor 62, the camera 64, and the like.
尽管未示出,所述终端6还可以包括给各个部件供电的电源(比如电池), 优选的,电源可以通过电源管理系统与所述至少一个处理器62逻辑相连,从 而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。电源还可 以包括一个或一个以上的直流或交流电源、再充电系统、电源故障检测电路、 电源转换器或者逆变器、电源状态指示器等任意组件。所述终端6还可以包 括多种传感器、蓝牙模块、Wi-Fi模块、摄像头等,在此不再赘述。Although not shown, the terminal 6 can also include a power supply (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the at least one processor 62 through a power management system, so as to realize management through the power management system Charging, discharging, and power management functions. The power supply may also include one or more DC or AC power sources, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and any other components. The terminal 6 may also include various sensors, bluetooth modules, Wi-Fi modules, cameras, etc., which will not be repeated here.
应该了解,所述实施例仅为说明之用,在专利申请范围上并不受此结构 的限制。It should be understood that the described embodiment is only for illustration, and is not limited by this structure on the scope of the patent application.
在进一步的实施例中,结合图1与图2,所述至少一个处理器62可执行 所述终端6的操作系统以及安装的各类应用程序(如所述的SVM差分模型 训练装置40)、程序代码等,例如,上述的各个模块,包括:构造模块400、 构造子模块4004及特征提取子模块4001、归一化子模块4002、差分子模块 4003、生成子模块4021及寻优子模块4022。所述至少一个处理器62还可执 行所述终端6的操作系统以及安装的各类应用程序(如所述的SVM差分模 型训练装置40)、程序代码等,例如,上述的各个模块,包括:第一提取模 块500、第二提取模块502、预处理模块504、归一化模块506、差分模块508、 验证模块510。In a further embodiment, in conjunction with FIG. 1 and FIG. 2, the at least one processor 62 can execute the operating system of the terminal 6 and installed various applications (such as the SVM differential model training device 40), Program code, etc., for example, each of the above-mentioned modules includes: construction module 400, construction submodule 4004 and feature extraction submodule 4001, normalization submodule 4002, difference submodule 4003, generation submodule 4021 and optimization submodule 4022 . The at least one processor 62 can also execute the operating system of the terminal 6 and installed various applications (such as the SVM differential model training device 40), program codes, etc., for example, the above-mentioned modules include: A first extraction module 500 , a second extraction module 502 , a preprocessing module 504 , a normalization module 506 , a difference module 508 , and a verification module 510 .
具体地,所述至少一个处理器62对上述指令的具体实现方法可参考图1 及图3对应实施例中相关步骤的描述,在此不赘述。Specifically, for the specific implementation method of the above instruction by the at least one processor 62, reference may be made to the description of relevant steps in the embodiments corresponding to FIG. 1 and FIG. 3 , and details are not repeated here.
在本发明所提供的几个实施例中,应该理解到,所揭露的系统,装置和 方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示 意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可 以有另外的划分方式。In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作 为模块显示的部件可以是或者也可以不是物理单元,即可以位于一个地方, 或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或 者全部模块来实现本实施例方案的目的。The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the modules can be selected according to actual needs to realize the purpose of the solution of this embodiment.
另外,在本发明各个实施例中的各功能模块可以集成在一个处理单元中, 也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单 元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件 功能模块的形式实现。In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware, or in the form of hardware plus software function modules.
对于本领域技术人员而言,显然本发明不限于上述示范性实施例的细节, 而且在不背离本发明的精神或基本特征的情况下,能够以其他的具体形式实 现本发明。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且 是非限制性的,本发明的范围由所附权利要求而不是上述说明限定,因此旨 在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本发明内。 不应将权利要求中的任何附图标记视为限制所涉及的权利要求。此外,显然 “包括”一词不排除其他单元或,单数不排除复数。系统权利要求中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第一, 第二等词语用来表示名称,而并不表示任何特定的顺序。It will be apparent to those skilled in the art that the present invention is not limited to the details of the above-described exemplary embodiments, but that the invention can be embodied in other specific forms without departing from the spirit or essential characteristics of the invention. Accordingly, the embodiments should be regarded in all points of view as exemplary and not restrictive, the scope of the invention being defined by the appended claims rather than the foregoing description, and it is therefore intended that the scope of the invention be defined by the appended claims rather than by the foregoing description. All changes within the meaning and range of equivalents of the elements are embraced in the present invention. Any reference sign in a claim should not be construed as limiting the claim concerned. Furthermore, it is clear that the word "comprising" does not exclude other elements or the singular does not exclude the plural. A plurality of units or devices stated in the system claims may also be realized by one unit or device through software or hardware. The words first, second, etc. are used to denote names and do not imply any particular order.
最后应说明的是,以上实施例仅用以说明本发明的技术方案而非限制, 尽管参照较佳实施例对本发明进行了详细说明,本领域的普通技术人员应当 理解,可以对本发明的技术方案进行修改或等同替换,而不脱离本发明技术 方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention without limitation, although the present invention has been described in detail with reference to preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be Modifications or equivalent replacements can be made without departing from the spirit and scope of the technical solutions of the present invention.
Claims (10)
- A kind of 1. SVM difference models training method, it is characterised in that the described method includes:Positive and negative sample set is constructed, including:1) the first face characteristic of the human face region on every certificate photograph is extracted, extracts the human face region on every an action shot The second face characteristic;2) first face characteristic is normalized to obtain the first normalization face characteristic, it is special to second face Sign is normalized to obtain the second normalization face characteristic;3) the described first normalization face characteristic and the second normalization face characteristic are made the difference to obtain difference face characteristic;4) positive negative sample pair is constructed, wherein, the positive sample carries out face to an action shot for same person and certificate photograph The feature and first category attribute that feature normalization and difference processing obtain, negative sample is to an action shot and certificate for different people Photo carries out the face characteristic normalization feature that simultaneously difference processing obtains and second category attribute;Training SVM difference models, including:1):Positive and negative sample training collection and positive and negative test sample collection are generated from the positive and negative sample set constructed;2):Find the optimum combination of the parameter g of penalty parameter c and kernel function;3):Preserve best parameter group and corresponding SVM difference models.
- 2. the method as described in claim 1, it is characterised in that described to generate positive negative sample from the positive and negative sample set constructed Training set and positive and negative test sample collection include:The positive and negative sample training collection for concentrating the default quantity of random selection first in the positive and negative sample training generated participates in training; The positive and negative test sample generated concentrates the positive and negative test sample collection of the default quantity of random selection second to participate in test.
- 3. method as claimed in claim 2, it is characterised in that the parameter g's for finding penalty parameter c and kernel function is optimal Combination includes:The positive and negative sample training collection of described first default quantity is input in SVM, calculates the first optimum combination parameter c, g;Progressively expand the scope of c, g and reduce step-length, preserve combination parameter c, g each time;Positive and negative test sample collection is selected to be tested on the SVM difference models corresponding to combination parameter c, the g preserved, accurately Corresponding parameter is the second optimum combination parameter c, g during rate highest.
- 4. the SVM difference models that a kind of method using described in 3 any one of claims 1 to 3 trains carry out face verification side Method, it is characterised in that the described method includes:Extract third party's face feature of the human face region in the certificate photograph of witness to be tested;Extract the 4th face characteristic of the human face region in the scene photo of witness to be tested;Third party's face feature is normalized to obtain the 3rd normalization face characteristic, to the 4th face characteristic It is normalized to obtain the 4th normalization face characteristic;Described 3rd normalization face characteristic and the 4th normalization face characteristic are made the difference to obtain the witness's to be tested Difference face characteristic;AndThe similarity of the difference face characteristic is calculated according to the SVM difference models;Judge whether the similarity is more than predetermined threshold value;AndWhen the similarity is more than the predetermined threshold value, determine the certificate photograph with the scene photo not to be same People;OrWhen the similarity is less than or equal to predetermined threshold value, determine the certificate photograph and the scene photo to be same People.
- 5. a kind of SVM difference models training device, it is characterised in that described device includes:Constructing module, for constructing positive and negative sample set, including:Feature extraction submodule, for extracting the first face characteristic of the human face region on every certificate photograph, extracts every and moves Second face characteristic of the human face region on state photo;Submodule is normalized, for first face characteristic to be normalized to obtain the first normalization face characteristic, Second face characteristic is normalized to obtain the second normalization face characteristic;Difference submodule, for being made the difference the described first normalization face characteristic and the second normalization face characteristic to obtain Difference face characteristic;Submodule is constructed, for constructing positive negative sample pair, wherein, the positive sample is to an action shot and certificate for same person Photo carries out the face characteristic normalization feature that simultaneously difference processing obtains and first category attribute, and negative sample for different people to moving State photo and certificate photograph carry out the face characteristic normalization feature that simultaneously difference processing obtains and second category attribute;Training module, for training SVM difference models, including:Submodule is generated, for generating positive and negative sample training collection and positive and negative test sample collection from the positive and negative sample set constructed;Optimizing submodule, the optimum combination of the parameter g for finding penalty parameter c and kernel function;Submodule is preserved, for preserving best parameter group and corresponding SVM difference models.
- 6. device as claimed in claim 5, it is characterised in that the generation submodule is raw from the positive and negative sample set constructed Include into positive and negative sample training collection and positive and negative test sample collection:The positive and negative sample training collection for concentrating the default quantity of random selection first in the positive and negative sample training generated participates in training; The positive and negative test sample generated concentrates the positive and negative test sample collection of the default quantity of random selection second to participate in test.
- 7. device as claimed in claim 6, it is characterised in that the optimizing submodule searching penalty parameter c and kernel function The optimum combination of parameter g includes:The positive and negative sample training collection of described first default quantity is input in SVM, calculates the first optimum combination parameter c, g;Progressively expand the scope of c, g and reduce step-length, preserve combination parameter c, g each time;Positive and negative test sample collection is selected to be tested on the SVM difference models corresponding to combination parameter c, the g preserved, accurately Corresponding parameter is the second optimum combination parameter c, g during rate highest.
- 8. the SVM difference models that a kind of device using described in claim 5 to 7 any one trains carry out face verification dress Put, it is characterised in that described device includes:First extraction module, third party's face feature of the human face region in certificate photograph for extracting witness to be tested;Second extraction module, the 4th face characteristic of the human face region in scene photo for extracting witness to be tested;Module is normalized, it is right for third party's face feature to be normalized to obtain the 3rd normalization face characteristic 4th face characteristic is normalized to obtain the 4th normalization face characteristic;Difference block, for being made the difference the described 3rd normalization face characteristic and the 4th normalization face characteristic to obtain State the difference face characteristic of witness to be tested;AndAuthentication module, for calculating the similarity of the difference face characteristic according to the SVM difference models;AndThe authentication module, is additionally operable to judge whether the similarity is more than predetermined threshold value;AndWhen the similarity is more than the predetermined threshold value, the authentication module determines the certificate photograph and the scene photo It is not same person;OrWhen the similarity is less than or equal to predetermined threshold value, the authentication module determines that the certificate photograph shines with the scene Piece is same person.
- A kind of 9. terminal, it is characterised in that:The terminal includes processor, and the processor is used to perform what is stored in memory The SVM difference models training method as described in any one in claims 1 to 3 is realized during computer program or realizes such as right It is required that the 4 face verification methods.
- 10. a kind of computer-readable recording medium, is stored thereon with computer program, it is characterised in that:The computer program The SVM difference models training method as described in any one in claims 1 to 3 is realized when being executed by processor or is realized as weighed Profit requires the 4 face verification methods.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711297473.2A CN107967461B (en) | 2017-12-08 | 2017-12-08 | SVM (support vector machine) differential model training and face verification method, device, terminal and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711297473.2A CN107967461B (en) | 2017-12-08 | 2017-12-08 | SVM (support vector machine) differential model training and face verification method, device, terminal and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107967461A true CN107967461A (en) | 2018-04-27 |
CN107967461B CN107967461B (en) | 2020-07-24 |
Family
ID=61999557
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711297473.2A Active CN107967461B (en) | 2017-12-08 | 2017-12-08 | SVM (support vector machine) differential model training and face verification method, device, terminal and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107967461B (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108648074A (en) * | 2018-05-18 | 2018-10-12 | 深圳壹账通智能科技有限公司 | Loan valuation method, apparatus based on support vector machines and equipment |
CN108805048A (en) * | 2018-05-25 | 2018-11-13 | 腾讯科技(深圳)有限公司 | A kind of method of adjustment of human face recognition model, device and storage medium |
CN110874602A (en) * | 2018-08-30 | 2020-03-10 | 北京嘀嘀无限科技发展有限公司 | Image identification method and device |
CN111522228A (en) * | 2019-02-02 | 2020-08-11 | 北京京东尚科信息技术有限公司 | Aircraft detection method and device |
CN112597493A (en) * | 2020-12-25 | 2021-04-02 | 北京通付盾人工智能技术有限公司 | Method and system for detecting man-machine operation of mobile equipment |
CN113556699A (en) * | 2020-04-24 | 2021-10-26 | 北京沃东天骏信息技术有限公司 | Sample set construction, indoor positioning model construction, indoor positioning method and device |
CN114359795A (en) * | 2021-12-28 | 2022-04-15 | 惠州市锦好医疗科技股份有限公司 | Digital hearing aid and scene classification method thereof |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101582113A (en) * | 2009-06-15 | 2009-11-18 | 江苏大学 | Method for identifying face image with identity through layered comparison |
CN102004899A (en) * | 2010-11-03 | 2011-04-06 | 无锡中星微电子有限公司 | Human face identifying system and method |
CN106407915A (en) * | 2016-08-31 | 2017-02-15 | 广州精点计算机科技有限公司 | SVM (support vector machine)-based face recognition method and device |
-
2017
- 2017-12-08 CN CN201711297473.2A patent/CN107967461B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101582113A (en) * | 2009-06-15 | 2009-11-18 | 江苏大学 | Method for identifying face image with identity through layered comparison |
CN102004899A (en) * | 2010-11-03 | 2011-04-06 | 无锡中星微电子有限公司 | Human face identifying system and method |
CN106407915A (en) * | 2016-08-31 | 2017-02-15 | 广州精点计算机科技有限公司 | SVM (support vector machine)-based face recognition method and device |
Non-Patent Citations (1)
Title |
---|
刘东辉等: "支持向量机最优参数选择的研究", 《河北科技大学学报》 * |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108648074A (en) * | 2018-05-18 | 2018-10-12 | 深圳壹账通智能科技有限公司 | Loan valuation method, apparatus based on support vector machines and equipment |
CN108648074B (en) * | 2018-05-18 | 2023-06-09 | 深圳壹账通智能科技有限公司 | Loan assessment method, device and equipment based on support vector machine |
CN108805048A (en) * | 2018-05-25 | 2018-11-13 | 腾讯科技(深圳)有限公司 | A kind of method of adjustment of human face recognition model, device and storage medium |
CN108805048B (en) * | 2018-05-25 | 2020-01-31 | 腾讯科技(深圳)有限公司 | face recognition model adjusting method, device and storage medium |
CN110874602A (en) * | 2018-08-30 | 2020-03-10 | 北京嘀嘀无限科技发展有限公司 | Image identification method and device |
CN111522228A (en) * | 2019-02-02 | 2020-08-11 | 北京京东尚科信息技术有限公司 | Aircraft detection method and device |
CN111522228B (en) * | 2019-02-02 | 2023-09-22 | 北京京东乾石科技有限公司 | Method and device for detecting aircraft |
CN113556699A (en) * | 2020-04-24 | 2021-10-26 | 北京沃东天骏信息技术有限公司 | Sample set construction, indoor positioning model construction, indoor positioning method and device |
CN112597493A (en) * | 2020-12-25 | 2021-04-02 | 北京通付盾人工智能技术有限公司 | Method and system for detecting man-machine operation of mobile equipment |
CN114359795A (en) * | 2021-12-28 | 2022-04-15 | 惠州市锦好医疗科技股份有限公司 | Digital hearing aid and scene classification method thereof |
Also Published As
Publication number | Publication date |
---|---|
CN107967461B (en) | 2020-07-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
William et al. | Face recognition using facenet (survey, performance test, and comparison) | |
US20230087526A1 (en) | Neural network training method, image classification system, and related device | |
CN107967461A (en) | The training of SVM difference models and face verification method, apparatus, terminal and storage medium | |
EP3074918B1 (en) | Method and system for face image recognition | |
CN105809125B (en) | Face recognition system based on multi-core ARM platform | |
US9697440B2 (en) | Method and apparatus for recognizing client feature, and storage medium | |
WO2021248733A1 (en) | Live face detection system applying two-branch three-dimensional convolutional model, terminal and storage medium | |
Lin et al. | Spatially eigen-weighted Hausdorff distances for human face recognition | |
CN111898550B (en) | Expression recognition model building method and device, computer equipment and storage medium | |
CN107958230A (en) | Facial expression recognizing method and device | |
Barman et al. | Influence of shape and texture features on facial expression recognition | |
CN108021908A (en) | Face age bracket recognition methods and device, computer installation and readable storage medium storing program for executing | |
US10423817B2 (en) | Latent fingerprint ridge flow map improvement | |
CN105740808A (en) | Human face identification method and device | |
CN114358279A (en) | Image recognition network model pruning method, device, equipment and storage medium | |
CN114708461A (en) | Multi-modal learning model-based classification method, device, equipment and storage medium | |
Lahiani et al. | Hand pose estimation system based on Viola-Jones algorithm for android devices | |
Liu et al. | Construction of a smart face recognition model for university libraries based on FaceNet-MMAR algorithm | |
CN102609715A (en) | Object type identification method combining plurality of interest point testers | |
Hebda et al. | A compact deep convolutional neural network architecture for video based age and gender estimation | |
Sun et al. | Face recognition with multi-resolution spectral feature images | |
Sinha et al. | Age Invariant Face Recogntion Using Pca And Msvm | |
Teo et al. | 2.5 D Face Recognition System using EfficientNet with Various Optimizers | |
CN114495133A (en) | Electronic invoice information extraction method and device, electronic equipment and storage medium | |
Sami et al. | Benchmarking human face similarity using identical twins |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |