Risk identification model training method, risk identification method and device
By converting the local features of the document image into elemental features, a risk identification model is constructed, which solves the problem of identifying forged documents in online document verification and achieves a more efficient and secure document verification process.
Patent Information
- Application Number
- CN202411390974.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-01-24
AI Technical Summary
It is difficult to accurately and quickly identify forged documents in online verification of certificates in the prior art, and there is a problem of insufficient security.
By obtaining the certificate image, the input certificate pre -training model is used to extract local characteristics, and the elemental characteristics recognize the network to convert local characteristics into more recognizable element characteristics, and build a risk recognition model to identify the authenticity of the certificate.
It achieves more accurate identification of document authenticity, improves the security and efficiency of online document verification, can quickly respond to document forgery attacks, and reduces model maintenance costs.
Smart Images

Figure CN119360187A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to computer technology, and in particular to a risk identification model training method, a risk identification method and a device. Background Art
[0002] In recent years, with the rapid development of the Internet, people can handle various affairs online and verify relevant documents online.
[0003] Document anti-counterfeiting detection is a key detection link in the online document verification process to ensure document security and prevent personal information leakage. In related technologies, document anti-counterfeiting detection mainly relies on a vision-based artificial intelligence model detection solution, that is, inputting the document image into the vision-based artificial intelligence model to obtain the document anti-counterfeiting detection result.
[0004] At present, in order to achieve more secure online certificate verification, it is urgent to provide a solution that can identify forged certificates more accurately and quickly. Summary of the invention
[0005] The embodiment of this specification provides a risk identification model training method, which uses an element feature recognition network to convert local features extracted by a document pre-training model into more recognizable element features, and then uses the element features to more accurately identify the authenticity of the document. The method includes:
[0006] Obtain the target document image;
[0007] Inputting the target document image into the document pre-training model to obtain local features corresponding to different image content types in the target document image;
[0008] Training at least one element feature recognition network using the local features corresponding to the different image content types;
[0009] A risk identification model is obtained based on at least one of the trained element feature recognition networks and the document pre-training model.
[0010] Further, in some embodiments, each of the element feature recognition networks includes a feature extraction layer and a feature classification layer;
[0011] The using the local features corresponding to the different image content types to train at least one element feature recognition network comprises:
[0012] Inputting the local features corresponding to each image content type into the feature extraction layer to obtain the corresponding original element features;
[0013] The original element features are mapped to corresponding category labels using the feature classification layer, and network parameters of the feature extraction layer and the feature classification layer are adjusted based on the category labels.
[0014] Furthermore, in some implementations, the target document image includes a first target document image; and acquiring the target document image includes:
[0015] Acquire a first document image set, the first document image set comprising at least a first candidate document image and a second candidate document image, the document type of the first candidate document image being different from the document type of the second candidate document image;
[0016] Determining a target area in the first candidate document image;
[0017] The second candidate document image is randomly selected, and the image content in the target area is copied to a corresponding position in the second candidate document image to obtain the first target document image.
[0018] Furthermore, in some implementations, inputting the target document image into a document pre-training model to obtain local features corresponding to different image content types in the target document image includes:
[0019] Segmenting the target document image into at least one image block, and inputting each image block into a document pre-training model to obtain image features corresponding to each image block;
[0020] The image features corresponding to the image blocks belonging to the same image content type are spliced to obtain local features corresponding to various image content types in the target document image.
[0021] Further, in some embodiments, the certificate pre-training model includes at least a feature embedding network and a feature encoding network;
[0022] The step of inputting each of the image blocks into the document pre-training model to obtain image features corresponding to each of the image blocks includes:
[0023] Embedding each of the image blocks through the feature embedding network to obtain a plurality of embedded features;
[0024] Each of the embedded features is input into the feature encoding network to obtain the image features corresponding to each of the image blocks.
[0025] Furthermore, in some embodiments, the method further comprises:
[0026] Acquire a second document image set;
[0027] The preset neural network is trained using the second document image set to obtain the document pre-training model.
[0028] Further, in some embodiments, the preset neural network model includes an encoder and a decoder;
[0029] The step of training a preset neural network using the second document image set to obtain the document pre-training model includes:
[0030] Performing random mask processing on each frame of sample image in the second document image set to obtain multiple frames of input images;
[0031] Inputting the unmasked image blocks in each of the input images into the encoder to obtain corresponding sample features;
[0032] The decoder splices and decodes each of the sample features and the corresponding mask image blocks in each of the input images to obtain a reconstructed image;
[0033] A loss value between the sample image and the reconstructed image is calculated in pixel space using a preset loss function, and model parameters of the encoder and model parameters of the decoder are adjusted according to the loss value.
[0034] The embodiment of this specification also proposes a risk identification method, which includes:
[0035] Obtain the image of the document to be detected;
[0036] Inputting the document image to be detected into the trained risk identification model to obtain the target element features in the document image to be detected;
[0037] Determining the document forgery risk of the document image to be detected according to the similarity between each reference element feature in a preset risk element feature library and the target element feature;
[0038] Wherein, the risk identification model is trained by any one of the risk identification model training methods.
[0039] Further, in some embodiments, the risk element feature library includes a first risk element feature library, and the reference element feature includes a first reference element feature;
[0040] The step of determining the risk of forgery of the document image to be detected according to the similarity between each reference element feature in a preset risk element feature library and the target element feature includes:
[0041] If the similarity between any first reference element feature in the first risk element feature library and the target element feature is less than a preset first similarity threshold, it is determined that the document image to be detected has a risk of document forgery.
[0042] Further, in some embodiments, the risk element feature library includes a second risk element feature library, and the reference element feature includes a second reference element feature;
[0043] The step of determining the risk of forgery of the document image to be detected according to the similarity between each reference element feature in a preset risk element feature library and the target element feature includes:
[0044] If the similarity between any second reference element feature in the second risk element feature library and the target element feature is greater than a preset second similarity threshold, it is determined that the document image to be detected has a risk of document forgery.
[0045] Furthermore, in some embodiments, the method further comprises:
[0046] Acquire a third document image set, wherein the third document image set includes authentic document images and / or forged document images corresponding to the authentic document images;
[0047] Inputting the real ID image and the forged ID image into the trained risk identification model respectively to obtain a first reference element feature in the real ID image and a second reference element feature in the forged ID image;
[0048] The risk element feature library is constructed based on the first reference element feature and / or the second reference element feature.
[0049] The embodiment of this specification also proposes a risk identification model training device, the device comprising:
[0050] A sample image acquisition module is used to acquire a target document image;
[0051] A local feature extraction module, used to input the target document image into the document pre-training model to obtain local features corresponding to different image content types in the target document image;
[0052] A target network training module, used for training at least one element feature recognition network using the local features corresponding to the different image content types;
[0053] The target model generation module is used to obtain a risk identification model based on at least one of the trained element feature recognition networks and the document pre-training model.
[0054] The embodiment of this specification also provides a risk identification device, the device comprising:
[0055] The certificate image acquisition module is used to acquire the certificate image to be detected;
[0056] An element feature extraction module is used to input the document image to be detected into the trained risk identification model to obtain the target element features in the document image to be detected;
[0057] An element feature comparison module, used to determine the document forgery risk of the document image to be detected according to the similarity between each reference element feature in a preset risk element feature library and the target element feature;
[0058] Wherein, the risk identification model is trained by any one of the risk identification model training methods.
[0059] The embodiments of the present specification also provide a storage medium, wherein the storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and executing the steps of the above method.
[0060] An embodiment of the present specification also provides an electronic device, comprising: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the steps of the above method.
[0061] The embodiments of the present specification also provide a computer program product, wherein the computer program product stores at least one instruction, and the at least one instruction is suitable for being loaded by a processor and executing the above method steps.
[0062] In the embodiment of the present specification, the target document image is first obtained, and the target document image is input into the document pre-training model to obtain local features corresponding to different image content types in the target document image. Then, at least one element feature recognition network is trained using the local features corresponding to different image content types, and a risk recognition model is obtained based on the trained at least one element feature recognition network and the document pre-training model. Finally, the trained risk recognition model and the preset risk element feature library are used to realize the recognition and detection of various forged documents. By adopting the method proposed in the embodiments of this specification, on the one hand, the element feature recognition network is used to convert the local features extracted by the document pre-training model into more recognizable element features, and then the element features are used to more accurately identify the authenticity of the document; on the other hand, the risk identification model and the risk element feature library can quickly realize the identification and detection of various forged documents. On the basis of ensuring the accuracy of risk identification, the efficiency of risk identification is also improved, thereby achieving a rapid response to document forgery attacks; on the other hand, when faced with the situation where the risk of document attacks is constantly changing, it is only necessary to update the risk element feature library without retraining the model, which has lower maintenance costs and high update and iteration efficiency, further improving the efficiency of risk identification and helping to achieve real-time interception of document forgery attacks. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 A schematic diagram of a system architecture for applying the embodiments of this specification;
[0064] Figure 2 A flowchart of a risk identification model training method provided in an embodiment of this specification;
[0065] Figure 3 A flowchart of another risk identification model training method provided in an embodiment of this specification;
[0066] Figure 4 A flowchart of another risk identification model training method provided in an embodiment of this specification;
[0067] Figure 5 A schematic diagram of a process for obtaining image features provided in an embodiment of this specification;
[0068] Figure 6 A schematic diagram of the principle of obtaining image features provided in an embodiment of this specification;
[0069] Figure 7 A schematic diagram of the principle of obtaining local features provided in the embodiments of this specification;
[0070] Figure 8 A schematic diagram of a process of training a certificate pre-training model provided in an embodiment of this specification;
[0071] Fig. 9 A schematic diagram of a risk identification method provided in an embodiment of this specification;
[0072] Fig.10 A schematic diagram of the principle of obtaining element characteristics provided in the embodiments of this specification;
[0073] Fig.11 A schematic diagram of the structure of a risk identification model training device provided in an embodiment of this specification;
[0074] Fig.12 A schematic diagram of the structure of a risk identification device provided in an embodiment of this specification;
[0075] Fig.13 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0076] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.
[0077] Figure 1 A schematic diagram of an architecture to which the embodiments of this specification can be applied is shown.
[0078] like Figure 1 As shown, the system architecture 100 may include one or more of terminal devices such as a smart phone 101, a portable computer 102, a desktop computer 103, a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the terminal device and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc. The terminal device may be various electronic devices with artificial intelligence computing capabilities. The electronic device may have a display screen, which is used to input the target document image, the document image to be detected, the risk identification result of the document image to be detected, etc.
[0079] It is understandable that the terminal device can also be any electronic device with an image acquisition function. For example, the target document image used in the risk identification model training process can be acquired in real time by an electronic device. Of course, the target document image can also be pre-acquired by other image acquisition devices and stored in the terminal device or server 105, and then called when training the model. This specification does not limit this. After the risk identification is completed, the risk identification results can be directly displayed to the detection personnel through the display screen on the terminal device.
[0080] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. According to the implementation requirements, there may be any number of terminal devices, networks and servers. For example, the server 105 may be a server cluster composed of multiple servers.
[0081] See also Figure 2 , which is a flowchart of a risk identification model training method provided in the embodiment of this specification. In the embodiment of this specification, the risk identification model training method is applied to a risk identification model training device or an electronic device equipped with a risk identification model training device. Figure 2 The process shown is described in detail, and the risk identification model training method can specifically include the following steps:
[0082] S202, obtaining a target document image;
[0083] In one or more embodiments of this specification, the target document image refers to an image used for risk identification model training. For example, it can be a document image containing personal information, such as a personal ID card image, a passport image, a driver's license image, etc. The embodiments of this specification do not limit the type of target document image, and any document image that has risk identification requirements and is suitable for risk identification model training can be used.
[0084] The target document image can be obtained from a database storing document images, or the target document image corresponding to the target document can be acquired in real time by an image acquisition unit. Of course, the target document image can also be acquired from another terminal device equipped with an image acquisition unit through wireless communication technology. This embodiment does not impose any special limitation on the method of acquiring the target document image.
[0085] S204, inputting the target document image into a document pre-training model to obtain local features corresponding to different image content types in the target document image;
[0086] In one or more embodiments of this specification, the document pre-training model refers to an artificial intelligence model used to extract local features in the target document image. For example, the document pre-training model can be a model obtained by pre-training using a large amount of document data based on a self-supervised model framework based on VIT (Vision Transformer). This specification does not specifically limit the model type of the document pre-training model.
[0087] Local features refer to image features containing the document's area of interest extracted from the target document image using the document pre-training model. For example, taking the target document image as a personal ID card image, the local features can be image features corresponding to the document number area in the target document image, or can be image features corresponding to the portrait area in the target document image. This specification does not specifically limit the specific content type of local features.
[0088] Exemplarily, the target document image can be segmented into at least one image block, and the image content type corresponding to each image block is determined. The segmented at least one image block is input into the document pre-training model to obtain the image features corresponding to each image block, and then the image features corresponding to the image blocks belonging to the same image content type are spliced to obtain the local features corresponding to each image content type in the target document image.
[0089] Still taking the target document image as a personal ID card image as an example, the image content type may include name content type, portrait content type, document number content type, etc., and the corresponding local features are name image features, portrait image features, document number image features, etc.
[0090] S206, training at least one element feature recognition network using the local features corresponding to the different image content types;
[0091] The element feature recognition network refers to an artificial intelligence model used to extract element features from local features of the target document image. For example, the element feature recognition network can be a multi-layer perceptron network, a convolutional neural network, a residual network, etc. This specification does not limit the network type of the element feature recognition network.
[0092] Element features can be more recognizable features such as color, background, font, handwriting, frame, foreign matter, relative position, etc. in the target document image. For example, for the text line area in the target document image, element features such as text line background, text line font, text line color, and text line anomaly are included. Text line anomaly includes whether the text line has handwriting, whether the text line has straight line frame marks, and whether the text line has foreign matter.
[0093] In one or more embodiments of the present specification, different feature extraction training tasks can be designed for different element features, so that the trained element feature recognition network extracts specific element features. For example, for text line background features, after obtaining local features corresponding to different image content types, the local features corresponding to different image content types can be input into the element feature recognition network to train the element feature recognition network to recognize different document background categories. For another example, for text line fonts, the local features corresponding to different image content types are also input into the element feature recognition network to train the element feature recognition network to recognize different font types.
[0094] It is understandable that the element feature recognition network used to extract different element features can be multiple network models or multi-layer networks in the same network model, and this specification does not limit this.
[0095] S208, obtaining a risk identification model based on at least one of the trained element feature recognition networks and the document pre-training model.
[0096] It should be noted that the document pre-training model has been trained before the target document image is input into the document pre-training model. Therefore, in the subsequent process of training different element feature recognition networks for different element features, the document pre-training model serves as a shared feature extractor, and the model parameters of the model remain frozen and do not participate in the training.
[0097] In one or more embodiments of the present specification, a risk identification model can be obtained by integrating an element feature recognition network for identifying different element features and a document pre-training network model. For example, the target document image is input into the document pre-training model, local features in the target document image are extracted, and the local features are further passed to each element feature recognition network, each element feature recognition network can recognize the corresponding element feature, and finally determine whether the target document has risks, such as the risk of forgery, tampering, etc., based on the recognized element features.
[0098] After training, the element feature recognition network can accurately identify and classify the element features it is responsible for. Therefore, the trained element feature recognition network can be used to convert the local features extracted by the document pre-training model into more recognizable element features, so that the element features can be used to more accurately identify the authenticity of the document.
[0099] In step S202 shown in the embodiment of this specification, the target document image includes a first target document image, which may refer to a document image that is subject to risk attack, such as a document image that has been tampered with. For example, a first document image set may be obtained first, and the first document image set includes a plurality of document images of different document types. By randomly pasting the document images of different document types in the first document image set, the element feature category to which the pasted area belongs is changed, and the document image after pasting is the first target document image.
[0100] It is understandable that the element features in the document images of different document types are different, such as the text line background of different documents is different. If a certain area in the document image is tampered with by other text strips, the text line background category of this area is different from the text line background category of other areas in the document image.
[0101] For example, the first ID image set includes at least a first candidate ID image and a second candidate ID image, the ID type of the first candidate ID image is different from the ID type of the second candidate ID image, and this specification does not limit the number of the first candidate ID images and the second candidate ID images.
[0102] Determine the target area in the first candidate ID image, the target area is the area where the first candidate ID image and other candidate ID images are pasted together. Randomly select the second candidate ID image, and copy the image content in the target area to the corresponding position in the second candidate ID image to obtain the first target ID image.
[0103] By pasting ID images of different ID types together, the diversity of training data used to train the element feature recognition network can be increased, so that the model can learn more comprehensive feature expressions and improve the generalization ability of the model. Moreover, because the pasting operation is based on known background categories, the generated new samples can directly inherit the background category labels of the original samples without the need for additional manual labeling, which reduces time costs.
[0104] See also Figure 3 , which is a flow chart of another risk identification model training method provided in the embodiment of this specification. Among them, each element feature recognition network includes a feature extraction layer and a feature classification layer; Figure 3 As shown, the method comprises the following steps:
[0105] S302, obtaining a target document image;
[0106] For step S302, please refer to the detailed description of step S202 in the first embodiment of this specification, which will not be repeated here.
[0107] S304, inputting the target document image into a document pre-training model to obtain local features corresponding to different image content types in the target document image;
[0108] For step S304, please refer to the detailed description of step S204 in the first embodiment of this specification, which will not be repeated here.
[0109] S306, inputting the local features corresponding to each image content type into the feature extraction layer to obtain the corresponding original element features;
[0110] Optionally, the feature extraction layer contains at least one fully connected layer, and each fully connected layer is followed by an activation function to introduce nonlinear characteristics. The local features corresponding to each image content type are transformed through the fully connected layer to obtain the corresponding original element features. By extracting deeper feature representations, it can help remove redundant information and enhance features related to specific tasks.
[0111] S308, mapping the original element features to corresponding category labels using the feature classification layer, and adjusting network parameters of the feature extraction layer and network parameters of the feature classification layer based on the category labels;
[0112] The output of the feature extraction layer can be mapped to the category label through the feature classification layer. For example, the softmax function can be used for multi-classification tasks and the probability of each category can be output, that is, the predicted category label can be output. Then, the output is calculated through forward propagation, and the predicted category label is compared with the true category label to calculate the corresponding loss value. The gradient of the loss value relative to the network parameters is calculated using the back propagation algorithm, and the network parameters are adjusted through an optimization algorithm (such as gradient descent) to minimize the loss function. After multiple iterations of optimization, until the model parameters converge, an element feature recognition network with better performance is obtained.
[0113] S310, obtaining a risk identification model based on at least one of the trained element feature recognition networks and the document pre-training model.
[0114] For step S310, please refer to the detailed description of step S208 in the first embodiment of this specification, which will not be repeated here.
[0115] In the embodiments of this specification, the element feature recognition network, as a supplement to the certificate pre-training model, can help further extract and optimize the element features required for specific tasks. This combination makes full use of the global feature extraction capability of the certificate pre-training model and the nonlinear feature conversion capability of the element feature recognition network, and can achieve better performance in the certificate attack risk identification task.
[0116] See also Figure 4, is a flow chart of another risk identification model training method provided in the embodiments of this specification. Figure 4 As shown, the method comprises the following steps:
[0117] S402, obtaining a target document image;
[0118] For step S402, please refer to the detailed description of step S202 in the first embodiment of this specification, which will not be repeated here.
[0119] S404, dividing the target document image into at least one image block, and inputting each image block into a document pre-training model to obtain image features corresponding to each image block;
[0120] The image block refers to a small-sized image obtained by segmenting a large-sized target document image, so that each small image block can be processed, analyzed or feature extracted separately.
[0121] Optionally, the target document image may be segmented into at least one image block according to the principle of equally segmenting the window image blocks. For example, if the size of the target document image is 224*224 and the preset size of each image block is 16*16, the target document image may be segmented into 196 non-overlapping image blocks.
[0122] By segmenting the target document image into multiple image blocks, local details of the image can be processed more finely, improving the accuracy of feature detection. Moreover, compared with processing the entire image, processing smaller image blocks can reduce the computing resource requirements and speed up the feature extraction process.
[0123] Furthermore, each image block obtained by segmentation can be input into the document pre-training model to obtain the image features corresponding to each image block. In one embodiment of the present specification, the document pre-training model can include at least a feature embedding network and a feature encoding network. Figure 5 The steps in the above example are used to input each image block into the ID pre-training model to obtain the image features corresponding to each image block. Figure 5 As shown, it may specifically include:
[0124] Step S502, embedding each of the image blocks through the feature embedding network to obtain a plurality of embedded features;
[0125] Among them, the feature embedding network is used to embed the image block to obtain the embedded feature. For example, the feature embedding network may include at least one convolution layer, and the image block is embedded through the convolution kernel in the convolution layer to obtain the embedded feature. For another example, in the feature embedding network, each image block can be converted into a corresponding image block vector, and each image block vector is input into a linear projection layer to output the embedded feature corresponding to each image block. Of course, the feature embedding network can also be other types of networks that can realize the embedding representation of image blocks, and the embodiments of this specification do not specifically limit the structure of the feature embedding network.
[0126] Step S504: input each of the embedded features into the feature encoding network to obtain image features corresponding to each of the image blocks.
[0127] In order to preserve the position information, each embedded feature is added with a position encoding. The position encoding is a fixed vector that is used to distinguish the relative positions of different image patches in the original image. It is understandable that the position encoding is usually learned so that the model can optimize the expression of position information according to the specific task.
[0128] Optionally, each embedded feature and the corresponding position code are input into a feature extraction network consisting of a multi-layer Transformer encoder. Each layer of Transformer encoder contains two submodules: a multi-head self-attention mechanism and a feedforward neural network. In the multi-head self-attention mechanism, the embedded features of each image block interact with the features of all other image blocks. By calculating the attention weights, the model can pay attention to other image blocks related to the current image block, thereby capturing global context information.
[0129] Of course, the feature extraction network may also be other types of networks that can realize the extraction of image features contained in the image block. This example embodiment does not specifically limit the structure of the feature extraction network.
[0130] refer to Figure 6 As shown in Figure 1, a schematic diagram of the model structure of a certificate pre-training model is given. Figure 6 In the example, the document pre-training model 600 may include at least a feature embedding network 6001 and a feature encoding network 6002. First, the input image 601 is segmented into at least one image block 602, and the image block 602 is input into the document pre-training model 600, so that the image block 602 is embedded and represented by the feature embedding network 6001 to obtain an embedded feature 603, and the embedded feature 603 also includes a position embedding. Then, the embedded feature 603 can be input into the feature encoding network 6002, and the image feature 604 corresponding to each image block 602 is output. Of course, Figure 6The network structure of the certificate pre-training model 600 is only a schematic example, and this embodiment is not limited to this.
[0131] The feature embedding network and feature encoding network can capture features in image blocks at different scales and levels, which helps capture key information in the document image. Moreover, the embedding and encoding process can enhance the robustness of feature representation, making the model more resistant to factors such as lighting, angle, and occlusion.
[0132] S406, splicing image features corresponding to image blocks belonging to the same image content type to obtain local features corresponding to various image content types in the target document image;
[0133] Take the target document image as a personal ID card image as an example, refer to Figure 7 As shown, the target ID image 701 is divided into 12 image blocks, wherein the image content types corresponding to the first image block and the second image block are name images, the image content types corresponding to the ninth image block, the tenth image block, the eleventh image block and the twelfth image block are ID number images, and the image content types corresponding to other image blocks are not described in detail here.
[0134] Each image block can be input into the document pre-training model 600 to obtain image features 604 corresponding to each image block, which are respectively the first image block token, the second image block token, etc. Further, the image features 604 corresponding to the image blocks belonging to the same image content type can be spliced to obtain local features 702 corresponding to various image content types in the target document image, which are respectively the name image feature, the document number image feature, etc.
[0135] Specifically, it can be seen from the target ID image 701 that the image content type corresponding to the first image block and the second image block is the name content type. According to the mapping relationship between the image block and the image block token, the first image block token and the second image block token can be spliced to obtain a local feature containing the name content, that is, a name image feature; similarly, the image content type corresponding to the ninth image block, the tenth image block, the eleventh image block and the twelfth image block is the ID number content type, then the ninth image block token, the tenth image block token, the eleventh image block token and the twelfth image block token can be spliced to obtain a local feature containing the ID number content, that is, a ID number image feature, and so on, all the local features of interest in the target ID image can be obtained.
[0136] By splicing the features corresponding to image blocks belonging to the same image content type, different parts of the document, such as the personal information area, the portrait area, etc., can be better organized and understood.
[0137] S408, inputting the local features corresponding to each image content type into the feature extraction layer to obtain the corresponding original element features;
[0138] For step S408, please refer to the detailed description of step S306 in the first embodiment of this specification, which will not be repeated here.
[0139] S410, mapping the original element features to corresponding category labels using the feature classification layer, and adjusting network parameters of the feature extraction layer and network parameters of the feature classification layer based on the category labels;
[0140] For step S410, please refer to the detailed description of step S308 in the first embodiment of this specification, which will not be repeated here.
[0141] S412: Obtain a risk identification model based on at least one of the trained element feature recognition networks and the document pre-training model.
[0142] For step S412, please refer to the detailed description of step S208 in the first embodiment of this specification, which will not be repeated here.
[0143] By combining the trained element feature recognition network and the document pre-training model, a comprehensive risk identification model can be constructed to quickly and efficiently identify document risks, detect tampering traces and other security issues. Moreover, the entire process is highly automated, reducing the need for manual intervention and improving risk identification efficiency. Importantly, it can also be adjusted according to different document types and application scenarios, with good scalability.
[0144] In one or more embodiments of the present specification, before inputting the target document image into the document pre-training model, a second document image set may be obtained to train a preset neural network using the second document image set to obtain the document pre-training model.
[0145] The second document image set may include sample images of several different document types. The document pre-training model may be a convolutional neural network, a Transformer network, or other architecture suitable for processing document images, which is not specifically limited in this specification.
[0146] See also Figure 8 , is a flow chart of a method for training a pre-trained model for a certificate provided in an embodiment of the present specification. The preset neural network model may include an encoder and a decoder, and the encoder and the decoder are asymmetric. Figure 8 As shown, the method comprises the following steps:
[0147] S802, performing random mask processing on each frame of sample image in the second document image set to obtain multiple frames of input images;
[0148] Taking any sample image in the second document image set as an example, the sample image can be divided into non-overlapping image blocks of size 16×16, and a higher mask ratio (such as 75%) is used to randomly mask a portion of the image blocks. At this time, there are two types of image blocks, namely masked image blocks and unmasked image blocks. By simulating the situation of missing information in the image, the model can learn how to fill in the missing parts and improve the model performance.
[0149] Moreover, each image block is converted into a high-dimensional feature through a block embedding operation to obtain an input image corresponding to the sample image. Similarly, the input image corresponding to each frame of the sample image can be obtained.
[0150] S804, inputting the unmasked image blocks in each of the input images into the encoder to obtain corresponding sample features;
[0151] After the masking operation, the unmasked image blocks in each frame of the input image are sent to the encoder for feature extraction to obtain sample features. For example, the encoder can be composed of a convolutional neural network, which is not limited in the embodiments of this specification.
[0152] S806, splicing and decoding each of the sample features and the corresponding mask image blocks in each of the input images through the decoder to obtain a reconstructed image;
[0153] Next, the sample features extracted from the encoder are concatenated with the mask image blocks in the corresponding frame input image to obtain a fused feature with the same size as the original input image. Finally, a lightweight decoder is used to reconstruct the original image based on the fused feature, such as decoding the fused feature to obtain a reconstructed image.
[0154] S808, calculating a loss value between the sample image and the reconstructed image in a pixel space using a preset loss function, and adjusting a model parameter of the encoder and a model parameter of the decoder according to the loss value;
[0155] The reconstructed image is compared with the original unmasked sample image, and the difference between the two is measured by a preset loss function (such as a mean square error loss function, a cross entropy loss function, etc.). In the present exemplary embodiment, the goal of the loss function is to minimize the pixel-level difference between the reconstructed image and the sample image. Based on the calculated loss value, the model parameters of the encoder and decoder are updated using a back propagation algorithm so that the model gradually learns to more accurately predict and reconstruct the masked image portion. After the preset neural network model training is completed, the document pre-training model can be obtained.
[0156] Pre-trained models are more easily adapted to new tasks, such as specific types of eKYC verification, with a small amount of data, reducing the large amount of time and resources required to train models from scratch. Pre-training the document pre-trained model on a large amount of document image data can significantly improve the performance in processing scene analysis and image reconstruction, thereby achieving more efficient and accurate identity authentication and security monitoring in eKYC scenarios.
[0157] In one or more embodiments of the present specification, after obtaining a trained risk identification model, the model can be used to pre-build a risk element feature library, wherein the risk element feature library refers to a pre-collected and constructed database containing various types of reference element features.
[0158] For example, the reference element feature may be an element feature extracted from a real ID image that does not have an attack risk or a disguise risk, or an element feature extracted from a forged ID image that has an attack risk or a disguise risk. For another example, the reference element feature may be a text line background feature, a text line font feature, a text line color feature, etc. extracted from the name field of the ID image, or a text line background feature, a text line font feature, a text line color feature, etc. extracted from the ID number field of the ID image. This specification does not specifically limit the type of reference element feature.
[0159] Optionally, a third document image set may be obtained, the third document image set including real document images and / or forged document images corresponding to the real document images. The real document images and forged document images may be respectively input into the trained risk identification model to obtain the first reference element features in the real document images and the second reference element features in the forged document images. Then, a risk element feature library is constructed based on the first reference element features and / or the second reference element features. For example, a first risk element feature library is constructed based on the first reference element features, and a second risk element feature library is constructed based on the second reference element features, both of which can be used for document risk identification.
[0160] The risk element signature library can be used for rapid risk assessment of new document images. When a new document image is input into the risk identification model, the extracted element features can be compared with the element features in the risk element signature library. As more document images are processed, the risk element signature library can be continuously updated and optimized to adapt to new risk attack techniques.
[0161] See also Fig. 9 , is a flow chart of a risk identification method provided in an embodiment of this specification. In an embodiment of this specification, the risk identification method is applied to a risk identification device or an electronic device equipped with a risk identification device. Fig. 9The process shown in the figure is described in detail. The risk identification method can specifically include the following steps:
[0162] S902, obtaining an image of the document to be detected;
[0163] In one or more embodiments of the present specification, the document image to be detected refers to the document image that needs to be risk identified. The document image to be detected can be the same as the target document image, such as one of the target document images, or it can be different from the target document image. This specification does not limit this.
[0164] The image of the document to be detected can be obtained from a database that stores document images, or the image of the document to be detected corresponding to the document to be detected can be acquired in real time by an image acquisition unit. Of course, the image of the document to be detected can also be acquired from another terminal device equipped with an image acquisition unit through wireless communication technology. This embodiment does not specifically limit the method for acquiring the image of the document to be detected.
[0165] S904, inputting the document image to be detected into the trained risk identification model to obtain target element features in the document image to be detected;
[0166] The trained risk identification model consists of a document pre-training model and at least one trained element feature recognition network.
[0167] In one possible embodiment, Fig.10 A schematic diagram of the principle of obtaining element characteristics provided in an embodiment of this specification.
[0168] refer to Fig.10 As shown, taking the image of the document to be detected as a personal ID card image as an example, Fig.10 As shown, the document image 1001 to be detected is divided into at least one image block, and each image block is input into the document pre-training model 600 to obtain the image features 604 corresponding to each image block. Furthermore, the image features 604 corresponding to the image blocks belonging to the same image content type can be spliced to obtain the local features 702 corresponding to various image content types in the target document image. Then, the local features 702 corresponding to various image content types can be input into different element feature recognition networks 1002 to obtain the corresponding element features 1003. Among them, each element feature recognition network 1002 is used to specifically extract specific element features 1003, including background features, font type features, etc.
[0169] It should be noted that the risk identification model is trained by the method described in detail in steps S202 to S208 of an embodiment of this specification, or is trained by the method described in detail in steps S302 to S310 of another embodiment of this specification, or is trained by the method described in detail in steps S402 to S412 of yet another embodiment of this specification, which will not be repeated here.
[0170] S906: Determine the risk of forgery of the document image to be detected according to the similarity between each reference element feature in a preset risk element feature library and the target element feature.
[0171] After obtaining the target element features of the document image to be detected through the trained risk identification model, the target element features can be compared with the reference element features in the preset risk element feature library, and the similarity between the reference element features and the target element features can be determined, so as to quickly determine whether the document image to be detected has the risk of document forgery based on the size of the similarity.
[0172] The similarity refers to data that measures the degree of similarity between each reference element feature and the target element feature. For example, the similarity between each reference element feature and the target element feature may be the cosine distance between each reference element feature and the target element feature, or the Euclidean distance between each reference element feature and the target element feature, or other types of data that can characterize the similarity between each reference element feature and the target element feature, which is not limited in this specification.
[0173] Optionally, the risk element feature library includes a first risk element feature library, which can be constructed by extracting first reference element features from real document images. If the similarity between any first reference element feature in the first risk element feature library and the target element feature is less than a preset first similarity threshold, it is determined that the document image to be detected has a risk of document forgery.
[0174] For example, at least one target element feature in the document image to be detected is extracted using the trained risk identification model, and then each target element feature is searched and compared with the first risk element feature library of the same document (real document). If the comparison difference between a target element feature and the first reference element feature in the first risk element feature library is large, such as the similarity between the two is less than the preset first similarity threshold, it is considered that the document image may be a forged document or there is an attack risk, and it is intercepted.
[0175] Optionally, the risk element feature library includes a second risk element feature library, and the reference element feature includes a second reference element feature. The second risk element feature library can be constructed by extracting a second reference element feature from a forged document image. If the similarity between any second reference element feature in the second risk element feature library and the target element feature is greater than a preset second similarity threshold, it is determined that the document image to be detected has a risk of document forgery.
[0176] For example, at least one target element feature in the document image to be detected is extracted using the trained risk identification model, and then each target element feature is retrieved and compared with the second risk element feature library of forged documents of the same document type. If the comparison difference between a certain target element feature and the second reference element feature in the second risk element feature library is small, such as the similarity between the two is greater than the preset second similarity threshold, it is considered that the document image may be a forged document or there is an attack risk, and it is also intercepted.
[0177] In the embodiments of this specification, the first similarity threshold and the second similarity threshold may be the same or different, and may be set according to actual needs, and this specification does not limit this.
[0178] It is understandable that in the embodiments of this specification, a combination comparison of multiple element features can also be performed, such as determining whether elements such as gender, age, and ID photo are identity information of the same person, and this specification does not limit this.
[0179] By calculating the similarity between the more recognizable element features extracted from the image of the document to be tested and the reference element features stored in the risk element feature library, the possible camouflage attack risk in the document image to be tested can be quickly and accurately determined. Moreover, when faced with the ever-changing risk of document attacks, only the risk element feature library needs to be updated, without the need to retrain the model, which reduces maintenance costs and increases update and iteration efficiency, further improving the efficiency of risk identification and helping to achieve real-time interception of document forgery attacks.
[0180] See also Fig.11 , is a schematic diagram of the structure of a risk identification model training device provided in an embodiment of this specification. Fig.11 As shown, the risk identification model training device 200 can be implemented as all or part of an electronic device through software, hardware, or a combination of both. According to some embodiments, the risk identification model training device 200 includes a sample image acquisition module 210, a local feature extraction module 220, a target network training module 230, and a target model generation module 240, specifically including:
[0181] The sample image acquisition module 210 is used to acquire the target document image;
[0182] A local feature extraction module 220 is used to input the target document image into the document pre-training model to obtain local features corresponding to different image content types in the target document image;
[0183] A target network training module 230, configured to train at least one element feature recognition network using the local features corresponding to the different image content types;
[0184] The target model generation module 240 is used to obtain a risk identification model based on at least one of the trained element feature recognition networks and the document pre-training model.
[0185] Optionally, each of the element feature recognition networks includes a feature extraction layer and a feature classification layer;
[0186] When the target network training module 230 trains at least one element feature recognition network using the local features corresponding to the different image content types, it is specifically used to:
[0187] Inputting the local features corresponding to each image content type into the feature extraction layer to obtain the corresponding original element features;
[0188] The original element features are mapped to corresponding category labels using the feature classification layer, and network parameters of the feature extraction layer and the feature classification layer are adjusted based on the category labels.
[0189] Optionally, the target document image includes a first target document image;
[0190] When executing the acquisition of the target document image, the sample image acquisition module 210 is specifically used to:
[0191] Acquire a first document image set, the first document image set comprising at least a first candidate document image and a second candidate document image, the document type of the first candidate document image being different from the document type of the second candidate document image;
[0192] Determining a target area in the first candidate document image;
[0193] The second candidate document image is randomly selected, and the image content in the target area is copied to a corresponding position in the second candidate document image to obtain the first target document image.
[0194] Optionally, when the local feature extraction module 220 inputs the target document image into the document pre-training model to obtain local features corresponding to different image content types in the target document image, it is specifically used to:
[0195] Segmenting the target document image into at least one image block, and inputting each image block into a document pre-training model to obtain image features corresponding to each image block;
[0196] The image features corresponding to the image blocks belonging to the same image content type are spliced to obtain local features corresponding to various image content types in the target document image.
[0197] Optionally, the document pre-training model includes at least a feature embedding network and a feature encoding network; when the local feature extraction module 220 inputs each image block into the document pre-training model to obtain the image features corresponding to each image block, it is specifically used to:
[0198] Embedding each of the image blocks through the feature embedding network to obtain a plurality of embedded features;
[0199] Each of the embedded features is input into the feature encoding network to obtain the image features corresponding to each of the image blocks.
[0200] Optionally, the risk identification model training device 200 further includes a model pre-training module 250, which is specifically used for:
[0201] Acquire a second document image set;
[0202] The preset neural network is trained using the second document image set to obtain the document pre-training model.
[0203] Optionally, when the model pre-training module 250 trains a preset neural network using the second document image set to obtain the document pre-training model, it is specifically used to:
[0204] Performing random mask processing on each frame of sample image in the second document image set to obtain multiple frames of input images;
[0205] Inputting the unmasked image blocks in each of the input images into the encoder to obtain corresponding sample features;
[0206] The decoder splices and decodes each of the sample features and the corresponding mask image blocks in each of the input images to obtain a reconstructed image;
[0207] A loss value between the sample image and the reconstructed image is calculated in pixel space using a preset loss function, and model parameters of the encoder and model parameters of the decoder are adjusted according to the loss value.
[0208] The above device embodiments correspond to the method embodiments. For specific descriptions, please refer to the description of the method embodiments, which will not be repeated here. The device embodiments are obtained based on the corresponding method embodiments and have the same technical effects as the corresponding method embodiments. For specific descriptions, please refer to the corresponding method embodiments.
[0209] See also Fig.12 , is a schematic diagram of the structure of a risk identification device provided in an embodiment of this specification. Fig.12 As shown, the risk identification device 300 can be implemented as all or part of the electronic device through software, hardware or a combination of both. According to some embodiments, the risk identification device 300 includes a document image acquisition module 310, an element feature extraction module 320 and an element feature comparison module 330, specifically including:
[0210] The document image acquisition module 310 is used to acquire the document image to be detected;
[0211] The element feature extraction module 320 is used to input the document image to be detected into the trained risk identification model to obtain the target element features in the document image to be detected;
[0212] An element feature comparison module 330 is used to determine the document forgery risk of the document image to be detected according to the similarity between each reference element feature in a preset risk element feature library and the target element feature;
[0213] Wherein, the risk identification model is trained by the method described in the risk identification model training device.
[0214] Optionally, the risk element feature library includes a first risk element feature library, and the reference element feature includes a first reference element feature; when the element feature comparison module 330 determines the document forgery risk of the document image to be detected according to the similarity between each reference element feature in the preset risk element feature library and the target element feature, it is specifically used to:
[0215] If the similarity between any first reference element feature in the first risk element feature library and the target element feature is less than a preset first similarity threshold, it is determined that the document image to be detected has a risk of document forgery.
[0216] Optionally, the risk element feature library includes a second risk element feature library, and the reference element feature includes a second reference element feature; when the element feature comparison module 330 determines the document forgery risk of the document image to be detected according to the similarity between each reference element feature in the preset risk element feature library and the target element feature, it is specifically used to:
[0217] If the similarity between any second reference element feature in the second risk element feature library and the target element feature is greater than a preset second similarity threshold, it is determined that the document image to be detected has a risk of document forgery.
[0218] Optionally, the risk identification device 300 further includes a feature library construction module 340, wherein the feature library construction module 340 is specifically used for:
[0219] Acquire a third document image set, wherein the third document image set includes authentic document images and / or forged document images corresponding to the authentic document images;
[0220] Inputting the real ID image and the forged ID image into the trained risk identification model respectively to obtain a first reference element feature in the real ID image and a second reference element feature in the forged ID image;
[0221] The risk element feature library is constructed based on the first reference element feature and / or the second reference element feature.
[0222] The above device embodiments correspond to the method embodiments. For specific descriptions, please refer to the description of the method embodiments, which will not be repeated here. The device embodiments are obtained based on the corresponding method embodiments and have the same technical effects as the corresponding method embodiments. For specific descriptions, please refer to the corresponding method embodiments.
[0223] The present specification also provides a computer storage medium, which can store multiple instructions, and the instructions are suitable for being loaded and executed by a processor as described above. Figures 2 to 10 The method of the embodiment shown in the figure can be specifically executed by referring to Figures 2 to 10 The specific description of the illustrated embodiment will not be repeated here.
[0224] This specification also provides a computer program product, which stores at least one instruction, and the at least one instruction is loaded by the processor and executes the method of the embodiment shown above. The specific execution process can be seen in Figures 2 to 10 The specific description of the illustrated embodiment will not be repeated here.
[0225] The embodiments of this specification also provide Fig.13 The structural diagram of the electronic device shown in FIG. Fig.13 At the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include hardware required for other services. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to implement the above-mentioned voice activity detection method.
[0226] Of course, in addition to software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the executor of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0227] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0228] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0229] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0230] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0231] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0232] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0233] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0234] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0235] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0236] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0237] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0238] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0239] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0240] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0241] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0242] The above description is only an embodiment of the present specification and is not intended to limit the present specification. For those skilled in the art, the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of the claims of the present specification.
Claims
1. A risk identification model training method, the method comprising: Obtain the target document image; Inputting the target document image into the document pre-training model to obtain local features corresponding to different image content types in the target document image; Training at least one element feature recognition network using the local features corresponding to the different image content types; A risk identification model is obtained based on at least one of the trained element feature recognition networks and the document pre-training model.
2. According to the risk identification model training method of claim 1, each of the element feature recognition networks includes a feature extraction layer and a feature classification layer; The using the local features corresponding to the different image content types to train at least one element feature recognition network comprises: Inputting the local features corresponding to each image content type into the feature extraction layer to obtain the corresponding original element features; The original element features are mapped to corresponding category labels using the feature classification layer, and network parameters of the feature extraction layer and the feature classification layer are adjusted based on the category labels.
3. According to the risk identification model training method of claim 1, the target document image comprises a first target document image; The step of obtaining the target document image comprises: Acquire a first document image set, the first document image set comprising at least a first candidate document image and a second candidate document image, the document type of the first candidate document image being different from the document type of the second candidate document image; Determining a target area in the first candidate document image; The second candidate document image is randomly selected, and the image content in the target area is copied to a corresponding position in the second candidate document image to obtain the first target document image.
4. According to the risk identification model training method of claim 1, the step of inputting the target document image into the document pre-training model to obtain local features corresponding to different image content types in the target document image comprises: Segmenting the target document image into at least one image block, and inputting each image block into a document pre-training model to obtain image features corresponding to each image block; The image features corresponding to the image blocks belonging to the same image content type are spliced to obtain local features corresponding to various image content types in the target document image.
5. According to the risk identification model training method of claim 4, the document pre-training model at least includes a feature embedding network and a feature encoding network; The step of inputting each of the image blocks into the document pre-training model to obtain image features corresponding to each of the image blocks includes: Embedding each of the image blocks through the feature embedding network to obtain a plurality of embedded features; Each of the embedded features is input into the feature encoding network to obtain the image features corresponding to each of the image blocks.
6. The risk identification model training method according to claim 1, further comprising: Acquire a second document image set; The preset neural network is trained using the second document image set to obtain the document pre-training model.
7. According to the risk identification model training method of claim 6, the preset neural network model includes an encoder and a decoder; The step of training a preset neural network using the second document image set to obtain the document pre-training model includes: Performing random mask processing on each frame of sample image in the second document image set to obtain multiple frames of input images; Inputting the unmasked image blocks in each of the input images into the encoder to obtain corresponding sample features; The decoder splices and decodes each of the sample features and the corresponding mask image blocks in each of the input images to obtain a reconstructed image; A loss value between the sample image and the reconstructed image is calculated in pixel space using a preset loss function, and model parameters of the encoder and model parameters of the decoder are adjusted according to the loss value.
8. A risk identification method, the method comprising: Obtain the image of the document to be detected; Inputting the document image to be detected into the trained risk identification model to obtain the target element features in the document image to be detected; Determining the document forgery risk of the document image to be detected according to the similarity between each reference element feature in a preset risk element feature library and the target element feature; Wherein, the risk identification model is trained by the method described in any one of claims 1-7.
9. The risk identification method according to claim 8, wherein the risk element feature library comprises a first risk element feature library, and the reference element feature comprises a first reference element feature; The step of determining the document forgery risk of the document image to be detected according to the similarity between each reference element feature in a preset risk element feature library and the target element feature includes: If the similarity between any first reference element feature in the first risk element feature library and the target element feature is less than a preset first similarity threshold, it is determined that the document image to be detected has a risk of document forgery.
10. The risk identification method according to claim 8, wherein the risk element feature library comprises a second risk element feature library, and the reference element feature comprises a second reference element feature; The step of determining the risk of forgery of the document image to be detected according to the similarity between each reference element feature in a preset risk element feature library and the target element feature includes: If the similarity between any second reference element feature in the second risk element feature library and the target element feature is greater than a preset second similarity threshold, it is determined that the document image to be detected has a risk of document forgery.
11. The risk identification method according to claim 8, further comprising: Acquire a third document image set, wherein the third document image set includes authentic document images and / or forged document images corresponding to the authentic document images; Inputting the real ID image and the forged ID image into the trained risk identification model respectively to obtain a first reference element feature in the real ID image and a second reference element feature in the forged ID image; The risk element feature library is constructed based on the first reference element feature and / or the second reference element feature.
12. A risk identification model training device, the device comprising: A sample image acquisition module is used to acquire a target document image; A local feature extraction module, used to input the target document image into the document pre-training model to obtain local features corresponding to different image content types in the target document image; A target network training module, used for training at least one element feature recognition network using the local features corresponding to the different image content types; The target model generation module is used to obtain a risk identification model based on at least one of the trained element feature recognition networks and the document pre-training model.
13. A risk identification device, comprising: The certificate image acquisition module is used to acquire the certificate image to be detected; An element feature extraction module is used to input the document image to be detected into the trained risk identification model to obtain the target element features in the document image to be detected; An element feature comparison module, used to determine the document forgery risk of the document image to be detected according to the similarity between each reference element feature in a preset risk element feature library and the target element feature; Wherein, the risk identification model is trained by the method described in any one of claims 1-7.
14. A storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method according to any one of claims 1 to 11.
15. An electronic device, comprising: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the steps of the method as claimed in any one of claims 1 to 11.
16. A computer program product having at least one instruction stored thereon, wherein when the at least one instruction is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.
Citation Information
Cited By
Image detection method, device and equipment
CN119887770A