Data processing method and apparatus

By acquiring the residual information of the image and the frequency-space feature extraction module, the problem of difficult detection of generative image tampering is solved, accurate tamper detection and positioning is achieved, and the robustness and generalization ability of the detection algorithm are enhanced.

WO2025167446A1PCT designated stage Publication Date: 2025-08-14HUAWEI TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/071256
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-02-05
Filing Date
2025-01-08
Publication Date
2025-08-14

AI Technical Summary

Technical Problem

The existing image tamper detection methods are difficult to effectively identify generative image tampering, especially the tampering results brought by the generative model are realistic and difficult to detect.

Method used

By acquiring residual information of the image, using the first network to predict the difference after image editing, and combining the frequency-space feature extraction module, a prediction model is designed for tamper detection and positioning.

Benefits of technology

Accurate detection and positioning of generative image tampering is realized, and the robustness and generalization ability of the detection algorithm are enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025071256_14082025_PF_FP_ABST
    Figure CN2025071256_14082025_PF_FP_ABST
Patent Text Reader

Abstract

A data processing method, applied to the field of artificial intelligence, and comprising: acquiring an image; predicting residual information of the image by means of a first network, the residual information being prediction of the residual between an original image and the image when the image is an image obtained by performing image editing on the original image; and obtaining target information by means of a predictive model on the basis of the image and the residual information, the target information being used for indicating whether the image has undergone image editing or an editing area where image editing has been performed. According to the present application, the residual information obtained by using the first network can be described as a mapping paradigm before and after image editing, the residual information can indicate the process of mapping the original image to a target domain of a generative model in image editing performed by means of the generative model, and the residual information can be used as prior input into the prediction network, so that detection and positioning of image editing can be achieved.
Need to check novelty before this filing date? Find Prior Art

Description

A data processing method and device thereof

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on February 5, 2024, with application number 202410168586.6 and application name “A data processing method and device thereof”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of artificial intelligence, and in particular to a data processing method and device thereof. Background Art

[0003] Artificial Intelligence (AI) is the theory, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a branch of computer science that seeks to understand the essence of intelligence and develop new intelligent machines that can respond in a manner similar to human intelligence. AI also studies the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making.

[0004] Images are one of the most important information transmission media in modern society and are widely disseminated on public platforms such as news and social media. However, due to the existence of image editing (such as image tampering), the authenticity of images cannot be guaranteed. Traditional image tampering methods, such as seam cropping, will leave pixel-level tampering traces. Therefore, most traditional tampering detection methods achieve tampering detection by detecting "traces". With the development of AIGC, generative image tampering is very common. Compared with traditional tampering seam cropping, the tampering results of the generative model are more realistic and therefore more difficult to detect. Generative image tampering is very common, but detection algorithms are still lacking.

[0005] Therefore, there is an urgent need for a detection method to determine whether an image has been edited. Summary of the Invention

[0006] In a first aspect, the present application provides a data processing method, comprising: acquiring an image; predicting residual information of the image through a first network; the residual information is a prediction of the residual between the original image and the image when the image is an image obtained by image editing of the original image; and obtaining target information through a prediction model based on the image and the residual information, the target information being used to indicate whether the image has undergone image editing or the editing area where the image has undergone image editing.

[0007] In an embodiment of the present application, the residual information obtained using the first network can be described as a mapping paradigm before and after image editing. Since in image editing performed by a generative model, the residual information can indicate the process of mapping the original image to the target domain of the generative model, the residual information can be used as a priori input into the prediction network, thereby realizing the detection and positioning of image editing.

[0008] In one possible implementation, image editing may be image tampering, for example, image tampering may include, but is not limited to, image format conversion, Gaussian blurring, seam cropping, modification using a GAN network, etc. For example, seam cropping may specifically involve replacing the content of part or all of the main area of ​​the image.

[0009] In one possible implementation, the prediction model includes: a feature extraction network, the feature extraction network includes a pooling module; the pooling module is used to perform pooling operations on input features at multiple scales, and fuse the pooling operation results of the multiple scales to obtain a fusion result.

[0010] The embodiment of the present application proposes a multi-scale feature difference modeling module for modeling the difference between the tampered area and the real area to enhance the features and obtain more accurate results.

[0011] In a possible implementation, the pooling module is further used to perform average pooling or maximum pooling on the input features, and to fuse the average pooling or maximum pooling result with the fusion result.

[0012] In one possible implementation, the prediction model includes: a feature extraction network, the feature extraction network includes a sub-feature extraction module, the sub-feature extraction module is used to extract features of the input in the frequency domain and space, obtain frequency domain features and spatial domain features, and fuse the frequency domain features and the spatial domain features.

[0013] The traditional frequency domain extraction method has no significant effect when applied to generative tampering. In addition, the size of the tampered area of ​​the generative model varies greatly, and the existing solutions have not designed corresponding processing methods for tampering of extreme scales. The above situation causes the existing traditional tampering detection algorithm to perform poorly in the generative tampering scenario. In other words, the characteristics of the generative model, such as frequency domain and spatial domain features, are difficult to be discovered. In addition, the size of the tampered area caused by the generative model varies greatly. In response to the above problems, the embodiment of the present application proposes a frequency-space domain feature extraction module. The dual branches extract the learnable features of the frequency domain and the spatial domain respectively as a supplement to the information, and capture the traces of tampering in multiple domains. Taking these characteristics into consideration, the embodiment of the present application designs a frequency-space domain feature extraction module. The dual branches extract the learnable features of the frequency domain and the spatial domain respectively as a supplement to the information, and capture the traces of tampering in multiple domains, helping to achieve more accurate tampering area positioning.

[0014] In a possible implementation, the method further includes: obtaining a first image sample and a second image sample; the second image sample is obtained after image editing the first image sample; and using the residual information between the second image sample and the first image sample as a label of the first image sample to train a second network to obtain the first network.

[0015] In one possible implementation, obtaining the second image sample includes: determining a prompt based on the first image sample and the first category of the subject included in the first image sample, the prompt indicating determining a replacement category for the subject whose category is the first category in the first image sample; determining, based on the prompt, through a language model, that the replacement category for the subject whose category is the first category in the first image sample is a second category; and obtaining the second image sample through a generation model based on the second category and the first image sample.

[0016] Existing generative tampering methods do not have a standardized automatic data generation method, which makes it impossible to train deep learning models. In response to the above problems, the embodiments of the present application propose a method for automatically generating generative tampering data, which can automatically and quickly generate tampering data without human intervention, filling the problem of data shortage in this field. In addition, the present invention constructs a reasonable training framework, applies generative tampering to real images, and combines blending of original and generated images with mixed rendering and multiple degradation methods to enhance the generalization and robustness of the model.

[0017] In a second aspect, the present application provides a data processing device, comprising:

[0018] An acquisition module, used for acquiring images;

[0019] A processing module is configured to predict residual information of the image through a first network; the residual information is a prediction of the residual between the original image and the image when the image is an image obtained by image editing of the original image; and target information is obtained through a prediction model based on the image and the residual information, the target information being used to indicate whether the image has been image edited or the editing area where the image has been edited.

[0020] In a possible implementation, the image editing specifically involves replacing the content of part or all of the main area of ​​the image.

[0021] In one possible implementation, the prediction model includes: a feature extraction network, the feature extraction network includes a pooling module; the pooling module is used to perform pooling operations on input features at multiple scales, and fuse the pooling operation results of the multiple scales to obtain a fusion result.

[0022] In a possible implementation, the pooling module is further used to perform average pooling or maximum pooling on the input features, and to fuse the average pooling or maximum pooling result with the fusion result.

[0023] In one possible implementation, the prediction model includes: a feature extraction network, the feature extraction network includes a sub-feature extraction module, the sub-feature extraction module is used to extract features of the input in the frequency domain and space, obtain frequency domain features and spatial domain features, and fuse the frequency domain features and the spatial domain features.

[0024] In a possible implementation, the apparatus further includes:

[0025] A training module is configured to obtain a first image sample and a second image sample; the second image sample is obtained by editing the first image sample;

[0026] The residual information between the second image sample and the first image sample is used as a label of the first image sample, and the second network is trained to obtain the first network.

[0027] In a possible implementation, the training module is specifically used to:

