Copy recognition model training, image recognition method, device, equipment and medium

By extracting texture features and calculating predicted values ​​from the unbalanced remake image sample set, combined with iterative updates of the hit model and focus loss function, a model that can quickly identify remake images is trained, solving the problems of low manual recognition accuracy and waste of resources. problem, achieving efficient and reliable authentication.

CN111476268BActive Publication Date: 2024-09-17CHINA PING AN LIFE INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010142973.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-03-04
Publication Date
2024-09-17
Estimated Expiration
2040-03-04

AI Technical Summary

Technical Problem

In existing identity verification, manual identification of reproduced images has low accuracy and consumes a lot of human resources. Moreover, due to the imbalance between normal images and reproduced images, it is easy to be ignored, leading to security issues.

Method used

By obtaining an unbalanced sample set of remake images, extracting texture features and calculating predicted values, iteratively updates using the hit model and focusing loss function to train a model that can quickly identify remake images.

Benefits of technology

It improves the accuracy and hit rate of duplicate image recognition, improves recognition efficiency and reliability, and saves costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111476268B
    Figure CN111476268B
Patent Text Reader

Abstract

The present invention discloses a method, device, equipment and medium for training a remake recognition model and recognizing remake images. The method comprises: obtaining a remake image sample set; extracting texture features from the remake image samples to obtain a prediction value; inputting the prediction value and the true label value of the remake image sample into a hit function to obtain a hit probability value; obtaining the loss value of the remake image sample through a focus loss function for overcoming the imbalance of the number of samples; when the loss value does not reach a preset convergence condition, iteratively updating the initial parameters of the remake recognition model until the loss value reaches the preset convergence condition, and recording the remake recognition model after convergence as a remake recognition model that has been trained. The present invention realizes adaptive training and learning in the case of an imbalanced number of input samples, and can quickly and accurately recognize remake images, thereby improving the accuracy and hit rate of recognition, thereby improving recognition efficiency and reliability, and saving costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image classification, and in particular to a copy recognition model training, an image recognition method, a device, a computer device and a storage medium. Background Art

[0002] With the development of the credit society, more and more application scenarios (such as those involving finance, insurance, and security) require the verification of user identities through document recognition and face recognition. In the prior art, existing identity verification is mainly done by manual verification with a large amount of manpower, which requires a lot of human resources and waiting time. Moreover, with the improvement of data photography technology, criminals have emerged in an endless stream of means to verify user identities through reprinted images. The accuracy of manual identification of reprinted images is low, and it is easy to make mistakes. In actual application scenarios, the use of reprinted images to verify user identities is relatively rare. Therefore, it is very easy to be neglected to manually identify a small number of reprinted images from a large number of normal images (that is, the number of normal images and reprinted images is unbalanced). If the reprinted images are not identified during the identity verification process, there will be security issues for user information. Summary of the invention

[0003] The present invention provides a copy recognition model training, image recognition method, device, computer equipment and storage medium, which realizes adaptive training and learning under the condition of uneven number of input samples, and can quickly and accurately identify the copy image, thereby improving the recognition accuracy and hit rate, thereby improving the recognition efficiency and reliability, and saving costs.

[0004] A copy recognition model training method, comprising:

[0005] Acquire a re-shot image sample set; input the re-shot image sample set into a re-shot recognition model containing initial parameters; the re-shot image sample set includes a number of re-shot image samples associated with true label values; the true label values ​​include positive label values ​​and negative label values; the number of re-shot image samples associated with the true label values ​​being positive label values ​​and the number of re-shot image samples associated with the true label values ​​being negative label values ​​are unbalanced;

[0006] Extracting texture features of the re-shot image sample by using the re-shot recognition model, and obtaining a prediction value output by the re-shot recognition model according to the texture features;

[0007] Inputting the predicted value and the true label value associated with the reshot image sample into a hit model in the reshot recognition model to obtain a hit probability value of the reshot image sample;

[0008] Inputting the hit probability value into a focus loss function used to overcome the imbalance of sample quantity in the remake recognition model to obtain a loss value of the remake image sample;

[0009] When the loss value does not reach the preset convergence condition, iteratively updating the initial parameters of the remake recognition model until the loss value reaches the preset convergence condition, and recording the remake recognition model after convergence as the trained remake recognition model;

[0010] When the loss value reaches a preset convergence condition, the remake recognition model after convergence is recorded as a trained remake recognition model.

[0011] An image recognition method, comprising:

[0012] Receive recognition instructions and obtain the image to be detected;

[0013] Input the image to be detected into a head portrait detection model to obtain a head portrait in the image to be detected; the head portrait detection model is trained according to the YOLO algorithm;

[0014] Inputting the headshot photo into a copy recognition model, and obtaining a prediction value of the texture feature of the headshot photo output by the copy recognition model; the copy recognition model is the copy recognition model that has been trained above;

[0015] The recognition result of the image to be detected is determined according to the prediction value output by the copy recognition model; the recognition result indicates whether the image to be detected is a copy.

[0016] A copy recognition model training device, comprising:

