Model training data generation method and device in certificate anti-counterfeiting detection
By physically collecting printed image data in multiple acquisition modes and generating fake card certificate data using artificial intelligence, a rich training data was built, which solved the problem of poor detection effect of certificate anti-counterfeiting detection model in the existing technology, and realized the More efficient identification of document fraud.
Patent Information
- Application Number
- CN202411606352.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2025-02-18
AI Technical Summary
In the prior art, the detection effect of the document anti-counterfeiting detection model is affected by the lack of sufficient quantity and type of printed image data, making it difficult to effectively identify document fraud.
By physically collecting printed image data in multiple acquisition modes, and using generative artificial intelligence to generate forged card certificate data, a rich training data set is built to improve the detection effect of the detection model.
The sufficient quantity and type of printed image data was obtained, which significantly improved the detection effect of the document anti-counterfeiting detection model and could more effectively identify document fraud.
Smart Images

Figure CN119478981A_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to the field of computers, and in particular, to a method and device for generating model training data in document anti-counterfeiting detection. Background Art
[0002] At present, electronic identity authentication is widely used. Document anti-counterfeiting is a key link in identity authentication. A common way to forge documents is to print out the document in color or black and white, and then impersonate the user's real document for identity authentication. This type of document forgery needs to be identified in document anti-counterfeiting detection.
[0003] In the prior art, a large number of real certificates and their corresponding printed images are often used to train the detection model, which is used to detect whether the input card data corresponds to a real certificate or a fake certificate. The user's certificate information is the user's private data, which needs to be protected from being leaked. Due to various environmental factors, it is difficult to obtain sufficient number and types of printed images in reality, which affects the detection effect of the detection model. Summary of the invention
[0004] One or more embodiments of this specification describe a method and device for generating model training data in document anti-counterfeiting detection, which can obtain sufficient quantity and types of printed images, thereby correspondingly improving the detection effect of the detection model.
[0005] In a first aspect, a method for generating model training data in document anti-counterfeiting detection is provided, the method comprising:
[0006] For any original card data in the original card data set, physically collect multiple printed image data corresponding to multiple collection modes to obtain the first type of training data consisting of the original card data and the multiple printed image data; wherein the original card data is used as a positive sample in the model training data, and the printed image data is used as a negative sample in the model training data;
[0007] For any original card data, a plurality of corresponding forged card data are generated by generative artificial intelligence to obtain a second type of training data consisting of the original card data and the plurality of forged card data; wherein the original card data is used as a positive sample in the model training data, and the forged card data is used as a negative sample in the model training data;
[0008] A training data set is determined based on the first type of training data and the second type of training data for training a detection model, wherein the detection model is used to detect whether the category corresponding to the input card data is a real certificate or a fake certificate.
[0009] In a possible implementation, the physically collecting a plurality of print image data corresponding to a plurality of collection modes respectively includes:
[0010] Corresponding to the printing conditions respectively included in the multiple acquisition modes, the printer is controlled to print any original card data respectively according to the multiple printing conditions to obtain multiple paper images;
[0011] Corresponding to the shooting conditions respectively included in the multiple acquisition modes, the camera is controlled to shoot the multiple paper pictures under the multiple shooting conditions respectively to obtain multiple printing image data.
[0012] Furthermore, the printing conditions include: paper material;
[0013] The control printer prints any original card data according to a plurality of printing conditions, including:
[0014] Control the printer to print any original card data on a variety of paper materials.
[0015] Further, the printing conditions include: printer model;
[0016] The control printer prints any original card data according to a plurality of printing conditions, including:
[0017] Start multiple printers corresponding to multiple printer models in sequence;
[0018] Control multiple printers to print any original card data.
[0019] Further, the shooting conditions include: image size;
[0020] The controlling camera takes the plurality of paper images under a plurality of shooting conditions respectively, including:
[0021] The camera is controlled to take the multiple paper pictures according to multiple image sizes respectively.
[0022] Further, the shooting conditions include: background information;
[0023] The controlling camera takes the plurality of paper images under a plurality of shooting conditions respectively, including:
[0024] The camera is controlled to take the multiple paper images under multiple background information respectively.
[0025] Further, the shooting conditions include: collecting lighting;
[0026] The controlling camera takes the plurality of paper images under a plurality of shooting conditions respectively, including:
[0027] The camera is controlled to take the multiple paper images under multiple collection lighting conditions respectively.
[0028] Furthermore, the multiple light collection methods include turning on a flashlight or turning off a flashlight.
[0029] Furthermore, the controlling camera to take the plurality of paper images under a plurality of shooting conditions respectively includes:
[0030] Through embodied intelligence, a robotic arm is used to control a camera to take the multiple paper images under a variety of shooting conditions.
[0031] In a possible implementation, for any original card data, generating a plurality of corresponding forged card data by means of generative artificial intelligence includes:
[0032] The first original card data is used as content, and the printed image data corresponding to the second original card data is used as style. The content and style are input into a pre-trained style transfer network to obtain forged card data whose first original card data conforms to the style.
[0033] Furthermore, the style transfer network is trained in the following manner:
[0034] Acquire third original card data and third print image data corresponding to the first acquisition mode, and fourth print image data corresponding to the first acquisition mode of the fourth original card data;
[0035] The third original card data is used as content, the fourth printed image data is used as style, and the content and style are input into a style transfer network to obtain third forged card data corresponding to the third original card data;
[0036] Determining a predicted loss based on the third forged card data and the third printed image data;
[0037] The parameters of the style transfer network are adjusted with minimizing the prediction loss as the training objective.
[0038] In a possible implementation, for any original card data, generating a plurality of corresponding forged card data by means of generative artificial intelligence includes:
[0039] Extracting text and graphics from the first original card data or its corresponding printed image data;
[0040] Add the extracted text and graphics to the first layer;
[0041] The first layer is distorted and degraded to obtain a processed first layer;
[0042] Choose a paper texture to add to the second layer;
[0043] Performing noise adding processing on the second layer to obtain a processed second layer;
[0044] Merge the first layer and the second layer to obtain a merged document image;
[0045] The document image is enhanced to simulate a real certificate, so as to obtain forged card data corresponding to the first original card data.
[0046] In a possible implementation, for any original card data, generating a plurality of corresponding forged card data by means of generative artificial intelligence includes:
[0047] The printed image data corresponding to the first original card data and the prompt words used to characterize the style are input into the multimodal large model to obtain the forged card data corresponding to the first original card data and conforming to the style.
[0048] In a second aspect, a device for generating model training data in document anti-counterfeiting detection is provided, the device comprising:
[0049] The acquisition unit is used to physically acquire a plurality of printed image data corresponding to a plurality of acquisition modes for any original card data in the original card data set, so as to obtain a first type of training data consisting of the original card data and the plurality of printed image data; wherein the original card data is used as a positive sample in the model training data, and the printed image data is used as a negative sample in the model training data;
[0050] A generating unit is used to generate a plurality of corresponding forged card data by using a generative artificial intelligence method for any original card data, so as to obtain a second type of training data consisting of the original card data and the plurality of forged card data; wherein the original card data is used as a positive sample in the model training data, and the forged card data is used as a negative sample in the model training data;
[0051] The determination unit is used to determine a training data set for training a detection model based on the first type of training data obtained by the acquisition unit and the second type of training data obtained by the generation unit. The detection model is used to detect whether the category corresponding to the input card data is a true certificate or a false certificate.
[0052] According to a third aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute the method of the first aspect.
[0053] According to a fourth aspect, a computing device is provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method of the first aspect is implemented.
[0054] Through the method and device provided in the embodiments of this specification, two methods are combined to construct a training data set. One method is to obtain the corresponding printed image data for the original card data through a physical acquisition method, and multiple acquisition modes are used in the physical acquisition method, so that a large number and a large number of types of printed images can be obtained; the other method is to generate the corresponding forged card data for the original card data through a generative artificial intelligence method. The forged card data can be regarded as an artificially generated printed image, which is efficient and enriches the types of printed images. As a supplement to the physical acquisition method, it can make up for the deficiency that the physical acquisition method cannot traverse various environmental conditions. By combining the two methods, a sufficient number and type of printed images can be obtained, and the detection effect of the detection model is correspondingly improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0056] Figure 1 A schematic diagram of an implementation scenario of an embodiment disclosed in this specification;
[0057] Figure 2 A flow chart of a method for generating model training data in document anti-counterfeiting detection according to an embodiment is shown;
[0058] Figure 3 A schematic diagram showing generation of forged card data according to one embodiment;
[0059] Figure 4 A schematic diagram showing the structure of a style transfer network according to an embodiment is shown;
[0060] Figure 5 A schematic block diagram of a device for generating model training data in document anti-counterfeiting detection according to one embodiment is shown. DETAILED DESCRIPTION
[0061] The solution provided in this specification is described below in conjunction with the accompanying drawings.
[0062] Figure 1This is a schematic diagram of an implementation scenario of an embodiment disclosed in this specification. This implementation scenario involves the generation of model training data in document anti-counterfeiting detection. It can be understood that the model training data includes positive samples and negative samples. Usually, the positive sample can be a real document, and the negative sample can be a printed image. In electronic program identity authentication, the corresponding card data can be collected by a camera, and then the detection model can be used to identify the category of the card data as a real certificate or a fake certificate. In the embodiment of this specification, in order to improve the detection effect of the detection model, it is necessary to obtain a sufficient number and type of printed images, and the printed images can be regarded as fake cards. Refer to Figure 1 Due to the influence of various environmental conditions, the printed images of the same real document under different environmental conditions have obvious differences. Taking the printer model and paper material as an example, a printed image is obtained on paper 1 through printer A, another printed image is obtained on paper 2 through printer B, and another printed image is obtained on paper 3 through printer C. These printed images are different, and the printed images may also be affected by other random factors, such as the depth of the printer ink marks, the folds of the paper, etc. In short, it is impossible to traverse the printed images under various environmental conditions.
[0063] The embodiments of this specification propose corresponding solutions for obtaining sufficient number and types of printed images so as to improve the detection effect of the detection model.
[0064] Figure 2 A flow chart of a method for generating model training data in document anti-counterfeiting detection according to an embodiment is shown. The method can be based on Figure 1 The implementation scenario shown in Figure 1 is as follows. Figure 2 As shown, the model training data generation method in the document anti-counterfeiting detection in this embodiment includes the following steps: Step 21, for any original card data in the original card data set, physically collect multiple printed image data corresponding to multiple collection modes, and obtain the first type of training data consisting of the original card data and the multiple printed image data; wherein the original card data is used as a positive sample in the model training data, and the printed image data is used as a negative sample in the model training data; Step 22, for any original card data, generate its corresponding multiple forged card data by using a generative artificial intelligence method, and obtain the second type of training data consisting of the original card data and the multiple forged card data; wherein the original card data is used as a positive sample in the model training data, and the forged card data is used as a negative sample in the model training data; Step 23, according to the first type of training data and the second type of training data, determine the training data set for training the detection model, and the detection model is used to detect whether the category corresponding to the input card data is a true certificate or a false certificate. The specific execution method of each of the above steps is described below.
[0065] First, in step 21, for any original card data in the original card data set, multiple printed image data corresponding to multiple acquisition modes are physically collected to obtain the first type of training data consisting of the original card data and the multiple printed image data; wherein the original card data is used as a positive sample in the model training data, and the printed image data is used as a negative sample in the model training data. It can be understood that the original card data can be regarded as the electronic image data of a real certificate, for example, the electronic image data stored in the mobile phone obtained by taking a photo of a real certificate through a mobile phone camera; the printed image data can be regarded as the electronic image data of the printed image, and the printed image is an image obtained by printing a photo of a real certificate on paper, for example, the printed image is obtained by printing a photo of a real certificate on paper, and then the electronic image data stored in the mobile phone is obtained by taking a photo through a mobile phone camera.
[0066] In one example, the physically collecting a plurality of printing image data corresponding to a plurality of collection modes respectively includes:
[0067] Corresponding to the printing conditions respectively included in the multiple acquisition modes, the printer is controlled to print any original card data respectively according to the multiple printing conditions to obtain multiple paper images;
[0068] Corresponding to the shooting conditions respectively included in the multiple acquisition modes, the camera is controlled to shoot the multiple paper pictures under the multiple shooting conditions respectively to obtain multiple printing image data.
[0069] In this example, the physical collection of print image data needs to go through two stages. One stage is to print the original card data to obtain a paper image, and the other stage is to capture the information of the paper image as electronic data to obtain print image data. Both stages will be affected by environmental conditions. Environmental conditions are divided into printing conditions and shooting conditions. By combining any printing condition and any shooting condition, specific environmental conditions can be formed and print image data under the specific environmental conditions can be obtained.
[0070] Furthermore, the printing conditions include: paper material;
[0071] The control printer prints any original card data according to a plurality of printing conditions, including:
[0072] Control the printer to print any original card data on a variety of paper materials.
[0073] In this example, the printed image data of different paper materials are physically collected and used to train the detection model, which helps the detection model to detect fake certificates by identifying the texture features of the paper material.
[0074] Further, the printing conditions include: printer model;
[0075] The control printer prints any original card data according to a plurality of printing conditions, including:
[0076] Start multiple printers corresponding to multiple printer models in sequence;
[0077] Control multiple printers to print any original card data.
[0078] In this example, the printed image data of different printer models is physically collected and used to train the detection model, which helps the detection model to detect fake certificates by identifying the printing features of the printer model.
[0079] In addition, the printing conditions may also include printing modes, such as horizontal printing or vertical printing, etc. By physically collecting the printed image data under different printing modes and using it to train the detection model, it is helpful for the detection model to detect fake certificates by identifying the characteristics of the printing mode.
[0080] Further, the shooting conditions include: image size;
[0081] The controlling camera takes the plurality of paper images under a plurality of shooting conditions respectively, including:
[0082] The camera is controlled to take the multiple paper pictures according to multiple image sizes respectively.
[0083] In this example, printed image data of different image sizes are physically collected and used to train a detection model, which helps the detection model detect fake certificates by identifying the characteristics of the image size.
[0084] Further, the shooting conditions include: background information;
[0085] The controlling camera takes the plurality of paper images under a plurality of shooting conditions respectively, including:
[0086] The camera is controlled to take the multiple paper images under multiple background information respectively.
[0087] In this example, by physically collecting printed image data with different background information and using it to train the detection model, it is helpful for the detection model to detect fake certificates by identifying the features of the background information. The background information may include a desktop, a wall, etc.
[0088] Further, the shooting conditions include: collecting lighting;
[0089] The controlling camera takes the plurality of paper images under a plurality of shooting conditions respectively, including:
[0090] The camera is controlled to take the multiple paper images under multiple collection lighting conditions respectively.
[0091] In this example, by physically collecting printed image data under different collection lighting, the detection model is trained using the data, which helps the detection model to detect fake certificates by identifying the characteristics of the collection lighting.
[0092] Furthermore, the multiple light collection methods include turning on a flashlight or turning off a flashlight.
[0093] In this example, the collected light is changed by actively controlling the flash to be turned on or off, and the detection model is trained using it, which helps the detection model to detect fake certificates by identifying the characteristics of the collected light.
[0094] Furthermore, the controlling camera to take the plurality of paper images under a plurality of shooting conditions respectively includes:
[0095] Through embodied intelligence, a robotic arm is used to control a camera to take the multiple paper images under a variety of shooting conditions.
[0096] In this example, embodied intelligence uses a robotic arm to control the camera to automatically collect print image data, which can improve collection efficiency.
[0097] Among them, embodied intelligence is a development area of artificial intelligence, which refers to the ability of an intelligent system or machine to interact with the environment in real time through perception and interaction. It can be simply understood as robots of various forms, allowing them to perform various tasks in a real physical environment to complete the evolution of artificial intelligence.
[0098] The embodiments of this specification can also achieve automated collection through program-controlled robotic arms instead of embodied intelligence.
[0099] It should be noted that when you have a real certificate corresponding to the original card data, you can also copy the real certificate to obtain a paper image corresponding to the original card data, and then take a photo of the paper image to obtain the copied image data. Both the copied image data and the printed image data are obtained through physical collection and can be collectively referred to as printed image data.
[0100] Then in step 22, for any original card data, a plurality of corresponding forged card data are generated by generative artificial intelligence, and the second type of training data consisting of the original card data and the plurality of forged card data is obtained; wherein the original card data is used as a positive sample in the model training data, and the forged card data is used as a negative sample in the model training data. It can be understood that the forged card data is obtained in a different way from the printed image data. The forged card data is generated directly from the original card data. In this process, there is no need to print the original card data on paper or take a picture of the paper, and the processing is more convenient and efficient.
[0101] Among them, generative artificial intelligence (AIGC) refers to the technology that generates relevant content with appropriate generalization ability through learning and identifying existing data based on artificial intelligence technical methods such as generative adversarial networks and large pre-trained models.
[0102] In one example, for any original card data, generating a plurality of corresponding forged card data by using generative artificial intelligence includes:
[0103] The first original card data is used as content, and the printed image data corresponding to the second original card data is used as style. The content and style are input into a pre-trained style transfer network to obtain forged card data whose first original card data conforms to the style.
[0104] In this example, when the content is the same original card data and different styles are used, forged card data of different styles will be generated.
[0105] Figure 3 A schematic diagram showing the generation of forged card data according to an embodiment. Figure 3 , taking user A's original card data as content, taking user B's printed image data of acquisition mode 1 as style 1, inputting content and style 1 into a pre-trained style transfer network, and obtaining user A's forged card data of style 1; taking user A's original card data as content, taking user B's printed image data of acquisition mode 2 as style 2, inputting content and style 2 into a pre-trained style transfer network, and obtaining user A's forged card data of style 2; taking user A's original card data as content, taking user B's printed image data of acquisition mode 3 as style 3, inputting content and style 3 into a pre-trained style transfer network, and obtaining user A's forged card data of style 3. It is understandable that different acquisition modes will bring different image styles. For example, different acquisition lighting or different paper materials will be reflected in the corresponding printed image data. Since this feature is not easy to display through pictures, Figure 3The illustration is just made through line segments in different directions, but the actual style is not limited to this.
[0106] Figure 4 FIG. 1 is a schematic diagram showing the structure of a style transfer network according to an embodiment. Figure 4 The input of the style transfer network is two images representing content and style respectively. These two images can also be called content image and style image respectively. The output is a stylized image. The content contained in the stylized image is consistent with the aforementioned content image, and its style is consistent with the aforementioned style image. The style transfer network mainly includes: a zero padding module, which increases the input dimension by zero padding along the channel dimension; a cascaded reversible residual module and a spatial compression module for performing forward reasoning; a channel refinement module for removing channel redundant information in content or style image features to achieve more effective style transfer; a linear transformation module for transmitting content representation z c Represent z in matching style s Statistical information of cs The aforementioned modules are also used for backward reasoning to reversely map the stylized representation into a stylized image. When the content is the original card data of user A and the style is the printed image data of user B, the stylized image obtained by the style transfer network can be used as the forged card data of user A, and its style is consistent with the printed image data of user B.
[0107] In the embodiments of this specification, the style transfer network can be used for diversified style transfer. Among them, the reversible residual module can not only retain the content affinity including pixel affinity and feature affinity, but also does not introduce redundant information, thereby achieving better stylization. With the help of Matting Laplacian training loss, the pixel affinity loss caused by linear transformation can be solved, which is suitable for various style transfers. A large number of experiments show that very good qualitative and quantitative results can be produced.
[0108] Furthermore, the style transfer network is trained in the following manner:
[0109] Acquire third original card data and third print image data corresponding to the first acquisition mode, and fourth print image data corresponding to the first acquisition mode of the fourth original card data;
[0110] The third original card data is used as content, the fourth printed image data is used as style, and the content and style are input into a style transfer network to obtain third forged card data corresponding to the third original card data;
[0111] Determining a predicted loss based on the third forged card data and the third printed image data;
[0112] The parameters of the style transfer network are adjusted with minimizing the prediction loss as the training objective.
[0113] For example, the original image and the color-printed image are regarded as a set of data, for example, the original image A1 and the corresponding color-printed image A2, and the material type of the color-printed image is marked, such as A4 paper, glossy paper, etc.; each set of data, the original image A1 and a style image B2 are input into the network, the style image B2 can be a color-printed image of another certificate, and the corresponding color-printed image A2 is used as the annotation result of this input; through the style transfer on the card, a style transfer network based on the color-printed style transfer of the card is trained. A normal image is input, and after being passed into the style transfer network, the corresponding color-printed style image is output. It can be understood that the material type of the color-printed image can correspond to the style of the color-printed image.
[0114] In one example, for any original card data, generating a plurality of corresponding forged card data by using generative artificial intelligence includes:
[0115] Extracting text and graphics from the first original card data or its corresponding printed image data;
[0116] Add the extracted text and graphics to the first layer;
[0117] The first layer is distorted and degraded to obtain a processed first layer;
[0118] Choose a paper texture to add to the second layer;
[0119] Performing noise adding processing on the second layer to obtain a processed second layer;
[0120] Merge the first layer and the second layer to obtain a merged document image;
[0121] The document image is enhanced to simulate a real certificate, so as to obtain forged card data corresponding to the first original card data.
[0122] For example, you can start with an image corresponding to a real ID, or you can start with a color-printed ID. First, the text and graphics in the source image are extracted into an ink layer, which is then distorted and degraded. Next, a white paper or a randomly selected paper texture is provided as the bottom layer. Like the ink layer, the paper can also be further processed to provide a random real paper texture. After both the ink and paper are processed, ink with the desired effect is applied to the paper. After this, the merged document image can be further enhanced, such as adding folds or other physical deformations or distortions that depend on the interaction between the paper and ink layers, and then adding lighting and shadows. The result is an image that simulates a real ID.
[0123] In one example, for any original card data, generating a plurality of corresponding forged card data by using generative artificial intelligence includes:
[0124] The printed image data corresponding to the first original card data and the prompt words used to characterize the style are input into the multimodal large model to obtain the forged card data corresponding to the first original card data and conforming to the style.
[0125] In this example, based on the prompt words, a multimodal large model can be used to further strengthen the fake certificate clues based on the printed image data. For example, the prompt words can be "generate a reproduced picture", "generate moiré pattern", "generate a mobile phone screen", etc.
[0126] Finally, in step 23, a training data set is determined based on the first type of training data and the second type of training data, and used to train a detection model, wherein the detection model is used to detect whether the category corresponding to the input card data is a true card or a false card. It can be understood that both the first type of training data and the second type of training data include positive samples and negative samples, but the generation methods are different. The two complement each other and can be used together to increase the number and type of negative samples.
[0127] In the embodiment of this specification, the detection model may be a binary classification model, which may output a category indicating a positive sample or a negative sample.
[0128] Through the method provided in the embodiments of this specification, two methods are combined to construct a training data set. One method is to obtain the corresponding printed image data of the original card data through a physical acquisition method, and multiple acquisition modes are used in the physical acquisition method, so that a large number and a large number of types of printed images can be obtained; the other method is to generate the corresponding forged card data of the original card data through a generative artificial intelligence method. The forged card data can be regarded as an artificially generated printed image, which is efficient and enriches the types of printed images. As a supplement to the physical acquisition method, it can make up for the deficiency that the physical acquisition method cannot traverse various environmental conditions. By combining the two methods, a sufficient number and type of printed images can be obtained, and the detection effect of the detection model is correspondingly improved.
[0129] According to another aspect of the embodiment, there is also provided a device for generating model training data in document anti-counterfeiting detection, which is used to execute the method provided in the embodiment of this specification. Figure 5 FIG. 1 is a schematic block diagram of a device for generating model training data in document anti-counterfeiting detection according to an embodiment. Figure 5 As shown, the device 500 includes:
[0130] The acquisition unit 51 is used for physically acquiring a plurality of printed image data corresponding to a plurality of acquisition modes for any original card data in the original card data set, and obtaining a first type of training data consisting of the original card data and the plurality of printed image data; wherein the original card data is used as a positive sample in the model training data, and the printed image data is used as a negative sample in the model training data;
[0131] The generating unit 52 is used to generate a plurality of forged card data corresponding to any original card data by using a generative artificial intelligence method, and obtain a second type of training data consisting of the original card data and the plurality of forged card data; wherein the original card data is used as a positive sample in the model training data, and the forged card data is used as a negative sample in the model training data;
[0132] The determination unit 53 is used to determine a training data set for training a detection model based on the first type of training data obtained by the acquisition unit 51 and the second type of training data obtained by the generation unit 52. The detection model is used to detect whether the category corresponding to the input card data is a true certificate or a false certificate.
[0133] Optionally, as an embodiment, the acquisition unit 51 includes:
[0134] The printing subunit is used to control the printer to print any original card data according to the printing conditions respectively included in the multiple acquisition modes, so as to obtain multiple paper images;
[0135] The shooting subunit is used to control the camera to shoot the multiple paper pictures obtained by the printing subunit under the multiple shooting conditions respectively included in the multiple acquisition modes to obtain multiple printing image data.
[0136] Furthermore, the printing conditions include: paper material;
[0137] The printing subunit is specifically used to control the printer to print any original card data on papers of various paper materials.
[0138] Further, the printing conditions include: printer model;
[0139] The printing subunit is specifically used for:
[0140] Start multiple printers corresponding to multiple printer models in sequence;
[0141] Control multiple printers to print any original card data.
[0142] Further, the shooting conditions include: image size;
[0143] The shooting subunit is specifically used to control the camera to shoot the multiple paper pictures according to multiple image sizes.
[0144] Further, the shooting conditions include: background information;
[0145] The shooting subunit is specifically used to control the camera to shoot the multiple paper images under multiple background information respectively.
[0146] Further, the shooting conditions include: collecting lighting;
[0147] The shooting subunit is specifically used to control the camera to shoot the multiple paper images under multiple collection lighting conditions.
[0148] Furthermore, the multiple light collection methods include turning on a flashlight or turning off a flashlight.
[0149] Furthermore, the shooting subunit is specifically used to control the camera by a robotic arm through embodied intelligence to shoot the multiple paper pictures under multiple shooting conditions.
[0150] Optionally, as an embodiment, the generating unit 52 is specifically used to take the first original card data as content, take the printed image data corresponding to the second original card data as style, input the content and style into a pre-trained style transfer network, and obtain the forged card data whose first original card data conforms to the style.
[0151] Furthermore, the style transfer network is trained in the following manner:
[0152] Acquire third original card data and third print image data corresponding to the first acquisition mode, and fourth print image data corresponding to the first acquisition mode of the fourth original card data;
[0153] The third original card data is used as content, the fourth printed image data is used as style, and the content and style are input into a style transfer network to obtain third forged card data corresponding to the third original card data;
[0154] Determining a predicted loss based on the third forged card data and the third printed image data;
[0155] The parameters of the style transfer network are adjusted with minimizing the prediction loss as the training objective.
[0156] Optionally, as an embodiment, the generating unit 52 includes:
[0157] An extraction subunit, used to extract text and graphics from the first original card data or its corresponding printed image data;
[0158] A first adding subunit, used for adding the text and graphics extracted by the extracting subunit to the first layer;
[0159] A first processing subunit is used to perform distortion and degradation processing on the first layer obtained by the first adding subunit to obtain a processed first layer;
[0160] The second adding subunit is used to select a paper texture to be added to the second layer;
[0161] A second processing subunit is used to perform noise adding processing on the second layer obtained by the second adding subunit to obtain a processed second layer;
[0162] A merging subunit, used for merging the first layer obtained by the first processing subunit and the second layer obtained by the second processing subunit to obtain a merged document image;
[0163] The enhancement processing subunit is used to perform enhancement processing simulating a real certificate on the document image obtained by the merging subunit to obtain forged card data corresponding to the first original card data.
[0164] Optionally, as an embodiment, the generating unit 52 is specifically used to input the printed image data corresponding to the first original card data and the prompt words used to characterize the style into the multimodal large model to obtain the forged card data corresponding to the first original card data and conforming to the style.
[0165] Through the device provided in the embodiment of this specification, two methods are combined to construct a training data set. One method is that the acquisition unit 51 obtains the corresponding print image data for the original card data through a physical acquisition method, and multiple acquisition modes are used in the physical acquisition method, so that a large number and a large number of types of print images can be obtained; the other method is that the generation unit 52 generates the corresponding forged card data for the original card data through a generative artificial intelligence method. The forged card data can be regarded as an artificially generated print image, which is efficient and enriches the types of print images. As a supplement to the physical acquisition method, it can make up for the deficiency that the physical acquisition method cannot traverse various environmental conditions. By combining the two methods, it is possible to obtain print images with sufficient quantity and types, and correspondingly improve the detection effect of the detection model.
[0166] According to another embodiment, there is also provided a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute a combination of Figure 2 The method described.
[0167] According to another embodiment of the present invention, a computing device is provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the Figure 2 The method described.
[0168] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the present invention can be implemented by hardware, software, firmware or any combination thereof. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.
[0169] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for generating model training data in document anti-counterfeiting detection, the method comprising: For any original card data in the original card data set, physically collect multiple printed image data corresponding to multiple collection modes to obtain the first type of training data consisting of the original card data and the multiple printed image data; wherein the original card data is used as a positive sample in the model training data, and the printed image data is used as a negative sample in the model training data; For any original card data, a plurality of corresponding forged card data are generated by generative artificial intelligence to obtain a second type of training data consisting of the original card data and the plurality of forged card data; wherein the original card data is used as a positive sample in the model training data, and the forged card data is used as a negative sample in the model training data; A training data set is determined based on the first type of training data and the second type of training data for training a detection model, wherein the detection model is used to detect whether the category corresponding to the input card data is a real certificate or a fake certificate.
2. The method of claim 1, wherein: The physical acquisition corresponds to a plurality of print image data of a plurality of acquisition modes, including: Corresponding to the printing conditions respectively included in the multiple acquisition modes, the printer is controlled to print any original card data respectively according to the multiple printing conditions to obtain multiple paper images; Corresponding to the shooting conditions respectively included in the multiple acquisition modes, the camera is controlled to shoot the multiple paper pictures under the multiple shooting conditions respectively to obtain multiple printing image data.
3. The method of claim 2, wherein: The printing conditions include: paper material; The control printer prints any original card data according to a plurality of printing conditions, including: Control the printer to print any original card data on a variety of paper materials.
4. The method of claim 2, wherein: The printing conditions include: printer model; The control printer prints any original card data according to a plurality of printing conditions, including: Start multiple printers corresponding to multiple printer models in sequence; Control multiple printers to print any original card data.
5. The method of claim 2, wherein: The shooting conditions include: image size; The controlling camera takes the plurality of paper images under a plurality of shooting conditions respectively, including: The camera is controlled to take the multiple paper pictures according to multiple image sizes respectively.
6. The method of claim 2, wherein: The shooting conditions include: background information; The controlling camera takes the plurality of paper images under a plurality of shooting conditions respectively, including: The camera is controlled to take the multiple paper images under multiple background information respectively.
7. The method of claim 2, wherein: The shooting conditions include: collecting light; The controlling camera takes the plurality of paper images under a plurality of shooting conditions respectively, including: The camera is controlled to take the multiple paper images under multiple collection lighting conditions respectively.
8. The method of claim 7, wherein: The multiple types of light collection include turning on a flash light or turning off a flash light.
9. The method of claim 2, wherein: The controlling camera takes the plurality of paper images under a plurality of shooting conditions respectively, including: Through embodied intelligence, a robotic arm is used to control a camera to take the multiple paper images under a variety of shooting conditions.
10. The method of claim 1, wherein: The method of using generative artificial intelligence to generate a plurality of corresponding forged card data for any original card data includes: The first original card data is used as content, and the printed image data corresponding to the second original card data is used as style. The content and style are input into a pre-trained style transfer network to obtain forged card data whose first original card data conforms to the style.
11. The method of claim 10, wherein: The style transfer network is trained in the following way: Acquire third original card data and third print image data corresponding to the first acquisition mode, and fourth print image data corresponding to the first acquisition mode of the fourth original card data; The third original card data is used as content, the fourth printed image data is used as style, and the content and style are input into a style transfer network to obtain third forged card data corresponding to the third original card data; Determining a predicted loss based on the third forged card data and the third printed image data; The parameters of the style transfer network are adjusted with minimizing the prediction loss as the training objective.
12. The method of claim 1, wherein: The method of using generative artificial intelligence to generate a plurality of corresponding forged card data for any original card data includes: Extracting text and graphics from the first original card data or its corresponding printed image data; Add the extracted text and graphics to the first layer; The first layer is distorted and degraded to obtain a processed first layer; Choose a paper texture to add to the second layer; Performing noise adding processing on the second layer to obtain a processed second layer; Merge the first layer and the second layer to obtain a merged document image; The document image is enhanced to simulate a real certificate, so as to obtain forged card data corresponding to the first original card data.
13. The method of claim 1, wherein: The method of using generative artificial intelligence to generate a plurality of corresponding forged card data for any original card data includes: The printed image data corresponding to the first original card data and the prompt words used to characterize the style are input into the multimodal large model to obtain the forged card data corresponding to the first original card data and conforming to the style.
14. A device for generating model training data in document anti-counterfeiting detection, the device comprising: The acquisition unit is used to physically acquire a plurality of printed image data corresponding to a plurality of acquisition modes for any original card data in the original card data set, so as to obtain a first type of training data consisting of the original card data and the plurality of printed image data; wherein the original card data is used as a positive sample in the model training data, and the printed image data is used as a negative sample in the model training data; A generating unit is used to generate a plurality of corresponding forged card data by using a generative artificial intelligence method for any original card data, so as to obtain a second type of training data consisting of the original card data and the plurality of forged card data; wherein the original card data is used as a positive sample in the model training data, and the forged card data is used as a negative sample in the model training data; The determination unit is used to determine a training data set for training a detection model based on the first type of training data obtained by the acquisition unit and the second type of training data obtained by the generation unit. The detection model is used to detect whether the category corresponding to the input card data is a true certificate or a false certificate.
15. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 1 to 13.
16. A computing device comprising a memory and a processor, wherein the memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 13 is implemented.