Method for generating training sample of screen shooting detection model
By generating a moiré pattern image and superimposing it on the original image, the problem of overfitting of the black border in the screen capture detection model is solved, and the recognition accuracy and defense capability of the screen capture detection model are improved.
Patent Information
- Application Number
- CN202510727040.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2025-09-12
AI Technical Summary
Existing screen-tapping detection models have the problem of inaccurate detection results when identifying screen-tapping attacks. They are prone to missing screen-tapping images with unclear screen borders or misidentifying non-screen-tapping images as screen-tapping images.
By obtaining an image containing moiré patterns, adversarial noise is obtained using a pre-trained screen capture detection model, a moiré pattern image is generated and superimposed with the original image to obtain a second image. When the screen capture detection model cannot recognize the image as a screen capture image, it is used as a training sample for model training.
Shifting the model's detection focus from black borders to moiré patterns avoids overfitting and improves the recognition accuracy and defense capabilities of the screen capture detection model.
Smart Images

Figure CN120635631A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification belong to the field of computer application technology, and in particular, relate to a method for generating training samples for a screen capture detection model. Background Art
[0002] In business scenarios involving personal or corporate information authentication, it's often necessary to review the credentials of individuals or businesses, such as personal ID cards, corporate licenses, and transaction records. This verification process requires users to take photos of the required documents in real time, which can lead to screen capture attacks. Screen capture attacks involve using a mobile phone or computer screen to display a photo of the required document, and then capturing the photo for authentication, rather than using genuine credentials.
[0003] To ensure accuracy, screen-snap detection models are often used in related technologies to detect screen-snap attacks. However, the related technologies suffer from the problem of inaccurate detection results from screen-snap detection models. Summary of the Invention
[0004] The purpose of this specification is to provide a method for generating training samples for a screen capture detection model.
[0005] A first aspect of this specification provides a method for generating training samples for a screen capture detection model, comprising:
[0006] Acquire a first image, wherein the first image includes moiré patterns;
[0007] When a first prediction result obtained by the screen capture detection model based on the first image indicates a screen capture image, acquiring adversarial noise corresponding to the first image based on the screen capture detection model;
[0008] generating a moiré image based on the countermeasure noise, and obtaining a second image based on the moiré image and the first image;
[0009] A screen capture detection model is used to perform prediction based on the second image to obtain a second prediction result; when the second prediction result indicates a non-screen capture image, a training sample for the screen capture detection model is generated based on the second image.
[0010] A second aspect of this specification provides an apparatus for generating training samples for a screen capture detection model, comprising:
[0011] An image acquisition module, configured to acquire a first image, wherein the first image includes moiré patterns;
[0012] an adversarial noise acquisition module, configured to acquire, based on the screen capture detection model, adversarial noise corresponding to the first image when a first prediction result obtained by the screen capture detection model based on the first image indicates a screen capture image;
[0013] an image generation module, configured to generate a moiré image based on the anti-noise, and obtain a second image based on the moiré image and the first image;
[0014] A prediction module is used to perform prediction based on the second image through a screen capture detection model to obtain a second prediction result; when the second prediction result indicates a non-screen capture image, a training sample of the screen capture detection model is generated based on the second image.
[0015] A third aspect of this specification provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed in a computer, the computer is caused to execute the above-mentioned method of generating training samples for a screen capture detection model.
[0016] The fourth aspect of this specification provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the above-mentioned method of generating training samples for the screen capture detection model is implemented.
[0017] A fifth aspect of this specification provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the above-mentioned method for generating training samples for a screen capture detection model.
[0018] To address the issue of inaccurate recognition results from screen capture detection models in related technologies, this specification provides a method for generating training samples for the screen capture detection model. First, a first image containing moiré patterns is acquired. The first image is detected using a pre-trained screen capture detection model. If the screen capture detection model can identify the first image as a screen capture image, adversarial noise is acquired based on the screen capture detection model. A moiré pattern image is generated based on the adversarial noise, and the moiré pattern image is superimposed on the first image to obtain a second image. Finally, the second image is detected using the screen capture detection model. If the screen capture detection model cannot identify the second image as a screen capture image, the second image is used as a training sample for the screen capture detection model.
[0019] The method described in this specification generates a moiré image through an adversarial attack and fuses the moiré image with the original screen capture image as a training sample. This effectively expands the screen capture attack cues in the training data and shifts the screen capture detection model's detection focus to pixel-level moiré cues, thereby avoiding overfitting to the screen border and improving the recognition accuracy of the screen capture detection model. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0021] Figure 1 It is a schematic diagram of moiré patterns;
[0022] Figure 2 is a schematic diagram of a method for generating training samples for a screen capture detection model in an embodiment of this specification;
[0023] Figure 3 This is a flowchart of a method for generating training samples for a screen capture detection model in an embodiment of this specification;
[0024] Figure 4 This is a block diagram of an apparatus for generating training samples for a screen capture detection model in one embodiment of this specification. DETAILED DESCRIPTION
[0025] To help those skilled in the art better understand the technical solutions in this specification, the following will provide a clear and complete description of the technical solutions in the embodiments of this specification, in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. All other embodiments derived by those skilled in the art based on the embodiments in this specification without creative effort shall fall within the scope of protection of this specification.
[0026] The inaccurate recognition results in the related art are mainly reflected in the following aspects: first, some screen-shot images will be missed, and second, some images that are not screen-shot attacks will be mistakenly detected as screen-shot images. An analysis of the problems existing in the related art shows that the screen-shot detection model in the related art detects whether there is a screen-shot attack by identifying the physical edge of the attack medium (such as the frame of a mobile phone or computer). Therefore, if the screen border line in the screen-shot image is not obvious, the screen-shot detection model will miss the detection. Similarly, if the user takes a picture at a location that includes a black border, such as placing an ID card on a black desktop for a picture, it will be mistakenly identified as a screen-shot image. It can be seen that in the related art, the problem of inaccurate screen-shot attack detection is caused by the overfitting of the model to the black screen border.
[0027] To address the issue of inaccurate recognition results from screen capture detection models in related technologies, this specification provides a method for generating training samples for the screen capture detection model. First, a first image containing moiré patterns is acquired. The first image is detected using a pre-trained screen capture detection model. If the screen capture detection model can identify the first image as a screen capture image, adversarial noise is acquired based on the screen capture detection model. A moiré pattern image is generated based on the adversarial noise, and the moiré pattern image is superimposed on the first image to obtain a second image. Finally, the second image is detected using the screen capture detection model. If the screen capture detection model cannot identify the second image as a screen capture image, the second image is used as a training sample for the screen capture detection model.
[0028] This specification addresses the moiré patterns present in screen capture images by using adversarial noise to generate moiré patterns for the screen capture detection model. The moiré pattern image is then superimposed with the original image to generate a second image that the screen capture detection model cannot recognize. Further training of the screen capture detection model using this second image as a training sample shifts the model's recognition focus from the black border to the moiré pattern, avoiding overfitting of the model to the black screen border. Because moiré patterns are unique patterns that exist in screen capture images and are generally absent in other scenes, the second image obtained by superimposing moiré patterns can effectively expand the screen capture attack clues in the training data and optimize the screen capture detection model.
[0029] Moreover, the moiré image is generated based on adversarial noise, which can generate a moiré image that is more targeted for the screen capture detection model, thereby making the obtained training samples more targeted. Training with the training samples can improve the accuracy of the screen capture detection model.
[0030] In addition, the anti-noise in this specification does not act directly on the first image, but on the moiré image. By synthesizing the moiré image to counter the attack, the detection attention of the screen capture detection model can be more easily shifted to the moiré clues at the pixel level, thereby improving the defense capability of the screen capture detection model.
[0031] Next, a method for generating training samples for a screen capture detection model provided in this specification will be described in detail.
[0032] For ease of understanding, here we first explain moiré. Moiré is a high-frequency interference stripe that appears on the photosensitive element of a digital camera or scanner. It is a high-frequency irregular stripe of color that appears on the image. Figure 1 When shooting a screen, moiré patterns may appear due to differences in pixel density between the screen and the camera's sensor.
[0033] The overall flow chart of the method is as follows Figure 2As shown, first, the image obtained by shooting the screen (later and Figure 2 The first image is also referred to as the first image in the figure) and is input into the screen capture detection model to obtain a prediction result. Generally, the screen capture detection model can identify the first image as a screen capture image. Then, the gradient back propagation method is used to obtain the adversarial noise corresponding to the image, and the adversarial noise is applied to the third image generated by the moiré generation method to obtain a moiré image. The moiré image is then superimposed with the image input to the screen capture detection model to obtain an adversarial attack image (hereinafter and Figure 2 The second image is then predicted using the screen capture detection model to obtain a prediction result. If the prediction result indicates that the second image is a screen capture image, the second image is re-input into the screen capture detection model and the above process is repeated until the screen capture detection model can no longer recognize the image as a screen capture image. This provides a training sample for the screen capture detection model.
[0034] Next, combine Figure 3 , to illustrate a method for generating training samples for a screen capture detection model shown in this specification. Figure 3 As shown, the method includes the following steps:
[0035] Step 301: Acquire a first image.
[0036] The first image includes moiré patterns.
[0037] The first image is an image including moiré patterns. The moiré patterns in the first image may be moiré patterns originally included in the image. For example, the first image is an image obtained by photographing a screen.
[0038] also, Figure 3 The method shown can also be executed in a loop. In this case, the first image can also be the second image generated in the previous loop. If the second prediction result obtained by the screen capture detection model for the second image generated in the previous loop indicates that the image is not a screen capture image, it is necessary to continue to execute the following method for the second image. Figure 3 In this case, the first image obtained in step 301 may be the second image generated in the previous cycle. In addition, in the first cycle, the first image may be an image obtained by shooting the screen.
[0039] Step 303: When a first prediction result obtained by the screen-capturing detection model based on the first image indicates a screen-capturing image, acquire adversarial noise corresponding to the first image based on the screen-capturing detection model.
[0040] Specifically, when the screen capture detection model can identify the first image as a screen capture image, the adversarial noise corresponding to the first image can be output according to the screen capture detection model.
[0041] A screen capture image refers to an image captured by capturing the screen of an electronic device. A screen capture detection model is used to detect whether an image is a screen capture image. Its output prediction result can be either a screen capture image or a non-screen capture image, indicating whether the input image is a screen capture image or not, respectively. The screen capture detection model can be a pre-trained model.
[0042] If the first image is an image obtained by capturing a screen, the first prediction result in step 303 may be obtained by inputting the first image into the screen capture detection model. If the first image is the second image generated in the previous cycle, the first prediction result may be the second prediction result obtained in step 307 in the previous cycle.
[0043] In the case that the screen capture detection model can identify the first image as a screen capture image, if the first image is used for further training of the screen capture detection model, the screen capture detection model will still detect whether it is a screen capture image according to the original mode during the training process. In other words, the model will perform detection based on whether there is a black border. If the model is trained using the first image, the problem of the model overfitting to the black border will be aggravated. It can be seen that the first image that the screen capture detection model can identify as a screen capture image cannot guide the model to learn to detect whether it is a screen capture image based on whether there is moiré, and the problem of overfitting to the black border cannot be avoided. This shows that the first image does not have a good effect on the further training of the model. Therefore, adversarial noise can be generated for the first image, and training samples can be generated using the adversarial noise.
[0044] Adversarial attacks are a technique that uses artificially designed input data to deceive deep learning models. The core principle is to exploit the model's inherent characteristics (such as gradient information and linear response) to generate small perturbations, causing the model to produce erroneous outputs. For example, in related technologies, for a model that identifies the presence of a cat in an image, the original cat image is slightly perturbed using an adversarial attack algorithm, resulting in a new image that the model cannot recognize as a cat.
[0045] Specifically, the principle of adversarial attacks is that although deep learning models are generally nonlinear, their activation functions (such as ReLU) are piecewise linear, resulting in near-linear behavior in local regions. This characteristic amplifies small perturbations in the input data (along the gradient), significantly altering the model output.
[0046] In the method described herein, adversarial noise is obtained based on the model's inherent characteristics using an adversarial attack method. In subsequent steps, a moiré image is generated based on the adversarial noise and superimposed onto the first image. The moiré image generated by the adversarial attack algorithm can significantly alter the model's output. Superimposing it onto the first image to produce a second image can make it difficult for the model, based on its existing black border recognition model, to identify the second image as a screen capture. Furthermore, using the second image, which the model finds difficult to identify as a screen capture, as a training sample can better guide the model in learning to identify screen capture attacks based on moiré recognition, thereby achieving better model training results and avoiding the problem of the original model overfitting to the black border.
[0047] In an optional embodiment, for combating noise, the specific form of the combating noise may include a coefficient corresponding to each pixel in the first image, and the specific form of the generated moiré image may be influenced by the coefficient.
[0048] In an optional embodiment, the method for obtaining the anti-noise may be to obtain the anti-noise corresponding to the first image by using the loss function of the screen capture detection model and performing gradient back propagation processing.
[0049] The gradient mathematically represents the rate and direction of change of a function at a specific point. Gradient backpropagation uses the backpropagation algorithm to calculate the gradient of the loss function with respect to the input image. The gradient of the loss function indicates how to modify the input data to most effectively reduce the loss. Therefore, using the gradient of the loss function to generate adversarial noise can more effectively generate a second image that is difficult for the model to identify as a captured image.
[0050] Step 305 : Generate a moiré image based on the anti-noise, and obtain a second image according to the moiré image and the first image.
[0051] Specifically, the adversarial noise is applied to the moiré image, and the moiré image generated based on the adversarial noise is superimposed on the first image to obtain the second image.
[0052] Among them, it is different from the adversarial attack algorithm in the related art, which generally directly applies adversarial noise to the original image. In this specification, adversarial noise is applied to the moiré image, and the moiré image generated based on the adversarial noise is combined with the original image (first image) to obtain a second image. If the adversarial noise is applied directly to the original image, the moiré in the modified first image may not be learned by the model. However, the present application uses adversarial noise to generate moiré targeting the weaknesses of the screen capture detection model, making the moiré easier to be learned by the screen capture detection model.
[0053] Generating a moiré image based on adversarial noise can involve superimposing the adversarial noise with the acquired third image (i.e., the image composed of moiré patterns) to obtain the moiré image. As previously described, the adversarial noise can be a coefficient corresponding to each pixel in the first image. Therefore, the coefficient can be multiplied by the corresponding pixel in the acquired third image to obtain the moiré image.
[0054] The third image can be a moiré image obtained from a network or database. In another optional embodiment, the third image can also be generated in real time. Accordingly, the process of generating the moiré image can be applying the adversarial noise to the third image obtained by the moiré generation method to obtain the moiré image. Furthermore, if the method described in this specification involves multiple iterations, and if the screen capture detection model predicts that the second image is a screen capture image in the previous iteration, the third image can also be the moiré image generated in the previous iteration.
[0055] The moiré generation method can be based on mathematical models, image processing and other methods. Several specific examples will be used here to illustrate this, which does not limit this specification.
[0056] Moiré generation methods based on mathematical models can be generated based on the beat effect, as moiré is essentially the interference phenomenon caused by the superposition of two periodic patterns. Furthermore, for two-dimensional images, moiré can be generated by superimposing two periodic grids, representing the display pixel array and the camera sensor array, respectively.
[0057] For the moiré generation method based on image processing, moiré can be generated through means such as neural network models.
[0058] After the moiré image is obtained, a second image may be generated based on the moiré image and the first image.
[0059] The second image can be generated by directly superimposing the first image and the moiré image. Specifically, superimposing can be performed by summing or weighted summing pixel values of pixels at corresponding positions in the first image and the moiré image.
[0060] In an optional embodiment, the moiré image may be deformed and the deformed moiré image may be superimposed on the first image to generate a second image. Deforming the moiré image may make the moiré patterns in the second image more realistic and more similar to those in images obtained by photographing a screen in real life.
[0061] In addition, since only a part of the area in the real screen capture image is generally the screen, when generating the second image, the moiré image can be scaled or cropped, and the processed moiré image can be superimposed on the preset position in the first image to obtain the second image.
[0062] The preset position can be the position of a preset center area, since the screen in the captured screen image is generally in the middle of the image. Alternatively, the preset position can be obtained by identifying the original captured screen image corresponding to the first image, identifying the location of the screen by identifying the black border using a neural network model, and using the position of the screen in the image as the preset position. If there are no multiple loops, the original captured screen image is the first image. If there are multiple loops, the original captured screen image refers to the first image input in the first loop.
[0063] In this way, by superimposing the moiré pattern only on the corresponding area of the screen, the second image can be made more consistent with the screen image actually obtained in reality.
[0064] Step 307: perform prediction based on the second image using the screen capture detection model to obtain a second prediction result; if the second prediction result indicates a non-screen capture image, generate a training sample for the screen capture detection model based on the second image.
[0065] Specifically, after obtaining the second image, the screen capture detection model can be used to predict the second image. If the screen capture detection model cannot identify the second image as a screen capture image, the adversarial attack is successful. The second image can be used as a training sample for optimizing the screen capture detection model, and the model can use this second image to learn to identify screen capture images based on the moiré patterns in the image.
[0066] The first and second in the second prediction result and the first prediction result are used to distinguish the prediction results for different images in one processing (i.e., one cycle in the case of multiple cycles). If there are multiple cycles, as described above, the second image obtained in the lth cycle can be used as the first image in the l+1th cycle. Correspondingly, the second prediction result in the lth cycle is the first prediction result in the l+1th cycle.
[0067] If the second prediction result indicates a non-screen capture image, this image can be used as a training sample. In the case of multiple iterations, this method can be executed repeatedly until a training sample for the screen capture detection model is obtained. Accordingly, if the second prediction result indicates a screen capture image, this second image can be used as the first image for the next iteration. This allows for the generation of training samples that meet the requirements.
[0068] Figure 3The method shown can be repeated multiple times to obtain multiple training samples, and then the training samples that mislead the model recognition results can be used to optimize the model training.
[0069] Specifically, the training sample includes a label for the second image, indicating that the second image is a screen capture image. The screen capture detection model can then be trained using the training sample using a supervised training method. In this way, after multiple rounds of learning, the model can learn the characteristics of moiré patterns and can then identify the training sample as a screen capture image, thereby achieving the training purpose.
[0070] like Figure 4 As shown, this specification also provides a device for generating training samples for a screen capture detection model, including:
[0071] An image acquisition module 410 is configured to acquire a first image, wherein the first image includes moiré patterns;
[0072] An adversarial noise acquisition module 420 is configured to acquire adversarial noise corresponding to the first image based on the screen capture detection model when a first prediction result obtained by the screen capture detection model based on the first image indicates a screen capture image;
[0073] An image generation module 430 is configured to generate a moiré image based on the anti-noise, and obtain a second image based on the moiré image and the first image;
[0074] The prediction module 440 is used to make a prediction based on the second image through the screen capture detection model to obtain a second prediction result; when the second prediction result indicates a non-screen capture image, a training sample of the screen capture detection model is generated based on the second image.
[0075] In an optional embodiment, the countermeasure noise includes a coefficient corresponding to each pixel in the first image; the image generation module 430 is specifically used to apply the countermeasure noise to the third image obtained by the moiré generation method to obtain a moiré image.
[0076] In an optional implementation, the image generation module 430 is specifically configured to perform deformation processing on the moiré image, and superimpose the deformed moiré image and the first image to obtain a second image.
[0077] In an optional embodiment, each module is executed in a loop until a training sample of the screen capture detection model is obtained; the prediction module 440 is also used to use the second image as the first image corresponding to the next cycle when the second prediction result indicates a screen capture image.
[0078] In an optional implementation, in the first cycle, the first image is an image obtained by photographing the screen.
[0079] In an optional implementation, the image generation module 430 is specifically configured to perform scaling or cropping processing on the moiré image, and superimpose the processed moiré image on a preset position in the first image to obtain a second image.
[0080] In an optional embodiment, the anti-noise acquisition module 420 is specifically used to obtain the anti-noise corresponding to the first image through the loss function of the screen capture detection model and gradient back propagation processing.
[0081] In an optional embodiment, the training sample includes a label of the second image, the label indicating that the second image is a screen capture image. The device further includes a training module (not shown in the figure) for training the screen capture detection model using the training sample.
[0082] In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures like diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using hardware modules. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA), is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system on a PLD through their own programming, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly done using "logic compiler" software. This is similar to the software compiler used when developing programs. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There is not just one HDL, but many, 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 will also understand that by simply programming the method flow in one of these hardware description languages and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.
[0083] The controller can be implemented in any suitable manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. 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 will also know that in addition to implementing the controller in a purely computer-readable program code format, the controller can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules that implement the method and structures within the hardware component.
[0084] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a server system. Of course, this specification does not exclude that with the future development of computer technology, the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, an in-vehicle human-computer interaction device, a cellular phone, a camera phone, a smartphone, 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.
[0085] Although one or more embodiments of this specification provide method operation steps as described in the embodiments or flow charts, more or fewer operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiments is only one way of executing the order of many steps and does not represent the only execution order. When the device or terminal product in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment). The term "comprise", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, product or equipment including a series of elements includes not only those elements, but also includes other elements that are not clearly listed, or also includes elements inherent to such process, method, product or equipment. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or equipment including the elements. For example, if the words first, second, etc. are used to represent the name, they do not represent any particular order.
[0086] For the convenience of description, the above devices are described in terms of functions divided into various modules. Of course, when implementing one or more of the present specifications, the functions of each module can be implemented in the same or multiple software and / or hardware, or the module that implements the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0087] This specification is described with reference to the flowcharts and / or block diagrams of the methods, apparatus (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks 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.
[0088] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work 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 The function specified in one or more boxes.
[0089] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device 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.
[0090] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0091] 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. Memory is an example of a computer-readable medium.
[0092] 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 disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage, graphene 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 transitory media such as modulated data signals and carrier waves.
[0093] Those skilled in the art will appreciate that one or more embodiments of this specification may be provided as a method, system, or computer program product. Thus, one or more embodiments of this specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, one or more embodiments of 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 magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0094] One or more embodiments of 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, and the like that perform specific tasks or implement specific abstract data types. One or more embodiments of this specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0095] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between the various embodiments can be referenced across them. Each embodiment focuses on the differences from the other embodiments. In particular, since the system embodiments are generally similar to the method embodiments, their description is relatively simple. For relevant parts, reference can be made to the description of the method embodiments. Throughout this specification, reference to the terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with that embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic representations of these terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, those skilled in the art may combine and integrate the different embodiments or examples, and features of different embodiments or examples, described in this specification, without conflict.
[0096] The foregoing description is merely an example of one or more embodiments of this specification and is not intended to limit the one or more embodiments of this specification. Those skilled in the art will appreciate that various modifications and variations of one or more embodiments of this specification are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of this specification are intended to be included within the scope of the claims.
Claims
1. A method for generating training samples for a screen capture detection model, comprising: Acquire a first image, wherein the first image includes moiré patterns; When a first prediction result obtained by the screen capture detection model based on the first image indicates a screen capture image, acquiring adversarial noise corresponding to the first image based on the screen capture detection model; generating a moiré image based on the countermeasure noise, and obtaining a second image based on the moiré image and the first image; A screen capture detection model is used to perform prediction based on the second image to obtain a second prediction result; when the second prediction result indicates a non-screen capture image, a training sample for the screen capture detection model is generated based on the second image.
2. The method according to claim 1, wherein the anti-noise comprises a coefficient corresponding to each pixel in the first image; Generating a moiré image based on the anti-noise comprises: The countermeasure noise is applied to a third image obtained by a moiré generation method to obtain a moiré image.
3. The method according to claim 1, wherein obtaining the second image according to the moiré image and the first image comprises: The moiré image is deformed, and the deformed moiré image and the first image are superimposed to obtain a second image.
4. The method according to claim 1, wherein the method is executed in a loop until a training sample for the screen capture detection model is obtained; When the second prediction result indicates a screen capture image, the method further includes: The second image is used as the first image corresponding to the next cycle. 5 . The method according to claim 4 , wherein in the first cycle, the first image is an image obtained by photographing the screen.
6. The method according to claim 1, wherein obtaining the second image according to the moiré image and the first image comprises: The moiré image is scaled or cropped, and the processed moiré image is superimposed on a preset position in the first image to obtain a second image.
7. The method according to claim 1, wherein obtaining adversarial noise corresponding to the first image based on the screen capture detection model comprises: The adversarial noise corresponding to the first image is obtained by using the loss function of the screen capture detection model through gradient back propagation processing.
8. The method according to claim 1, wherein the training sample includes a label of the second image, and the label indicates that the second image is a screen capture image; The method further comprises: The screen capture detection model is trained using the training samples.
9. A computer program product comprising a computer program / instruction, which implements the method according to any one of claims 1 to 8 when executed by a processor.
10. A computing device comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method according to any one of claims 1 to 8 is implemented.