[0017] An acquisition module is used to acquire a re-shot image sample set; input the re-shot image sample set into a re-shot recognition model containing initial parameters; the re-shot image sample set includes a number of re-shot image samples associated with true label values; the true label values ​​include positive label values ​​and negative label values; the number of re-shot image samples associated with true label values ​​that are positive label values ​​and the number of re-shot image samples associated with true label values ​​that are negative label values ​​are unbalanced;

[0018] An extraction module, used for extracting texture features of the remake image sample through the remake recognition model, and obtaining a prediction value output by the remake recognition model according to the texture features;

[0019] A hit module, used for inputting the predicted value and the real label value associated with the reshot image sample into a hit model in the reshot recognition model to obtain a hit probability value of the reshot image sample;

[0020] An overcoming module, used for inputting the hit probability value into a focus loss function used for overcoming the imbalance of sample quantity in the remake recognition model, so as to obtain a loss value of the remake image sample;

[0021] A non-convergence module, used for iteratively updating the initial parameters of the remake recognition model when the loss value does not reach the preset convergence condition, until the loss value reaches the preset convergence condition, and recording the remake recognition model after convergence as the trained remake recognition model;

[0022] The convergence module is used to record the converged copy recognition model as a trained copy recognition model when the loss value reaches a preset convergence condition.

[0023] An image recognition device, comprising:

[0024] A receiving module is used to receive a recognition instruction and obtain an image to be detected;

[0025] An input module is used to input the image to be detected into a head portrait detection model to obtain a head portrait in the image to be detected; the head portrait detection model is trained according to the YOLO algorithm;

[0026] A prediction module, used for inputting the head portrait into a copy recognition model, and obtaining a prediction value of the texture feature of the head portrait output by the copy recognition model; the copy recognition model is the copy recognition model that has been trained above;

[0027] A determination module is used to determine the recognition result of the image to be detected according to the prediction value output by the copy recognition model; the recognition result represents whether the image to be detected is a copy.

[0028] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned copy recognition model training method when executing the computer program, or implements the steps of the above-mentioned image recognition method when executing the computer program.

[0029] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the above-mentioned copy recognition model training method, or implements the steps of the above-mentioned image recognition method when the computer program is executed by a processor.

[0030] The method, device, computer equipment and storage medium for training a remake recognition model provided by the present invention obtain a remake image sample set, wherein the remake image sample set includes unbalanced remake image samples associated with positive label values ​​and unbalanced remake image samples associated with negative label values, extracts texture features from the remake image samples to obtain prediction values, inputs the prediction values ​​and the real label values ​​of the remake image samples into a hit model to obtain a hit probability value, obtains the loss value of the remake image sample through a focus loss function for overcoming the imbalance in the number of samples, and when the loss value does not reach a preset convergence condition, iteratively updates the initial parameters of the remake recognition model until the loss value reaches the preset convergence condition, and records the remake recognition model after convergence as a remake recognition model that has been trained. Therefore, adaptive training and learning is implemented in the case of an imbalance in the number of input samples, and remake images can be quickly and accurately identified, thereby improving the accuracy and hit rate of identification, thereby improving the identification efficiency and reliability, and saving costs.

[0031] The image recognition method, device, computer equipment and storage medium provided by the present invention input the image to be detected into the trained copy recognition model, and output the recognition result of the image to be detected. In this way, the present invention can quickly and accurately identify the copy image, improve the recognition accuracy and hit rate, enhance the recognition efficiency and reliability, and save costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0033] Figure 1 Schematic diagram of an application environment of a copy recognition model training method or an image recognition method in one embodiment of the present invention;

[0034] Figure 2 is a flow chart of a copy recognition model training method in one embodiment of the present invention;

[0035] Figure 3 is a flowchart of step S201 of the copy recognition model training method in one embodiment of the present invention;

[0036] Figure 4 is a flow chart of an image recognition method in one embodiment of the present invention;

[0037] Figure 5It is a principle block diagram of a copy recognition model training device in one embodiment of the present invention;

[0038] Figure 6 is a principle block diagram of an image recognition device in one embodiment of the present invention;

[0039] Figure 7 is a schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION

[0040] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0041] The copy recognition model training method provided by the present invention can be applied to Figure 1 In an application environment, a client (computer device) communicates with a server via a network. The client (computer device) includes but is not limited to various personal computers, laptops, smart phones, tablet computers, cameras, and portable wearable devices. The server can be implemented as an independent server or a server cluster consisting of multiple servers.

[0042] In one embodiment, if Figure 2 As shown, a recognition model training method is provided, and its technical solution mainly includes the following steps S10-S60:

[0043] S10, obtaining a reshot image sample set; inputting the reshot image sample set into a reshot recognition model containing initial parameters; the reshot image sample set comprises a number of reshot image samples associated with true label values; the true label values ​​comprise positive label values ​​and negative label values; the number of reshot image samples associated with true label values ​​that are positive label values ​​and the number of reshot image samples associated with true label values ​​that are negative label values ​​are unbalanced.