[0028] Determining a prompt according to the first image sample and a first category of a subject included in the first image sample, wherein the prompt indicates determining a replacement category of the subject in the first image sample whose category is the first category;

[0029] According to the prompt, determining, through a language model, that a replacement category of the subject of the first category in the first image sample is a second category;

[0030] The second image sample is obtained by generating a model according to the second category and the first image sample.

[0031] In a third aspect, an embodiment of the present application provides a data processing device, which may include a memory, a processor, and a bus system, wherein the memory is used to store programs, and the processor is used to execute the programs in the memory to perform the first aspect and any optional method thereof.

[0032] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer executes the above-mentioned first aspect and any optional method thereof.

[0033] In a fifth aspect, an embodiment of the present application provides a computer program, which, when executed on a computer, enables the computer to execute the above-mentioned first aspect and any optional method thereof.

[0034] In a sixth aspect, the present application provides a chip system comprising a processor configured to support the execution of a data processing device to implement the functions described in the aforementioned aspects, such as transmitting or processing the data or information described in the aforementioned methods. In one possible design, the chip system further comprises a memory configured to store program instructions and data necessary for executing the device or training the device. The chip system may consist of a single chip or may include a chip and other discrete components. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] FIG1A is a schematic diagram of a structure of an artificial intelligence main framework;

[0036] 1B and 1C are schematic diagrams of the application system framework of the present invention;

[0037] FIG1D is a schematic diagram of an optional hardware structure of a terminal;

[0038] FIG2 is a schematic diagram of the structure of a server;

[0039] FIG3 is a schematic diagram of a system architecture of the present application;

[0040] Figure 4 shows a process of cloud services;

[0041] FIG5 is a flowchart of a data processing method provided in an embodiment of the present application;

[0042] FIG6 is a schematic diagram of a data processing method provided in an embodiment of the present application;

[0043] FIG7 is a schematic diagram of a data processing method provided in an embodiment of the present application;

[0044] FIG8 is a schematic diagram of an image before and after editing provided by an embodiment of the present application;

[0045] FIG9A is a schematic diagram of a data processing method provided in an embodiment of the present application;

[0046] FIG9B is a schematic diagram of an effect provided by an embodiment of the present application;

[0047] FIG10 is a schematic structural diagram of a data processing device provided in an embodiment of the present application;

[0048] FIG11 is a schematic diagram of the structure of an execution device provided in an embodiment of the present application;

[0049] FIG12 is a schematic diagram of a structure of a training device provided in an embodiment of the present application;

[0050] FIG13 is a schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION

[0051] The following describes the embodiments of the present invention in conjunction with the accompanying drawings. The terms used in the embodiments of the present invention are only used to explain the specific embodiments of the present invention, and are not intended to limit the present invention.

[0052] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0053] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, and this is merely a way of distinguishing the objects of the same attributes when describing them in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0054] As used herein, the terms "substantially," "about," and similar terms are used as terms of approximation, not as terms of degree, and are intended to take into account the inherent variations in measurements or calculations that one of ordinary skill in the art would recognize. Furthermore, the use of "may" when describing embodiments of the present invention refers to "one or more possible embodiments." As used herein, the terms "use," "using," and "used" may be considered synonymous with the terms "utilize," "utilizing," and "utilized," respectively. Additionally, the term "exemplary" is intended to refer to an example or illustration.

[0055] First, let's describe the overall workflow of an AI system. See Figure 1A, which shows a schematic diagram of the main AI framework. This AI framework will be explained from two perspectives: the "intelligent information chain" (horizontal axis) and the "IT value chain" (vertical axis). The "intelligent information chain" reflects the entire process from data acquisition to processing. For example, it could be the general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, and intelligent execution and output. Throughout this process, data undergoes a condensed journey from "data-information-knowledge-wisdom." The "IT value chain," spanning the underlying infrastructure of human intelligence, information (provided and processed by technology), and the system's industrial ecosystem, reflects the value that AI brings to the information technology industry.

[0056] (1) Infrastructure

[0057] Infrastructure provides computing power for AI systems, enabling communication with the outside world and supporting this through a foundational platform. External communication occurs through sensors; computing power is provided by intelligent chips (CPUs, NPUs, GPUs, ASICs, FPGAs, and other hardware accelerators). The foundational platform includes a distributed computing framework and network-related platform guarantees and support, including cloud storage and computing, and interconnected networks. For example, sensors communicate with the outside world to acquire data, which is then fed into the intelligent chips within the distributed computing system provided by the foundational platform for computation.

[0058] (2) Data

[0059] Data above the infrastructure layer represents data sources for AI. This data includes graphics, images, voice, and text, as well as IoT data from traditional devices. This includes business data from existing systems and sensor data such as force, displacement, liquid level, temperature, and humidity.

[0060] (3) Data processing

[0061] Data processing generally includes data training, machine learning, deep learning, search, reasoning, decision-making, etc.

[0062] Among them, machine learning and deep learning can symbolize and formalize data for intelligent information modeling, extraction, preprocessing, and training.

[0063] Reasoning refers to the process of simulating human intelligent reasoning in computers or intelligent systems, using formalized information to perform machine thinking and solve problems based on reasoning control strategies. Typical functions are search and matching.

[0064] Decision-making refers to the process of making decisions after intelligent information is reasoned, and usually provides functions such as classification, sorting, and prediction.

[0065] (4) General ability

[0066] After the data has undergone the data processing mentioned above, some general capabilities can be further formed based on the results of the data processing, such as algorithms or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.

[0067] (5) Smart products and industry applications

[0068] Smart products and industry applications refer to the products and applications of artificial intelligence systems in various fields. They are the encapsulation of the overall artificial intelligence solution, which productizes intelligent information decision-making and realizes practical application. Its application areas mainly include: smart terminals, smart transportation, smart medical care, autonomous driving, smart cities, etc.

[0069] First, we will introduce the application scenarios of this application. This application can be applied to, but is not limited to, applications with image editing and recognition functions or cloud services provided by cloud-side servers. The following are introduced separately:

[0070] 1. Image Editing and Recognition Applications

[0071] The product form of the embodiment of the present application can be an image editing and recognition application. The image editing and recognition application can be run on a terminal device or a cloud-side server.

[0072] Among them, the image editing recognition in the embodiment of the present application can be based on the input image to determine whether the image has undergone an editing operation or the image area of ​​the editing operation.

[0073] In a possible implementation, an image editing and recognition application can implement an image editing and recognition task and obtain a processing result.

[0074] For example, an image edit recognition application may implement at least an image edit recognition task based on a diffusion method, but is not limited thereto.

[0075] In one possible implementation, a user may open an image editing and recognition application installed on a terminal device and input image data. The image editing and recognition application may process the image data using a model trained using the method provided in an embodiment of the present application or using the method provided in an embodiment of the present application, and present the processing results (whether the image has undergone an editing operation or an editing operation on the image area) to the user (the presentation method may be, but is not limited to, display, playback, saving, uploading to the cloud, etc.).

[0076] In one possible implementation, a user can open an image editing and recognition application installed on a terminal device and input image data. The image editing and recognition application can send the image data to a server on the cloud side. The server on the cloud side processes the image data using a model trained using the method provided in an embodiment of the present application, and transmits the processing results back to the terminal device. The terminal device can present the processing results to the user (the presentation method can be, but is not limited to, display, playback, saving, uploading to the cloud side, etc.).

[0077] Next, the image editing and recognition application in the embodiment of this application is introduced from the perspective of functional architecture and product architecture that implements the functions.

[0078] Referring to FIG. 1B , FIG. 1B is a schematic diagram of the functional architecture of an image editing and recognition application in an embodiment of the present application:

[0079] In one possible implementation, as shown in FIG1B , an image editing and recognition application 102 may receive input parameters 101 (e.g., including image data) and generate processing results 103. The image editing and recognition application 102 may be executed on (for example) at least one computer system and include computer code that, when executed by one or more computers, causes the computers to execute a model trained using the method provided in the embodiments of the present application.

[0080] Referring to FIG. 1C , FIG. 1C is a schematic diagram of the physical architecture of an image editing and recognition application program according to an embodiment of the present application:

