Method and device for detecting counterfeit image

By converting and feature extraction of bayer image data collected by the sensor, and identifying forged images using the detection model, the problem of difficulty in detecting forged bayer images in the prior art is solved, and effective forged detection and prevention of bayer image data is achieved.

CN119723685APending Publication Date: 2025-03-28WEBANK (CHINA)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411780377.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

The prior art is difficult to effectively detect and prevent fake bayer images generated using AI, especially in the financial field, which may be used to bypass the defense system and defraud funds.

Method used

By obtaining bayer graph data collected by the sensor, converting it to preset formats (such as BGGR, GBRG, GRBG, RGGB), and using trained detection models (such as tree model or XGBoost model) to extract the converted graph data locally to determine whether the image is forged.

Benefits of technology

Effective forgery detection of bayer image data is realized, the accuracy and efficiency of identifying forgery images are improved, and the future forgery attacks on bayer images are prevented.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119723685A_ABST
    Figure CN119723685A_ABST
Patent Text Reader

Abstract

The invention discloses a method and device for detecting a forged image, and the method comprises the steps: obtaining first Bayer graph data collected by a sensor through interface calling; the first bayer graph data is converted into second bayer graph data in a preset format, and the preset format is any one of blue-green-green-red (BGGR), green-blue-red-green (GBRG), green-red-blue-green (GRBG) and red-green-green-blue (RGGB); and carrying out local feature extraction on the second bayer graph data, and determining whether the first bayer graph data is a forged image or not through local features. By the adoption of the method, forgery detection for bayer graph data can be achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer vision technology, and in particular to a method and device for detecting forged images. Background Art

[0002] With the rapid development of artificial intelligence (AI) technology, AI can generate realistic text, images, videos, audio and other content, bringing new opportunities and challenges to the financial sector. Fraudsters can use AI to forge facial images, thereby bypassing the existing financial defense system through forged facial images and defrauding huge amounts of money. For this reason, the financial industry urgently needs innovative anti-fraud technologies to effectively respond to new threats brought by AI, protect customer funds and data security, and maintain the stability of the financial market.

[0003] Since the current defense algorithms are all passive strategies, that is, the defenders will only improve the algorithms after the emergence of new attack algorithms, which causes the defense algorithms to always lag behind the attack algorithms. An effective strategy is to advance the defense. At present, the attack algorithms all forge red, green and blue (RGB) images, and there is no forgery of bayer images. Therefore, a detection method for bayer images is urgently needed to prevent the forgery of bayer images in the future. Summary of the invention

[0004] The present application provides a method and device for detecting forged images, which are used to implement forgery detection for Bayer graph data.

[0005] In a first aspect, an embodiment of the present application provides a method for detecting a forged image, which can be performed by a device for detecting a forged image, the method comprising: acquiring first bayer graph data collected by a sensor through an interface call; converting the first bayer graph data into second bayer graph data in a preset format, wherein the preset format is any one of blue, green, green, red (Blue, Green, Green, Red, BGGR), green, blue, red, green (Green, Blue, Red, Green, GBRG), green, red, blue, green (Green, Red, Blue, Green, GRBG), and red, green, green, blue (Red, Green, Green, Blue, RGGB); performing local feature extraction on the second bayer graph data, and determining whether the first bayer graph data is a forged image through the local features.

[0006] By adopting the above method, by converting the collected Bayer graph data into a preset format and then extracting local features of the converted graph data, it is possible to determine whether the collected Bayer graph data is a forged image. In this way, the authenticity of the collected image can be detected at the level of the Bayer graph data, effectively preventing attacks at the level of the Bayer graph data.

[0007] In a possible implementation, local features are extracted from the second bayer graph data, and whether the bayer graph data is a forged image is determined through the local features, including: inputting the second bayer graph data into a trained first detection model, and determining whether the first bayer graph data is a forged image through the first detection model; the first detection model is a tree model.

[0008] By adopting the above method, the first detection model is trained to detect the second bayer graph data, which effectively improves the accuracy and efficiency of determining whether the first bayer graph data is a forged image.

[0009] In a possible implementation, the negative samples used by the first detection model during training are obtained by: performing forgery processing on the first RGB image to obtain a second RGB image; and performing reverse reconstruction on the second RGB image to obtain Bayer graph data as negative samples.