[0044] It can be understood that the reshot image sample set includes at least one reshot image sample associated with a true label value, and the reshot image samples associated with the true label value include reshot image samples associated with positive label values ​​(that is, samples of normal images) and reshot image samples associated with negative label values ​​(that is, samples of reshot images), wherein there is an imbalance between the sample number of reshot image samples associated with the true label value being the positive label value and the sample number of reshot image samples associated with the true label value being the negative label value, the proportion of the sample number of the reshot image samples associated with the true label value being the positive label value in the reshot image sample set is marked as the positive sample proportion, and the sample number of the reshot image samples associated with the true label value being the positive label value is marked as the positive sample proportion. The proportion of the number of re-shot image samples associated with negative label values ​​in the re-shot image sample set is marked as the negative sample proportion, and the imbalance is the huge difference between the negative sample proportion and the positive sample proportion. For example, the re-shot image sample set has 1000 re-shot image samples, of which 5 re-shot image samples are associated with negative label values ​​of the true label value, and 995 re-shot image samples are associated with positive label values ​​of the true label value. The positive sample proportion is 0.5%, and the negative sample proportion is 99.5%. The difference between the positive sample proportion and the negative sample proportion is huge, which indicates that the sample numbers of re-shot image samples associated with positive label values ​​of the true label value and the re-shot image samples associated with negative label values ​​of the true label value are unbalanced. The re-shot image sample set is input into a re-shot recognition model containing initial parameters, and the initial parameters can be set according to requirements, for example, the initial parameters can be set to random parameter values.

[0045] S20, extracting texture features of the re-shot image sample through the re-shot recognition model, and obtaining a prediction value output by the re-shot recognition model according to the texture features.

[0046] It can be understood that the remake identification model is a deep convolutional neural network model that identifies whether an input image is a remake image. The remake identification model includes an input layer, a hidden layer, a pooling layer, a fully connected layer and an output layer. The neural network structure in the remake identification model can be set according to needs. For example, the neural network structure in the remake identification model can be a neural network structure of the VGG series, a neural network structure of the Inception series, a neural network structure of the GoogleNet series, and a neural network structure of the ResNet series, etc. The texture features include ripple features, pattern features, and abnormal streak features. The remake identification model extracts the texture features in the remake image sample. According to the texture features, the remake identification model outputs the predicted value for identifying the remake image sample. The predicted value is a value close to the true label value obtained by the remake identification model for predicting the counter-criticism image sample. For example, the true label value of the remake image sample is 1, and the remake identification model identifies the remake image sample and outputs the predicted value of the remake image sample as 0.9.

[0047] S30, inputting the predicted value and the true label value associated with the reshot image sample into a hit model in the reshot recognition model to obtain a hit probability value of the reshot image sample.

[0048] It can be understood that the predicted value and the true label value associated with the reshot image sample are input into the hit model of the reshot recognition model. The hit model is used to calculate the hit probability value of the reshot image sample. The hit probability value of the reshot image sample is calculated according to the hit function formula in the hit model to obtain the hit probability value of the reshot image sample. The hit probability value is the probability that the predicted value hits the true label value. For example, if the predicted value is 0.9 and the true label value is 1, then the hit probability value is 0.9.

[0049] In one embodiment, the step S30, that is, inputting the predicted value and the true label value associated with the reshot image sample into the hit model in the reshot recognition model to obtain the hit probability value of the reshot image sample, includes:

[0050] S301, inputting the predicted value and the real label value associated with the re-shot image sample into the hit function of the following hit model to obtain the hit probability value of the re-shot image sample:

[0051]

[0052] in:

[0053] i is the number of times the remake recognition model is trained;

[0054] P i is the hit probability value of the i-th training of the remake recognition model;

[0055] y i is the predicted value of the i-th training of the remake recognition model;

[0056] x is the true label value;

[0057] m is the positive sample label value;

[0058] n is the negative sample label value.

[0059] It is understandable that the positive sample label value and the negative sample label value can be set according to requirements. Preferably, the positive sample label value can be 1, and the negative sample label value can be 0.

[0060] S40, inputting the hit probability value into a focus loss function used to overcome the imbalance of sample quantity in the re-shoot recognition model, so as to obtain a loss value of the re-shoot image sample.

[0061] It can be understood that the loss function in the remake recognition model is a focus loss function used to overcome the imbalance in the number of samples. The loss value of the remake image sample is calculated by the formula of the focus loss function. The loss value is the difference between the true label value and the predicted value identified by the remake recognition model for the remake image sample, and then backpropagation is used to iteratively update the model parameters in the remake recognition model. The focus loss function has excellent robustness for the remake image sample set with an unbalanced number of samples. The focus loss function is more sensitive to the remake image samples with a small number of samples in the remake image sample set with an unbalanced number of samples, and is insensitive and does not exaggerate the remake image samples with a large number of samples in the remake image sample set with an unbalanced number of samples, thereby improving the generalization ability of the remake recognition model, and can perform adaptive learning when the remake image sample set with an unbalanced number of input samples is input. Therefore, the focus loss function can make the remake recognition model converge in the direction of higher accuracy and hit rate.

[0062] In one embodiment, in step S40, the focusing loss function is:

[0063] L=-logP i ×(1-P i ) γ

[0064] in,

[0065] L is the loss value;

[0066] P iis the hit probability value of the i-th training of the remake recognition model;

[0067] γ is the parameter value to reduce the interference of unbalanced samples:

[0068]