[0081] Referring to FIG1C , FIG1C shows a schematic diagram of a system architecture. The system may include a terminal 100 and a server 200. The server 200 may include one or more servers (FIG1C illustrates one server as an example). The server 200 may provide image editing recognition or natural language generation functions for one or more terminals.

[0082] Among them, the terminal 100 can be installed with an image editing and recognition application, or open a web page related to the image editing and recognition or natural language generation function. The above application and web page can provide an interface. The terminal 100 can receive the relevant parameters entered by the user on the image editing and recognition or natural language generation function interface, and send the above parameters to the server 200. The server 200 can obtain the processing results based on the received parameters and return the processing results to the terminal 100.

[0083] It should be understood that in some optional implementations, the terminal 100 can also complete the action of obtaining the processing result based on the received parameters by itself without the need for the cooperation of the server, and the embodiments of the present application are not limited to this.

[0084] Next, the product form of the terminal 100 in FIG1C is described;

[0085] The terminal 100 in the embodiment of the present application can be a mobile phone, a tablet computer, a wearable device, an in-vehicle device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., and the embodiment of the present application does not impose any restrictions on this.

[0086] FIG1D shows a schematic diagram of an optional hardware structure of the terminal 100 .

[0087] 1D , the terminal 100 may include components such as a radio frequency unit 110, a memory 120, an input unit 130, a display unit 140, a camera 150 (optional), an audio circuit 160 (optional), a speaker 161 (optional), a microphone 162 (optional), a processor 170, an external interface 180, and a power supply 190. Those skilled in the art will appreciate that FIG1D is merely an example of a terminal or multi-function device and does not limit the terminal or multi-function device. The terminal or multi-function device may include more or fewer components than shown, or may combine certain components or have different components.

[0088] The input unit 130 can be used to receive input digital or character information and generate key signal input related to user settings and function control of the portable multifunction device. Specifically, the input unit 130 may include a touch screen 131 (optional) and / or other input devices 132. The touch screen 131 can detect user touch operations on or near it (for example, operations performed on or near the touch screen using a finger, joint, stylus, or any other suitable object) and drive corresponding connected devices according to pre-set programs. The touch screen can detect user touch actions on the touch screen, convert the touch actions into touch signals and transmit them to the processor 170. It can also receive and execute commands sent by the processor 170; the touch signals include at least touch point coordinate information. The touch screen 131 provides an input interface and an output interface between the terminal 100 and the user. Touch screens can be implemented using various types, including resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch screen 131, the input unit 130 may also include other input devices. Specifically, the other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.

[0089] Among them, other input devices 132 can receive input image data or text data.

[0090] The display unit 140 may be used to display information input by or provided to the user, various menus of the terminal 100, interactive interfaces, file display, and / or playback of any multimedia file. In an embodiment of the present application, the display unit 140 may be used to display the interface and processing results of an image editing and recognition application.

[0091] Memory 120 can be used to store instructions and data. It primarily includes an instruction storage area and a data storage area. The data storage area can store various data, such as multimedia files and text. The instruction storage area can store software units such as the operating system, applications, and instructions required for at least one function, or subsets or extensions thereof. It may also include non-volatile random access memory (RAM). It provides processor 170 with management functions for the hardware, software, and data resources within the computing and processing device, supporting control software and applications. It is also used to store multimedia files and running programs and applications.

[0092] The processor 170 is the control center of the terminal 100. It connects all components of the terminal 100 using various interfaces and circuits. By executing instructions stored in the memory 120 and accessing data stored therein, it executes various functions of the terminal 100 and processes data, thereby providing overall control of the terminal device. Optionally, the processor 170 may include one or more processing units. Preferably, the processor 170 may integrate an application processor and a modem processor, with the application processor primarily processing the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into the processor 170. In some embodiments, the processor and memory may be implemented on a single chip; in other embodiments, they may be implemented on separate chips. The processor 170 may also generate corresponding operational control signals and send them to the corresponding components of the computing and processing device. It may also read and process data in the software, particularly the data and programs in the memory 120, to enable the various functional modules therein to perform their corresponding functions, thereby controlling the corresponding components to operate as instructed.

[0093] Among them, the memory 120 can be used to store software codes related to the data processing method, the processor 170 can execute the steps of the chip's data processing method, and can also schedule other units (such as the above-mentioned input unit 130 and display unit 140) to achieve corresponding functions.

[0094] The RF unit 110 (optional) can be used to send and receive information or receive and send signals during a call. For example, after receiving downlink information from the base station, it is passed to the processor 170 for processing; in addition, it sends the designed uplink data to the base station. Generally, the RF circuit includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF unit 110 can also communicate with network devices and other devices via wireless communication. This wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.

[0095] In this embodiment of the present application, the RF unit 110 may send image data or text data to the server 200 and receive a processing result sent by the server 200.

[0096] It should be understood that the radio frequency unit 110 is optional and can be replaced by other communication interfaces, such as a network port.

[0097] The terminal 100 also includes a power supply 190 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 170 through a power management system, thereby managing functions such as charging, discharging, and power consumption through the power management system.

[0098] The terminal 100 further includes an external interface 180 , which may be a standard Micro USB interface or a multi-pin connector, and may be used to connect the terminal 100 to other devices for communication, or to connect a charger to charge the terminal 100 .

[0099] Although not shown, the terminal 100 may also include a flash, a wireless fidelity (WiFi) module, a Bluetooth module, sensors with different functions, etc., which are not described in detail here. Some or all of the methods described below may be applied to the terminal 100 shown in FIG1D .

[0100] Next, the product form of the server 200 in FIG1C is described;

[0101] FIG2 provides a schematic diagram of the structure of a server 200. As shown in FIG2, the server 200 includes a bus 201, a processor 202, a communication interface 203, and a memory 204. The processor 202, the memory 204, and the communication interface 203 communicate with each other via the bus 201.

[0102] Bus 201 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. Buses can be categorized as address buses, data buses, and control buses. For ease of illustration, FIG2 shows only one thick line, but this does not imply that there is only one bus or only one type of bus.

[0103] The processor 202 may be any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0104] The memory 204 may include volatile memory, such as random access memory (RAM). The memory 204 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard drive (HDD), or solid state drive (SSD).

[0105] The memory 204 may be used to store software codes related to the data processing method, and the processor 202 may execute the steps of the data processing method of the chip, and may also schedule other units to implement corresponding functions.

[0106] It should be understood that the above-mentioned terminal 100 and server 200 can be centralized or distributed devices, and the processors in the above-mentioned terminal 100 and server 200 (such as processor 170 and processor 202) can be hardware circuits (such as application specific integrated circuit (ASIC), field-programmable gate array (FPGA), general-purpose processor, digital signal processor (DSP), microprocessor or microcontroller, etc.), or a combination of these hardware circuits. For example, the processor can be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.

[0107] It should be understood that the steps related to the model reasoning process in the embodiments of this application involve AI-related operations. When performing AI operations, the instruction execution architecture of the terminal device and server is not limited to the processor-memory architecture described above. The system architecture provided in the embodiments of this application is described in detail below with reference to Figure 3.

[0108] FIG3 is a schematic diagram of the system architecture provided by an embodiment of the present application. As shown in FIG3 , the system architecture 500 includes an execution device 510 , a training device 520 , a database 530 , a client device 540 , a data storage system 550 , and a data acquisition system 560 .

[0109] The execution device 510 includes a calculation module 511, an I / O interface 512, a pre-processing module 513, and a post-processing module 514. The calculation module 511 may include the target model / rule 501, and the pre-processing module 513 and the post-processing module 514 are optional.

[0110] The execution device 510 may be a terminal device or a server that runs the above-mentioned image editing and recognition application.

[0111] The data acquisition device 560 is used to collect training samples. The training samples can be image data, etc. After collecting the training samples, the data acquisition device 560 stores these training samples in the database 530.

[0112] The training device 520 can train the neural network to be trained (such as the prediction model in the embodiment of the present application, etc.) based on the training samples maintained in the database 530 to obtain the target model / rule 501.

[0113] It should be understood that the training device 520 can perform a pre-training process on the neural network to be trained based on the training samples maintained in the database 530, or fine-tune the model based on the pre-training.