[0010] In a possible implementation, the first detection model is an xgboost model; positive samples used by the first detection model during training include public bayer graph data and bayer graph data collected by a camera device.

[0011] In one possible implementation, the image input format is BGGR; converting the bayer map data into an image input format corresponding to a living body detection model includes: if the format of the bayer map data is GBRG, deleting the data of the leftmost column of pixels in the bayer map data; if the format of the bayer map data is GRBG, deleting the data of the top row of pixels in the bayer map data; if the format of the bayer map data is RGGB, deleting the data of the leftmost column of pixels and the top row of pixels in the bayer map data.

[0012] By using the above method, bayer graph data in various formats are converted into a unified input format, so that the input of the first detection model is in a unified format, which simplifies the training process of the first detection model. Since the first detection model is trained based on samples in the same format, the accuracy of the first detection model can also be improved.

[0013] In a possible implementation, the method is used to detect a living object, and the method further includes: obtaining a third RGB image generated by the first bayer graph data, inputting the third RGB image into a second detection model, and determining whether the third RGB image is a forged image; if neither the first bayer graph data nor the third RGB image is forged, determining that the object of the image acquisition is a living object.

[0014] By using the above method, the first bayer graph data and the third RGB image are detected. If neither of them is a forged image, it is determined that the image acquisition object is a living object.

[0015] In a second aspect, an embodiment of the present application provides a device for detecting a forged image, the device comprising: an acquisition module, used to acquire first Bayer image data collected by a sensor through an interface call; a conversion module, used to convert the first bayer image data into second bayer image data in a preset format, wherein the preset format is any one of blue-green-green-red BGGR, green-blue-red-green GBRG, green-red-blue-green GRBG, and red-green-green-blue RGGB; a processing module, used to extract local features of the second bayer image data, and determine whether the first bayer image data is a forged image through the local features.

[0016] In a possible implementation, the processing module is specifically used to input the second bayer graph data into a trained first detection model, and determine whether the first bayer graph data is a forged image through the first detection model; the first detection model is a tree model.

[0017] In a possible implementation, the first detection model is an xgboost model; positive samples used by the first detection model during training include public bayer graph data and bayer graph data collected by a camera device.

[0018] In one possible implementation, the image input format is BGGR; the conversion module is specifically used to, if the format of the bayer map data is GBRG, delete the data of the leftmost column of pixels in the bayer map data; if the format of the bayer map data is GRBG, delete the data of the top row of pixels in the bayer map data; if the format of the bayer map data is RGGB, delete the data of the leftmost column of pixels and the data of the top row of pixels in the bayer map data.

[0019] In a possible implementation, the device is used to detect a living object, the acquisition module is further used to acquire a third RGB image generated by the first bayer image data, and the processing module is further used to input the third RGB image into a second detection model to determine whether the third RGB image is a forged image; if neither the first bayer image data nor the third RGB image is forged, it is determined that the object of the image acquisition is a living object.

[0020] In a third aspect, an embodiment of the present application further provides a device for detecting forged images, the device comprising a memory and a processor, the memory being used to store computer programs or instructions; the processor being used to call the computer programs or instructions stored in the memory to execute a method as in any possible implementation of the first aspect.

[0021] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which instructions are stored. When a computer reads and executes the instructions, the computer executes a method in any possible implementation of the first aspect.

[0022] In a fifth aspect, an embodiment of the present application provides a computer program product, wherein instructions are stored in the computer program product. When a computer reads and executes the instructions, the computer executes the method in any possible implementation of the first aspect above. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0024] Figure 1 A schematic diagram of a process flow corresponding to a method for detecting forged images provided in an embodiment of the present application;

[0025] Figure 2 A system schematic diagram provided for an embodiment of the present application;

[0026] Figure 3 A schematic diagram of a bayer graph in a different format provided in an embodiment of the present application;

[0027] Figure 4 A schematic diagram of constructing a negative sample provided in an embodiment of the present application;

[0028] Figure 5 A schematic diagram of internal modules of a device for detecting forged images provided in an embodiment of the present application;