[0069] in:

[0070] γ is the parameter value for reducing the interference of unbalanced samples;

[0071] h is the adjustment parameter value;

[0072] A i is the weighted hit probability value of the i-th training obtained by the weighted hit function.

[0073] It is understandable that the adjustment parameter value can be set according to demand, the adjustment parameter value is a positive value, and the weighted hit probability value is a probability value calculated by weighting the hit probability value of the current training and the hit probability value of the previous training.

[0074] In this way, the weighted hit function makes full use of the hit probability value of the previous training, and the hit probability value of the current training and the hit probability value of the previous training are considered together to obtain the parameter value for reducing the interference of unbalanced samples, so that the remake recognition model can converge in the direction of higher accuracy and hit rate.

[0075] In one embodiment, the weighted hit function is:

[0076]

[0077] in:

[0078] i is the number of times the recognition model is trained;

[0079] A i is the weighted hit probability value of the i-th training of the remake recognition model;

[0080] P i is the hit probability value of the i-th training of the remake recognition model;

[0081] P i-1 is the hit probability value of the i-1th training of the remake recognition model.

[0082] It can be understood that during the first training process, the weighted hit probability value of the first training is equal to the hit probability value of the first training. During the second training process, the weighted hit probability of the second training is obtained by weighted calculation of the hit probability value of the first training and the hit probability value of the second training. And so on, during the i-th training process, the weighted hit probability of the i-th training is obtained by weighted calculation of the hit probability value of the i-1-th training and the hit probability value of the i-th training, until the remake recognition model stops training.

[0083] In one embodiment, the adjustment parameter value in the focus loss function is h=0.65. It can be understood that, through experimental data analysis, when the adjustment parameter value is H=0.65, γ and P i The curve is optimal and the effect is best.

[0084] S50, when the loss value does not reach the preset convergence condition, iteratively update the initial parameters of the copy recognition model until the loss value reaches the preset convergence condition, and record the copy recognition model after convergence as the trained copy recognition model.

[0085] Understandably, the preset convergence condition may be that the value obtained after the loss value is calculated after a preset number of training times is very small and will not decrease any further, or the preset convergence condition may be that the loss value is less than a set threshold, for example, the preset convergence condition is that the loss value is very small after 8000 calculations and will not decrease any further, or the preset convergence condition is that the loss value is less than 0.002, etc. When the loss value does not reach the preset convergence condition, the initial parameters of the remake recognition model are continuously iterated and updated until the loss value reaches the preset convergence condition, then the training is stopped, and the remake recognition model after convergence is recorded as the remake recognition model that has completed training.

[0086] In this way, when the loss value does not reach the preset convergence condition, it can continuously move toward a direction with higher accuracy and hit rate, so that the accuracy and hit rate of the predicted value are getting higher and higher.

[0087] S60, when the loss value reaches a preset convergence condition, recording the converged copy recognition model as a trained copy recognition model.

[0088] It is understandable that when the loss value reaches the preset convergence condition, the training is stopped. At this time, all model parameters in the copy recognition model do not change, and the copy recognition model after convergence is recorded as the trained copy recognition model.

[0089] The present invention obtains a re-shot image sample set; inputs the re-shot image sample set into a re-shot recognition model containing initial parameters; the re-shot image sample set includes a plurality of re-shot image samples associated with true label values; the true label values ​​include positive label values ​​and negative label values; the number of re-shot image samples associated with the true label values ​​being positive label values ​​and the number of re-shot image samples associated with the true label values ​​being negative label values ​​are unbalanced; extracts texture features from the re-shot image samples through the re-shot recognition model, and obtains a predicted value output by the re-shot recognition model according to the texture features; and associates the predicted value with the true label value associated with the re-shot image sample. Input the hit model in the remake recognition model to obtain the hit probability value of the remake image sample; input the hit probability value into the focusing loss function in the remake recognition model for overcoming the imbalance of sample quantity to obtain the loss value of the remake image sample; when the loss value does not reach the preset convergence condition, iteratively update the initial parameters of the remake recognition model until the loss value reaches the preset convergence condition, and record the remake recognition model after convergence as the trained remake recognition model; when the loss value reaches the preset convergence condition, record the remake recognition model after convergence as the trained remake recognition model.

[0090] Thus, the present invention realizes the following steps: obtaining a remade image sample set, the remade image sample set includes unbalanced remade image samples associated with positive label values ​​of the true label value and remade image samples associated with negative label values ​​of the true label value, extracting texture features from the remade image samples, obtaining prediction values, inputting the prediction values ​​and the true label values ​​of the remade image samples into a hit model to obtain a hit probability value, obtaining the loss value of the remade image samples through a focus loss function for overcoming the imbalance of the number of samples, iteratively updating the initial parameters of the remade recognition model when the loss value does not reach a preset convergence condition, until the loss value reaches a preset convergence condition, and recording the remade recognition model after convergence as a remade recognition model that has been trained. Therefore, adaptive training and learning is realized in the case of an imbalance in the number of input samples, and remade images can be quickly and accurately identified, thereby improving the accuracy and hit rate of identification, thereby improving the efficiency and reliability of identification, and saving costs.