[0114] It should be noted that, in actual applications, the training samples maintained in the database 530 may not all be collected by the data acquisition device 560, but may also be received from other devices. It should also be noted that the training device 520 may not train the target model / rule 501 entirely based on the training samples maintained in the database 530, but may also obtain training samples from the cloud or other places for model training. The above description should not be used as a limitation on the embodiments of the present application.

[0115] The target model / rule 501 obtained through training with the training device 520 can be applied to different systems or devices, such as the execution device 510 shown in FIG3 . The execution device 510 can be a terminal, such as a mobile phone terminal, a tablet computer, a laptop computer, an augmented reality (AR) / virtual reality (VR) device, an in-vehicle terminal, etc., or a server, etc.

[0116] Specifically, the training device 520 may transfer the trained model to the execution device 510 .

[0117] In Figure 3, the execution device 510 is configured with an input / output (I / O) interface 512 for data interaction with external devices. The user can input data (such as image data in the embodiment of the present application) to the I / O interface 512 through the client device 540.

[0118] Preprocessing module 513 and preprocessing module 514 are used to preprocess the input data received by I / O interface 512. It should be understood that preprocessing module 513 and preprocessing module 514 may be absent or only one preprocessing module may be present. If preprocessing module 513 and preprocessing module 514 are absent, computing module 511 may be used directly to process the input data.

[0119] When the execution device 510 preprocesses the input data, or when the computing module 511 of the execution device 510 performs calculations and other related processing, the execution device 510 can call the data, code, etc. in the data storage system 550 for corresponding processing, and can also store the data, instructions, etc. obtained from the corresponding processing in the data storage system 550.

[0120] Finally, the I / O interface 512 provides the processed results to the client device 540 and thus to the user.

[0121] In the scenario shown in FIG3 , the user can manually input data, and this "manual input data" can be operated through the interface provided by I / O interface 512. In another scenario, client device 540 can automatically send input data to I / O interface 512. If user authorization is required for client device 540 to automatically send input data, the user can set the corresponding permissions in client device 540. The user can view the results output by execution device 510 on client device 540, and the specific presentation form can be a display, sound, action, or other specific method. Client device 540 can also serve as a data acquisition terminal, collecting input data input into I / O interface 512 and output results output from I / O interface 512 as new sample data, and storing them in database 530. Of course, collection can also be performed without client device 540, and instead the I / O interface 512 directly stores the input data input into I / O interface 512 and output results output from I / O interface 512 as new sample data in database 530.

[0122] It is worth noting that FIG3 is merely a schematic diagram of a system architecture provided by an embodiment of the present application, and the positional relationships between the devices, components, modules, etc. shown in the figure do not constitute any limitation. For example, in FIG3 , the data storage system 550 is an external memory relative to the execution device 510. In other cases, the data storage system 550 can also be placed in the execution device 510. It should be understood that the execution device 510 can be deployed in the client device 540.

[0123] From the inference side of the model:

[0124] In the embodiment of the present application, the computing module 511 of the above-mentioned execution device 510 can obtain the code stored in the data storage system 550 to implement the steps related to the model reasoning process in the embodiment of the present application.

[0125] In an embodiment of the present application, the computing module 511 of the execution device 510 may include a hardware circuit (such as an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a general-purpose processor, a digital signal processor (DSP), a microprocessor or a microcontroller, etc.), or a combination of these hardware circuits. For example, the training device 520 may be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.

[0126] Specifically, the computing module 511 of the execution device 510 can be a hardware system with an execution instruction function, and the steps related to the model reasoning process provided in the embodiment of the present application can be software codes stored in the memory. The computing module 511 of the execution device 510 can obtain the software code from the memory and execute the obtained software code to implement the steps related to the model reasoning process provided in the embodiment of the present application.

[0127] It should be understood that the computing module 511 of the execution device 510 can be a combination of a hardware system that does not have the function of executing instructions and a hardware system that has the function of executing instructions. Some of the steps related to the model reasoning process provided in the embodiment of the present application can also be implemented by the hardware system that does not have the function of executing instructions in the computing module 511 of the execution device 510, which is not limited here.

[0128] From the training side of the model:

[0129] In an embodiment of the present application, the above-mentioned training device 520 can obtain the code stored in the memory (not shown in Figure 3, which can be integrated into the training device 520 or deployed separately from the training device 520) to implement the steps related to model training in the embodiment of the present application.

[0130] In an embodiment of the present application, the training device 520 may include a hardware circuit (such as an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a general-purpose processor, a digital signal processor (DSP), a microprocessor or a microcontroller, etc.), or a combination of these hardware circuits. For example, the training device 520 may be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.

[0131] It should be understood that the training device 520 can be a combination of a hardware system that does not have the function of executing instructions and a hardware system that has the function of executing instructions. Some of the steps related to model training provided in the embodiments of the present application can also be implemented by the hardware system in the training device 520 that does not have the function of executing instructions, which is not limited here.

[0132] 3. Image editing and recognition cloud services provided by the server:

[0133] In a possible implementation, the server may provide the image editing and recognition function service to the terminal side through an application programming interface (API).

[0134] Among them, the terminal device can send relevant parameters (such as images and other data) to the server through the API provided by the cloud. The server can obtain processing results based on the received parameters, etc., and return the processing results to the terminal.

[0135] The description of the terminal and the server can be the same as that of the above embodiments, and will not be repeated here.

[0136] FIG4 shows a process of using a cloud service of image editing and recognition function provided by a cloud platform.

[0137] 1. Activate and purchase the image editing and recognition service.

[0138] 2. Users can download the software development kit (SDK) corresponding to the image editing and recognition service. Cloud platforms usually provide multiple development versions of the SDK for users to choose according to the needs of the development environment, such as JAVA version SDK, Python version SDK, PHP version SDK, Android version SDK, etc.

[0139] 3. After the user downloads the corresponding version of the SDK to the local computer as needed, import the SDK project into the local development environment, configure and debug it in the local development environment. The local development environment can also be used to develop other functions, forming an application that integrates image editing and recognition capabilities.

[0140] 4. When an image editing and recognition application is used and needs to perform image editing and recognition, it can trigger an API call for this function. When the application triggers this function, it initiates an API request to a running instance of the image editing and recognition service in the cloud environment. The API request carries the image data, and the running instance in the cloud environment processes the image and obtains the processing result.

[0141] 5. The cloud environment returns the processing results to the application, thereby completing a call to the image editing and recognition function.

[0142] Since the embodiments of the present application involve the application of a large number of neural networks, in order to facilitate understanding, the relevant terms and related concepts such as neural networks involved in the embodiments of the present application are first introduced below.

[0143] (1) Neural Network

[0144] A neural network can be composed of neural units. A neural unit can refer to an operation unit that takes xs (i.e., input data) and intercept 1 as input. The output of the operation unit can be:

[0145] Where s = 1, 2, ... n, n is a natural number greater than 1, Ws is the weight of xs, and b is the bias of the neural unit. f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal of the neural unit into the output signal. The output signal of the activation function can be used as the input of the next convolutional layer, and the activation function can be a sigmoid function. A neural network is a network formed by connecting multiple single neural units mentioned above, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract the features of the local receptive field. The local receptive field can be an area composed of several neural units.

[0146] (2) Convolutional neural network (CNN) is a deep neural network with a convolutional structure. Convolutional neural network contains a feature extractor consisting of a convolution layer and a subsampling layer, which can be regarded as a filter. The convolution layer refers to the neuron layer in the convolutional neural network that performs convolution processing on the input signal. In the convolution layer of the convolutional neural network, a neuron can only be connected to some neurons in the adjacent layer. A convolution layer usually contains several feature planes, and each feature plane can be composed of some rectangularly arranged neural units. The neural units in the same feature plane share weights, and the shared weights here are convolution kernels. Shared weights can be understood as the way of extracting features is independent of position. The convolution kernel can be formalized as a matrix of random size, and the convolution kernel can obtain reasonable weights through learning during the training process of the convolutional neural network. In addition, the direct benefit of shared weights is to reduce the connections between the layers of the convolutional neural network, while reducing the risk of overfitting.

