False certificate detection method, readable storage medium, equipment and program product
By iteratively training the model with a balanced sample set and applying curriculum learning, the detection accuracy for both ordinary and highly realistic fake certificates is improved, addressing the imbalance in existing recognition models.
Patent Information
- Application Number
- CN202411315813.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2024-12-20
AI Technical Summary
Existing fake certificate recognition models struggle to distinguish between ordinary and highly realistic fake certificates due to imbalanced training data distribution, leading to a decrease in detection accuracy for ordinary certificates.
Iteratively train the original recognition model using a sample set that includes more ordinary certificates and fewer highly realistic certificates, maintaining the dominance of ordinary certificates while enhancing the model's ability to detect highly realistic ones by adjusting the sample proportion and using curriculum learning algorithms.
The solution maintains the detection accuracy for ordinary certificates while significantly improving the detection of highly realistic certificates, ensuring overall enhanced fake certificate recognition.
Smart Images

Figure CN119169376A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a method for detecting fake certificates, a readable storage medium, a device, and a program product. Background Art
[0002] In the electronic Know Your Customer (eKYC) scenario, it is often necessary to verify the authenticity of the documents provided by the customer. At this time, a fake certificate recognition model based on machine learning technology can be used. The fake certificate recognition model usually uses a large amount of common fake certificate data as samples for training. Therefore, the model has good generalization ability for common fake certificates and can achieve efficient detection of them. However, with the improvement of certificate counterfeiting technology, realistic fake certificates obtained by means such as screen copying, color printing, and high-precision imitation have a higher degree of simulation than the above-mentioned ordinary fake certificates, making it difficult for the above-mentioned fake certificate recognition model to distinguish between true and false, and the detection accuracy rate decreases.
[0003] In the related art, in order to improve the detection capability of the fake certificate recognition model for realistic fake certificates, the training samples corresponding to realistic fake certificates and the historical training samples corresponding to ordinary fake certificates are usually mixed to train the fake certificate recognition model. However, even if the trained fake certificate recognition model improves the detection capability for realistic fake certificates, the overall distribution of the training samples changes significantly due to the mixing between different training samples. For example, the number of training samples for realistic certificates is far greater than the historical training samples for ordinary certificates, which causes the model to over-focus on the features of the training samples for realistic fake certificates and reduces the detection capability for ordinary fake certificates. Given that the detection capability for ordinary fake certificates is one of the key indicators in the eKYC scenario, this reduction in capability is not in line with expectations. Summary of the invention
[0004] In view of this, this specification provides a method and device for detecting fake certificates to solve the deficiencies in the related art.
[0005] Specifically, this specification is implemented through the following technical solutions:
[0006] According to a first aspect of an embodiment of this specification, a method for detecting a fake certificate is provided, comprising:
[0007] Obtaining an original fake certificate recognition model, wherein the original fake certificate recognition model is used to detect a first type of fake certificate;
[0008] Obtaining a set of samples to be trained, wherein the set of samples to be trained includes first-class samples corresponding to the first-class false certificates and second-class samples corresponding to the second-class false certificates, the second-class false certificates are more realistic than the first-class false certificates, and the number of the second-class samples is less than the number of the first-class samples;
[0009] The original fake certificate recognition model is iteratively trained according to the set of samples to be trained to generate a target fake certificate recognition model. According to a second aspect of the embodiments of this specification, a computer readable storage medium is provided, on which a computer program / instruction is stored, and when the program / instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0010] According to a third aspect of the embodiments of this specification, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the steps of the method described in the first aspect are implemented.
[0011] According to a fourth aspect of the embodiments of this specification, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the method described in the first aspect are implemented.
[0012] In the technical solution provided in this specification, the original false certificate recognition model used to detect the first type of false certificates can be iteratively trained through the set of samples to be trained, so as to generate a target false certificate recognition model. The set of samples to be trained includes first-class samples corresponding to the first type of false certificates and second-class samples corresponding to the second type of false certificates, and the second type of false certificates are more realistic than the first type of false certificates, and the number of the second type of samples corresponding to them is also less than the first type of samples, so that the set of samples to be trained can ensure the proportion of different types of false certificate samples, and based on the relationship of the degree of realism, the first type of false certificates can be regarded as ordinary false certificates and the second type of false certificates can be regarded as realistic false certificates. For the original fake certificate recognition model, on the one hand, even if the sample proportion of the second type of fake certificates is increased, the dominance of the first type of fake certificates is still maintained, thus ensuring that the target fake certificate recognition model will not over-focus on realistic fake certificates and ignore the characteristics of ordinary fake certificates; on the other hand, by increasing the samples of the second type of fake certificates, the model can learn more characteristics of the second type of fake certificates, thereby improving the detection ability of such samples, but because the sample size of the first type of fake certificates is still dominant, the target fake certificate recognition model will not over-fit the characteristics of the second type of fake certificates. Combining the effects of the above two aspects, the above target fake certificate recognition model can effectively enhance the detection accuracy of realistic fake certificates while maintaining the detection accuracy of ordinary fake certificates.
[0013] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present specification. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification, and for ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0015] Figure 1 is a schematic diagram of the architecture of a fake certificate detection system shown in an exemplary embodiment of this specification;
[0016] Figure 2 It is a flowchart of a method for detecting a fake certificate shown in an exemplary embodiment of this specification;
[0017] Figure 3 is a schematic diagram of an original fake certificate recognition model for extracting and analyzing multimodal features shown in an exemplary embodiment of this specification;
[0018] Figure 4 is a schematic diagram of an exemplary embodiment of this specification showing a model iterative training algorithm combining a preset number K and curriculum learning;
[0019] Figure 5 is a schematic diagram of a model-implemented reconstruction learning method shown in an exemplary embodiment of this specification;
[0020] Figure 6 is a schematic structural diagram of an electronic device shown in an exemplary embodiment of this specification;
[0021] Figure 7 It is a structural schematic diagram of a fake certificate detection device shown in an exemplary embodiment of this specification. DETAILED DESCRIPTION
[0022] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this manual are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0023] Figure 1 FIG. 1 is a schematic diagram of the architecture of a fake certificate detection system provided by an exemplary embodiment. Figure 1 As shown, the system includes an original fake certificate recognition model 102 , a sample set to be trained 104 , and a target fake certificate recognition model 106 .
[0024] The original fake certificate recognition model 102 can be a deep learning model based on machine learning, such as a convolutional neural network (CNN), a transformer, etc., and is used to detect the first type of fake certificates. The model can be generated in advance based on a large number of first type of fake certificates, so it has a good generalization ability for the first type of fake certificates, which also means that the original fake certificate recognition model 102 still has a good detection ability when facing other first type of fake certificates that have not been trained.
[0025] In addition, the original fake certificate recognition model 102 can be a recognition model specially trained for the first type of fake certificates, or the original fake certificate recognition model 102 can be a pre-trained model applied to other tasks, and the pre-trained model is trained on a data set similar to the above-mentioned recognition task. Therefore, the knowledge learned from the above-mentioned other tasks can be applied to the above-mentioned recognition task, thereby providing a technical basis for detecting the first type of fake certificates.
[0026] Since the second type of fake certificates are more realistic than the first type of fake certificates, and the generalization ability of the original fake certificate recognition model 102 is only applicable to other fake certificates with a similar degree of realism to the first type of fake certificates, the original fake certificate recognition model 102 is difficult to detect the second type of fake certificates. At this time, a new fake certificate recognition model is needed to simultaneously detect the first and second types of fake certificates.
[0027] To this end, the original fake certificate recognition model 102 can be iteratively trained based on the sample set 104 to be trained, so that the target fake certificate recognition model generated by the training can not only add the detection capability for the second type of fake certificates, but also have the detection capability for the first type of fake certificates in the original fake certificate recognition model 102.
[0028] In the sample set 104 to be trained, there may be a first class of samples corresponding to the first class of false certificates and a second class of samples corresponding to the second class of false certificates, wherein the number of the second class of samples is set to be less than the first class of samples, so that the sample set 104 to be trained as a whole presents a situation where the first class of samples dominates and the second class of samples occupies a secondary position. Since in the field of machine learning, the model can learn the pattern in the corresponding sample by minimizing the loss function, when the original false certificate recognition model 102 receives a new training sample, especially when the training sample has different characteristics from the first class of samples like the second class of samples, the original false certificate recognition model 102 will try to adjust its internal parameters during the training process to better adapt to these new samples. Of course, even if the proportion of the second class of samples is increased in the sample set 104 to be trained, the first class of samples still maintains a dominant position in the sample set 104 to be trained, which can ensure that the target false certificate recognition model 106 will not pay too much attention to the second class of false certificates and ignore the characteristics of the first class of false certificates. In this way, the target false certificate recognition model 106 generated after training can not only guarantee the detection capability for the first class of false certificates, but also improve the detection capability for the second class of false certificates.
[0029] Figure 2 FIG. 1 is a flow chart of a method for detecting a fake certificate as shown in an exemplary embodiment of this specification. Figure 2 As shown, the method includes:
[0030] Step S202, obtaining an original fake certificate recognition model, wherein the original fake certificate recognition model is used to detect the first type of fake certificates.
[0031] In order to make the target fake certificate recognition model have the ability to detect the first type of fake certificates, the original fake certificate recognition model can be obtained and further trained to generate the target fake certificate recognition model. For an introduction to the original fake certificate recognition model, please refer to Figure 1 And the corresponding instructions will not be repeated here in this manual.
[0032] Step S204, obtaining a set of samples to be trained, wherein the set of samples to be trained includes first-category samples corresponding to the first-category false certificates and second-category samples corresponding to the second-category false certificates, the second-category false certificates are more realistic than the first-category false certificates, and the number of the second-category samples is less than the number of the first-category samples.
[0033] In order to enable the trained original fake certificate recognition model to handle the recognition tasks for the first type of fake certificates and the second type of fake certificates, the original fake certificate recognition model can be trained specifically using the above-mentioned set of samples to be trained. The above-mentioned set of samples to be trained includes the first type of samples corresponding to the first type of fake certificates and the second type of samples corresponding to the second type of fake certificates.
[0034] The difference between the first type of fake certificates and the second type of fake certificates is the degree of realism, which can be determined based on one or more dimensions, each of which can reflect the corresponding forgery characteristics of the fake certificates. For example, in the case where the first type of fake certificates and the second type of fake certificates are obtained by screen copying and / or color printing, the degree of realism can be defined based on dimensions such as moiré, pixel particles, color deviation, and the presence of screen / paper borders. Among them, if the moiré and pixel particles of the certificate are more obvious, the color deviation is more serious, and there is a screen / paper border, it can be said that the degree of realism of the certificate is lower and can be easily distinguished; otherwise, it means that the degree of realism of the fake certificate is higher and difficult to distinguish.
[0035] For the above-mentioned first category of false certificates and the above-mentioned second category of false certificates, the method of quantifying dimensions and setting corresponding dimensional conditions can be used to clarify which false certificates belong to the first category and which false certificates belong to the second category. Specifically, on the one hand, the moiré patterns in the above-mentioned dimensions can be quantified into the contrast of the corresponding moiré patterns, that is, the difference between the maximum and minimum brightness values of the moiré patterns. The contrast can establish a positive correlation with the visibility of the moiré patterns; the pixel particles are quantified into the signal-to-noise ratio determined based on image noise analysis; the color difference is quantified into the chromaticity error ΔE; the existence state of the screen / paper border is quantified into the detection result based on the edge detection algorithm. Of course, each dimension can also be quantified by other quantization methods, which is not limited in this specification. On the other hand, the corresponding dimensional conditions can be set for the quantization results of each dimension respectively, and defined as follows according to actual needs: a false certificate that meets any of the above dimensional conditions is a first category of false certificates, otherwise it is a second category of false certificates; or, a false certificate that meets any / specific multiple dimensional conditions above is a first category of false certificates, otherwise it is a second category of false certificates. Among them, taking the above quantification results as an example, the dimensional conditions for the first type of false certificates may include: the moiré contrast is greater than a preset visible threshold, the image signal-to-noise ratio is less than a preset signal-to-noise ratio threshold, the chromaticity error ΔE is greater than a preset error threshold, and the detection result of the edge detection algorithm indicates the existence of a screen / paper border.
[0036] The above-mentioned degree of realism can be determined based on dimensions such as moiré patterns, pixel particles, etc. that can reflect counterfeit characteristics. The solution of this specification can also introduce sample clarity on the basis of the above dimensions to classify the above-mentioned first type of fake certificates and the above-mentioned second type of fake certificates.
[0037] In one embodiment, when there are multiple first-class definitions for the first-class fake certificates, the set of samples to be trained may include first-class samples corresponding to each first-class definition; and / or, when there are multiple second-class definitions for the second-class fake certificates, the set of samples to be trained may include second-class samples corresponding to each second-class definition. Wherein, if the definition of the sample is higher, it means that the forged features obtained from the sample are clearer, the determined degree of realism is more likely to conform to the actual situation, and the trained model is easier to detect the first-class fake certificates and / or the second-class fake certificates under high definition (for example, fake certificate photos taken based on real certificates on a high-definition screen). Correspondingly, if the definition of the sample is lower, it means that the forged features obtained from the sample are more blurred, the determined degree of realism is more likely to deviate from the actual situation, and the trained model is easier to detect the first-class fake certificates and / or the second-class fake certificates under low definition (for example, fake certificate photos taken based on real certificates on a low-definition screen). The set of samples to be trained in this embodiment can divide the same type of samples according to different definitions, so the trained model can effectively identify the first type of false certificates and / or the second type of false certificates at any definition. In addition, the above-mentioned first type of definition and the above-mentioned second type of definition can be regarded as the image resolution of the corresponding samples, for example: the first type of definition can include, for example, 360P (360 Progressive, i.e., 360×640 pixels) and 720P (720 Progressive, i.e., 1280×720 pixels); the second type of definition can include, for example, 1024P (1024 Progressive, i.e., 1024×768 pixels), 2K (i.e., 2048x1080 pixels) and 4K (i.e., 3840x2160 pixels). Of course, the first type of clarity and the second type of clarity are independent of each other and there is no necessary correlation. Therefore, the first type of clarity may include, for example, 2K, 4K and other clarity, and the second type of clarity may include, for example, 360P, 720P and other clarity. The two may also include clarity that is shared by each other, or even completely identical clarity, and this specification does not impose any restrictions on this.
[0038] The sample features contained in the above-mentioned first category of samples and the above-mentioned second category of samples can be implemented in a multimodal manner in this specification.
[0039] In one embodiment, the first type of sample and the second type of sample may respectively include multimodal features extracted from the corresponding sample certificates, and the multimodal features may be obtained by fusing multiple basic features extracted from the corresponding sample certificates, wherein the basic features may include any of the following: red green blue (RGB) spatial domain color information, fast Fourier transform (FFT) frequency domain information, high pass filter information, edge detection operator information and constrained convolution information. The content of the basic features and the fusion method of the multimodal features are not limited in this specification. In this embodiment, the multimodal features that fuse multiple basic features can enable the original fake certificate recognition model to understand the first type of fake certificates and the second type of fake certificates from different perspectives, thereby improving the detection capability for the two types of fake certificates, and helping the detection capability of the model to be better generalized to new and unseen fake certificates. At the same time, when the basic features corresponding to some modalities may be noisy or incomplete, the basic features of other modalities can provide supplementary sample information, thereby improving the robustness of the above model.
[0040] Below Figure 3 Taking sample image 2 as an example, the extraction and prediction process of the above multimodal features is introduced as follows: Figure 3As shown, in the training process for the original fake certificate recognition model, it is assumed that the original fake certificate recognition model includes a CNN sub-model and a multilayer perceptron (MLP) sub-model, wherein the CNN sub-model is used to extract the features of each sample image in the sample set to be trained, and the MLP sub-model is used to classify the extracted features to detect whether the corresponding sample image is a fake certificate. The above sample image 2 is respectively extracted with the following basic features by the CNN sub-model: spatial domain features 1 determined based on the original RGB image, frequency domain features determined based on FFT frequency domain transformation, 2, high frequency features determined based on spatial rich mode (SRM) high pass filtering, 3, contour features 4 determined based on Sobel contour operator, and constrained features 5 determined based on Bayar constrained convolution, and then the extracted multiple features are fused into a multimodal feature by means of, for example, splicing, weighting or transformation, and the multimodal feature can be used as the input of the MLP sub-model, and the corresponding sample image is detected to be a fake certificate by the classification ability of the MLP sub-model. Among them, the extraction operation of each basic feature can be processed by different neural network branches in the CNN sub-model, so as to realize multi-branch collaborative work to improve the overall performance of the model. In addition, the above-mentioned high-frequency feature 3 can also be obtained according to actual needs by using methods such as trapezoidal high-pass filtering, exponential high-pass filtering, etc. Correspondingly, the contour feature 4 and the constraint feature 5 can also be obtained by contour operators and convolution techniques other than the Sobel contour operator and the Bayar constrained convolution, which is not limited in this specification.
[0041] The number of the first category samples is greater than the second category samples, and the minimum difference between the two can be kept greater than the predefined target threshold, avoiding the situation where the first category samples exceed the second category samples but the difference in number is very small, thereby ensuring that the overall distribution of the sample set to be trained is not that the first category samples occupy the majority and the second category samples occupy a small part, so that the target false certificate recognition model can greatly enhance the detection ability of the second category samples while maintaining the detection ability of the first category samples. Of course, in response to the increase in the number of iterations of the original false certificate recognition model, the target threshold can show a periodic or non-periodic downward trend, and the decline rate each time can remain unchanged or dynamically adjusted with the number of iterations, so that the proportion of the second category samples in the sample set to be trained is gradually increased. Considering that the original false certificate recognition model after preliminary training has a strong generalization ability for the first category of false certificates, even if the number of training samples of the second category is appropriately increased in the subsequent iterative training process without affecting the dominant position of the second category samples, it will not lead to a decrease in the detection ability for the first category of false certificates, but can improve the detection ability for the second category of false certificates.
[0042] Step S206, iteratively training the original fake certificate recognition model according to the set of samples to be trained to generate a target fake certificate recognition model.
[0043] After obtaining the above-mentioned set of samples to be trained, the above-mentioned original false certificate recognition model can be iteratively trained according to the set of samples to be trained, and a target false certificate recognition model for detecting the above-mentioned first type of false certificates and second type of false certificates can be generated.
[0044] The above-mentioned set of samples to be trained can adjust the samples participating in the iterative training as the number of iterations of the above-mentioned original false certificate recognition model changes.
[0045] In one embodiment, a candidate sample set containing second category candidate samples corresponding to second category false certificates can be obtained, and in each iterative training of the sample set to be trained, a preset number of second category candidate samples are selected from the above candidate sample set according to preset sample screening conditions as the second category samples in the above sample set to be trained. In other words, the second category samples of the sample set to be trained participating in each round of iterative training may be different. At the same time, considering that the production cost of the first category of false certificates is much lower than that of the second category of false certificates, the probability of the latter appearing in actual scenarios is relatively low, and there are fewer second category samples available for training. This makes it possible to effectively avoid the problem of overfitting of the above target false certificate recognition model to the second category of false certificates by reselecting the second category samples in each iteration.
[0046] It should be noted that the first category of samples in the above-mentioned set of samples to be trained can also be selected based on a method similar to the above-mentioned second category of false certificates, that is, a preset number of first category candidate samples are selected from the corresponding candidate sample set as the first category of samples in the above-mentioned set of samples to be trained in each iterative training. Alternatively, the first category of samples in the sample set to be trained can be repeatedly involved in the model training. The reason is that the probability of the first category of false certificates appearing in actual scenarios is relatively high, and the number of first category samples available for training is abundant. Repeated training can effectively improve the consistency and stability of the detection results for the first category of false certificates. For the convenience of discussion, the first category of samples in the embodiments of this specification are set by default to repeatedly participate in each iterative training.
[0047] The above sample screening conditions can be defined as follows: when the above original false certificate recognition model is undergoing the nth iteration training, a preset number of second-category candidate samples are selected from the above candidate sample set in descending order of the loss values corresponding to the n-1th iteration training as the second-category samples in the above-mentioned sample set to be trained, wherein n is a positive integer not less than 2. Starting from the second iteration training, the above original false certificate recognition model can count the loss values (Loss) of the second-category samples in the previous iteration training, and select a preset number of second-category samples with the largest loss values as the second-category samples for this iteration training. The following is an introduction to a model iterative training algorithm based on a preset number K based on the following pseudo code:
[0048]
[0049] First, let's introduce each of the above parameters:
[0050] θ: Parameters of the model. The detection efficiency of the corresponding model can be improved by optimizing this parameter.
[0051] epochs: The number of training cycles for the original fake identification model.
[0052] T: The total number of iterations in each training cycle.
[0053] t: current iteration number.
[0054] Bt: The first type of samples included in the set of samples to be trained at the tth iteration.
[0055] Et: The second type of candidate samples included in the set of samples to be trained at the tth iteration.
[0056] A set consisting of each sample in the first category of candidate samples, each sample can be composed of a feature vector and a corresponding sample label.
[0057] A set consisting of each sample in the second category of candidate samples, each sample may be composed of a feature vector and a corresponding sample label.
[0058] l=(f θ (x i ), y i )∈R: The loss function of the model, used to measure the model output f θ (x i ) and the true label y i In this specification, the larger the Loss value, the more difficult it is to accurately detect the corresponding sample.
[0059] The loss values of the second category candidate samples are sorted according to the loss function l to obtain the second category candidate samples sorted by loss value. The above o is used as the sorting order, which can be set to descending order by default.
[0060] Secondly, the above pseudo code introduces the process of the original fake certificate recognition model performing a total of T iterative training according to the set of samples to be trained in one cycle. Specifically, in the case of the first iteration, D2′ can be set to K random or preset samples in D2, so as to avoid the special situation that the loss value corresponding to the previous iterative training does not exist; in the case of non-first iteration, each sample in D2 can be tested by the model trained in the previous iteration, and the loss value of the current sample can be determined by the above loss function, and each second-class candidate sample can be arranged in descending order of loss value to obtain Assuming the preset number is K, then we can get The K second-category candidate samples with the largest loss values are selected in turn as the second-category samples D2 participating in this iterative training. Then, the total loss values corresponding to all first-category false certificates and the total loss values corresponding to all second-category samples in D2 can be calculated, and then the above-mentioned original false certificate recognition model is updated based on two or more total loss values. Among them, since the number of D1 and D2 is predictable, it is possible to determine an appropriate K value based on the ratio of the two numbers, and then control the number of first-category samples and second-category samples in each iterative training, so as to avoid problems such as underfitting or overfitting in the detection of the first-category false certificates or the second-category false certificates by the above-mentioned target false certificate recognition model.
[0061] It can be understood by those skilled in the art that the fine-tuning model f generated by initialization ft (·;θ) can be regarded as the original fake certificate recognition model f pre (·; θ) is a corresponding model temporarily generated during the iterative training process. The model parameter θ of the former can also be inherited from the above-mentioned original false certificate recognition model. As the number of iterations changes, the parameter θ in the above-mentioned fine-tuning model is continuously updated. When the iterative training is officially completed, the above-mentioned fine-tuning model can be independent of the original false certificate recognition model and used as the above-mentioned target false certificate recognition model to perform the recognition tasks for the first category of false certificates and the second category of false certificates.
[0062] The execution process of the above pseudocode can be regarded as a complete iterative training cycle (referred to as one round of training) of the above original fake certificate recognition model for the above sample set to be trained, which is applicable to the case where the above sample set to be trained is divided into two types of samples, the first type of samples and the second type of samples, according to the degree of realism. In addition, the scheme of this specification can gradually train more samples with different degrees of realism by adding multiple rounds of training.
[0063] In one embodiment, after generating a target false certificate recognition model, if the first category samples and the second category samples can be further subdivided into more samples according to the degree of realism, then a newly added sample set can be obtained, which may include the first category newly added samples corresponding to the above-mentioned first category false certificates and the second category newly added samples corresponding to the above-mentioned second category false certificates, each sample is not added with a sample label for distinguishing the above-mentioned first category false certificates from the above-mentioned second category false certificates, and the above-mentioned first category newly added samples and the above-mentioned second category newly added samples are respectively divided into multiple levels from low to high according to the degree of realism; through a curriculum learning (Dynamic Curriculum Learning) algorithm, the above-mentioned target false certificate recognition model is gradually updated through multiple stages, wherein each stage selects at least a part of the first category newly added samples and at least a part of the second category newly added samples in the above-mentioned newly added sample set, and the level of the samples selected in the previous stage is not higher than the level of the samples selected in the next stage. In this embodiment, the samples in the newly added sample set are not added with corresponding sample labels, so it is impossible to distinguish the first type of false certificates from the above-mentioned second type of false certificates, and further, it is impossible to directly determine the appropriate preset number K by means of the above-mentioned pseudocode. Therefore, the scheme of this specification can introduce a dynamic adaptive curriculum learning algorithm (Hardness-Aware Dynamic Curriculum Learning, HardDCL) that supports unsupervised learning and sample difficulty perception to update and optimize the above-mentioned target false certificate recognition model, thereby detecting false certificates with correspondingly higher degrees of realism.
[0064] like Figure 4 As shown, this specification will use the model iteration training algorithm of curriculum learning to optimize the target false certificate recognition model finally output by the algorithm in the model iteration training algorithm based on the preset number K. For the convenience of distinction and description, in this embodiment, the fine-tuning model or the target false certificate recognition model output by the first round of algorithm is referred to as f ft (·; θ1), the fine-tuning model or target false identification model output by the second round of algorithm is referred to as f ft (·; θ2)..., and so on. As shown in the following pseudo code:
[0065]
[0066] First, let's introduce each of the above parameters:
[0067] a, b: Hyperparameters used to dynamically determine the difficulty threshold of samples.
[0068] D: The set of new samples consisting of the first category of new samples and the second category of new samples.
[0069] According to the loss function l, the loss values of all samples in the newly added sample set are sorted to obtain the second type of newly added samples sorted by loss value. The above o is used as the sorting order, which can be set to descending order by default.
[0070] Secondly, the above pseudo code introduces how the target fake certificate recognition model uses the curriculum learning algorithm to iteratively train the original fake certificate recognition model in an unsupervised learning scenario. Specifically, a sample difficulty threshold thres that decreases with the number of iterations t can be defined, and the estimated ratio of the first category of new samples to the second category of new samples in the new sample set is obtained. The estimated number of second category new samples K in the new sample set has been determined. In the first iteration, D′ can be set to K random or preset samples in D, thereby avoiding the special case where the loss value corresponding to the previous iterative training does not exist; in the case of non-first iteration, each sample in D can be tested through the model trained in the previous iteration, and the loss value of the current sample can be determined by the above loss function, and each second category of new samples is arranged in descending order of loss value to obtain Assuming the preset number is K, then we can get In the above, the K samples with the largest loss values are selected in turn as the second type of newly added samples to calculate the corresponding total loss value, and all samples in D are taken as the overall samples mixed with the first type of newly added samples and the second type of newly added samples to calculate the corresponding total loss value. If the total loss value of the second type of newly added samples is greater than the product of the total loss value of the overall samples and the above sample difficulty threshold, then the above original false certificate recognition model is updated based on the total loss value of the second type of newly added samples, otherwise the above original false certificate recognition model is updated based on the total loss value of the overall samples. It can be understood that since the above sample difficulty threshold decreases with the increase of the number of iterations t, the total loss value of the second type of newly added samples is often less than the result of the above product in the case of a low number of iterations, so that the target false certificate recognition model tends to be trained according to all samples in the newly added sample set in the early stage of iterative training, and tends to be trained according to the second type of newly added samples in the later stage of iterative training, so that the samples in the newly added sample set are trained for the target false certificate recognition model according to the corresponding order of realism from low to high. This data training method can not only maintain the detection ability for the first type of false certificates, but also enhance the detection ability for the second type of false certificates.
[0071] Among them, the above-mentioned estimated ratio does not need to give an accurate value compared to the model iterative training algorithm based on the preset number K, but only provides an estimated value that fits the historical data according to the actual scenario. In addition, in special cases such as when the value of K is too large, the above-mentioned D′ may contain new samples of the first category with a large loss, which can be treated as a de facto new sample of the second category for processing in this specification.
[0072] When the above-mentioned first category of newly added samples and the above-mentioned second category of newly added samples are divided into multiple levels from low to high according to the degree of realism, the third or even more rounds of model iteration training algorithm can be performed on the samples with higher realism according to the above-mentioned curriculum learning algorithm. Among them, the execution discussion of the above-mentioned model iteration training algorithm based on curriculum learning depends on the division of the degree of realism. For example, when the above-mentioned first category of newly added samples and the above-mentioned second category of newly added samples are divided into three levels a, b, and c, and the high-level samples can be included in the samples of the lower level, that is, the first category of newly added samples and the second category of newly added samples of level c can be included in the corresponding samples of level b and level a, and the first category of newly added samples and the second category of newly added samples of level b can be included in the corresponding samples of level a. Then in Figure 4 In the second round, the curriculum learning algorithm can be implemented for the lowest level a and b samples, and in the third round, the curriculum learning algorithm is implemented for the b and c level samples. The following pseudo code introduces the implementation of the third round of curriculum learning algorithm:
[0073]
[0074]
[0075] Similar to the second round of model iterative training algorithm based on curriculum learning, the third round of model iterative training algorithm based on curriculum learning has no substantial changes in the implementation idea. The only difference is that based on D′ determined in the second round, D″ with a higher degree of realism is further divided, and based on the size of the sample loss values of the two, it is determined based on which sample’s total loss value to update the above-mentioned target fake certificate recognition model.
[0076] For the original fake certificate recognition model in iterative training, the accuracy of the model prediction can be measured based on the loss value, a quantitative indicator. Specifically, for a given certificate sample, the model can calculate the difference between the predicted value of the prediction output and the true value represented by the true label based on the corresponding loss function. If the loss value is larger, it means that the original fake certificate recognition model after training is still weak in detecting the fake certificate type corresponding to the above certificate sample. The certificate sample can be further used to re-participate in training to update the above original fake certificate recognition model. In addition, this manual can also obtain other loss values by other means, and apply them in combination with the above loss values.
[0077] In one embodiment, during at least one round of iterative training, for at least one sample in the set of samples to be trained, the original fake certificate identification model can respectively calculate a first loss value and a second loss value corresponding to each sample, and update the original fake certificate identification model according to the first loss value and the second loss value. The first loss value is calculated by the predicted value output by the original fake certificate identification model for the corresponding sample, for example Figure 5 In , for sample image 2 in the sample set to be trained, after the predicted value is obtained through CNN sub-model, multimodal feature fusion, and MLP sub-model processing, the first loss value can be calculated in combination with the true value represented by the label of sample image 2 and the above loss function; the above second loss value can be calculated by the fine-grained feature map corresponding to the corresponding sample and the reconstructed map generated based on the feature encoding of the corresponding sample, for example Figure 5 In the example, based on the Generative Adversarial Network (GANs), pixel-level fine-grained feature maps such as screen moiré and reflective maps can be extracted from the sample image 2, and the fine-grained feature maps are used as the constraint target for the reconstruction task of the sample image 2, wherein the reconstruction task for the sample image 2 refers to generating a reconstruction map of the sample image 2 by using the corresponding feature decoder according to the sample features extracted by the CNN sub-model. The second loss value between the fine-grained feature map and the reconstruction map is calculated by loss functions such as mean squared error (MSE) and cross-entropy loss. At this point, the original fake certificate recognition model updated by the first loss value and the second loss value can have a stronger discrimination ability for extreme samples, and will not consume too much computing power in the prediction stage.
[0078] Figure 7 is a schematic structural diagram of a device provided by an exemplary embodiment. Figure 6 At the hardware level, the device includes a processor 602, an internal bus 604, a network interface 606, a memory 608, and a non-volatile memory 610, and may also include hardware required for other functions. One or more embodiments of this specification may be implemented based on software, such as the processor 602 reading the corresponding computer program from the non-volatile memory 610 into the memory 608 and then running it. Of course, in addition to the software implementation, one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0079] Please refer to Figure 7 , the fake certificate detection device can be applied to Figure 7 The device shown in the figure is used to implement the technical solution of this specification. The fake certificate detection device may include:
[0080] The original fake certificate recognition model acquisition unit 702 is used to acquire the original fake certificate recognition model, and the original fake certificate recognition model is used to detect the first type of fake certificates;
[0081] The to-be-trained sample set acquisition unit 704 is used to acquire a to-be-trained sample set, wherein the to-be-trained sample set includes first-category samples corresponding to the first-category false certificates and second-category samples corresponding to the second-category false certificates, wherein the second-category false certificates are more realistic than the first-category false certificates, and the number of the second-category samples is less than the number of the first-category samples;
[0082] The model training unit 706 iteratively trains the original fake certificate recognition model according to the sample set to be trained to generate a target fake certificate recognition model.
[0083] Optionally, the above device further includes:
[0084] A second category candidate sample selection unit, used to obtain a candidate sample set, wherein the candidate sample set includes the second category candidate samples corresponding to the second category false certificates;
[0085] In each iteration training of the above-mentioned sample set to be trained, a preset number of second-category candidate samples are selected from the above-mentioned candidate sample set according to a preset sample screening condition as the second-category samples in the above-mentioned sample set to be trained.
[0086] Optionally, the second type of candidate sample selection unit is specifically used for:
[0087] When the above-mentioned original false certificate recognition model is trained for the nth iteration, a preset number of second-category candidate samples are selected from the above-mentioned candidate sample set in descending order of the loss values corresponding to the n-1th iteration training as the second-category samples in the above-mentioned sample set to be trained, and n is a positive integer not less than 2.
[0088] Optionally, in the case that the first-category false certificate has multiple first-category clearnesses, the set of samples to be trained includes first-category samples corresponding to each first-category clearness; and / or,
[0089] In the case that the second-category false certificate has multiple second-category clarity, the to-be-trained sample set includes second-category samples corresponding to each second-category clarity.
[0090] Optionally, the above device further includes:
[0091] The target threshold value definition unit is used to ensure that the minimum difference between the first type of samples and the second type of samples is greater than a predefined target threshold value.
[0092] Optionally, the target threshold definition unit is specifically used to:
[0093] In response to the increase in the number of iterations of the original fake certificate recognition model, the target threshold shows a downward trend.
[0094] Optionally, the above device further includes:
[0095] The curriculum learning algorithm application unit is used to obtain a newly added sample set, wherein the newly added sample set includes a first type of newly added sample corresponding to the first type of fake certificates and a second type of newly added sample corresponding to the second type of fake certificates, each sample is not added with a sample label for distinguishing the first type of fake certificates from the second type of fake certificates, and the first type of newly added sample and the second type of newly added sample are divided into multiple levels from low to high according to the degree of realism;
[0096] Through the curriculum learning algorithm, the above-mentioned target false certificate recognition model is gradually updated through multiple stages; wherein each stage selects at least a part of the first category of new samples and at least a part of the second category of new samples in the above-mentioned new sample set, and the level of the samples selected in the previous stage is not higher than the level of the samples selected in the next stage.
[0097] Optionally, the first category of samples and the second category of samples respectively include multimodal features extracted from corresponding sample documents, and the multimodal features are obtained by fusing multiple basic features of the corresponding sample documents, and the basic features include any one of the following: red, green and blue spatial domain color information, fast Fourier transform frequency domain information, high-pass filter information, edge detection operator information and constrained convolution information.
[0098] Optionally, the above device further includes:
[0099] A reconstruction learning unit is used to, during at least one round of iterative training, respectively calculate a first loss value and a second loss value corresponding to each sample in the above-mentioned set of samples to be trained, and update the above-mentioned original fake certificate recognition model according to the above-mentioned first loss value and the above-mentioned second loss value;
[0100] Among them, the above-mentioned first loss value is calculated by the predicted value output by the above-mentioned original false certificate recognition model for the corresponding sample, and the above-mentioned second loss value is calculated by the fine-grained feature map corresponding to the corresponding sample and the reconstructed map generated based on the feature encoding of the corresponding sample.
[0101] Based on the same concept as the above method, this specification also provides an electronic device, including: a processor; a memory for storing processor executable instructions; wherein the processor implements the steps of the method described in any of the above embodiments by running the executable instructions.
[0102] Based on the same concept as the above method, this specification also provides a computer-readable storage medium on which computer instructions are stored. When the instructions are executed by a processor, the steps of the method described in any of the above embodiments are implemented.
[0103] Based on the same concept as the above method, this specification also provides a computer program product, including a computer program / instruction, which implements the steps of the method described in any of the above embodiments when executed by a processor.
Claims
1. A method for detecting a fake certificate, comprising: Obtaining an original fake certificate recognition model, wherein the original fake certificate recognition model is used to detect a first type of fake certificate; Obtaining a set of samples to be trained, wherein the set of samples to be trained includes first-class samples corresponding to the first-class false certificates and second-class samples corresponding to the second-class false certificates, the second-class false certificates are more realistic than the first-class false certificates, and the number of the second-class samples is less than the number of the first-class samples; The original false certificate recognition model is iteratively trained according to the set of samples to be trained to generate a target false certificate recognition model.
2. According to the method of claim 1, the step of obtaining a set of samples to be trained comprises: Acquire a candidate sample set, wherein the candidate sample set includes the second category candidate samples corresponding to the second category false certificates; In each iteration training of the to-be-trained sample set, a preset number of second-category candidate samples are selected from the candidate sample set according to a preset sample screening condition as the second-category samples in the to-be-trained sample set.
3. The method according to claim 2, wherein selecting a corresponding number of second-category candidate samples from the candidate sample set as second-category samples in the to-be-trained sample set according to a preset sample screening condition comprises: When the original fake certificate recognition model is trained for the nth iteration, a preset number of second-category candidate samples are selected from the candidate sample set in descending order of the loss values corresponding to the n-1th iteration training as the second-category samples in the sample set to be trained, where n is a positive integer not less than 2.
4. The method according to claim 1, In the case that the first type of false certificates has a plurality of first type of clarity, the set of samples to be trained includes first type samples corresponding to each first type of clarity; and / or, In the case that the second type of false certificates have multiple second type of clarity, the to-be-trained sample set includes second type samples corresponding to each second type of clarity. 5 . The method according to claim 1 , wherein a minimum difference between the first category of samples and the second category of samples is greater than a predefined target threshold. 6 . The method according to claim 5 , wherein in response to an increase in the number of iterations of the original fake certificate recognition model, the target threshold value shows a downward trend.
7. The method according to claim 1, further comprising: Acquire a newly added sample set, wherein the newly added sample set includes a first type of newly added sample corresponding to the first type of false certificates and a second type of newly added sample corresponding to the second type of false certificates, each sample is not added with a sample label for distinguishing the first type of false certificates from the second type of false certificates, and the first type of newly added sample and the second type of newly added sample are respectively divided into a plurality of levels from low to high according to the degree of realism; The target false certificate recognition model is gradually updated through multiple stages through a curriculum learning algorithm; wherein each stage selects at least a portion of the first category of newly added samples and at least a portion of the second category of newly added samples in the newly added sample set, and the level of the samples selected in the previous stage is not higher than the level of the samples selected in the next stage.
8. According to the method of claim 1, the first category of samples and the second category of samples respectively include multimodal features extracted from corresponding sample documents, and the multimodal features are obtained by fusing multiple basic features of the corresponding sample documents, and the basic features include any of the following: red, green and blue spatial domain color information, fast Fourier transform frequency domain information, high-pass filter information, edge detection operator information and constrained convolution information.
9. The method according to claim 1, wherein the iterative training of the original fake certificate recognition model according to the to-be-trained sample set comprises: During at least one round of iterative training, for at least one sample in the set of samples to be trained: respectively calculating a first loss value and a second loss value corresponding to each sample, and updating the original fake certificate recognition model according to the first loss value and the second loss value; Among them, the first loss value is calculated by the predicted value output by the original false certificate recognition model for the corresponding sample, and the second loss value is calculated by the fine-grained feature map corresponding to the corresponding sample and the reconstructed map generated based on the feature encoding of the corresponding sample.
10. A computer-readable storage medium having a computer program / instruction stored thereon, wherein the program / instruction, when executed by a processor, implements the steps of the method according to any one of claims 1 to 9.
11. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any one of the methods of claims 1 to 9 when executing the program.
12. A computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 9.