[0091] In one embodiment, before step S20, that is, before extracting texture features of the re-shot image sample by the re-shot recognition model and obtaining the predicted value output by the re-shot recognition model according to the texture features, the following steps are included:

[0092] S201, through transfer learning, the copy recognition model obtains all model parameters of the trained binary classification neural network model, and determines all the model parameters as initial parameters of the copy recognition model.

[0093] Understandably, the initial parameters include the network structure of the remake recognition model and the parameter values ​​in the network structure of the remake recognition model. The transfer learning (TL) is to use the parameters of the existing training models in other fields and apply them to the tasks in this field, that is, the remake recognition model obtains all the model parameters of the trained binary classification neural network model through transfer learning, and then determines all the model parameters of the binary classification neural network model as the initial parameters of the remake recognition model. The binary classification neural network model can be selected according to the needs, for example, the binary classification neural network model can select a gender recognition model based on Tensorflow.

[0094] In this way, through transfer learning, the model parameters of the trained binary classification neural network model are directly obtained as the model parameters of the copy recognition model, which improves the starting point of the copy recognition model, that is, improves it on the basis of the original accuracy and hit rate, thereby greatly shortening the training time of the copy recognition model.

[0095] In one embodiment, if Figure 3 As shown, before step S201, that is, through transfer learning, the copy recognition model obtains all model parameters of the trained binary classification neural network model, and before determining all model parameters as initial parameters of the copy recognition model, it includes:

[0096] S2011, obtaining a binary classification image sample set associated with a binary classification label value; inputting the binary classification image sample set into a binary classification neural network model including binary classification initial parameters; the binary classification image sample set includes a plurality of binary classification image samples associated with the binary classification label value; the binary classification label value includes a positive binary classification label value and a negative binary classification label value;

[0097] It can be understood that the binary classification neural network model is a neural network model that outputs recognition results (the recognition results have only two classification situations) by extracting texture features. The recognition results of the binary classification neural network model can be set according to needs. For example, the recognition result of the binary classification neural network model is to identify whether the back photo of the ID card is a photocopy, which indicates that the binary classification neural network model is a neural network model for identifying photocopies of the back photo of the ID card. The binary classification image sample set includes at least one binary classification image sample associated with a binary classification label value, and the binary classification image samples associated with the binary classification label value include binary classification image samples associated with positive binary classification label values ​​and binary classification image samples associated with negative binary classification label values, wherein the sample number of the binary classification image samples associated with the binary classification label value being the positive binary classification label value and the sample number of the binary classification image samples associated with the binary classification label value being the negative binary classification label value are balanced, and the balance is that the proportion of the binary classification image samples associated with the binary classification label value being the positive binary classification label value in the binary classification image sample set and the proportion of the binary classification image samples associated with the binary classification label value being the negative binary classification label value in the binary classification image sample set are almost equal, for example, the binary classification image sample set has 1000 binary classification image samples, of which 500 are associated with the binary classification label value being the negative binary classification label value, accounting for 50%; and 500 are associated with the binary classification label value being the positive binary classification label value, accounting for 50%. The binary classification image sample set is input into a binary classification neural network model including binary classification initial parameters.

[0098] S2012, extracting texture features of the binary classification image samples through the binary classification neural network model, and obtaining binary classification prediction values ​​output by the binary classification neural network model according to the texture features;

[0099] It can be understood that the binary classification recognition model includes an input layer, a hidden layer, a pooling layer, a fully connected layer and an output layer. The neural network structure in the binary classification recognition model can be set according to needs. For example, the neural network structure in the binary classification recognition model can be a neural network structure of the VGG series, a neural network structure of the Inception series, a neural network structure of the GoogleNet series, and a neural network structure of the ResNet series, etc. The neural network structure in the binary classification recognition model is consistent with the neural network structure in the remake recognition model. The texture features include wavy pattern features, pattern features, and abnormal pattern features. The binary classification recognition model extracts the texture features in the binary classification image samples. According to the texture features, the binary classification recognition model outputs the binary classification prediction value for identifying the binary classification image samples. The binary classification prediction value is a value close to the binary classification label value obtained by the binary classification neural network model for predicting the binary classification image samples. For example, the true label value of the binary classification image sample is 0, and the binary classification recognition model identifies the binary classification image sample and outputs the binary classification prediction value of the binary classification image sample as 0.2.

[0100] S2013, inputting the binary classification prediction value and the binary classification label value associated with the binary classification image sample into the binary classification cross entropy loss function in the binary classification neural network model to obtain the binary classification loss value of the binary classification image sample;

[0101] It can be understood that according to the binary classification prediction value and the binary classification label value associated with the binary classification image sample, the binary classification loss value of the binary classification image sample can be obtained through the binary classification cross entropy loss function, and the binary classification cross entropy loss function is a loss function suitable for a binary classification image sample set with a balanced sample size.

[0102] In one embodiment, in step S2013, the binary cross entropy loss function is:

[0103] L CE = -logQ j

[0104] in,

[0105] j is the number of times the binary classification neural network model is trained;

[0106] L CE is the binary classification loss value;

[0107] Q i is the binary classification hit probability value of the jth training:

[0108]

[0109] in,