[0147] CNN is a very common neural network. As mentioned in the basic concepts introduction above, a convolutional neural network is a deep neural network with a convolutional structure. It is a deep learning architecture. Deep learning architecture refers to the use of machine learning algorithms to perform multiple levels of learning at different levels of abstraction. As a deep learning architecture, CNN is a feed-forward artificial neural network. Each neuron in the feed-forward artificial neural network can respond to the image input.

[0148] (3) Deep Neural Networks

[0149] Deep Neural Network (DNN), also known as multi-layer neural network, can be understood as a neural network with many hidden layers. There is no special metric for "many" here. Based on the position of different layers in DNN, the neural network inside DNN can be divided into three categories: input layer, hidden layer, and output layer. Generally speaking, the first layer is the input layer, the last layer is the output layer, and the layers in between are all hidden layers. The layers are fully connected, that is, any neuron in the i-th layer must be connected to any neuron in the i+1-th layer. Although DNN looks complicated, the work of each layer is actually not complicated. Simply put, it is the following linear relationship expression: in, is the input vector, is the output vector, is the offset vector, W is the weight matrix (also called coefficient), and α() is the activation function. Each layer is just an input vector After such a simple operation, the output vector Since there are many DNN layers, the coefficient W and the offset vector The definition of these parameters in DNN is as follows: Take the coefficient W as an example: Assume that in a three-layer DNN, the linear coefficient from the 4th neuron in the second layer to the 2nd neuron in the third layer is defined as The superscript 3 represents the layer number of the coefficient W, while the subscript corresponds to the output of the third layer index 2 and the input of the second layer index 4. In summary, the coefficient from the kth neuron in the L-1th layer to the jth neuron in the Lth layer is defined as It's important to note that the input layer has no W parameter. In deep neural networks, more hidden layers allow the network to better capture complex real-world situations. Theoretically, a model with more parameters has higher complexity and greater "capacity," meaning it can handle more complex learning tasks. Training a deep neural network is essentially the process of learning the weight matrix, with the ultimate goal of obtaining the weight matrices for all layers of a trained deep neural network (a weight matrix formed by the vectors W across many layers).

[0150] (4) Loss function

[0151] During the training of a deep neural network, because we want the output of the deep neural network to be as close as possible to the desired predicted value, we can compare the current network's predicted value with the desired target value and then update the weight vector of each layer of the neural network based on the difference between the two. (Of course, before the first update, there is usually an initialization process, which pre-configures the parameters for each layer in the deep neural network.) For example, if the network's predicted value is too high, the weight vector is adjusted to make it predict a lower value. This adjustment is continued until the deep neural network can predict the desired target value or a value very close to the desired target value. Therefore, it is necessary to predefine "how to compare the difference between the predicted value and the target value." This is the loss function (or objective function), which is an important equation used to measure the difference between the predicted value and the target value. For example, the loss function output value (loss) indicates a greater difference, so training a deep neural network becomes a process of minimizing this loss.

[0152] (5) Backpropagation algorithm

[0153] The back propagation (BP) algorithm can be used to correct the size of the initial model parameters during training, reducing the model's error loss. Specifically, forward propagation of the input signal to the output generates error loss. This error loss information is then backpropagated to update the parameters in the initial model, thereby converging the error loss. The BP algorithm is a backward propagation movement driven by error loss, aiming to obtain optimal model parameters, such as the weight matrix.

[0154] (6) Image Manipulation (NeRF): An operation that modifies the original image. Such operations can be: image format conversion, Gaussian blur, seam cropping, modification using GAN network, etc.

[0155] (7) Generated Image Manipulation: Modifying images using generative models.

[0156] (8) Generative AI (Artificial Intelligence Generated Content, AIGC): refers to the technology based on artificial intelligence technical methods such as generative adversarial networks and large pre-trained models, which generates relevant content with appropriate generalization capabilities through learning and recognition of existing data.

[0157] (9) Semantic Mask: The result of semantic segmentation of the input using a semantic segmentation network, usually displayed in the form of a black and white mask.

[0158] (10) Transformer Network

[0159] The transformer network may include an embedding layer and at least one transformer layer, wherein the at least one transformer layer may be N transformer layers (N is an integer greater than 0), wherein each transformer layer includes an attention layer, an add&norm layer, a feedforward layer, and an add&norm layer that are adjacent in sequence. In the embedding layer, the current input is embedded to obtain multiple feature vectors; in the attention layer, P input vectors are obtained from the previous layer of the transformer layer, and with any first input vector among the P input vectors as the center, based on the correlation between each input vector within a preset attention window and the first input vector, an intermediate vector corresponding to the first input vector is obtained, thereby determining the P intermediate vectors corresponding to the P input vectors; in the pooling layer, the P intermediate vectors are merged into Q output vectors, wherein the multiple output vectors obtained by the last transformer layer in at least one transformer layer are used as feature representations of the current input.

[0160] Next, the above steps are introduced in detail with reference to specific examples.

[0161] First, in the embedding layer, the current input is embedded to obtain multiple feature vectors.

[0162] The embedding layer can be called an input embedding layer. The current input can be a text input, for example, a paragraph of text or a sentence. The text can be Chinese text, English text, or text in other languages. After obtaining the current input, the embedding layer can embed each word in the current input to obtain a feature vector for each word. In some embodiments, the embedding layer includes an input embedding layer and a positional encoding layer. In the input embedding layer, word embedding processing can be performed on each word in the current input to obtain a word embedding vector for each word. In the position encoding layer, the position of each word in the current input can be obtained, and then the position vector of each word can be processed. In some examples, the position of each word can be the absolute position of each word in the current input. Taking the current input "How many numbers should I return Huabei" as an example, the position of "how many" can be represented as the first position, the position of "number" can be represented as the second position, and so on. In some examples, the position of each word can be the relative position between each word. Still taking the current input of "On which date should I repay" as an example, the position of "on which date" can be expressed as before "number", the position of "number" can be expressed as after "on which date" and before "should", etc. When the word embedding vector and position vector of each word in the current input are obtained, the position vector of each word and the corresponding word embedding vector can be combined to obtain the feature vector of each word, that is, to obtain multiple feature vectors corresponding to the current input. Multiple feature vectors can be represented as an embedding matrix with a preset dimension. The number of feature vectors in the multiple feature vectors can be set to M, and the preset dimension can be H, so that the multiple feature vectors can be represented as an M×H embedding matrix.

[0163] (11) Attention mechanism

[0164] The attention mechanism mimics the internal process of biological observation behavior, namely, a mechanism that aligns internal experience and external sensations to increase the observation precision of certain areas. It can quickly filter out high-value information from a large amount of information using limited attention resources. The attention mechanism can quickly extract important features from sparse data and is therefore widely used in natural language processing tasks, especially machine translation. The self-attention mechanism is an improvement on the attention mechanism, which reduces dependence on external information and is better at capturing the internal correlation of data or features. The essential idea of ​​the attention mechanism can be rewritten as the following formula:

[0165] Here, Lx = ||Source|| represents the length of the Source. This formula implies that the elements in the Source are imagined to consist of a series of data pairs. Given a Query element in the target, the similarity or correlation between the Query and each Key is calculated to obtain the weight coefficient for each Key's corresponding Value. The weighted sum of the Values ​​is then taken to obtain the final Attention value. Essentially, the Attention mechanism performs a weighted sum of the Values ​​of the Source elements, with the Query and Key used to calculate the weight coefficient for the corresponding Value. Conceptually, Attention can be understood as selectively filtering out a small amount of important information from a large amount of information and focusing on this important information, while ignoring the majority of less important information. This focusing process is reflected in the calculation of the weight coefficients: the larger the weight, the more focus is placed on the corresponding Value. In other words, the weight represents the importance of the information, while the Value represents the corresponding information. The self-attention mechanism can be understood as internal attention. The attention mechanism occurs between the Query element of the Target and all elements of the Source. The self-attention mechanism refers to the attention mechanism that occurs between the internal elements of the Source or the internal elements of the Target. It can also be understood as the attention calculation mechanism in the special case of Target = Source. The specific calculation process is the same, only the calculation object has changed.

[0166] (12) Degradation: Using image processing techniques such as downsampling and JPEG compression to change image quality.

