Method and device for detecting image, storage medium and electronic equipment
By combining the image detection framework of global semantic features and local perceptual features, using semantic segmentation model and mask regression model, the problem of difficulty in detecting generated pictures and local editing generated pictures in the existing technology is solved, and the accuracy of AIGC generated pictures is achieved Identification and distinction improves social security.
Patent Information
- Application Number
- CN202411223197.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-02
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-09-02
AI Technical Summary
The prior art is difficult to effectively detect and generate images generated at the same time, resulting in the inability to effectively identify and trace the images generated by AIGC, affecting social security.
By combining global semantic features and local perceptual features, using semantic segmentation models and mask regression models, a unified image detection framework is built to identify and distinguish the regions generated by AIGC.
It realizes accurate detection of global and local AIGC-generated pictures, can effectively distinguish between tampered areas and real areas, and improves the security of picture authentication and social impact guarantee.
Smart Images

Figure CN119206311A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to computer technology, and in particular to a method, device, storage medium and electronic equipment for detecting an image. Background Art
[0002] In recent years, the large-scale model of text-generated images has developed rapidly and can generate an image based on a short text. Especially after the generation model based on the diffusion model came out, the quality of the generated images has made a qualitative leap. Various open source communities support users to use various open source models for various types of generation creation. On the one hand, the text-generated image technology will generate various risks such as celebrity photos and famous paintings, involving various copyright issues; on the other hand, the image-generated image technology will stylize and edit real images, perform some fraudulent operations for image authentication, and cause adverse social impacts. Therefore, there is an urgent need for AIGC (Artificial Intelligence Generated Content) detection technology to identify the generated images and conduct a series of applications such as tracing and accountability to ensure social security. At present, the images generated by AIGC include global generation methods such as text-generated images and image-generated images, as well as local editing generation methods such as image editing and image filling. Therefore, it is very necessary to have a set of detection methods to solve both global AIGC generation and AIGC local editing generation detection methods. Summary of the invention
[0003] The purpose of the embodiments of this specification is to provide a method, device, storage medium and electronic device for detecting an image.
[0004] The embodiments of this specification provide a method for detecting an image, by using the same framework to study the algorithms of global AIGC detection and local AIGC detection, unifying the global AIGC detection and local AIGC detection into a framework by combining global semantic features with local perception features, and introducing a semantic segmentation model to extract semantic features, aiming to perceive local features with specific meanings, because local editing often tends to modify areas with specific semantics (such as foreground objects), and introducing edited area mask regression to guide the model to focus on the tampered area, while forming a focus of attention with the real area, which is conducive to distinguishing the tampered area from the real picture. The method includes:
[0005] Obtaining a trained image detection model, wherein the image detection model includes a semantic segmentation model, a global picture coding model, a local picture coding model, a detection score discrimination model, and a mask regression model;
[0006] Obtaining corresponding global input information and local input information according to the target image, wherein the global input information includes the target image, and the local input information includes a target number of image units obtained by segmenting the target image;
[0007] Inputting the local input information into the local picture coding model to obtain local feature information corresponding to the output target image, and inputting the local feature information into the mask regression model to obtain a target mask corresponding to the output target image, wherein the target mask is used to indicate the position of the editing area in the target image;
[0008] Inputting the global input information into the global picture coding model to obtain global feature information corresponding to the output target image, and inputting the global feature information into the semantic segmentation model to obtain semantic feature information corresponding to the output target image;
[0009] The semantic feature information, the global feature information and the local feature information are input into the detection score discrimination model to obtain a target image generation result corresponding to the output target image, and the target image generation result and the target mask are used as the output of the image detection model for the target image.
[0010] Furthermore, the target image includes any of the following:
[0011] Real images;
[0012] Generate images globally;
[0013] Local editing generates images.
[0014] Furthermore, obtaining the global input information and the local input information corresponding to the target image includes:
[0015] The target image is adjusted to a preset size, and corresponding global input information and local input information are obtained according to the adjusted target image, wherein the global input information includes the adjusted target image, and the local input information includes a target number of image units obtained by segmenting the adjusted target image.
[0016] Furthermore, the step of inputting the semantic feature information, the global feature information and the local feature information into the detection score discrimination model to obtain an output target image generation result includes:
[0017] The semantic feature information, the global feature information and the local feature information are concatenated along the channel to obtain final discriminant feature information;
[0018] The final discriminant feature information is input into the detection score discriminant model to obtain the output target image generation result.
[0019] Furthermore, obtaining the trained image detection model includes:
[0020] According to the training image samples, the mask labels corresponding to the training image samples and the image generation labels, the image detection model is trained based on the classification loss function and the mask regression loss function to obtain a trained image detection model.
[0021] Furthermore, the training image sample is a pair of training images, and the pair of training images includes a globally generated training image and a locally edited generated training image.
[0022] Furthermore, the input of the classification loss function includes the image generation label corresponding to the globally generated training image, the image generation label corresponding to the locally edited training image, the final discriminant feature information corresponding to the globally generated training image, and the final discriminant feature information corresponding to the locally edited training image.
[0023] Furthermore, the input of the mask regression loss function includes the mask label corresponding to the globally generated training image, the mask label corresponding to the locally edited training image, the target mask output by the mask regression model for the globally generated training image, and the target mask output by the mask regression model for the locally edited training image.
[0024] The present specification also provides a method for detecting an image, the method comprising:
[0025] Constructing an image detection model, wherein the image detection model includes a semantic segmentation model, a global picture coding model, a local picture coding model, a detection score discrimination model, and a mask regression model;
[0026] Obtaining corresponding global input information and local input information according to the training image sample, wherein the global input information includes the training image sample, and the local input information includes a target number of image units obtained by segmenting the training image sample;
[0027] Inputting the local input information into the local picture coding model to obtain output local feature information, and inputting the local feature information into the mask regression model to obtain an output target mask, wherein the target mask is used to indicate the position of the editing area in the training image sample;
[0028] Inputting the global input information into the global picture coding model to obtain output global feature information, and inputting the global feature information into the semantic segmentation model to obtain output semantic feature information;
[0029] The semantic feature information, the global feature information and the local feature information are input into the detection score discrimination model to obtain the output target image generation result. According to the target mask, the target image generation result, the mask label and the image generation label corresponding to the training image sample, the image detection model is trained based on the classification loss function and the mask regression loss function to obtain a trained image detection model.
[0030] Furthermore, the training image sample is a pair of training images, and the pair of training images includes a globally generated training image and a locally edited generated training image.
[0031] The embodiment of this specification also provides a device for detecting an image, including:
[0032] A model acquisition module, used to obtain a trained image detection model, wherein the image detection model includes a semantic segmentation model, a global image coding model, a local image coding model, a detection score discrimination model, and a mask regression model;
[0033] An input acquisition module, used to obtain corresponding global input information and local input information according to a target image, wherein the global input information includes the target image, and the local input information includes a target number of image units obtained by segmenting the target image;
[0034] A local feature output module, used for inputting the local input information into the local picture coding model to obtain the local feature information corresponding to the output target image, and inputting the local feature information into the mask regression model to obtain the target mask corresponding to the output target image, wherein the target mask is used to indicate the position of the editing area in the target image;
[0035] A global feature output module, used for inputting the global input information into the global picture coding model to obtain global feature information corresponding to the output target image, and inputting the global feature information into the semantic segmentation model to obtain semantic feature information corresponding to the output target image;
[0036] A model output module is used to input the semantic feature information, the global feature information and the local feature information into the detection score discrimination model to obtain a target image generation result corresponding to the output target image, and use the target image generation result and the target mask as the output of the image detection model for the target image.
[0037] The embodiment of this specification also provides a device for training an image detection model, including:
[0038] A model building module, used to build an image detection model, wherein the image detection model includes a semantic segmentation model, a global picture coding model, a local picture coding model, a detection score discrimination model and a mask regression model;
[0039] An input acquisition module, used to obtain corresponding global input information and local input information according to the training image sample, wherein the global input information includes the training image sample, and the local input information includes a target number of image units obtained by segmenting the target image sample;
[0040] A local feature output module, used for inputting the local input information into the local picture coding model to obtain output local feature information, and inputting the local feature information into the mask regression model to obtain output target mask, wherein the target mask is used to indicate the position of the editing area in the target image;
[0041] A global feature output module, used for inputting the global input information into the global picture coding model to obtain output global feature information, and inputting the global feature information into the semantic segmentation model to obtain output semantic feature information;
[0042] The model training module is used to input the semantic feature information, the global feature information and the local feature information into the detection score discrimination model to obtain the output target image generation result, and train the image detection model based on the classification loss function and the mask regression loss function according to the target mask, the target image generation result, the mask label and the image generation label corresponding to the training image sample to obtain a trained image detection model.
[0043] The embodiments of the present specification also provide a computer program product, wherein the computer program product stores at least one instruction, and the at least one instruction is suitable for being loaded by a processor and executing the above method steps.
[0044] The embodiments of the present specification also provide a storage medium, wherein the storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and executing the steps of the above method.
[0045] An embodiment of the present specification also provides an electronic device, comprising: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the steps of the above method.
[0046] In the embodiments of the present specification, the algorithms of global AIGC detection and local AIGC detection are studied by utilizing the same framework, and the global AIGC detection and local AIGC detection are unified into a framework by combining global semantic features with local perception features. At the same time, a semantic segmentation model is introduced to extract semantic features, aiming to perceive local features with specific meanings, because local editing tends to modify areas with specific semantics (such as foreground objects). In addition, edited area mask regression is introduced to guide the model to focus on the tampered area, while forming a focus on the real area, which is conducive to distinguishing the tampered area from the real picture. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 A schematic diagram of a flow chart of a method for detecting an image provided in an embodiment of this specification;
[0048] Figure 2 A flowchart of a method for training an image detection model provided in an embodiment of this specification;
[0049] Figure 3 A flowchart of a method for detecting an image provided as an example in an embodiment of this specification;
[0050] Figure 4 A schematic diagram of a device for detecting an image provided in an embodiment of this specification;
[0051] Figure 5 A schematic diagram of the structure of a device for training an image detection model provided in an embodiment of this specification;
[0052] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.
[0054] See also Figure 1 , is a flow chart of a method for detecting an image provided in an embodiment of this specification. In the embodiment of this specification, the method for detecting an image is applied to a device for detecting an image (hereinafter referred to as "image detection device") or an electronic device equipped with an image detection device. Figure 1The process shown is described in detail, and the method for detecting an image may specifically include the following steps:
[0055] S102, obtaining a trained image detection model, wherein the image detection model includes a semantic segmentation model, a global picture coding model, a local picture coding model, a detection score discrimination model, and a mask regression model.
[0056] In some embodiments, the image detection model is an image detection framework composed of multiple models, and the multiple models include a semantic segmentation model, a global picture coding model, a local picture coding model, a detection score discrimination model and a mask regression model. The input of the semantic segmentation model, the global picture coding model and the local picture coding model is the input of the image detection model, that is, the input of the image detection model will be respectively input into the semantic segmentation model, the global picture coding model and the local picture coding model, and the output of the local picture coding model will be input into the mask regression model, that is, the input of the mask regression model is the output of the local picture coding model, the output of the semantic segmentation model, the output of the global picture coding model and the output of the local picture coding model will be input into the detection score discrimination model, that is, the input of the detection score discrimination model includes the output of the semantic segmentation model, the output of the global picture coding model and the local picture coding model. The output of the encoding model, the output result of the detection score discrimination model is the image generation result used to indicate whether the input image is generated by AIGC, the output result of the mask regression model is the mask corresponding to the input image, and the mask is used to indicate the position of the AIGC editing area in the input image. The output result of the detection score discrimination model and the output result of the mask regression model are used as the output result of the image detection model, that is, the input of the semantic segmentation model, the global picture coding model, and the local picture coding model is the input of the image detection model. The output of the local picture coding model is input into the mask regression model on the one hand and into the detection score discrimination model on the other hand. The output of the global picture coding model will be input into the detection score discrimination model, and the output of the semantic segmentation model will also be input into the score discrimination model. The output of the detection score discrimination model and the mask regression model is the output of the image detection model.
[0057] In some embodiments, the semantic segmentation model is obtained after pre-training, the global image coding model is composed of a residual convolutional network res-block (res-block is a basic component in the ResNet network structure), the local image coding model is composed of a transformer structure (the transformer structure mainly includes an encoder (Encoder) and a decoder (Decoder)), the detection score discrimination model is composed of a fully connected layer FC (Fully Connected Layer), and the mask regression model is a statistical model for quantitatively describing the statistical relationship between variables. It is a statistical prediction model that describes the relationship between independent variables (also called explanatory variables or features, that is, the local features output by the local image coding model in this scheme) and dependent variables (also called response variables or target variables, that is, the mask used to indicate the position of the AIGC editing area in the input image in this scheme).
[0058] In some embodiments, the embodiments of this specification do not impose any limitations on the training method of the image detection model. Those skilled in the art should understand that any model training method can be included in the protection scope of this specification, and this specification does not impose any limitations on this.
[0059] In some embodiments, the method of obtaining the trained image detection model includes but is not limited to reading the trained image detection model from the memory or local storage space, sending an image detection model acquisition request to the corresponding server and accepting the trained image detection model returned by the server based on the image detection model acquisition request, etc. It should be noted that the above-mentioned acquisition method is only an example and not a limitation. Those skilled in the art should understand that any acquisition method can be included in the protection scope of this specification, and this specification does not limit this.
[0060] S104, obtaining corresponding global input information and local input information according to the target image, wherein the global input information includes the target image, and the local input information includes a target number of image units obtained by segmenting the target image.
[0061] In some embodiments, it is necessary to first obtain global input information and local input information corresponding to the target image of the input image detection model. The global input information is the target image itself. The target image is evenly divided into a target number of multiple image units (image blocks, patches), and the target number of multiple image units is used as the local input information corresponding to the target image. In some embodiments, the target image can be a real picture, or it can be a picture generated globally by AIGC, or it can be a picture generated by AIGC by locally editing a real picture.
[0062] In some embodiments, the number of targets may be preset, that is, different input images correspond to the same number of targets, or the number of targets may also be determined based on the attribute information of the input image, that is, different input images correspond to their own independent number of targets, and the attribute information includes but is not limited to the image size information, image resolution information, image color information, image content information, etc. of the input image. This example embodiment does not specifically limit this. For example, the number of targets may be determined based on the size information of the input image. The larger the size of the input image, the greater the number of targets. For another example, the number of targets may also be determined based on the number of objects in the input image. The greater the number of objects in the input image, the greater the number of targets. It should be noted that the above method for determining the number of targets is only an example and not a limitation. Those skilled in the art should understand that any method for determining the number of targets based on the attribute information of the input image may be included in the scope of protection of this specification, and this specification does not limit this.
[0063] S106, inputting the local input information into the local picture coding model to obtain local feature information corresponding to the output target image, and inputting the local feature information into the mask regression model to obtain a target mask corresponding to the output target image, wherein the target mask is used to indicate the position of the editing area in the target image.
[0064] In some embodiments, a target number of multiple image units are input into a local picture coding model to obtain local feature information corresponding to the target image output by the local picture coding model (i.e., feature information corresponding to each image unit), and then the local feature information is input into a mask regression model to obtain a target mask corresponding to the target image output by the mask regression model, and the target mask is used to indicate the position of the AIGC editing area in the target image.
[0065] In some embodiments, the mask is a matrix or image of the same size as the original image (i.e., the target image), which is used to indicate or identify a specific area in the original image (i.e., the area edited by AIGC). The mask is binary (i.e., it only contains values of 0 or 1), wherein a value of 1 indicates that the area corresponding to the value in the original image has been edited by AIGC or the area is generated by AIGC, and a value of 0 indicates that the area corresponding to the value in the original image has not been edited by AIGC or the area is not generated by AIGC. According to the position of a certain value in the mask in the mask, the corresponding position corresponding to the position in the original image can be obtained, and according to the value, it can be determined whether the area at the corresponding position in the original image has been edited by AIGC or whether the area is generated by AIGC. For example, the mask can be a matrix, which only includes values 0 and 1, and the position of the value 0 in the matrix will correspond to a A corresponding position, the area at the corresponding position in the original image has not been edited by AIGC or the area is not generated by AIGC, the position of the value 1 in the matrix will also correspond to a corresponding position in the original image, the area at the corresponding position in the original image has been edited by AIGC or the area is generated by AIGC. For another example, the mask can also be an image, the pixel value of each pixel in the image only includes 0 and 1, since the pixel value 1 is white and the pixel value 0 is black, that is, the mask is a black-and-white image including only black and white, the position of the pixel value 0 in the image will correspond to a corresponding position in the original image, the area at the corresponding position in the original image has not been edited by AIGC or the area is not generated by AIGC, the position of the pixel value 1 in the image will also correspond to a corresponding position in the original image, the area at the corresponding position in the original image has been edited by AIGC or the area is generated by AIGC. In some embodiments, if the original image (i.e., the target image) is a picture generated globally by AIGC, then the corresponding mask is a matrix composed only of the numerical value 1, or the mask is an image composed only of the pixel value 1 (i.e., a fully white image), that is, the mask corresponding to the picture generated globally by AIGC is the entire image, and the mask corresponding to the picture generated by local editing by AIGC is the specific edited location.
[0066] S108, inputting the global input information into the global picture coding model to obtain global feature information corresponding to the output target image, and inputting the global feature information into the semantic segmentation model to obtain semantic feature information corresponding to the output target image.
[0067] In some embodiments, the global input information is respectively input into the global picture coding model and the semantic segmentation model, and the semantic feature information corresponding to the target image output by the semantic segmentation model can be obtained. Because the local editing of real pictures by AIGC generally edits areas with specific semantics (such as specific objects), the semantic features can be used to effectively capture the features of the local editing, and the global feature information (i.e., global perceptual features) corresponding to the target image output by the global picture coding model can also be obtained.
[0068] S110, inputting the semantic feature information, the global feature information and the local feature information into the detection score discrimination model to obtain a target image generation result corresponding to the output target image, and using the target image generation result and the target mask as the output of the image detection model for the target image.
[0069] In some embodiments, the semantic feature information corresponding to the target image output by the semantic segmentation model, the global feature information corresponding to the target image output by the global picture coding model, and the local feature information corresponding to the target image output by the local picture coding model are input into the detection score discrimination model to obtain a target image generation result corresponding to the target image output by the detection score discrimination model. The target image generation result is used to indicate whether the target image is generated by AIGC (including AIGC global generation and AIGC local editing generation). For example, if the target image is generated by AIGC, the output target image generation result is 1. If the target image is not generated by AIGC, the output target image generation result is 0.
[0070] In some embodiments, the target image generation result corresponding to the target image output by the detection score discrimination model and the target mask corresponding to the target image output by the mask regression model are used as the output of the trained image detection model for the target image input into the model. For example, the output of the image detection model includes that the target image is a real picture, and the output also includes that the mask corresponding to the target image is a matrix composed only of the value 0, or the mask is an image composed only of the pixel value 0 (i.e., a completely black image). For another example, the output of the image detection model includes that the target image is a picture generated globally by AIGC, and the output also includes that the mask corresponding to the target image is a matrix composed only of the value 1, or the mask is an image composed only of the pixel value 0. For example, the output of the image detection model includes that the target image is a picture generated by local editing of AIGC (that is, the picture generated by local editing of the real picture by AIGC), and the output also includes that the mask corresponding to the target image is a matrix composed of numerical values 0 and 1, or is an image composed of pixel values 0 and pixel values 1 (that is, a black and white image), wherein the numerical value 1 or pixel value 1 indicates that the area at the corresponding position of the position of the numerical value or the pixel value in the mask in the target image has been edited by AIGC, and the numerical value 0 or pixel value 0 indicates that the area at the corresponding position of the position of the numerical value or the pixel value in the mask in the target image has not been edited by AIGC.
[0071] In the embodiments of the present specification, the algorithms of global AIGC detection and local AIGC detection are studied by utilizing the same framework, and the global AIGC detection and local AIGC detection are unified into a framework by combining global semantic features with local perception features. At the same time, a semantic segmentation model is introduced to extract semantic features, aiming to perceive local features with specific meanings, because local editing tends to modify areas with specific semantics (such as foreground objects). In addition, edited area mask regression is introduced to guide the model to focus on the tampered area, while forming a focus on the real area, which is conducive to distinguishing the tampered area from the real picture.
[0072] In some embodiments, the target image includes any one of the following: a real image; a globally generated image; a locally edited generated image. In some embodiments, the target image input to the image detection model can be a real image, or an image globally generated by AIGC, or an image generated by locally editing a real image by AIGC.
[0073] In some embodiments, the obtaining of the global input information and local input information corresponding to the target image includes: adjusting the target image to a preset size, and obtaining the corresponding global input information and local input information according to the adjusted target image, wherein the global input information includes the adjusted target image, and the local input information includes a target number of image units obtained by segmenting the adjusted target image. In some embodiments, the target image needs to be adjusted to a preset size (for example, scaled or enlarged to 512*512) first. This example embodiment does not specifically limit the specific value of the preset size. At this time, the global input information is the adjusted target image, and the adjusted target image is evenly segmented into a target number of image units, and the target number of image units is used as the local input information corresponding to the target image.
[0074] In some embodiments, the inputting the semantic feature information, the global feature information and the local feature information into the detection score discriminant model to obtain the output target image generation result includes: splicing the semantic feature information, the global feature information and the local feature information along the channel to obtain the final discriminant feature information; inputting the final discriminant feature information into the detection score discriminant model to obtain the output target image generation result. In some embodiments, the semantic feature information corresponding to the target image output by the semantic segmentation model, the global feature information corresponding to the target image output by the global picture coding model, and the local feature information corresponding to the target image output by the local picture coding model are first spliced along the channel to obtain the final discriminant feature information, and then the final discriminant feature information is input into the detection score discriminant model to obtain the target image generation result corresponding to the target image output by the detection score discriminant model. For example, the data formats corresponding to the semantic feature information, the global feature information, and the local feature information are all X*Y*N, X is the number of pixels in the x direction, Y is the number of pixels in the y direction, and N is the number of color channels. The three feature information are spliced along their respective corresponding channels, and the data format corresponding to the final discriminant feature information obtained after splicing is X*Y*3N. For example, the data formats corresponding to the semantic feature information, the global feature information, and the local feature information are all 512*512*3 (that is, the number of color channels is 3), and the data format corresponding to the final discriminant feature information obtained after splicing is 512*512*9 (that is, the number of color channels is 9).
[0075] In some embodiments, the obtaining of the trained image detection model includes: training the image detection model based on the classification loss function and the mask regression loss function according to the training image samples, the mask labels and the image generation labels corresponding to the training image samples, to obtain the trained image detection model. In some embodiments, one training image can be input into the image detection model for training at a time, or multiple training images can be input into the image detection model for training at a time. In some embodiments, the image generation label corresponding to the training image sample is used to indicate or identify whether the training image is generated by AIGC (including AIGC global generation and AIGC local editing generation). For example, if the training image is generated by AIGC, its corresponding image generation label is 1, and if the training image is not generated by AIGC, its corresponding image generation label is 0. In some embodiments, the mask label corresponding to the training image sample is used to indicate or identify a specific area in the training image (i.e., an area edited by AIGC). For example, if the training image is a real picture, its corresponding mask label is a matrix consisting only of numerical values 0 or an image consisting only of pixel values 0 (i.e., a completely black image). If the training image is a picture generated globally by AIGC, its corresponding mask label is a matrix consisting only of numerical values 1 or an image consisting only of pixel values 1 (i.e., a completely white image). If the training image is a picture generated by local editing by AIGC, its corresponding mask label is a matrix consisting of numerical values 0 and numerical values 1 or an image consisting of pixel values 0 and pixel values 1 (i.e., a black and white image), wherein the numerical value 1 or pixel value 1 indicates that the area corresponding to the position of the numerical value or the pixel value in the mask label in the corresponding position in the training image has been edited by AIGC, and the numerical value 0 or pixel value 0 indicates that the area corresponding to the position of the numerical value or the pixel value in the mask label in the corresponding position in the training image has not been edited by AIGC. In some embodiments, a training image is input into an image detection model to obtain a target mask corresponding to the training image and a target image generation result corresponding to the training image output by the image detection model; the image detection model is trained based on a mask regression loss function according to the target mask and the mask label; and the image detection model is trained based on a classification loss function according to the target image generation result and the image generation label, to finally obtain a trained image detection model.
[0076] In some embodiments, the training image sample is a pair of training images, and the pair of training images includes a globally generated training image and a locally edited training image. In some embodiments, each time a pair of training images is input into the image detection model for training, the pair of training images includes a globally generated training image by AIGC and a locally edited training image by AIGC, so that balanced training samples can be achieved during the training process, and knowledge forgetting can be avoided. In some embodiments, there does not need to be any correlation between the globally generated training image and the locally edited training image in a pair of training images. In some embodiments, in the training stage of the image detection model, it is necessary to input a pair of training images each time for training, and in the prediction stage after the training is completed to obtain the trained image detection model, it is only necessary to input a target image to be predicted, and it is not necessary to input a pair of images.
[0077] In some embodiments, the input of the classification loss function includes the image generation label corresponding to the globally generated training image, the image generation label corresponding to the locally edited generated training image, the final discriminant feature information corresponding to the globally generated training image, and the final discriminant feature information corresponding to the locally edited generated training image. In some embodiments, the semantic feature information corresponding to the target image output by the semantic segmentation model, the global feature information corresponding to the target image output by the global picture coding model, and the local feature information corresponding to the target image output by the local picture coding model are first spliced along the channel to obtain the final discriminant feature information, and then the final discriminant feature information is input into the detection score discriminant model to obtain the target image generation result corresponding to the target image output by the detection score discriminant model. In some embodiments, the function formula of the classification loss function is as follows:
[0078]
[0079] in, is the classification loss, is the image generation label corresponding to the locally edited generated image in a pair of training images, It is the final discriminant feature information after splicing corresponding to the local edited generated image obtained after inputting the local edited generated image into the image detection model, is the image generation label corresponding to the global generated image in a pair of training images, It is the final discriminant feature information after splicing corresponding to the global generated image obtained after the global generated image is input into the image detection model.
[0080] In some embodiments, the input of the mask regression loss function includes the mask label corresponding to the global generated training image, the mask label corresponding to the local edited generated training image, the target mask output by the mask regression model for the global generated training image, and the target mask output by the mask regression model for the local edited generated training image. In some embodiments, the function formula of the mask regression loss function is as follows:
[0081]
[0082] in, is the mask regression loss, is the mask label corresponding to the local edited generated image in a pair of training images, is the target mask of the mask regression model for the local edited image output, is the mask label corresponding to the global generated image in a pair of training images, is the target mask output by the mask regression model for the global generated image.
[0083] Figure 2 A flowchart of a method for training an image detection model provided in an embodiment of this specification. In an embodiment of this specification, the method for training an image detection model is applied to a device for training an image detection model (hereinafter referred to as an "image detection model training device") or an electronic device equipped with an image detection model training device. Figure 2 The process shown is described in detail, and the method for training the image detection model may specifically include the following steps:
[0084] S202, construct an image detection model, wherein the image detection model includes a semantic segmentation model, a global picture coding model, a local picture coding model, a detection score discrimination model, and a mask regression model. In some embodiments, the image detection model has been described in detail above and will not be repeated here. Here, the embodiments of this specification do not impose any limitations on the construction method of the image detection model. Those skilled in the art should understand that any model construction method can be included in the protection scope of this specification, and this specification does not limit this. For example, the semantic segmentation model, the global picture coding model, the local picture coding model, the detection score discrimination model, and the mask regression model are combined together according to a preset framework to form an image detection model.
[0085] S204, obtaining corresponding global input information and local input information according to the training image sample, wherein the global input information includes the training image sample, and the local input information includes a target number of image units obtained by segmenting the training image sample. The implementation method of step S204 is the same or similar to the aforementioned step S104, and will not be repeated here.
[0086] S206, inputting the local input information into the local picture coding model to obtain output local feature information, and inputting the local feature information into the mask regression model to obtain an output target mask, wherein the target mask is used to indicate the location of the edited area in the training image sample. The implementation method of step S206 is the same or similar to the aforementioned step S106, and will not be repeated here.
[0087] S208, input the global input information into the global picture coding model to obtain output global feature information, and input the global feature information into the semantic segmentation model to obtain output semantic feature information. The implementation of step S208 is the same or similar to the aforementioned step S108, and will not be repeated here.
[0088] S210, input the semantic feature information, the global feature information and the local feature information into the detection score discriminant model to obtain the output target image generation result, and train the image detection model based on the classification loss function and the mask regression loss function according to the target mask, the target image generation result, the mask label and the image generation label corresponding to the training image sample to obtain a trained image detection model. In some embodiments, the method of obtaining the target image generation result corresponding to the training image sample output by the detection score discriminant model has been described in detail above and will not be repeated here. In some embodiments, the method of training the image detection model based on the classification loss function and the mask regression loss function has been described in detail above and will not be repeated here.
[0089] In some embodiments, the training image sample is a pair of training images, and the pair of training images includes a globally generated training image and a locally edited training image. In some embodiments, the case where the training image sample is a pair of training images including an AIGC globally generated training image and an AIGC locally edited training image has been described in detail above and will not be repeated here.
[0090] Figure 3 A flowchart of a method for detecting an image provided as an example in an embodiment of this specification.
[0091] like Figure 3As shown, the global input information corresponding to the target image to be predicted (i.e., the target image itself) is respectively input into the semantic segmentation model and the global picture coding model, and the local input information corresponding to the target image (i.e., the target number of image units obtained by segmenting the target image) is input into the local picture coding model. The local feature information output by the local picture coding model is input into the mask regression model to obtain the target mask corresponding to the target image output by the mask regression model. The target mask is used to indicate the position of the AIGC editing area in the target image. The semantic feature information output by the semantic segmentation model, the global feature information output by the global picture coding model, and the local feature information output by the local picture coding model are input into the detection score discrimination model to obtain the target image generation result corresponding to the target image output by the detection score discrimination model. The target image generation result is used to indicate whether the target image is generated by AIGC (including AIGC global generation and AIGC local editing generation).
[0092] Figure 4 A schematic diagram of the structure of a device for detecting an image provided in an embodiment of the present specification, the device for detecting an image (hereinafter referred to as "image detection device 1") can be implemented as all or part of an electronic device through software, hardware or a combination of both. According to some embodiments, the image detection device 1 includes a model acquisition module 11, an input acquisition module 12, a local feature output module 13, a global feature output module 14 and a model output module 15.
[0093] A model acquisition module 11 is used to obtain a trained image detection model, wherein the image detection model includes a semantic segmentation model, a global image coding model, a local image coding model, a detection score discrimination model, and a mask regression model;
[0094] An input acquisition module 12, configured to obtain corresponding global input information and local input information according to a target image, wherein the global input information includes the target image, and the local input information includes a target number of image units obtained by segmenting the target image;
[0095] A local feature output module 13 is used to input the local input information into the local picture coding model to obtain the local feature information corresponding to the output target image, and input the local feature information into the mask regression model to obtain the target mask corresponding to the output target image, wherein the target mask is used to indicate the position of the editing area in the target image;
[0096] A global feature output module 14 is used to input the global input information into the global picture coding model to obtain the global feature information corresponding to the output target image, and input the global feature information into the semantic segmentation model to obtain the semantic feature information corresponding to the output target image;
[0097] The model output module 15 is used to input the semantic feature information, the global feature information and the local feature information into the detection score discrimination model to obtain the target image generation result corresponding to the output target image, and use the target image generation result and the target mask as the output of the image detection model for the target image.
[0098] In some embodiments, the target image includes any of the following:
[0099] Real images;
[0100] Generate images globally;
[0101] Local editing generates images.
[0102] In some embodiments, obtaining the global input information and the local input information corresponding to the target image includes:
[0103] The target image is adjusted to a preset size, and corresponding global input information and local input information are obtained according to the adjusted target image, wherein the global input information includes the adjusted target image, and the local input information includes a target number of image units obtained by segmenting the adjusted target image.
[0104] In some embodiments, the inputting the semantic feature information, the global feature information and the local feature information into the detection score discrimination model to obtain an output target image generation result includes:
[0105] The semantic feature information, the global feature information and the local feature information are concatenated along the channel to obtain final discriminant feature information;
[0106] The final discriminant feature information is input into the detection score discriminant model to obtain the output target image generation result.
[0107] In some embodiments, obtaining a trained image detection model includes:
[0108] According to the training image samples, the mask labels corresponding to the training image samples and the image generation labels, the image detection model is trained based on the classification loss function and the mask regression loss function to obtain a trained image detection model.
[0109] In some embodiments, the training image sample is a pair of training images, and the pair of training images includes a globally generated training image and a locally edited generated training image.
[0110] In some embodiments, the input of the classification loss function includes the image generation label corresponding to the globally generated training image, the image generation label corresponding to the locally edited training image, the final discriminant feature information corresponding to the globally generated training image, and the final discriminant feature information corresponding to the locally edited training image.
[0111] In some embodiments, the input of the mask regression loss function includes the mask label corresponding to the globally generated training image, the mask label corresponding to the locally edited training image, the target mask output by the mask regression model for the globally generated training image, and the target mask output by the mask regression model for the locally edited training image.
[0112] Figure 5 A schematic diagram of the structure of a device for training an image detection model provided in an embodiment of the present specification, the device for training an image detection model (hereinafter referred to as "image detection model training device 2") can be implemented as all or part of an electronic device through software, hardware or a combination of both. According to some embodiments, the image detection model training device 2 includes a model construction module 21, an input acquisition module 22, a local feature output module 23, a global feature output module 24 and a model training module 25.
[0113] A model building module 21 is used to build an image detection model, wherein the image detection model includes a semantic segmentation model, a global picture coding model, a local picture coding model, a detection score discrimination model and a mask regression model;
[0114] An input acquisition module 22, configured to obtain corresponding global input information and local input information according to the training image sample, wherein the global input information includes the training image sample, and the local input information includes a target number of image units obtained by segmenting the target image sample;
[0115] A local feature output module 23, used for inputting the local input information into the local picture coding model to obtain output local feature information, and inputting the local feature information into the mask regression model to obtain output target mask, wherein the target mask is used to indicate the position of the editing area in the target image;
[0116] A global feature output module 24, configured to input the global input information into the global picture coding model to obtain output global feature information, and input the global feature information into the semantic segmentation model to obtain output semantic feature information;
[0117] The model training module 25 is used to input the semantic feature information, the global feature information and the local feature information into the detection score discrimination model to obtain the output target image generation result, and train the image detection model based on the classification loss function and the mask regression loss function according to the target mask, the target image generation result, the mask label and the image generation label corresponding to the training image sample to obtain a trained image detection model.
[0118] In some embodiments, the training image sample is a pair of training images, and the pair of training images includes a globally generated training image and a locally edited generated training image.
[0119] The above device embodiments correspond to the method embodiments. For specific descriptions, please refer to the description of the method embodiments, which will not be repeated here. The device embodiments are obtained based on the corresponding method embodiments and have the same technical effects as the corresponding method embodiments. For specific descriptions, please refer to the corresponding method embodiments.
[0120] The embodiment of the present specification also provides a computer storage medium, which can store multiple instructions, and the instructions are suitable for being loaded by a processor to execute the method of the embodiment of the present specification.
[0121] The embodiments of the present specification also provide a computer program product, which stores at least one instruction, and the at least one instruction is loaded by the processor to execute the method of the embodiments of the present specification.
[0122] The embodiments of this specification also provide Figure 6 The structural diagram of the electronic device shown in FIG. Figure 6 At the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include hardware required for other services. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to implement the above-mentioned voice activity detection method.
[0123] Of course, in addition to software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the executor of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0124] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0125] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0126] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0127] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0128] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0129] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0130] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0131] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0132] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0133] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0134] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0135] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0136] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0137] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0138] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0139] The above description is only an embodiment of the present specification and is not intended to limit the present specification. For those skilled in the art, the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of the claims of the present specification.
Claims
1. A method for detecting an image, comprising: Obtaining a trained image detection model, wherein the image detection model includes a semantic segmentation model, a global picture coding model, a local picture coding model, a detection score discrimination model, and a mask regression model; Obtaining corresponding global input information and local input information according to the target image, wherein the global input information includes the target image, and the local input information includes a target number of image units obtained by segmenting the target image; Inputting the local input information into the local picture coding model to obtain local feature information corresponding to the output target image, and inputting the local feature information into the mask regression model to obtain a target mask corresponding to the output target image, wherein the target mask is used to indicate the position of the editing area in the target image; Inputting the global input information into the global picture coding model to obtain global feature information corresponding to the output target image, and inputting the global feature information into the semantic segmentation model to obtain semantic feature information corresponding to the output target image; The semantic feature information, the global feature information and the local feature information are input into the detection score discrimination model to obtain a target image generation result corresponding to the output target image, and the target image generation result and the target mask are used as the output of the image detection model for the target image.
2. The method according to claim 1, wherein the target image comprises any one of the following: Real images; Generate images globally; Local editing generates images.
3. According to the method of claim 1, the step of obtaining the global input information and the local input information corresponding to the target image comprises: The target image is adjusted to a preset size, and corresponding global input information and local input information are obtained according to the adjusted target image, wherein the global input information includes the adjusted target image, and the local input information includes a target number of image units obtained by segmenting the adjusted target image.
4. The method according to claim 1, wherein the step of inputting the semantic feature information, the global feature information and the local feature information into the detection score discrimination model to obtain an output target image generation result comprises: The semantic feature information, the global feature information and the local feature information are concatenated along the channel to obtain final discriminant feature information; The final discriminant feature information is input into the detection score discriminant model to obtain the output target image generation result.
5. The method according to any one of claims 1 to 4, wherein obtaining a trained image detection model comprises: According to the training image samples, the mask labels corresponding to the training image samples and the image generation labels, the image detection model is trained based on the classification loss function and the mask regression loss function to obtain a trained image detection model. 6 . The method according to claim 5 , wherein the training image sample is a pair of training images, and the pair of training images includes a globally generated training image and a locally edited generated training image.
7. According to the method of claim 6, the input of the classification loss function includes the image generation label corresponding to the globally generated training image, the image generation label corresponding to the locally edited training image, the final discriminant feature information corresponding to the globally generated training image, and the final discriminant feature information corresponding to the locally edited training image.
8. According to the method of claim 6, the input of the mask regression loss function includes the mask label corresponding to the globally generated training image, the mask label corresponding to the locally edited training image, the target mask output by the mask regression model for the globally generated training image, and the target mask output by the mask regression model for the locally edited training image.
9. A method for training an image detection model, comprising: Constructing an image detection model, wherein the image detection model includes a semantic segmentation model, a global image coding model, a local image coding model, a detection score discrimination model, and a mask regression model; Obtaining corresponding global input information and local input information according to the training image sample, wherein the global input information includes the training image sample, and the local input information includes a target number of image units obtained by segmenting the training image sample; Inputting the local input information into the local picture coding model to obtain output local feature information, and inputting the local feature information into the mask regression model to obtain an output target mask, wherein the target mask is used to indicate the position of the editing area in the training image sample; Inputting the global input information into the global picture coding model to obtain output global feature information, and inputting the global feature information into the semantic segmentation model to obtain output semantic feature information; The semantic feature information, the global feature information and the local feature information are input into the detection score discrimination model to obtain the output target image generation result. According to the target mask, the target image generation result, the mask label and the image generation label corresponding to the training image sample, the image detection model is trained based on the classification loss function and the mask regression loss function to obtain a trained image detection model.
10. The method according to claim 9, wherein the training image sample is a pair of training images, and the pair of training images includes a globally generated training image and a locally edited generated training image.
11. A device for detecting an image, comprising: A model acquisition module, used to obtain a trained image detection model, wherein the image detection model includes a semantic segmentation model, a global image coding model, a local image coding model, a detection score discrimination model, and a mask regression model; An input acquisition module, used to obtain corresponding global input information and local input information according to a target image, wherein the global input information includes the target image, and the local input information includes a target number of image units obtained by segmenting the target image; A local feature output module, used for inputting the local input information into the local picture coding model to obtain the local feature information corresponding to the output target image, and inputting the local feature information into the mask regression model to obtain the target mask corresponding to the output target image, wherein the target mask is used to indicate the position of the editing area in the target image; A global feature output module, used for inputting the global input information into the global picture coding model to obtain global feature information corresponding to the output target image, and inputting the global feature information into the semantic segmentation model to obtain semantic feature information corresponding to the output target image; A model output module is used to input the semantic feature information, the global feature information and the local feature information into the detection score discrimination model to obtain a target image generation result corresponding to the output target image, and use the target image generation result and the target mask as the output of the image detection model for the target image.
12. A device for training an image detection model, comprising: A model building module, used to build an image detection model, wherein the image detection model includes a semantic segmentation model, a global picture coding model, a local picture coding model, a detection score discrimination model and a mask regression model; An input acquisition module, used to obtain corresponding global input information and local input information according to the training image sample, wherein the global input information includes the training image sample, and the local input information includes a target number of image units obtained by segmenting the target image sample; A local feature output module, used for inputting the local input information into the local picture coding model to obtain output local feature information, and inputting the local feature information into the mask regression model to obtain output target mask, wherein the target mask is used to indicate the position of the editing area in the target image; A global feature output module, used for inputting the global input information into the global picture coding model to obtain output global feature information, and inputting the global feature information into the semantic segmentation model to obtain output semantic feature information; The model training module is used to input the semantic feature information, the global feature information and the local feature information into the detection score discrimination model to obtain the output target image generation result, and train the image detection model based on the classification loss function and the mask regression loss function according to the target mask, the target image generation result, the mask label and the image generation label corresponding to the training image sample to obtain a trained image detection model.
13. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
14. An electronic device, characterized in that: include: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the steps of the method as claimed in any one of claims 1 to 10.
15. A computer program product having at least one instruction stored thereon, characterized in that: When the at least one instruction is executed by the processor, the steps of the method described in any one of claims 1 to 10 are implemented.
Citation Information
Patent Citations
Multitask tampered image detection method guided by global features
CN114202529A
Model training method, image processing method and device, and medium
CN115424013A
Semantic segmentation method for remote sensing image
CN118351311A
Image processing method and apparatus, computer-readable storage medium
US20210366127A1
Image processing method and terminal device
WO2023246822A1