[0110] j is the number of times the binary classification neural network model is trained;

[0111] s j is the binary classification prediction value of the j-th training of the binary classification neural network model;

[0112] t is the binary classification label value;

[0113] w is the binary positive label value;

[0114] v is the negative label value of the binary classification.

[0115] It can be understood that the binary classification hit probability value is the probability that the binary classification prediction value hits the binary classification label value. For example, if the binary classification prediction value is 0.3 and the binary classification label value is 0, then the hit probability value is 1-0.3=0.7. The binary classification positive label value and the binary classification negative label value can be set according to demand. Preferably, the binary classification positive label value can be 1, and the binary classification negative label value can be 0. The binary classification positive label value can be consistent with the positive sample label value or inconsistent, and the binary classification negative label value can be consistent with the negative sample label value or inconsistent. S2014, when the binary classification loss value does not reach the preset binary classification convergence condition, iteratively update the binary classification initial parameters of the binary classification neural network model until the binary classification loss value reaches the preset binary classification convergence condition, and record the binary classification neural network model after convergence as the trained binary classification neural network model;

[0116] Understandably, the preset binary classification convergence condition can be the condition that the binary classification loss value is very small and will not decrease after the preset binary classification training times, or the preset binary classification convergence condition can be the condition that the binary classification loss value is less than the set binary classification threshold. When the loss value does not reach the preset convergence condition, the binary classification initial parameters of the binary classification neural network model are continuously updated iteratively until the binary classification loss value reaches the preset binary classification convergence condition, then the training is stopped, and the binary classification neural network model after convergence is recorded as the trained binary classification neural network model.

[0117] S2015, when the binary classification loss value reaches a preset binary classification convergence condition, the binary classification neural network model after convergence is recorded as a trained binary classification neural network model.

[0118] It can be understood that when the binary classification loss value reaches the preset binary classification convergence condition, the training is stopped. At this time, all model parameters in the binary classification neural network model are no longer changing, and the binary classification neural network model after convergence is recorded as a trained binary classification neural network model.

[0119] In this way, by training the binary classification neural network model, all model parameters of the trained binary classification neural network model are obtained to provide the initial parameters for the copy recognition model.

[0120] The image recognition method provided by the present invention can be applied to Figure 1 In an application environment, a client (computer device) communicates with a server via a network. The client (computer device) includes but is not limited to various personal computers, laptops, smart phones, tablet computers, cameras, and portable wearable devices. The server can be implemented as an independent server or a server cluster consisting of multiple servers.

[0121] In one embodiment, if Figure 4 As shown, an image recognition method is provided, and its technical solution mainly includes the following steps S100-S400:

[0122] S100, receiving a recognition instruction and acquiring an image to be detected.

[0123] Understandably, the image to be detected may be an image containing a human face, such as a head shot taken above the clavicle, an image of the front side of an ID card (with a face on the front side), and the like.

[0124] S200, inputting the image to be detected into a head portrait detection model to obtain a head portrait in the image to be detected; the head portrait detection model is trained according to the YOLO algorithm.

[0125] Understandably, by using the YOLO algorithm in the head portrait detection model, preferably, the head portrait detection model includes the YOLOv3 algorithm, the head portrait detection is performed on the image to be detected using multi-scale features, and it can be determined whether the image to be detected contains a face. For example, the image to be detected is a frontal image of a person taken by a camera. According to experimental data, it can be concluded that the accuracy of the frontal image detection is 99.95%, and the face detection area is extracted within 30 milliseconds.

[0126] In this way, by using the head portrait detection model trained by the YOLO algorithm, it is possible to extract only useful head portraits (useful information) in the image to be detected for recognition, thereby improving recognition efficiency and accuracy. By referencing the trained copy recognition model, the recognition accuracy and hit rate are improved, thereby improving recognition efficiency and reliability and saving costs.

[0127] S300, inputting the head portrait into a copy recognition model, and obtaining a prediction value of the texture feature of the head portrait output by the copy recognition model; the copy recognition model is the copy recognition model that has been trained as mentioned above.

[0128] It can be understood that the copy shot recognition model is a trained copy shot recognition model obtained by training through the above-mentioned copy shot recognition model training method. The head portrait is input into the copy shot recognition model, and the texture features of the head portrait are extracted by the copy shot recognition model. The copy shot recognition model recognizes the texture features and outputs the predicted value of the head portrait.

[0129] S400, determining a recognition result of the image to be detected according to the prediction value output by the copy recognition model; the recognition result indicates whether the image to be detected is a copy.

[0130] It can be understood that by converting the predicted value into a percentage value in a percentage probability format, for example: the predicted value is 0.01, and the probability of identifying a negative label value converted into a percentage probability format is 99%, and the predicted value after conversion is judged whether it is greater than a preset probability threshold. The probability threshold can be set according to demand, for example, the probability threshold can be set to 98%. If the predicted value after conversion is greater than the probability threshold, it is determined that the recognition result of the image to be detected is a copied image.

[0131] The present invention inputs the image to be detected into the trained copy recognition model and outputs the recognition result of the image to be detected. In this way, the present invention can quickly and accurately identify the copy image, improve the recognition accuracy and hit rate, enhance the recognition efficiency and reliability, and save costs.