[0029] Figure 6 A schematic diagram of the structure of a device 6000 for detecting forged images provided in an embodiment of the present application. DETAILED DESCRIPTION

[0030] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0031] At present, the method of forging facial images based on AI to defraud huge amounts of money usually forges facial images in RGB format. RGB format is a commonly used image format. For this reason, the financial industry can effectively identify forged facial images in RGB format through corresponding anti-fraud technology to protect the security of customers' funds and data. However, with the advancement of AI technology, new ways of forging faces may emerge. For this reason, an effective defense measure is to advance the defense. Based on this, the present application proposes a method for detecting forged images, which can identify forged face images in Bayer format.

[0032] To better understand the Bayer format diagram in this application, the following is a brief description of the process of taking a photo with a camera. Light incidence: When a camera takes a photo, the light is first focused by the lens and then shines on the image sensor; Color filtering: The image sensor is covered with an array of Bayer filters, each of which only allows light of a specific color to pass through. Since the human eye is most sensitive to green light, the number of green filters in the bayer array is usually twice that of red and blue filters; Photoelectric conversion: After the light passes through the bayer filter, it shines on the photosensitive element of the sensor, which converts the light signal into an electrical signal. These electrical signals correspond to the color of the filter, forming the original bayer data; Analog-to-digital conversion: The analog signal on the sensor is then converted into a digital signal by the analog-to-digital converter (ADC). These digital signals represent the light intensity under different color filters; Bayer data: The data obtained at this time is bayer data, which is a raw image data that has not undergone any color interpolation processing. Each pixel contains only one color information (red, green or blue), and the other two color information needs to be estimated by the algorithm; Image processing: The bayer data will then be sent to the image processor (Image Signal Processor, ISP) for processing. In the ISP, the bayer data will undergo demosaicing and other image enhancement steps to finally generate a complete color image; Therefore, bayer data is the initial data in the camera shooting process, which is the basis for subsequent image processing and color reconstruction.

[0033] Figure 1 A schematic diagram of a process flow corresponding to a method for detecting a forged image provided in an embodiment of the present application, the process flow can be executed by a device for detecting a forged image, such as Figure 1 As shown, the process includes the following steps:

[0034] Step 101: The device for detecting forged images obtains first bayer graph data collected by a sensor through an interface call.

[0035] The device for detecting forged images may be a computer, a physical server, or other device, and the sensor is an important component in a smart device, which may be a smart phone, a smart tablet, a computer, or the like. The smart device acquires the first bayer graph data through a built-in sensor, and the device for detecting forged images calls the first bayer graph data acquired by the sensor through an interface, and the first bayer graph data may be face data to be detected.

[0036] For example, Figure 2 A system schematic diagram provided for an embodiment of the present application, from Figure 2It can be seen that the lens of the smart device captures the image of the face to be detected, and then generates the first bayer map data through the sensor. The first bayer map is actually a color picture composed of three colors: red, green and blue. The device for detecting forged images obtains the first bayer map data and detects the first bayer map data.

[0037] Step 102: The apparatus for detecting forged images converts the first bayer graph data into second bayer graph data in a preset format, wherein the preset format is any one of BGGR, GBRG, GRBG, and RGGB.

[0038] For example, since there are four formats of Bayer diagrams, namely BGGR, GBRG, GRBG and RGGB, these four formats of Bayer diagrams are all based on the characteristic that the human eye is more sensitive to green, so the number of green pixels is twice that of red and blue pixels during design, and different cameras and image sensors can use different Bayer arrangement formats. Figure 3 A schematic diagram of a Bayer graph in a different format provided in an embodiment of the present application, comprising Figure 3 It can be seen that the four formats are all composed of one red pixel, one blue pixel and two green pixels, but the arrangement order of each pixel in the four formats is different.

[0039] In order to more conveniently detect whether the first bayer graph data is a forged image, the four formats of bayer graph data can be converted into a unified preset format. If the unified preset format is set to BGGR format, the four formats of bayer graph data need to be converted into BGGR format. Exemplarily, if the format of the first bayer graph data is GBRG, the data of the leftmost column of pixels in the first bayer graph data is deleted; if the format of the first bayer graph data is GRBG, the data of the top row of pixels in the first bayer graph data is deleted; if the format of the first bayer graph data is RGGB, the data of the leftmost column of pixels and the data of the top row of pixels in the first bayer graph data are deleted. The unified preset format can also be set to any one of the four formats, which will not be elaborated here. It can be understood that since there is a lot of graph data, deleting a column or a row of data has little effect on the entire graph data.