[0167] Images are one of the most important information transmission media in modern society and are widely disseminated on public platforms such as news and social media. However, due to the existence of image editing (such as image tampering), the authenticity of images cannot be guaranteed. Traditional image tampering methods, such as seam cropping, will leave pixel-level tampering traces. Therefore, most traditional tampering detection methods achieve tampering detection by detecting "traces". With the development of AIGC, generative image tampering is very common. Compared with traditional tampering seam cropping, the tampering results of the generative model are more realistic and therefore more difficult to detect. Generative image tampering is very common, but detection algorithms are still lacking.

[0168] Therefore, there is an urgent need for a detection method to determine whether an image has been edited.

[0169] In order to solve the above problems, the present invention provides a data processing method. The data processing method of the present invention is described in detail below with reference to the accompanying drawings.

[0170] Refer to Figure 5, which is a flow chart of a data processing method provided in an embodiment of the present application. As shown in Figure 5, a data processing method provided in an embodiment of the present application may include steps 501 to 503, and these steps are described in detail below.

[0171] 501. Acquire an image.

[0172] In one possible implementation, an image may be an object to be detected to determine whether it has been edited. The image editing may be image tampering. For example, image tampering may include, but is not limited to, image format conversion, Gaussian blurring, seam cropping, and modification using a GAN network. For example, seam cropping may specifically involve replacing the content of part or all of the main area of ​​the image.

[0173] 502. Predict residual information of the image using a first network; the residual information is a prediction of a residual between the original image and the image when the image is an image obtained by image editing of the original image;

[0174] In one possible implementation, the image can be input into a first network (which may also be referred to as a residual network in this application). The first network can be trained to have the ability to predict the residual between the image and the original image before the image is edited. The image editing can be performed by a generative model. Therefore, the residual information can express the process of mapping the original image to the target domain of the generative model. This information can be used as a priori input into a model for image editing recognition (for example, the prediction model in the embodiment of this application).

[0175] In an embodiment of the present application, the residual information obtained using the first network can be described as a mapping paradigm before and after image editing. Since in image editing performed by a generative model, the residual information can indicate the process of mapping the original image to the target domain of the generative model, the residual information can be used as a priori input into the prediction network, thereby realizing the detection and positioning of image editing.

[0176] When the image editing is performed by a generative model, the prediction process of the above-mentioned prediction residual information can be called a generative model mapping paradigm learning branch (ShadowTracer), which learns the characteristics of the target domain of the generative model. Due to the powerful generative model capabilities, almost no pixel-level traces are left after tampering, and it is difficult for humans to find out whether the image has been edited (for example, tampered). The present application learns the inherent pattern of generative tampering and extracts subtle tampering traces through a residual network. The network learns the mapping paradigm of the generative model, that is, the process of mapping the original image to the target domain of the generative model, as a priori input to the prediction network to assist in the detection and positioning of tampering. The tampering traces left by generative image editing are relatively hidden, so the existing detection algorithms have poor performance when facing generative image editing. The first network of the present application can learn the mapping paradigm of the generative model, that is, the process of mapping the original image to the target domain of the generative model, to assist subsequent detection algorithms.

[0177] Next, we introduce the training process of the first network:

[0178] In one possible implementation, a first image sample and a second image sample can be obtained; the second image sample is obtained after image editing of the first image sample; the residual information between the second image sample and the first image sample is used as a label of the first image sample, and the second network is trained to obtain the first network.

[0179] In one possible implementation, a prompt can be determined based on the first image sample and the first category of the subject included in the first image sample, the prompt indicating determination of a replacement category for the subject whose category is the first category in the first image sample; based on the prompt, the replacement category of the subject whose category is the first category in the first image sample is determined to be a second category through a language model; based on the second category and the first image sample, the second image sample is obtained through a generation model.

[0180] Refer to Figure 6, which is a flow chart of the training sample generation process. As shown in Figure 6, an original image and corresponding classification attributes are input, as shown by the tower in the figure. First, the zero-shot segmentation model is used to extract the area of ​​the category in the figure and output the corresponding segmentation mask (Semantic Mask). At the same time, the large language model is used to obtain similar classes of classification attributes, such as the Eiffel Tower; finally, the segmentation mask and the similar class to be replaced are input into the generative model to obtain a reasonable and high-quality tampering result.

[0181] Referring to Figure 7, Figure 7 is a schematic diagram of the training process of the first network. As shown in Figure 7, for an original image I, the above-mentioned automatic data generation method is used to generate multiple tampered images generated by different generative models, and then the original image is fused with the multiple generative tampered images using the rendering formula to obtain the target image It. In order to increase the robustness and generalization of the algorithm, a random degradation process such as downsampling, JPEG compression, etc. can be applied to the target image It to obtain a degraded target image I't. The degraded target image is used as the input of the network, and the residual between the degraded target image and the original image is used as the learning true value to train the residual network proposed in this invention. Finally, a generative model mapping paradigm learning branch is obtained, which can learn the general mapping process of the generative model, input the original image, and output the residual image (for example, as shown on the right side of Figure 8, the left side of Figure 8 is the original image, the middle of Figure 8 is the generative tampered image, and the right side of Figure 8 is the mapping paradigm output image).

[0182] Existing generative tampering methods do not have a standardized automatic data generation method, which makes it impossible to train deep learning models. In response to the above problems, the embodiments of the present application propose a method for automatically generating generative tampering data, which can automatically and quickly generate tampering data without human intervention, filling the problem of data shortage in this field. In addition, the present invention constructs a reasonable training framework, applies generative tampering to real images, and combines blending of original and generated images with mixed rendering and multiple degradation methods to enhance the generalization and robustness of the model.

[0183] 503. Obtain target information through a prediction model based on the image and the residual information, where the target information is used to indicate whether the image has been edited or an edited area where the image has been edited.

[0184] In one possible implementation, the prediction model includes: a feature extraction network, the feature extraction network includes a pooling module; the pooling module is used to perform pooling operations on input features at multiple scales, and fuse the pooling operation results of the multiple scales to obtain a fusion result.

[0185] The embodiment of the present application proposes a multi-scale feature difference modeling module for modeling the difference between the tampered area and the real area to enhance the features and obtain more accurate results.

[0186] In a possible implementation, the pooling module is further used to perform average pooling or maximum pooling on the input features, and to fuse the average pooling or maximum pooling result with the fusion result.

[0187] In one possible implementation, the prediction model includes: a feature extraction network, the feature extraction network includes a sub-feature extraction module, the sub-feature extraction module is used to extract features of the input in the frequency domain and space, obtain frequency domain features and spatial domain features, and fuse the frequency domain features and the spatial domain features.

[0188] The traditional frequency domain extraction method has no significant effect when applied to generative tampering. In addition, the size of the tampered area of ​​the generative model varies greatly, and the existing solutions have not designed corresponding processing methods for tampering of extreme scales. The above situation causes the existing traditional tampering detection algorithm to perform poorly in the generative tampering scenario. In other words, the characteristics of the generative model, such as frequency domain and spatial domain features, are difficult to be discovered. In addition, the size of the tampered area caused by the generative model varies greatly. In response to the above problems, the embodiment of the present application proposes a frequency-space domain feature extraction module. The dual branches extract the learnable features of the frequency domain and the spatial domain respectively as a supplement to the information, and capture the traces of tampering in multiple domains. Taking these characteristics into consideration, the embodiment of the present application designs a frequency-space domain feature extraction module. The dual branches extract the learnable features of the frequency domain and the spatial domain respectively as a supplement to the information, and capture the traces of tampering in multiple domains, helping to achieve more accurate tampering area positioning.

[0189] Next, a specific architecture diagram of the prediction model in the embodiment of the present application is introduced. As shown in Figure 9A, the original image is first sent to the frequency-spatial feature extraction module (FSB) for extraction. The FSB is shown in the upper right corner of Figure 9A. The frequency domain branch uses fast Fourier transform (FFT) and learnable parameters to extract frequency domain information, and uses convolution to extract spatial domain features. The two features are then fused as the output of the FSB. The features extracted by the FSB are sent to the Transformer block together with the ShadowTracer to extract features. The extracted features are sent to the multi-scale feature difference modeling module (MWAM) for difference modeling of features of different scales to increase the detection capability of different tampering sizes. Finally, the detection model uses a decoder (Decoder) to output the location of the tampered area with the difference modeling features in the form of a mask.