[0132] In one embodiment, a copy recognition model training device is provided, and the copy recognition model training device corresponds to the copy recognition model training method in the above embodiment. Figure 5 As shown, the remake recognition model training device includes an acquisition module 11, an extraction module 12, a hit module 13, an overcoming module 14, a non-convergence module 15 and a convergence module 16. The functional modules are described in detail as follows:

[0133] The acquisition module 11 is used to acquire a re-shot image sample set; input the re-shot image sample set into a re-shot recognition model containing initial parameters; the re-shot image sample set includes a number of re-shot image samples associated with true label values; the true label values ​​include positive label values ​​and negative label values; the number of re-shot image samples associated with true label values ​​that are positive label values ​​and the number of re-shot image samples associated with true label values ​​that are negative label values ​​are unbalanced;

[0134] An extraction module 12, configured to extract texture features of the remake image sample using the remake recognition model, and obtain a prediction value output by the remake recognition model according to the texture features;

[0135] A hit module 13, used for inputting the predicted value and the real label value associated with the reshot image sample into a hit model in the reshot recognition model to obtain a hit probability value of the reshot image sample;

[0136] An overcoming module 14 is used to input the hit probability value into a focus loss function used to overcome the imbalance of sample quantity in the remake recognition model, so as to obtain a loss value of the remake image sample;

[0137] The non-convergence module 15 is used for iteratively updating the initial parameters of the remake recognition model when the loss value does not reach the preset convergence condition, until the loss value reaches the preset convergence condition, and recording the remake recognition model after convergence as the remake recognition model that has completed training;

[0138] The convergence module 16 is used to record the converged copy recognition model as a trained copy recognition model when the loss value reaches a preset convergence condition.

[0139] For the specific limitations of the remake recognition model training device, please refer to the limitations of the remake recognition model training method above, which will not be repeated here. Each module in the above-mentioned remake recognition model training device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0140] In one embodiment, an image recognition device is provided, which corresponds one-to-one to the image recognition method in the above embodiment. Figure 6 As shown, the image recognition device includes a receiving module 101, an input module 102, a prediction module 103 and a determination module 104. The functional modules are described in detail as follows:

[0141] The receiving module 101 is used to receive a recognition instruction and obtain an image to be detected;

[0142] An input module 102 is used to input the image to be detected into a head portrait detection model to obtain a head portrait in the image to be detected; the head portrait detection model is trained according to the YOLO algorithm;

[0143] The prediction module 103 is used to input the head portrait into a copy recognition model to obtain the prediction value of the texture feature of the head portrait output by the copy recognition model; the copy recognition model is the copy recognition model that has been trained above;

[0144] The determination module 104 is used to determine the recognition result of the image to be detected according to the prediction value output by the copy recognition model; the recognition result represents whether the image to be detected is a copy.

[0145] For the specific definition of the image recognition device, please refer to the definition of the image recognition method above, which will not be repeated here. Each module in the above-mentioned image recognition device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0146] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a copy recognition model training method or an image recognition method is implemented.

[0147] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the copy recognition model training method in the above embodiment is implemented, or when the processor executes the computer program, the image recognition method in the above embodiment is implemented.

[0148] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the copy recognition model training method in the above embodiment is implemented, or when the computer program is executed by a processor, the image recognition method in the above embodiment is implemented.

[0149] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0150] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0151] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A method for training a copy recognition model, characterized in that: include: Acquire a re-shot image sample set; input the re-shot image sample set into a re-shot recognition model containing initial parameters; the re-shot image sample set includes a number of re-shot image samples associated with true label values; the true label values ​​include positive label values ​​and negative label values; the number of re-shot image samples associated with the true label values ​​being positive label values ​​and the number of re-shot image samples associated with the true label values ​​being negative label values ​​are unbalanced; Extracting texture features of the re-shot image sample by using the re-shot recognition model, and obtaining a prediction value output by the re-shot recognition model according to the texture features; Inputting the predicted value and the true label value associated with the reshot image sample into a hit model in the reshot recognition model to obtain a hit probability value of the reshot image sample; Inputting the hit probability value into a focus loss function used to overcome the imbalance of sample quantity in the remake recognition model to obtain a loss value of the remake image sample; When the loss value does not reach the preset convergence condition, iteratively updating the initial parameters of the remake recognition model until the loss value reaches the preset convergence condition, and recording the remake recognition model after convergence as the trained remake recognition model; When the loss value reaches a preset convergence condition, recording the remake recognition model after convergence as a trained remake recognition model; The focusing loss function is: L=―logP i ×(1―P i ) γ in, L is the loss value; P i is the hit probability value of the i-th training of the remake recognition model; γ is the parameter value to reduce the interference of unbalanced samples: in: γ is the parameter value for reducing the interference of unbalanced samples; h is the adjustment parameter value; A i is the weighted hit probability value of the i-th training obtained by the weighted hit function; The weighted hit function is: in: i is the number of times the recognition model is trained; A i is the weighted hit probability value of the i-th training of the remake recognition model; P i is the hit probability value of the i-th training of the remake recognition model; P i―1 is the hit probability value of the i-1th training of the remake recognition model.