[0040] Optionally, after converting the first bayer graph data into a preset format, the first bayer graph data can also be scaled to a uniform preset size. The preset size can be set to 112 pixels * 112 pixels. Scaling can be achieved through difference calculation. The embodiment of the present application does not specifically limit the preset size and scaling method.

[0041] Step 103: the apparatus for detecting forged images extracts local features from the second bayer graph data, and determines whether the first bayer graph data is a forged image based on the local features.

[0042] Exemplarily, after converting the first bayer graph data into a uniform preset format and scaling, the second bayer graph data is obtained, and the device for detecting forged images extracts local features from the second bayer graph data, and determines whether the first bayer graph data is a forged image through the local features. Because if the bayer graph data is forged, the forged bayer graph has more obvious replacement traces on the replaced pixels, especially boundary features, such as high-pass filtering, gradient filtering, local variance, etc. These local features can more easily determine true and false bayer graphs.

[0043] Optionally, performing local feature extraction on the second bayer graph data, and determining whether the second bayer graph data is a forged image by using the local features, includes: inputting the second bayer graph data into a trained first detection model, and determining whether the first bayer graph data is a forged image by using the first detection model. The first detection model may be a deep neural network model, but the deep neural network model usually requires a large amount of sample data for training, and has high requirements on the quality and diversity of the data. For this application, it is difficult to obtain a large amount of sample data.

[0044] The first detection model can be a tree model. In the embodiment of the present application, the first detection model can be a distributed gradient enhancement library (eXtreme Gradient Boosting, XGBoost) model. The advantage of using the XGBoost model is that: XGBoost will calculate the importance of the features in the model internally, and based on the importance of each feature to the model decision (for example, through gain, frequency, etc.), it can automatically reduce the reliance on unimportant features. This means that unimportant features may be ignored or given very small weights in the final model; XGBoost is built based on tree models (decision trees, boosted trees), and these trees select the best features and splitting points to minimize the loss function during training. Therefore, although it does not perform "feature extraction" like convolutional neural networks, it will select the features that can best improve the performance of the model at each segmentation point of the data; XGBoost can handle nonlinear relationships because it models the complex interactions between features through tree structures. These trees can capture the complex relationships between features through multiple splitting points, thereby reducing the need for manual feature engineering to a certain extent; decision trees can generate new feature representations by splitting different combinations of feature values ​​(i.e., forming new rules by combining splitting points of different features), and this combination is actually automatically discovering the interactions between different features.

[0045] The training of the XGBoost model first requires obtaining samples, which include positive samples and negative samples. Both positive samples and negative samples are face image data in Bayer format. Positive samples are image data that has not been forged, and negative samples are image data that has been forged. Specifically, the negative samples used by the first detection model in the training process are obtained in the following manner, including: forging the first RGB image to obtain a second RGB image, and reversely reconstructing the second RGB image to obtain Bayer image data as negative samples. Figure 4 A schematic diagram of constructing a negative sample provided in an embodiment of the present application, comprising Figure 4 It can be seen that the first RGB image is combined with the replaced face to forge the second RGB image, and the second RGB image is reversely reconstructed to obtain a negative sample. Since the second RGB image is forged, the sample obtained by reverse reconstruction based on the forged second RGB image also belongs to the sample obtained by forging. The positive samples used by the first detection model in the training process include public bayer graph data and bayer graph data collected by the camera device, wherein the public bayer graph data can be a public data set downloaded in the digital negative (DNG) format. Currently, common DNG format public data include fivek_dataset, etc. DNG is an archiving format for raw data files generated by digital cameras. After being obtained, the bayer graph is usually saved in DNG format; the bayer graph data collected by the camera device uses the open interface of the mobile phone, such as the camera 2 interface of the Android end, to capture and collect bayer data in real scenes in real time.