[0190] The embodiment of the present application constructs a generative image tampering detection framework based on a dual-stream Transformer architecture. First, a generative model mapping paradigm learning branch (ShadowTracer) is designed to learn the features of the target domain of the generative model. At the same time, a frequency-spatial domain feature extraction module (Frequency branch, FSB) and a multi-scale feature difference modeling module (MWAM) are also designed to assist in detection from the frequency domain features, spatial domain features and inconsistency of the feature domain respectively. In addition, a method for automatically generating generative tampering data is designed to automatically generate a large amount of reasonable and high-quality generative tampering data.

[0191] Next, the beneficial effects of the embodiments of the present application are introduced in combination with the experimental results. Tables 1 and 2 are objective index comparisons of the performance of the present application and the most advanced existing methods. Figures 9A and 9B are subjective effect demonstrations of the embodiments of the present application (the solution of the present application is GIMFormer in Figure 9A). As shown in Tables 1 and 2, in the comparison of the detection capability Setting of the public data set GIM, compared with the existing traditional tampering detection method, the method of the present application has a significant improvement in classification and segmentation performance. In addition, the existing segmentation method is more inclined to detect objects rather than tampering areas, so there is a high false detection rate and poor generalization to generative tampering detection. In the comparison of the generalization capability Setting of the public data set GIM, compared with the existing traditional tampering detection and segmentation methods, the method of the present application is effective in cross-generative model tampering detection, indicating good generalization across generative models. In addition, the method proposed in the present application is effective in generative tampering detection across data distribution, indicating good generalization across data. Compared with traditional tampering detection algorithms, this application can detect clear and accurate tampering areas for generative tampering.

[0192] Compared with other comparison methods, this application solution has high recall, fewer false detections, and can accurately detect whether there is tampering during generation.

[0193] Table 1

[0194] Table 2

[0195] 10 , which is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application. As shown in FIG10 , a data processing device provided in an embodiment of the present application, the device 1000 includes:

[0196] An acquisition module 1001 is used to acquire an image;

[0197] For a detailed description of the acquisition module 1001 , reference may be made to the description of step 501 in the above embodiment, which will not be repeated here.

[0198] The processing module 1002 is used to predict residual information of the image through a first network; the residual information is a prediction of the residual between the original image and the image when the image is an image obtained by image editing of the original image; based on the image and the residual information, target information is obtained through a prediction model, and the target information is used to indicate whether the image has been image edited or the editing area where the image has been edited.

[0199] For a detailed description of the processing module 1002 , reference may be made to the description of steps 502 to 503 in the above embodiment, which will not be repeated here.

[0200] In a possible implementation, the image editing specifically involves replacing the content of part or all of the main area of ​​the image.

[0201] In one possible implementation, the prediction model includes: a feature extraction network, the feature extraction network includes a pooling module; the pooling module is used to perform pooling operations on input features at multiple scales, and fuse the pooling operation results of the multiple scales to obtain a fusion result.

[0202] In a possible implementation, the pooling module is further used to perform average pooling or maximum pooling on the input features, and to fuse the average pooling or maximum pooling result with the fusion result.

[0203] In one possible implementation, the prediction model includes: a feature extraction network, the feature extraction network includes a sub-feature extraction module, the sub-feature extraction module is used to extract features of the input in the frequency domain and space, obtain frequency domain features and spatial domain features, and fuse the frequency domain features and the spatial domain features.

[0204] In a possible implementation, the apparatus further includes:

[0205] A training module is configured to obtain a first image sample and a second image sample; the second image sample is obtained by editing the first image sample;

[0206] The residual information between the second image sample and the first image sample is used as a label of the first image sample, and the second network is trained to obtain the first network.

[0207] In a possible implementation, the training module is specifically used to:

[0208] Determining a prompt according to the first image sample and a first category of a subject included in the first image sample, wherein the prompt indicates determining a replacement category of the subject in the first image sample whose category is the first category;

[0209] According to the prompt, determining, through a language model, that a replacement category of the subject of the first category in the first image sample is a second category;

[0210] The second image sample is obtained by generating a model according to the second category and the first image sample.

[0211] Next, a terminal device provided in an embodiment of the present application is introduced. Please refer to Figure 11. Figure 11 is a structural diagram of a terminal device provided in an embodiment of the present application. The terminal device 1100 can be specifically manifested as a virtual reality VR device, a mobile phone, a tablet, a laptop computer, a smart wearable device, etc., which is not limited here. Specifically, the terminal device 1100 includes: a receiver 1101, a transmitter 1102, a processor 1103 and a memory 1104 (wherein the number of processors 1103 in the terminal device 1100 can be one or more, and Figure 11 takes one processor as an example), wherein the processor 1103 may include an application processor 11031 and a communication processor 11032. In some embodiments of the present application, the receiver 1101, the transmitter 1102, the processor 1103 and the memory 1104 may be connected via a bus or other means.

[0212] The memory 1104 may include a read-only memory and a random access memory, and provides instructions and data to the processor 1103. A portion of the memory 1104 may also include non-volatile random access memory (NVRAM). The memory 1104 stores processor and operation instructions, executable modules, or data structures, or subsets or extended sets thereof. The operation instructions may include various operation instructions for implementing various operations.

[0213] Processor 1103 controls the operation of the execution device. In specific applications, the various components of the execution device are coupled together via a bus system. In addition to a data bus, the bus system may also include a power bus, a control bus, and a status signal bus. However, for clarity, all of these buses are referred to as a bus system in the figure.

[0214] The methods disclosed in the above embodiments of the present application can be applied to or implemented by processor 1103. Processor 1103 can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits or software instructions in processor 1103. The above processor 1103 can be a general-purpose processor, a digital signal processor (DSP), a microprocessor, or a microcontroller, and can further include an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The processor 1103 can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in conjunction with the embodiments of the present application can be directly implemented as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 1104. Processor 1103 reads information from memory 1104 and, in conjunction with its hardware, completes the steps involved in the model training or model inference process in the above method.

[0215] Receiver 1101 can be used to receive input digital or character information and generate signal input related to executing device-related settings and function control. Transmitter 1102 can be used to output digital or character information through the first interface. Transmitter 1102 can also be used to send instructions to the disk pack through the first interface to modify data in the disk pack. Transmitter 1102 can also include a display device such as a display screen.

[0216] The embodiment of the present application also provides a server. Please refer to Figure 12. Figure 12 is a schematic diagram of the structure of the server provided in the embodiment of the present application. The server 1200 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPUs) 1212 (for example, one or more processors) and a memory 1232, and one or more storage media 1230 (for example, one or more mass storage devices) for storing application programs 1242 or data 1244. Among them, the memory 1232 and the storage medium 1230 can be temporary storage or permanent storage. The program stored in the storage medium 1230 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 1212 can be configured to communicate with the storage medium 1230 to execute a series of instruction operations in the storage medium 1230 on the server 1200.

[0217] The server 1200 may also include one or more power supplies 1226, one or more wired or wireless network interfaces 1250, one or more input and output interfaces 1258; or one or more operating systems 1241, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.

[0218] In an embodiment of the present application, the central processing unit 1212 is used to execute actions related to model training or model reasoning in the above embodiments.

[0219] An embodiment of the present application also provides a computer program product, which, when running on a computer, enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.

[0220] A computer-readable storage medium is also provided in an embodiment of the present application, which stores a program for signal processing. When the computer-readable storage medium is run on a computer, it enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.

[0221] The execution device, training device or terminal device provided in the embodiments of the present application can specifically be a chip, and the chip includes: a processing unit and a communication unit, the processing unit can be, for example, a processor, and the communication unit can be, for example, an input / output interface, a pin or a circuit, etc. The processing unit can execute the computer execution instructions stored in the storage unit, so that the chip in the execution device executes the data processing method described in the above embodiment, or so that the chip in the training device executes the data processing method described in the above embodiment. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc. The storage unit can also be a storage unit located outside the chip in the wireless access device, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.

[0222] Specifically, see Figure 13 , which is a schematic diagram of the structure of a chip provided in an embodiment of the present application. The chip may be a neural network processor (NPU) 1300. NPU 1300 is mounted on a host CPU (host CPU) as a coprocessor, with tasks assigned by the host CPU. The core of the NPU is arithmetic circuit 1303, which is controlled by controller 1304 to extract matrix data from memory and perform multiplication operations.