2. The copy recognition model training method according to claim 1, characterized in that: Before extracting texture features of the remake image sample by the remake recognition model and obtaining the prediction value output by the remake recognition model according to the texture features, the method includes: Through transfer learning, the copy recognition model obtains all model parameters of the trained binary classification neural network model, and determines all the model parameters as the initial parameters of the copy recognition model.

3. The copy recognition model training method according to claim 2, characterized in that: The process of obtaining all model parameters of the trained binary classification neural network model by the copy recognition model through transfer learning, and determining all model parameters as initial parameters of the copy recognition model, includes: Obtain a binary classification image sample set associated with a binary classification label value; input the binary classification image sample set into a binary classification neural network model containing binary classification initial parameters; the binary classification image sample set includes a number of binary classification image samples associated with the binary classification label value; the binary classification label value includes a positive binary classification label value and a negative binary classification label value; Extracting texture features of the binary classification image samples through the binary classification neural network model, and obtaining binary classification prediction values ​​output by the binary classification neural network model according to the texture features; Inputting the binary classification prediction value and the binary classification label value associated with the binary classification image sample into the binary classification cross entropy loss function in the binary classification neural network model to obtain the binary classification loss value of the binary classification image sample; When the binary classification loss value does not reach the preset binary classification convergence condition, iteratively updating the binary classification initial parameters of the binary classification neural network model until the binary classification loss value reaches the preset binary classification convergence condition, and recording the binary classification neural network model after convergence as the trained binary classification neural network model; When the binary classification loss value reaches a preset binary classification convergence condition, the binary classification neural network model after convergence is recorded as a trained binary classification neural network model.

4. An image recognition method, characterized in that: include: Receive recognition instructions and obtain the image to be detected; Inputting the image to be detected into a head portrait detection model to obtain a head portrait in the image to be detected; The head portrait detection model is trained according to the YOLO algorithm; Inputting the headshot photo into a copy recognition model, and obtaining a predicted value of the texture feature of the headshot photo output by the copy recognition model; the copy recognition model is a copy recognition model that has been trained in the copy recognition model training method according to any one of claims 1 to 3; The recognition result of the image to be detected is determined according to the prediction value output by the copy recognition model; the recognition result indicates whether the image to be detected is a copy.

5. A copy recognition model training device, characterized in that: include: An acquisition module, used for acquiring a sample set of reproduced images; The re-shot image sample set is input into a re-shot recognition model including initial parameters; the re-shot image sample set includes a plurality of re-shot image samples associated with true label values; the true label values ​​include positive label values ​​and negative label values; the number of re-shot image samples associated with the true label values ​​being positive label values ​​and the number of re-shot image samples associated with the true label values ​​being negative label values ​​are unbalanced; An extraction module, used for extracting texture features of the remake image sample through the remake recognition model, and obtaining a prediction value output by the remake recognition model according to the texture features; A hit module, used for inputting the predicted value and the real label value associated with the reshot image sample into a hit model in the reshot recognition model to obtain a hit probability value of the reshot image sample; An overcoming module, used for inputting the hit probability value into a focus loss function used for overcoming the imbalance of sample quantity in the remake recognition model, so as to obtain a loss value of the remake image sample; A non-convergence module, used for iteratively updating the initial parameters of the remake recognition model when the loss value does not reach the preset convergence condition, until the loss value reaches the preset convergence condition, and recording the remake recognition model after convergence as the trained remake recognition model; A convergence module, used for recording the remake recognition model after convergence as a trained remake recognition model when the loss value reaches a preset convergence condition; The focusing loss function is: L=―logP i ×(1―P i ) γ in, L is the loss value; P i is the hit probability value of the i-th training of the remake recognition model; γ is the parameter value to reduce the interference of unbalanced samples: in: γ is the parameter value for reducing the interference of unbalanced samples; h is the adjustment parameter value; A i is the weighted hit probability value of the i-th training obtained by the weighted hit function; The weighted hit function is: in: i is the number of times the recognition model is trained; A i is the weighted hit probability value of the i-th training of the remake recognition model; P i is the hit probability value of the i-th training of the remake recognition model; P i―1 is the hit probability value of the i-1th training of the remake recognition model.

6. An image recognition device, characterized in that: include: A receiving module is used to receive a recognition instruction and obtain an image to be detected; An input module is used to input the image to be detected into a head portrait detection model to obtain a head portrait in the image to be detected; the head portrait detection model is trained according to the YOLO algorithm; A prediction module, used for inputting the headshot photo into a copy recognition model, and obtaining a prediction value of the texture feature of the headshot photo output by the copy recognition model; the copy recognition model is a copy recognition model that has been trained in the copy recognition model training method according to any one of claims 1 to 3; A determination module is used to determine the recognition result of the image to be detected according to the prediction value output by the copy recognition model; the recognition result represents whether the image to be detected is a copy.

7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the copy recognition model training method as described in any one of claims 1 to 3 is implemented, or when the processor executes the computer program, the image recognition method as described in claim 4 is implemented.

8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by the processor, the copy recognition model training method as described in any one of claims 1 to 3 is implemented, or when the processor executes the computer program, the image recognition method as described in claim 4 is implemented.