[0046] After obtaining the positive samples and negative samples, the positive samples are divided into positive training samples and positive test samples according to a certain ratio, and the negative samples are divided into negative training samples and negative test samples according to a certain ratio. The ratio can be 8:2 or other ratios. Set the initial parameters of the first detection model, input the positive training samples, the labels of the positive training samples, the negative training samples and the labels of the negative training samples into the first detection model, the labels of the positive training samples can be non-forged, and the labels of the negative training samples can be forged. Input the positive test samples and the negative test samples into the first detection model, calculate the accuracy and recall rate of the first detection model, if the accuracy and recall rate both meet the preset threshold, the training of the first detection model is completed; if there are indicators in the accuracy and recall rate that do not meet the preset threshold, continue to train the first detection model until the accuracy and recall rate of the first detection model meet the preset threshold.

[0047] After the first detection model is trained, the second bayer graph data is input into the trained first detection model to obtain the output result of the first detection model. If the output result of the first detection model is true, it means that the first bayer graph is not a forged image. If the output result of the first detection model is false, it means that the first bayer graph is a forged image. It can be understood that the first detection model is deployed on a device for detecting forged images.

[0048] By using the above method in the embodiment of the present application, the first bayer graph data collected by the sensor can be obtained through an interface call, and then the first bayer graph data can be detected. If the output result of the first detection model is false, the request related to the first bayer graph data is intercepted.

[0049] Optionally, the method for detecting forged images provided in the embodiment of the present application can also be used to detect living objects, including: obtaining a third RGB image generated by the first bayer graph data, inputting the third RGB image into a second detection model, determining whether the third RGB image is a forged image, and if both the first bayer graph data and the third RGB image are not forged, then determining that the object of the image acquisition is a living object. Specifically, in the process of detecting the authenticity of the first bayer graph data, the first bayer graph data can also generate a third RGB image. Before performing face recognition based on the third RGB image, the third RGB image is input into the second detection model. The second detection model detects the authenticity of images in RGB format. If the second detection model detects that the third RGB image is not forged, and the first detection model detects that the image data in the first bayer format is not forged, then it can be determined that the object acquired by the image acquisition is a living object. It should be noted that the second detection model can also be deployed on the same device as the first detection model.

[0050] Figure 5 Schematic diagram of the internal modules of a device 5000 for detecting forged images provided in an embodiment of the present application. Figure 5 As shown, the device may include: an acquisition module 501, a conversion module 502, a processing module 503, and optionally, a storage module, the storage module is used to store computer instructions or programs, and the processing module 503 can call the computer instructions or programs in the storage module.

[0051] The acquisition module 501 is used to acquire first Bayer image data collected by the sensor through an interface call; the conversion module 502 is used to convert the first bayer image data into second bayer image data in a preset format, wherein the preset format is any one of blue-green-green-red BGGR, green-blue-red-green GBRG, green-red-blue-green GRBG, and red-green-green-blue RGGB; the processing module 503 is used to extract local features from the second bayer image data, and determine whether the first bayer image data is a forged image through the local features.

[0052] In a possible implementation, the processing module 503 is specifically used to input the second bayer graph data into a trained first detection model, and determine whether the first bayer graph data is a forged image through the first detection model; the first detection model is a tree model.

[0053] In a possible implementation, the first detection model is an xgboost model; positive samples used by the first detection model during training include public bayer graph data and bayer graph data collected by a camera device.

[0054] In one possible implementation, the image input format is BGGR; the conversion module 502 is specifically used to, if the format of the bayer graph data is GBRG, delete the data of the leftmost column of pixels in the bayer graph data; if the format of the bayer graph data is GRBG, delete the data of the top row of pixels in the bayer graph data; if the format of the bayer graph data is RGGB, delete the data of the leftmost column of pixels and the data of the top row of pixels in the bayer graph data.

[0055] In a possible implementation, the device is used to detect a living object, the acquisition module 501 is further used to acquire a third RGB image generated by the first bayer image data, and the processing module 503 is further used to input the third RGB image into a second detection model to determine whether the third RGB image is a forged image; if neither the first bayer image data nor the third RGB image is forged, it is determined that the object of the image acquisition is a living object.