[0223] In some implementations, the arithmetic circuit 1303 includes multiple processing units (PEs). In some implementations, the arithmetic circuit 1303 is a two-dimensional systolic array. The arithmetic circuit 1303 can also be a one-dimensional systolic array or other electronic circuitry capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit 1303 is a general-purpose matrix processor.

[0224] For example, assume there are input matrix A, weight matrix B, and output matrix C. The computation circuit retrieves the corresponding data of matrix B from weight memory 1302 and caches it on each PE in the computation circuit. The computation circuit then retrieves the data of matrix A from input memory 1301 and performs a matrix operation on it with matrix B. The partial or final matrix result is stored in accumulator 1308.

[0225] Unified memory 1306 is used to store input and output data. Weight data is directly transferred to weight memory 1302 through the Direct Memory Access Controller (DMAC) 1305. Input data is also transferred to unified memory 1306 through the DMAC.

[0226] BIU stands for Bus Interface Unit 1310 , which is used for interaction between the AXI bus, DMAC, and instruction fetch buffer (IFB) 1309 .

[0227] The bus interface unit 1310 (BIU) is used for the instruction fetch memory 1309 to obtain instructions from the external memory, and is also used for the storage unit access controller 1305 to obtain the original data of the input matrix A or the weight matrix B from the external memory.

[0228] DMAC is mainly used to move input data in the external memory DDR to the unified memory 1306 or to move weight data to the weight memory 1302 or to move input data to the input memory 1301.

[0229] The vector calculation unit 1307 includes multiple operation processing units. When necessary, it further processes the output of the operation circuit 1303, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. It is mainly used for non-convolutional / fully connected layer network calculations in neural networks, such as batch normalization, pixel-level summation, and upsampling of feature planes.

[0230] In some implementations, the vector calculation unit 1307 can store the processed output vector in the unified memory 1306. For example, the vector calculation unit 1307 can apply a linear function or a nonlinear function to the output of the operation circuit 1303, such as linear interpolation of the feature plane extracted by the convolution layer, or accumulate a vector of values ​​to generate an activation value. In some implementations, the vector calculation unit 1307 generates a normalized value, a pixel-level summed value, or both. In some implementations, the processed output vector can be used as an activation input to the operation circuit 1303, for example, for use in subsequent layers in a neural network.

[0231] An instruction fetch buffer 1309 connected to the controller 1304 is used to store instructions used by the controller 1304;

[0232] Unified memory 1306, input memory 1301, weight memory 1302, and instruction fetch memory 1309 are all on-chip memories. External memories are private to the NPU hardware architecture.

[0233] The processor mentioned in any of the above places can be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the above program.

[0234] It should also be noted that the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. In addition, in the drawings of the device embodiments provided in this application, the connection relationship between the modules indicates that there is a communication connection between them, which can be specifically implemented as one or more communication buses or signal lines.

[0235] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course can also be implemented by dedicated hardware including application-specific integrated circuits, dedicated CPUs, dedicated memories, dedicated components, etc. In general, all functions performed by computer programs can be easily implemented with corresponding hardware, and the specific hardware structures used to implement the same function can also be diverse, such as analog circuits, digital circuits, or dedicated circuits. However, for the present application, software program implementation is a better implementation method in most cases. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer's floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., and includes a number of instructions to enable a computer device (which can be a personal computer, training equipment, or network equipment, etc.) to execute the methods described in each embodiment of the present application.

[0236] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0237] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, a computer, a training device or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website, a computer, a training device or a data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

Claims

1. A data processing method, characterized in that: include: Acquire images; Predicting residual information of the image through the first network; The residual information is a prediction of the residual between the original image and the image when the image is an image obtained by image editing of the original image; Target information is obtained according to the image and the residual information through a prediction model, where the target information is used to indicate whether the image has been edited or an editing area where the image has been edited.

2. The method according to claim 1, characterized in that The image editing specifically involves replacing the content of part or all of the main area of the image.

3. The method according to claim 1 or 2, characterized in that The prediction model includes: a feature extraction network, which includes a pooling module; the pooling module is used to perform pooling operations on input features at multiple scales, and fuse the pooling operation results of the multiple scales to obtain a fusion result.

4. The method according to any one of claims 1 to 3, characterized in that: The pooling module is also used to perform average pooling or maximum pooling on the input features, and fuse the results of average pooling or maximum pooling with the fusion result.

5. The method according to any one of claims 1 to 4, characterized in that: The prediction model includes: a feature extraction network, the feature extraction network includes a sub-feature extraction module, the sub-feature extraction module is used to extract features of the input features in the frequency domain and space, obtain frequency domain features and spatial domain features, and fuse the frequency domain features and the spatial domain features.

6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: Acquire a first image sample and a second image sample; the second image sample is obtained by image editing the first image sample; The residual information between the second image sample and the first image sample is used as a label of the first image sample, and the second network is trained to obtain the first network.

7. The method according to claim 6, characterized in that The obtaining of the second image sample comprises: Determining a prompt according to the first image sample and a first category of a subject included in the first image sample, wherein the prompt indicates determining a replacement category of the subject in the first image sample whose category is the first category; According to the prompt, determining, through a language model, that a replacement category of the subject of the first category in the first image sample is a second category; The second image sample is obtained by generating a model according to the second category and the first image sample.

8. A data processing device, characterized in that: include: An acquisition module, used for acquiring images; a processing module, configured to predict residual information of the image through a first network; The residual information is a prediction of the residual between the original image and the image when the image is an image obtained by image editing of the original image; Target information is obtained according to the image and the residual information through a prediction model, where the target information is used to indicate whether the image has been edited or an editing area where the image has been edited.

9. The device according to claim 8, characterized in that The image editing specifically involves replacing the content of part or all of the main area of the image.

10. The device according to claim 8 or 9, characterized in that The prediction model includes: a feature extraction network, which includes a pooling module; the pooling module is used to perform pooling operations on input features at multiple scales, and fuse the pooling operation results of the multiple scales to obtain a fusion result.

11. The device according to any one of claims 8 to 10, characterized in that The pooling module is also used to perform average pooling or maximum pooling on the input features, and fuse the results of average pooling or maximum pooling with the fusion result.

12. The device according to any one of claims 8 to 11, characterized in that The prediction model includes: a feature extraction network, the feature extraction network includes a sub-feature extraction module, the sub-feature extraction module is used to extract features of the input features in the frequency domain and space, obtain frequency domain features and spatial domain features, and fuse the frequency domain features and the spatial domain features.

13. The device according to any one of claims 8 to 12, characterized in that The device further comprises: A training module is configured to obtain a first image sample and a second image sample; the second image sample is obtained by editing the first image sample; The residual information between the second image sample and the first image sample is used as a label of the first image sample, and the second network is trained to obtain the first network.

14. The device according to claim 13, characterized in that The training module is specifically used to: Determining a prompt according to the first image sample and a first category of a subject included in the first image sample, wherein the prompt indicates determining a replacement category of the subject in the first image sample whose category is the first category; According to the prompt, determining, through a language model, that a replacement category of the subject of the first category in the first image sample is a second category; The second image sample is obtained by generating a model according to the second category and the first image sample.

15. A computer storage medium, characterized in that The computer storage medium stores one or more instructions that, when executed by one or more computers, cause the one or more computers to perform the operations of the method of any one of claims 1 to 7.

16. A computer program product, characterized in that The method comprises computer-readable instructions, which, when executed on a computer device, cause the computer device to execute the method according to any one of claims 1 to 7.

17. A system comprising at least one processor and at least one memory; the processor and the memory are connected via a communication bus and communicate with each other; The at least one memory is used to store code; The at least one processor is configured to execute the code to perform the method according to any one of claims 1 to 7.

18. A chip comprising a processor, characterized in that: The processor is used to support a data processing device to implement the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Tampered image identification method and device based on deep learning

    CN109754393A

  • Image tampering detection method and system and storage medium

    CN112861960A

  • Image reverse recovery method based on deep learning

    CN112991239A

  • Method and apparatus for editing image

    US20210133931A1