[0056] Figure 6 FIG. 6 is a schematic diagram of a device 6000 for detecting forged images provided in an embodiment of the present application. Figure 6 As shown, it includes at least one processor 601 and a memory 602 connected to the at least one processor 601. The specific connection medium between the processor 601 and the memory 602 is not limited in the embodiment of the present application. Figure 6For example, the processor 601 and the memory 602 are connected via a bus. The bus can be divided into an address bus, a data bus, a control bus, etc.

[0057] In the embodiment of the present application, the memory 602 stores instructions that can be executed by at least one processor 601 , and the at least one processor 601 can implement the steps of the above-mentioned method for detecting forged images by executing the instructions stored in the memory 602 .

[0058] The processor 601 is the control center of the computer device, and can use various interfaces and lines to connect various parts of the computer device, and perform resource settings by running or executing instructions stored in the memory 602 and calling data stored in the memory 602. Optionally, the processor 601 may include one or more processing units, and the processor 601 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 601. In some embodiments, the processor 601 and the memory 602 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on independent chips.

[0059] Processor 601 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware processor for execution, or can be executed by a combination of hardware and software modules in the processor.

[0060] The memory 602 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 602 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 602 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 602 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.

[0061] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0062] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0063] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0064] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0065] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A method for detecting forged images, characterized in that: The method comprises: Obtain the first Bayer image data collected by the sensor through the interface call; Convert the first bayer graph data into second bayer graph data in a preset format, wherein the preset format is any one of blue-green-green-red BGGR, green-blue-red-green GBRG, green-red-blue-green GRBG, and red-green-green-blue RGGB; Perform local feature extraction on the second bayer graph data, and determine whether the first bayer graph data is a forged image based on the local features.

2. The method according to claim 1, characterized in that Extracting local features from the second bayer graph data, and determining whether the bayer graph data is a forged image based on the local features, includes: The second bayer graph data is input into a trained first detection model, and whether the first bayer graph data is a forged image is determined by the first detection model; the first detection model is a tree model.

3. The method according to claim 2, characterized in that The negative samples used by the first detection model in the training process are obtained in the following manner, including: Performing forgery processing on the first red, green and blue (RGB) image to obtain a second RGB image; The second RGB image is inversely reconstructed to obtain Bayer graph data as a negative sample.

4. The method according to claim 2, characterized in that: The first detection model is an xgboost model; The positive samples used by the first detection model during the training process include public Bayer graph data and Bayer graph data collected by a camera device.

5. The method according to any one of claims 1 to 4, characterized in that The image input format is BGGR; converting the bayer graph data into an image input format corresponding to a living body detection model includes: If the format of the bayer graph data is GBRG, then deleting the data of the leftmost column of pixels in the bayer graph data; If the format of the Bayer graph data is GRBG, then deleting the data of the top row of pixels in the Bayer graph data; If the format of the bayer graph data is RGGB, the data of the leftmost column of pixels and the data of the topmost row of pixels in the bayer graph data are deleted.

6. The method according to any one of claims 1 to 4, characterized in that The method is used to detect a living object, and the method further comprises: Obtaining a third RGB image generated by the first bayer graph data, inputting the third RGB image into a second detection model, and determining whether the third RGB image is a forged image; If the first bayer graph data and the third RGB image are not forged, it is determined that the object of image acquisition is a living object.

7. A device for detecting forged images, characterized in that: The device comprises: An acquisition module is used to acquire the first Bayer image data collected by the sensor through an interface call; a conversion module, configured to convert the first bayer graph data into second bayer graph data in a preset format, wherein the preset format is any one of blue-green-green-red BGGR, green-blue-red-green GBRG, green-red-blue-green GRBG, and red-green-green-blue RGGB; A processing module is used to extract local features from the second bayer graph data, and determine whether the first bayer graph data is a forged image through the local features.

8. A device for detecting forged images, characterized in that: include: Memory, used to store computer programs or instructions; A processor, configured to call a computer program or instruction stored in the memory to execute the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when a computer reads and executes the instructions, the computer executes the method according to any one of claims 1 to 6.

10. A computer program product, characterized in that The computer program product stores instructions, and when a computer reads and executes the instructions, the computer performs the method according to any one of claims 1 to 6.