Dataset construction method, system, electronic device and storage medium

By classifying and equally extracting real images and synthetic images to build a high-quality dataset, the problem of low synthetic image detection accuracy of the detection model is solved, and more efficient synthetic image recognition is achieved.

CN120047958BActive Publication Date: 2025-09-30ZHONGDIAN DATA IND CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510519280.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-24
Publication Date
2025-09-30
Estimated Expiration
2045-04-24

AI Technical Summary

Technical Problem

Existing detection models have low detection accuracy for synthetic images generated by diffusion models, and it is difficult to effectively distinguish synthetic images from real images.

Method used

The real images are divided into a first real image set and a second real image set, and synthetic images are generated based on the first real image set. The synthetic images are further divided into two categories: those with defects and those without defects. The target data set is constructed through equal extraction and classification to train the detection model.

Benefits of technology

The detection accuracy of the detection model for synthetic images is improved, and the features of synthetic images can be learned more comprehensively, thereby enhancing the recognition ability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120047958B_ABST
    Figure CN120047958B_ABST
Patent Text Reader

Abstract

The present application discloses a dataset construction method, system, electronic device, and storage medium, relating to the field of model training technology. The disclosed dataset construction method includes: dividing each real image into a first real image set and a second real image set, and obtaining each synthetic image based on each real image in the first real image set; dividing each synthetic image into a first synthetic image set and a second synthetic image set, and classifying the synthetic images in the first synthetic image set; extracting an equal number of images of each category from the first synthetic image set, and extracting images from the second synthetic image set to obtain a third synthetic image set; constructing a target dataset based on the real images in the second real image set and the synthetic images in the third synthetic image set, and training a detection model based on the target dataset. The present application aims to solve the technical problem of how to improve the accuracy of the detection model in detecting and recognizing synthetic images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of model training technology, and in particular to a data set construction method, system, electronic device and storage medium. Background Art

[0002] As a key carrier of information, images play a crucial role in the information transmission process. Currently, there are various ways to acquire images. Based on their generation characteristics, they can be broadly categorized as real images and synthetic images. Real images are those that have not been tampered with, while synthetic images are generated using specific models and algorithms.

[0003] Obviously, since synthetic images are generated through human intervention and model construction, they carry a greater risk of misuse and even malicious abuse than real images. Therefore, distinguishing synthetic images from real ones is crucial. Currently, detection models are widely used in synthetic image detection and serve as a primary detection tool. However, with technological advancements, synthetic images generated by diffusion models have exhibited new characteristics. These images often lack traditional recognition features, such as artifacts, resulting in lower detection accuracy for synthetic images.

[0004] Therefore, how to improve the accuracy of the detection model in detecting and identifying synthetic images is a technical problem that has yet to be solved by those skilled in the art. Summary of the Invention

[0005] The main purpose of this application is to provide a data set construction method, system, electronic device and storage medium, aiming to solve the technical problem of how to improve the accuracy of detection and recognition of synthetic images by the detection model.

[0006] To achieve the above objectives, this application proposes a dataset construction method, which includes:

[0007] Dividing each real image into a first real image set and a second real image set, and obtaining each synthetic image based on each real image in the first real image set;

[0008] dividing the synthetic images into a first synthetic image set and a second synthetic image set, and classifying the synthetic images in the first synthetic image set, wherein the first synthetic image set includes synthetic images with defects and the second synthetic image set includes synthetic images without defects;

[0009] Extracting an equal number of images of each category from the first synthetic image set, and extracting images from the second synthetic image set to obtain a third synthetic image set;

[0010] A target dataset is constructed based on the real images in the second real image set and the synthetic images in the third synthetic image set to train a detection model based on the target dataset.

[0011] In one embodiment, before the step of dividing the real images into a first set of real images and a second set of real images, the method further comprises:

[0012] Obtaining original real images from each data source, and filtering the original real images according to preset image size, image clarity range, aspect ratio range, and redundant information to obtain various intermediate real images;

[0013] Deduplication is performed on each of the intermediate real images, and each of the intermediate real images obtained after deduplication is used as each of the real images.

[0014] In one embodiment, before the step of deduplicating the intermediate real images and using the intermediate real images obtained after deduplication as the real images, the method further includes:

[0015] Calculating similarities between image-text pairs consisting of each intermediate real image and the text corresponding to each intermediate real image to obtain similarities corresponding to each image-text pair, and selecting target real images from each intermediate real image based on the similarities;

[0016] The step of deduplicating the intermediate real images and using the intermediate real images obtained after deduplication as the real images includes:

[0017] Deduplication is performed on each of the target real images, and each of the target real images obtained after deduplication is used as each of the real images.

[0018] In one embodiment, before the step of dividing the real images into a first set of real images and a second set of real images, the method further comprises:

[0019] Obtaining text corresponding to the original real image in each data source, and filtering the text corresponding to the original real image using a preset text size threshold to obtain various intermediate texts;

[0020] Deduplication is performed on each of the intermediate texts, and the original real images corresponding to each of the intermediate texts obtained after deduplication are used as each real image.

[0021] In one embodiment, before the step of dividing the real images into a first set of real images and a second set of real images, the method further comprises:

[0022] Filtering the text corresponding to each real image using a preset sensitive word detector, and filtering each real image using a preset NSFW image detector to obtain a preprocessed real image set;

[0023] The step of dividing each real image into a first real image set and a second real image set comprises:

[0024] The preprocessed real image set is divided into a first real image set and a second real image set.

[0025] In one embodiment, the step of extracting an equal number of images of each category from the first synthetic image set and extracting images from the second synthetic image set to obtain a third synthetic image set includes:

[0026] extracting a first preset number of images from each category in the first synthetic image set to obtain a fourth synthetic image set;

[0027] determining a total number of defect-free images based on the number of images in the fourth synthetic image set and a preset coefficient value, and extracting images from the second synthetic image set based on the total number of defect-free images to obtain a fifth synthetic image set;

[0028] The fourth composite image set and the fifth composite image set are combined to obtain a third composite image set.

[0029] In one embodiment, the step of obtaining each synthesized image based on each of the real images in the first real image set includes:

[0030] Inputting each of the real images in the first real image set into the graph-to-graph model to obtain respective synthetic images;

[0031] or,

[0032] Inputting the text corresponding to each of the real images in the first real image set into the text-based graph model to obtain respective synthetic images;

[0033] or,

[0034] Inputting each of the real images in the first real image set into the image-to-text model to obtain the material text corresponding to each of the real images in the first real image set;

[0035] Text enhancement is performed on each of the material texts, and each of the material texts after text enhancement is input into a text-generated graph model to obtain a synthetic image corresponding to each of the real images in the first real image set.

[0036] In addition, to achieve the above objectives, the present application also proposes a dataset construction system, which includes:

[0037] a first image processing module, configured to divide each real image into a first real image set and a second real image set, and obtain each synthetic image based on each real image in the first real image set;

[0038] a second image processing module, configured to divide the composite images into a first composite image set and a second composite image set, and classify the composite images in the first composite image set, wherein the first composite image set includes composite images with defects and the second composite image set includes composite images without defects;

[0039] a third image processing module, configured to extract an equal number of images of each category from the first synthetic image set, and extract images from the second synthetic image set, to obtain a third synthetic image set;

[0040] A data set integration module is used to construct a target data set based on the real images in the second real image set and the synthetic images in the third synthetic image set, so as to train a detection model based on the target data set.

[0041] In addition, to achieve the above-mentioned purpose, the present application also proposes an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the dataset construction method described above.

[0042] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium. A computer program is stored on the storage medium, and when the computer program is executed by a processor, the steps of the dataset construction method described above are implemented.

[0043] In an embodiment of the present application, by dividing each real image into a first real image set and a second real image set, and obtaining a synthetic image based on the real image in the first real image set, real images and synthetic images for constructing a data set can be obtained; then the synthetic images are divided into a first synthetic image set and a second synthetic image set, and the synthetic images in the first synthetic image set are classified, which can facilitate the statistics of the features of defective images of each category by defective image classification; then, images of each category are extracted in equal amounts from the first synthetic image set, and images are extracted from the second synthetic image set to obtain a third synthetic image set, which can further subdivide the defective images, thereby facilitating the extraction of images with different defective features. Synthesized images, and by extracting images from the second synthetic image set, the third synthetic image set can contain both images without defects and defective images with various defect features, so that the features of the synthetic images can be comprehensively summarized through the third synthetic image set; finally, based on the real images in the second real image set and the synthetic images in the third synthetic image set, a target data set is constructed to train a detection model based on the target data set. A high-quality target data set can be constructed through the third synthetic image set containing all the features of the synthetic images and the images in the second real image set containing the features of the real images, and then a model with high synthetic image detection accuracy can be trained based on the high-quality target data set. It can be seen that the present application has achieved the purpose of improving the accuracy of the detection model in detecting synthetic images. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0045] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0046] Figure 1 A flowchart of the first embodiment of the dataset construction method of this application is provided;

[0047] Figure 2 A flowchart of another embodiment of the method for constructing a dataset of the present application is provided;

[0048] Figure 3 This is a flowchart of a specific embodiment of the dataset construction method of this application;

[0049] Figure 4 A schematic diagram of the module structure of the data set construction system according to an embodiment of the present application;

[0050] Figure 5 Schematic diagram of the structure of the electronic device involved in the dataset construction method in the embodiment of the present application.

[0051] The purpose, features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0052] It should be understood that the specific embodiments described herein are merely used to explain the technical solutions of the present application and are not intended to limit the present application.

[0053] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0054] As a key carrier of information, images play a crucial role in the information transmission process. Currently, there are various ways to acquire images. Based on their generation characteristics, they can be broadly categorized as real images and synthetic images. Real images are those that have not been tampered with, while synthetic images are generated using specific models and algorithms.

[0055] Obviously, since synthetic images are generated through human intervention and model construction, they carry a greater risk of misuse and even malicious abuse than real images. Therefore, distinguishing synthetic images from real ones is crucial. Currently, detection models are widely used in synthetic image detection and serve as a primary detection tool. However, with technological advancements, synthetic images generated by diffusion models have exhibited new characteristics. These images often lack traditional recognition features, such as artifacts, resulting in lower detection accuracy for synthetic images.

[0056] Therefore, how to improve the accuracy of the detection model in detecting and identifying synthetic images is a technical problem that has yet to be solved by those skilled in the art.

[0057] To solve the above problems, the embodiment of the present application divides each real image into a first real image set and a second real image set, and obtains a synthetic image based on the real image in the first real image set, so as to obtain real images and synthetic images for constructing a data set; then the synthetic images are divided into a first synthetic image set and a second synthetic image set, and the synthetic images in the first synthetic image set are classified, which can facilitate the statistics of the features of defective images of each category by defective image classification; then, images of each category are extracted in equal amounts from the first synthetic image set, and images are extracted from the second synthetic image set to obtain a third synthetic image set, which can further subdivide defective images, thereby facilitating the extraction of images with different defects. In addition, by extracting images from the second synthetic image set, the third synthetic image set can contain both images without defects and defective images with various defect features, so that the features of the synthetic images can be comprehensively summarized through the third synthetic image set; finally, based on the real images in the second real image set and the synthetic images in the third synthetic image set, a target data set is constructed to train a detection model based on the target data set. A high-quality target data set can be constructed through the third synthetic image set containing all the features of the synthetic images and the images in the second real image set containing the features of the real images, and then a model with high synthetic image detection accuracy can be trained based on the high-quality target data set. It can be seen that the present application has achieved the purpose of improving the accuracy of the detection model in detecting synthetic images.

[0058] It should be noted that the execution entity of the dataset construction method of this application can be an electronic device with data processing, network communication and program running functions, such as a tablet computer, personal computer, server, etc.

[0059] Based on this, the present invention provides a method for constructing a data set. Figure 1 , Figure 1 This is a flowchart of the first embodiment of the dataset construction method of this application.

[0060] In this embodiment, the dataset construction method includes steps S10 to S40:

[0061] Step S10, dividing each real image into a first real image set and a second real image set, and obtaining each synthetic image based on each real image in the first real image set;

[0062] It should be noted that synthetic images refer to images created by computer-generated algorithms (such as generative adversarial networks, diffusion models, etc.). Synthetic images are not captured directly from the real world, but are generated by an AI (Artificial Intelligence) model based on input data or parameters. Real images refer to images captured directly from the real world by a camera or other imaging device. Real images represent actual scenes, objects or events in nature. Based on this, in this embodiment, the first real image set includes real images used to guide the generation of synthetic images, and the second real image set refers to a portion of real images directly used to train the detection model. The detection model is a model used to identify synthetic images, and this application does not limit the type of model.

[0063] For example, each real image can be randomly split into a first real image set and a second real image set, and then the real images in the first real image set can be processed by models such as DALL-E (an artificial intelligence image generation technology, an image generation model based on deep learning) to generate images, images to generate text, and text to generate images, so as to obtain a synthetic image.

[0064] It should be noted that the random allocation method adopted above can ensure that there is no systematic correlation between the first real image set and the second real image set, and further ensure that there is no systematic correlation between the synthetic images generated based on the first real image set and the second real image set, thereby enriching the data set used for model training based on the synthetic images and real images that have no systematic correlation.

[0065] Step S20, dividing the composite images into a first composite image set and a second composite image set, and classifying the composite images in the first composite image set, wherein the first composite image set includes composite images with defects, and the second composite image set includes composite images without defects;

[0066] For example, the defects of synthetic images can be divided into six different defect categories: physical defects, geometric defects, human body part defects, image distortion, text representation problems, and semantic scene problems. Specifically, the definitions of each category are as follows:

[0067] Physical defects include all elements in the image that contradict or violate the laws of physics. Specifically, physical defects mainly include optical anomalies and gravity anomalies. Optical anomalies include mirror reflection paradoxes (the reflection angle of metal surfaces or water surfaces deviates from Fresnel's law; for example, the reflection on the water surface deviates by more than 15° from the actual position of the object), shadow paradoxes (the direction of the object's shadow is inconsistent with the position of the light source; for example, in a multi-light source scene, the shadow directions conflict with each other), and light transmission anomalies (transparent materials do not correctly represent the refraction path of light; for example, the shape and position of objects seen through glass appear significantly distorted). Gravity anomalies include anti-gravity levitation (objects lack physical support; for example, a teacup floats 10 cm above a tabletop), fluid dynamics errors (water flow exhibits non-Newtonian fluid properties; for example, a stationary water curtain on a vertical wall), and cloth motion paradoxes (the direction of clothing fluttering is opposite to the direction of wind force; for example, the wind blows to the left but clothing flutters to the right).

[0068] Geometric defects: Synthesized images contain morphological errors that violate the principles of projective geometry, manifesting as inconsistencies in object shape, perspective relationships, or spatial structure. Specifically, geometric defects mainly include morphological distortion, spatial relationship anomalies, and symmetry violations. Morphological distortion includes topological errors (an abnormal number of furniture legs, such as a five-legged chair) and surface breaks (sudden changes in the curvature of a cylinder, such as a curvature change rate exceeding 0.25 per square millimeter). Spatial relationship anomalies include perspective contradictions (violations of the rule that near objects are larger than far objects, such as a pedestrian in the distance appearing larger than a nearby car) and depth layering errors (foreground objects being unreasonably obscured by background objects, such as a person standing in front having their shadow cast on a person behind them). Symmetry violations include mirror asymmetry (for example, the difference in pupil diameter between the left and right sides of a face exceeds 15%) and repeated pattern breaks (for example, tile textures are misaligned by more than 5 pixels at the seam).

[0069] Human body defects: Human body defects refer to unnatural manifestations of human anatomical structures or biomechanical characteristics in images that are easily perceived by the human visual system. Specifically, human body defects mainly include local anomalies, global anomalies, and material anomalies. Local anomalies include hand distortion (abnormal number of fingers, such as a 6-fingered palm, excessive joint rotation angle, such as wrist flexion exceeding 120°), facial inconsistencies (bilateral pupil color difference, such as LAB color difference ΔE>8, tooth arrangement that violates the dental arch curve), global anomalies (limb disproportion, such as a forearm length to upper arm ratio outside the normal range of 1:1.2-1.5), and kinematic paradoxes (the direction of knee flexion is inconsistent with the direction of force, such as the calf swinging forward when running). Material anomalies include skin color mutation (such as LAB color difference ΔE>5 between adjacent skin areas) and material penetration (such as the non-physical fusion of earrings and earlobe tissue).

[0070] Image distortion: Image distortion refers to signal processing defects introduced during the image generation process, which impair the integrity of visual information. Specifically, image distortion mainly includes frequency domain anomalies, spatial domain anomalies, and style conflicts. Frequency domain anomalies include checkerboard artifacts (for example, periodic checkered noise with an amplitude exceeding 3 decibels in high-frequency areas) and color banding effects (for example, discrete color scales appear in a gradient sky, with hue changes exceeding 5 degrees). Spatial domain anomalies include local blurring (for example, the 50% value of the modulation transfer function at the edge of a key object is less than 0.3 cycles per pixel) and detail annihilation (for example, the structural similarity index of the texture area is less than 0.65 compared to the original image). Style conflicts include brushstroke abrupt changes (for example, the appearance of vector graphic feature edges in an oil painting-style image) and lighting style conflicts (for example, realistic scenes contain cartoon-style shadows).

[0071] Text representation issues: Text representation issues refer to morphological or semantic errors in text elements within an image. Specifically, text representation issues primarily include morphological anomalies, semantic anomalies, and spatial anomalies. Morphological anomalies include character distortion (for example, the right arc of the letter "B" is missing, forming the combination "13") and font mutations (for example, a mixture of Songti and Heiti within the same word). Semantic anomalies include meaningless combinations (for example, signs displaying garbled characters such as "@#GmbH_2023") and contextual inconsistencies (for example, a Chinese building sign displaying the English word "PIZZERIA"). Spatial anomalies include perspective distortion (for example, text on a wall does not follow a plane projection transformation) and surface adaptation failures (for example, text on a cylindrical surface does not undergo arc deformation).

[0072] Semantic scene problems: Semantic scene problems refer to situations where the combination of elements in an image conforms to physical / geometric laws, but the overall semantic logic violates common sense. Specifically, semantic scene problems mainly include spatiotemporal contradictions, ecological contradictions, and functional contradictions. Spatiotemporal contradictions include seasonal conflicts (for example, a figure wearing a short-sleeved T-shirt in a snowy scene) and day-night misalignment (for example, the midday sun appears against a starry sky). Ecological contradictions include species distribution anomalies (for example, a colony of penguins appears in a desert scene) and cultural mismatches (for example, a figure in Tang Dynasty clothing uses a smartphone). Functional contradictions include instrument misuse (for example, a microscope used as a drinking cup) and behavioral paradoxes (for example, a diver lighting a lighter on the seabed).

[0073] In a feasible implementation, images with defects may be classified by using a model or manual annotation, and this application does not impose any restrictions on this.

[0074] Step S30, extracting an equal number of images of each category from the first synthetic image set, and extracting images from the second synthetic image set, to obtain a third synthetic image set;

[0075] It should be noted that the third synthetic image set is a set of images extracted from the first synthetic image set, and an image set extracted from the second synthetic image set. In addition, the above-mentioned equal extraction means that the same number of images are extracted for each category. For example, when there are 10 defect categories in the first synthetic image set, and the number of images to be extracted is preset to 100, equal extraction means extracting 100 images from each of the 10 defect categories, so that 10*100=1000 images can be extracted from the first synthetic image set. In addition, in order to facilitate the detection model to learn the features of synthetic images without defects, images can also be extracted from the second synthetic image set, wherein the number of images extracted from the second synthetic image set is not limited in this embodiment.

[0076] It's understandable that different categories in the first synthetic image set have different defect characteristics, while the second synthetic image set, while lacking the defects of the synthetic images, possesses common synthetic image characteristics. Therefore, to allow the detection model to fully learn the characteristics corresponding to different defect types and the common synthetic image characteristics, a third synthetic image set for training the detection model can be obtained by extracting images from each defect category and from the second synthetic image set.

[0077] Furthermore, in one feasible embodiment, data augmentation can be performed on the images extracted from the first synthetic image set and the images extracted from the second synthetic image set before being combined to form a third synthetic image set. Data augmentation can be performed by rotation or flipping, thereby expanding the third synthetic image set while preserving image features.

[0078] Furthermore, in one feasible implementation, when required by the application scenario, the proportion of synthetic images of certain defect categories extracted from the first synthetic dataset can be specifically increased, thereby specifically enhancing the detection model's ability to identify certain synthetic defect conditions. Furthermore, by properly controlling the proportion of images of various categories extracted from the first synthetic dataset, the detection model can be prevented from overfitting to a single, frequently occurring synthetic defect condition.

[0079] Step S40: constructing a target dataset based on the real images in the second real image set and the synthetic images in the third synthetic image set, so as to train a detection model based on the target dataset.

[0080] It is understood that after obtaining the third synthetic image set containing features of synthetic images and real images containing features of real images, the real images in the second real image set can be combined with the third synthetic image set to obtain a target dataset. Furthermore, the detection model can be trained based on the target dataset, allowing the detection model to fully learn the differences in features between synthetic and real images based on the target dataset, thereby improving the accuracy of synthetic image detection.

[0081] In this embodiment, by dividing each real image into a first real image set and a second real image set, and obtaining a synthetic image based on the real image in the first real image set, real images and synthetic images for constructing a data set can be obtained; then the synthetic images are divided into a first synthetic image set and a second synthetic image set, and the synthetic images in the first synthetic image set are classified, which can facilitate the statistics of the features of defective images of each category by means of defective image classification; then, images of each category are extracted in equal amounts from the first synthetic image set, and images are extracted from the second synthetic image set to obtain a third synthetic image set, which can further subdivide the defective images, thereby facilitating the extraction of synthetic images with different defective features. In addition, by extracting images from the second synthetic image set, the third synthetic image set can contain both images without defects and defective images with various defect features, so that the features of the synthetic images can be comprehensively summarized through the third synthetic image set; finally, based on the real images in the second real image set and the synthetic images in the third synthetic image set, a target data set is constructed to train a detection model based on the target data set. A high-quality target data set can be constructed through the third synthetic image set containing all the features of the synthetic images and the images in the second real image set containing the features of the real images, and then a model with high synthetic image detection accuracy can be trained based on the high-quality target data set. It can be seen that the present application has achieved the purpose of improving the accuracy of the detection model in detecting synthetic images.

[0082] Furthermore, based on the first embodiment of the method for constructing a dataset of the present application, a second embodiment of the method for constructing a dataset of the present application is proposed.

[0083] In this embodiment, before the above step S10, the method further includes:

[0084] Step S100: obtaining original real images from various data sources, and filtering the original real images according to preset image size, image clarity range, aspect ratio range, and redundant information to obtain various intermediate real images;

[0085] Understandably, the features of raw, real-world images from a single data source often have limitations. Therefore, acquiring raw, real-world images from multiple data sources can help the detection model learn the features of different raw, real-world images. Raw, real-world images refer to real-world images obtained from a data source and have not undergone any processing.

[0086] It is understandable that low-quality images and images with unbalanced aspect ratios will affect the training effect of the detection model. Therefore, the original real image can be filtered by image size, image clarity range, aspect ratio range, and image redundant information, and the original real image remaining after filtering is used as the intermediate real image.

[0087] In addition, the QR codes, emoticons, and region segmentation symbols in the original real image are invalid data in the synthetic image detection process. Therefore, in a feasible implementation, invalid data can also be filtered out based on the data characteristics of each data source.

[0088] In step S200 , deduplication is performed on each of the intermediate real images, and each of the intermediate real images obtained after deduplication is used as each of the real images.

[0089] It is understandable that there may be duplicate images in different data sources. Therefore, the convolutional neural network can be trained through contrastive learning technology to detect duplicate images and then remove duplicate data in the intermediate real images.

[0090] In this embodiment, the present application filters the image by setting various filtering conditions and removes duplicate images through data deduplication, thereby improving the quality of the image and laying the foundation for improving the accuracy of the detection model.

[0091] In a feasible implementation manner, before the above step S200, the method further includes:

[0092] Step S300: Calculating similarities between image-text pairs consisting of the intermediate real images and the text corresponding to the intermediate real images to obtain similarities corresponding to the image-text pairs, and selecting target real images from the intermediate real images based on the similarities.

[0093] It is understood that, in addition to images, the data source may also include preset text corresponding to the images. For example, a pre-trained comparative language image model can be used to calculate the similarity between an intermediate real image and its corresponding text. This similarity can then be calculated based on the pre-trained comparative language image model. Each of these similarities can then be compared with a pre-set similarity threshold, and the intermediate real image with a similarity greater than or equal to the similarity threshold is selected as the target real image.

[0094] Exemplarily, if the similarity between the intermediate real image A and the text corresponding to the intermediate real image A is greater than a similarity threshold, the intermediate real image A can be used as the target real image.

[0095] Based on this, the above step S200 includes:

[0096] Step S2001 , deduplicating each of the target real images, and using each of the target real images obtained after deduplication as each of the real images.

[0097] In this embodiment, the present application obtains similarity by comparing the language image pre-training model and obtains the real image based on the similarity, so as to retain higher quality images, thereby improving the quality of the data set and further increasing the probability of the detection model learning the correct features.

[0098] In a feasible implementation manner, before the above step S10, the method further includes:

[0099] Step S400: obtaining text corresponding to the original real image from each data source, and filtering the text corresponding to the original real image using a preset text size threshold to obtain various intermediate texts;

[0100] In step S500 , duplicates are removed from the intermediate texts, and the original real images corresponding to the intermediate texts obtained after the duplicates are removed are used as the real images.

[0101] It's understandable that factors like image size and clarity can affect the quality of real images, and thus the accuracy of the detection model's synthetic image detection. The text associated with the real image can also affect the accuracy of the detection model's synthetic image detection. Therefore, text associated with the original real image can be filtered using a pre-set text size threshold, where text size refers to the amount of storage space occupied by the text.

[0102] Specifically, text with a text size lower than a preset value may be used as intermediate text, and after deduplication of the intermediate text, the original real image corresponding to the deduplicated intermediate text may be used as the real image.

[0103] Therefore, the present application can further improve the efficiency of the detection model in detecting synthetic images by processing the text corresponding to the image.

[0104] In a feasible implementation manner, before the above step S10, the method further includes:

[0105] Step S600: filtering the text corresponding to each real image using a preset sensitive word detector, and filtering each real image using a preset NSFW image detector to obtain a preprocessed real image set;

[0106] Understandably, real images may contain NSFW images (not safe for work, containing pornographic, violent, or other inappropriate content), and the text corresponding to real images may contain personal data. Therefore, a pre-set sensitive word detector can be used to identify and remove sensitive data such as ID numbers, mobile phone numbers, email addresses, and IP addresses from text, and an NSFW image detector can be used to filter out NSFW images.

[0107] Based on this, the above step S10 further includes:

[0108] Step S101 : dividing the pre-processed real image set into a first real image set and a second real image set.

[0109] In this embodiment, the technical problem of privacy leakage can be avoided by using a sensitive word detector and an NSFW image detector.

[0110] Furthermore, based on the first embodiment and / or the second embodiment of the dataset construction method of the present application, a third embodiment of the dataset construction method of the present application is proposed.

[0111] Please refer to Figure 2 In this embodiment, the above step S30 includes:

[0112] Step S301, extracting a first preset number of images from each category in the first synthetic image set to obtain a fourth synthetic image set;

[0113] Step S302: determining the total number of defect-free images based on the number of images in the fourth synthetic image set and a preset coefficient value, and extracting images from the second synthetic image set based on the total number of defect-free images to obtain a fifth synthetic image set;

[0114] It should be noted that the coefficient value is used to adjust the ratio of the number of defective images to the number of non-defective images. The total number of non-defective images can be the product of the number of images in the fourth composite image set and the coefficient value.

[0115] Step S303: Merge the fourth composite image set and the fifth composite image set to obtain a third composite image set.

[0116] In this embodiment, the present application ensures that the detection model can learn both the characteristics of different defects and the characteristics of defect-free synthetic images by extracting synthetic images corresponding to different defect types in equal amounts and extracting defect-free synthetic images in a preset ratio, thereby improving the accuracy of the detection model in identifying synthetic images.

[0117] Furthermore, based on the first embodiment and / or the second embodiment of the dataset construction method of the present application, a fourth embodiment of the dataset construction method of the present application is proposed.

[0118] In this embodiment, the above step S10 includes:

[0119] Step S102, classifying the real images and extracting a second preset number of images from each category to obtain a second real image set;

[0120] It should be noted that the basis for classifying real images can be the image scene or the type of image object, and this application does not impose any restrictions on this.

[0121] In one possible approach, categories could include: People, Animals, Food, Nature and Environment, Architecture and Urban Landscape, Urban Infrastructure, Transportation, Everyday Objects, Health and Medical, Art and Design, Social Activities, Equipment and Tools.

[0122] In order to facilitate the detection model to learn the real image features of each category, a second preset number of images can be extracted from each category, and the extracted images are used as the second real image set.

[0123] Step S103 : merging the real images that do not belong to the second real image set to obtain a first real image set.

[0124] In this embodiment, the present application can enrich the features in the data set by first classifying and then dividing the second real image set and the first real image set, thereby facilitating the detection model to learn more comprehensive real image features.

[0125] In a feasible implementation manner, the above step S10 further includes:

[0126] Step S104, inputting each of the real images in the first real image set into a graph-to-graph model to obtain each synthetic image;

[0127] In this embodiment, a synthetic image can be obtained through a graph-based graph model, wherein the graph-based graph model can be an extended model or a generative adversarial network model, and this application does not impose any restrictions on this.

[0128] Step S105: inputting the text corresponding to each of the real images in the first real image set into the text-based graph model to obtain each synthetic image;

[0129] In this embodiment, in addition to obtaining a synthetic image based on an image-derived graph model, a synthetic image can also be obtained based on the text corresponding to the real image through a text-derived graph model. In this application, the specific type of the text-derived graph model is not limited.

[0130] Step S106: input each of the real images in the first real image set into the image-to-text model to obtain the material text corresponding to each of the real images in the first real image set;

[0131] In step S107 , text enhancement is performed on each of the material texts, and each of the material texts after text enhancement is input into a text-generated graph model to obtain a synthetic image corresponding to each of the real images in the first real image set.

[0132] It should be noted that when synthesizing images directly from real images using image-derived image models, the inherent randomness of image-derived image models makes it impossible to control the details of the synthesized image. Therefore, this application proposes a solution that combines image-derived text models, text enhancement, and text-derived image models.

[0133] Specifically, after obtaining the material text through the image-to-text model, industry knowledge can be integrated into the material text through text enhancement technology, so that the process of generating synthetic images based on the material text is controllable, thereby improving the quality of the synthetic image, and then enabling the detection model to detect synthetic images of specific industries.

[0134] Furthermore, based on the various embodiments of the dataset construction method of the present application described above, a specific embodiment of the dataset construction method of the present application is proposed.

[0135] Please refer to Figure 3 , Figure 3 This is a flowchart of a specific embodiment of the dataset construction method of this application. Figure 3 The steps of the dataset construction method in this application are as follows:

[0136] 1. Data processing:

[0137] Image data is obtained from SA1B (a large-scale image segmentation dataset containing 11 million diverse, high-resolution, privacy-preserving images and over 1.1 billion high-quality segmentation masks), Wanjuan 1.0 (the first open-source version of the Wanjuan multimodal corpus, consisting of text, image, and video datasets), COCO (a large-scale object detection, segmentation, and captioning dataset), Laion5B (a large-scale multimodal dataset containing 5.85 billion high-quality image-text pairs), and DOCCI (containing approximately 15,000 high-resolution images with detailed human annotations). For example, 50,000 images can be extracted from SA1B, Wanjuan 1.0, COCO, and Laion5B, respectively, and 15,000 image and text data can be extracted from DOCCI, resulting in a total of 215,000 data items. The data is then processed through several steps: data filtering, data deduplication, security checks, and image-text pair processing.

[0138] (1) Data filtering: Filter out low-quality images that are too small or too large (e.g., images smaller than 150 pixels, images larger than 50,000 pixels), and images with an unbalanced aspect ratio (e.g., images with a ratio exceeding 4:1). Furthermore, the data characteristics of multiple data sources are explored to remove invalid data such as QR codes, emoticons, and segmented images.

[0139] (2) Data deduplication: Convolutional neural networks are trained using contrastive learning to solve the problem of image duplicate detection and remove duplicate data from the dataset.

[0140] (3) Security Detection: Apply NSFW image detectors and sensitive word detection to all data in the dataset. If an image is NSFW, it is deleted. In addition, to reduce the risk of personal data leakage, sensitive data such as ID card numbers, mobile phone numbers, email addresses, and IP addresses can also be removed from the data.

[0141] (4) Image-text pair data processing: To ensure the usability of image-text pair data, we can filter the content of image-text pairs. For example, we can use the ViT-B / 32 CLIP model (a variant of the CLIP model, where "B" stands for the base model and "32" refers to the patch size of 32) to calculate the cosine similarity between the image and text encodings, and then remove image-text pairs with low cosine similarity (e.g., remove all image-text pairs with a cosine similarity below 0.28).

[0142] After data filtering, deduplication, security testing, and graphic and text processing, 215,000 data items from SA1B, Wanjuan1.0, COCO, Laion5B, and DOCCI were collected to obtain 128,500 data items that met the requirements.

[0143] 2. Dataset construction:

[0144] (1) Based on the 128,500 data items obtained after data processing, 40,000 data items were extracted as real data for training the detection model (i.e., obtaining the second real image set). The real data included categories such as people, animals, food, nature and environment, architecture and urban landscape, urban infrastructure, transportation, daily necessities, health and medical care, art and design, social activities, equipment and tools. The remaining 88,500 data items were used as the material for generating synthetic images (i.e., obtaining the first real image set).

[0145] (2) Four models were selected: ProGAN (a variant of generative adversarial network), SD3 (an open source model for text-to-image), Kolors (a large text-to-image model), and DALLE3 (a version of the DALL E series model). 88,500 pieces of data were randomly and evenly divided into four groups as source data for the four models. The text required by the text-to-image model is generated by an image-to-text model, such as the CPM2.5 model (an autoregressive language model based on the Transformer architecture), or it can be obtained by text enhancement based on the text corresponding to the real image. A synthetic image is generated from one image or one text. In this way, 88,500 synthetic images (i.e. Figure 3 (synthetic data in ).

[0146] (3) 88,500 synthetic images were labeled according to defect image classification (i.e. Figure 3 ). Assume that there are 8,600 defective images each of physical defects, geometric defects, body part defects, image distortion, text representation issues, and semantic scene issues, with the remainder being non-defective images. To ensure an equal number of defective images of each type, a synthetic image set of 40,000 images was constructed using a 1:10 ratio (coefficient of 10) between defective images and non-defective synthetic images.

[0147] (4) The target dataset is constructed from 40,000 real images and 40,000 extracted synthetic images in a 1:1 ratio. The target dataset is then divided into a fine-tuning dataset and an evaluation dataset, with a fine-tuning dataset and an evaluation dataset ratio of 8:2. That is, 64,000 images (32,000 real images and 32,000 synthetic images) are used to construct the fine-tuning dataset, and 16,000 images (8,000 real images and 8,000 synthetic images) are used to construct the evaluation dataset.

[0148] 3. Model fine-tuning and evaluation:

[0149] Based on the constructed dataset, the CLIP ViT-L / 14 model is fine-tuned for binary classification of synthetic images. The fine-tuned model is adapted to the classification task of distinguishing synthetic images from real images.

[0150] (1) Model fine-tuning: To meet the binary classification requirements of distinguishing synthetic images from real images, the output of the penultimate layer of the model is fine-tuned to identify synthetic images. 32,000 real images and 32,000 synthetic images are used for fine-tuning. The corresponding feature vectors {𝐫1,…,𝐫N} and {𝐟1,…,𝐟N} extracted at the output of the penultimate layer are collected, where 𝐫i=CLIP*(Ri) and 𝐟i=CLIP*(Fi). A mini-batch stochastic gradient descent (SGD) optimizer is used for parameter updates. The cross-entropy loss function is used to calculate the difference between the model prediction and the actual data by minimizing the distribution difference of the feature vectors in high-dimensional space to fine-tune the model. The learning rate is set to 4e-6, the weight decay is set to 1e-3, and training is performed for 3-8 epochs (training cycles).

[0151] (2) Model Evaluation: The performance of the model is evaluated on an independent evaluation dataset. The fine-tuned CLIP ViT-L / 14 model is applied to extract the feature vectors of the image to be evaluated. The nearest neighbor method is used to score the image by calculating the distance between the image features and the known real image features in the feature space. The confidence level (0-1) of whether the image is a synthetic image is given. Scoring criteria: Output range: 0-1; higher scores (1) indicate synthetic images, lower scores (0) indicate real images; a threshold of 0.5 is given, and images greater than 0.5 are considered synthetic images.

[0152] The comparison of the evaluation results of each synthetic image detection method on the evaluation dataset is shown in Table 1 below:

[0153] Table 1

[0154]

[0155] The meanings of the indicators in Table 1 are as follows:

[0156] Accuracy refers to the ratio of the number of samples correctly predicted by the model to the total number of samples. The calculation formula for accuracy is:

[0157] Accuracy = (TP + TN) / (TP + TN + FP + FN);

[0158] Among them, TP (True Positive) is the number of images correctly identified as synthetic images, TN (True Negative) is the number of images correctly identified as real images, FP (False Positive) is the number of real images incorrectly identified as synthetic images, and FN (False Negative) is the number of synthetic images incorrectly identified as real images.

[0159] Average Precision (AP) is obtained by calculating the area under the PR (Precision-Recall) curve. It combines the accuracy (Precision) and recall (Recall) to provide a comprehensive evaluation indicator. Calculation steps:

[0160] Calculate the prediction score for each sample;

[0161] Sort all samples by prediction score from high to low;

[0162] Gradually increase the threshold and calculate the precision and recall under different thresholds;

[0163] Draw the precision-recall curve;

[0164] Calculate the area under the curve:

[0165] AP = Σ(R_n - R_(n-1)) * P_n;

[0166] Where: R_n is the recall rate of the nth threshold, R_(n-1) is the recall rate of the n-1th threshold, and P_n is the precision rate of the nth threshold.

[0167] True accuracy refers to the accuracy of real images, that is, the detection model's prediction accuracy in identifying real images. This metric focuses on the detection model's ability to distinguish real images in real applications. Its calculation formula is the same as that of detection accuracy.

[0168] Forgery accuracy refers to the accuracy of synthetic images, that is, the detection model's prediction accuracy in identifying synthetic images. This metric measures the detection model's ability to distinguish synthetic images and is calculated using the same formula as detection accuracy.

[0169] As shown in the table above, the fine-tuned detection model in this application achieved an accuracy of 72.45% on the evaluation dataset, an average precision of 69.45%, a true accuracy of 99.58%, and a forged accuracy of 70.54%, which is a significant improvement over previous traditional methods. CNNSpot, FreDect, Fusing, GramNet, LGrad, and UnivFD methods performed poorly on the evaluation dataset, with overall accuracies less than 50%, below random chance. The average precision ranged from 32% to 45%, indicating that the overall discrimination capabilities of traditional methods were weak. True accuracies were generally high, with most exceeding 90%, indicating that the detection models were very adept at identifying real images and were heavily biased towards judging them as real. However, forgery accuracies were extremely low, ranging from 0 to 0.15, indicating that traditional methods were almost unable to identify the synthetic images in the evaluation test set. Furthermore, the fine-tuned CLIP ViT-L / 14 model was able to effectively distinguish between synthetic and real images and was adaptable to images generated by different generative models. Furthermore, because the detection model proposed in this application uses a fixed feature extractor, it does not require targeted training. Furthermore, the proposed evaluation is stable and not affected by the features of a single generative model, resulting in excellent performance in cross-model testing. This demonstrates that this application improves the accuracy and generalization of synthetic image detection, expanding the application scenarios of synthetic image detection models.

[0170] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the method for constructing the dataset of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0171] This application also provides a dataset construction system, please refer to Figure 4 , the dataset construction system includes:

[0172] A first image processing module 10 is configured to divide each real image into a first real image set and a second real image set, and obtain each synthetic image based on each real image in the first real image set;

[0173] a second image processing module 20, configured to divide the composite images into a first composite image set and a second composite image set, and classify the composite images in the first composite image set, wherein the first composite image set includes composite images with defects and the second composite image set includes composite images without defects;

[0174] A third image processing module 30 is configured to extract an equal number of images of each category from the first synthetic image set and extract images from the second synthetic image set to obtain a third synthetic image set;

[0175] The data set integration module 40 is configured to construct a target data set based on the real images in the second real image set and the synthetic images in the third synthetic image set, so as to train a detection model based on the target data set.

[0176] In one embodiment, the dataset construction system further includes:

[0177] A first filtering module is configured to obtain original real images from each data source and filter the original real images according to a preset image size, image clarity range, aspect ratio range, and redundant information to obtain respective intermediate real images;

[0178] The first deduplication module is used to deduplicate each of the intermediate real images and use each of the intermediate real images obtained after deduplication as each of the real images.

[0179] In one embodiment, the dataset construction system further includes:

[0180] a similarity screening module, configured to calculate similarities between image-text pairs consisting of each of the intermediate real images and the text corresponding to each of the intermediate real images, obtain similarities corresponding to each of the image-text pairs, and screen out target real images from each of the intermediate real images based on the similarities;

[0181] Based on this, the first deduplication module is further used to:

[0182] Deduplication is performed on each of the target real images, and each of the target real images obtained after deduplication is used as each of the real images.

[0183] In one embodiment, the dataset construction system further includes:

[0184] A second filtering module is used to obtain text corresponding to the original real image in each data source, and filter the text corresponding to the original real image according to a preset text size threshold to obtain various intermediate texts;

[0185] The second deduplication module is configured to dedupe the intermediate texts and use the original real images corresponding to the intermediate texts obtained after deduplication as the real images.

[0186] In one embodiment, the dataset construction system further includes:

[0187] A third filtering module is configured to filter the text corresponding to each real image using a preset sensitive word detector, and to filter each real image using a preset NSFW image detector, to obtain a preprocessed real image set;

[0188] Based on this, the first image processing module 10 is further configured to:

[0189] The preprocessed real image set is divided into a first real image set and a second real image set.

[0190] In one embodiment, the third image processing module 30 is further configured to:

[0191] extracting a first preset number of images from each category in the first synthetic image set to obtain a fourth synthetic image set;

[0192] determining a total number of defect-free images based on the number of images in the fourth synthetic image set and a preset coefficient value, and extracting images from the second synthetic image set based on the total number of defect-free images to obtain a fifth synthetic image set;

[0193] The fourth composite image set and the fifth composite image set are combined to obtain a third composite image set.

[0194] In one embodiment, the first image processing module 10 is further configured to:

[0195] Classifying the real images and extracting a second preset number of images from each category to obtain a second real image set;

[0196] The real images that do not belong to the second real image set are merged to obtain a first real image set.

[0197] In one embodiment, the first image processing module 10 is further configured to:

[0198] Inputting each of the real images in the first real image set into the graph-to-graph model to obtain respective synthetic images;

[0199] or,

[0200] Inputting the text corresponding to each of the real images in the first real image set into the text-based graph model to obtain respective synthetic images;

[0201] or,

[0202] Inputting each of the real images in the first real image set into the image-to-text model to obtain the material text corresponding to each of the real images in the first real image set;

[0203] Text enhancement is performed on each of the material texts, and each of the material texts after text enhancement is input into a text-generated graph model to obtain a synthetic image corresponding to each of the real images in the first real image set.

[0204] The dataset construction system provided in this application, employing the dataset construction method described in the aforementioned embodiments, can address the technical problem of improving the accuracy of detection models in detecting and recognizing synthetic images. Compared to the prior art, the dataset construction system provided in this application offers the same beneficial effects as the dataset construction method described in the aforementioned embodiments. Other technical features of the dataset construction system are the same as those disclosed in the aforementioned embodiments and are not further elaborated upon here.

[0205] The present application provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the dataset construction method in the above-mentioned embodiment 1.

[0206] Reference below Figure 5 , which shows a structural schematic diagram of an electronic device suitable for implementing the embodiments of the present application. Figure 5 The electronic device shown is merely an example and should not limit the functions and scope of use of the embodiments of the present application.

[0207] like Figure 5 As shown, the electronic device may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes based on programs stored in a read-only memory 1002 or programs loaded from a storage device 1003 into a random access memory 1004. The random access memory 1004 also stores various programs and data required for the operation of the electronic device. The processing device 1001, the read-only memory 1002, and the random access memory 1004 are interconnected via a bus 1005. An input / output interface 1006 is also connected to the bus. Typically, the following systems may be connected to the input / output interface 1006: an input device 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; a storage device 1003 including, for example, a magnetic tape or hard disk; and a communication device 1009. The communication device 1009 may allow the electronic device to communicate with other devices wirelessly or wired to exchange data. Although the figures show electronic devices with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have instead.

[0208] In particular, according to the embodiments disclosed in the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program comprising program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via a communication device, or installed from a storage device 1003, or installed from a read-only memory 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are performed.

[0209] The electronic device provided in this application, employing the dataset construction method described in the aforementioned embodiment, can address the technical problem of improving the accuracy of a detection model in detecting and recognizing synthetic images. Compared to the prior art, the electronic device provided in this application achieves the same beneficial effects as the dataset construction method described in the aforementioned embodiment. Other technical features of this electronic device are the same as those disclosed in the aforementioned embodiment and are not further elaborated upon here.

[0210] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0211] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

[0212] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, a computer program) stored thereon, and the computer-readable program instructions are used to execute the dataset construction method in the above embodiment.

[0213] The computer-readable storage medium provided herein may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems, or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including, but not limited to, wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0214] The computer-readable storage medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0215] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by an electronic device, the electronic device: divides each real image into a first real image set and a second real image set, and obtains a synthetic image based on the real images in the first real image set; divides the synthetic images into a first synthetic image set and a second synthetic image set, and classifies the synthetic images in the first synthetic image set; extracts images of each category in equal amounts from the first synthetic image set, and extracts images from the second synthetic image set to obtain a third synthetic image set; constructs a target data set based on the real images in the second real image set and the synthetic images in the third synthetic image set, so as to train a detection model based on the target data set.

[0216] Computer program code for performing the operations of the present application may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0217] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, program segment or a part of code, and the module, program segment or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.

[0218] The modules described in the embodiments of the present application may be implemented in software or hardware, wherein the name of a module does not necessarily limit the unit itself.

[0219] The computer-readable storage medium provided in this application stores computer-readable program instructions (i.e., a computer program) for executing the aforementioned dataset construction method. This computer-readable storage medium addresses the technical problem of improving the accuracy of detection models for synthetic image recognition. Compared to the prior art, the beneficial effects of the computer-readable storage medium provided in this application are similar to those of the dataset construction method provided in the aforementioned embodiments and are not further elaborated here.

[0220] The above description is only part of the embodiments of the present application and does not limit the patent scope of the present application. All equivalent structural transformations made by using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect application in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A method for constructing a data set, characterized in that: The data set construction method includes: Randomly dividing each real image into a first real image set and a second real image set, and obtaining each synthetic image based on each real image in the first real image set; wherein there is no systematic correlation between the first real image set and the second real image set, and there is no systematic correlation between the synthetic image and the second real image set; Dividing the synthetic images into a first synthetic image set and a second synthetic image set, and classifying the synthetic images in the first synthetic image set, wherein the first synthetic image set includes synthetic images with defects, and the defect categories include: physical defects, geometric defects, human body part defects, image distortion, text representation problems, and semantic scene problems, and the second synthetic image set includes synthetic images without defects; extracting a first preset number of images from each category of the first synthetic image set to obtain a fourth synthetic image set; determining a total number of defect-free images based on the number of images in the fourth synthetic image set and a preset coefficient value, and extracting images from the second synthetic image set based on the total number of defect-free images to obtain a fifth synthetic image set; merging the fourth composite image set and the fifth composite image set to obtain a third composite image set; A target dataset is constructed based on the real images in the second real image set and the synthetic images in the third synthetic image set to train a detection model based on the target dataset.

2. The dataset construction method according to claim 1, wherein: Before the step of dividing the real images into a first real image set and a second real image set, the method further includes: Obtaining original real images from each data source, and filtering the original real images according to preset image size, image clarity range, aspect ratio range, and redundant information to obtain various intermediate real images; Deduplication is performed on each of the intermediate real images, and each of the intermediate real images obtained after deduplication is used as each of the real images.

3. The dataset construction method according to claim 2, wherein: Before the step of deduplicating the intermediate real images and using the intermediate real images obtained after deduplication as the real images, the method further includes: Calculating similarities between image-text pairs consisting of each intermediate real image and the text corresponding to each intermediate real image to obtain similarities corresponding to each image-text pair, and selecting target real images from each intermediate real image based on the similarities; The step of deduplicating the intermediate real images and using the intermediate real images obtained after deduplication as the real images includes: Deduplication is performed on each of the target real images, and each of the target real images obtained after deduplication is used as each of the real images.

4. The dataset construction method according to claim 1, wherein: Before the step of dividing the real images into a first real image set and a second real image set, the method further includes: Obtaining text corresponding to the original real image in each data source, and filtering the text corresponding to the original real image using a preset text size threshold to obtain various intermediate texts; Deduplication is performed on each of the intermediate texts, and the original real images corresponding to each of the intermediate texts obtained after deduplication are used as each real image.

5. The method for constructing a data set according to claim 1, wherein: Before the step of dividing the real images into a first real image set and a second real image set, the method further includes: Filtering the text corresponding to each real image using a preset sensitive word detector, and filtering each real image using a preset NSFW image detector to obtain a preprocessed real image set; The step of dividing each real image into a first real image set and a second real image set comprises: The preprocessed real image set is divided into a first real image set and a second real image set.

6. The method for constructing a data set according to claim 1, wherein: The step of obtaining each synthetic image based on each real image in the first real image set comprises: Inputting each of the real images in the first real image set into the graph-to-graph model to obtain respective synthetic images; or, Inputting the text corresponding to each of the real images in the first real image set into the text-based graph model to obtain respective synthetic images; or, Inputting each of the real images in the first real image set into the image-to-text model to obtain the material text corresponding to each of the real images in the first real image set; Text enhancement is performed on each of the material texts, and each of the material texts after text enhancement is input into a text-generated graph model to obtain a synthetic image corresponding to each of the real images in the first real image set.

7. A data set construction system, characterized in that: The dataset construction system includes: a first image processing module, configured to randomly divide each real image into a first real image set and a second real image set, and obtain each synthetic image based on each real image in the first real image set, wherein there is no systematic correlation between the first real image set and the second real image set, and there is no systematic correlation between the synthetic image and the second real image set; a second image processing module, configured to divide each of the synthetic images into a first synthetic image set and a second synthetic image set, and classify the synthetic images in the first synthetic image set, wherein the first synthetic image set includes synthetic images with defects, and the defect categories include: physical defects, geometric defects, human body part defects, image distortion, text representation problems, and semantic scene problems, and the second synthetic image set includes synthetic images without defects; a third image processing module configured to extract an equal number of images of each category from the first synthetic image set and to extract images from the second synthetic image set to obtain a third synthetic image set. The third image processing module is further configured to extract a first preset number of images from each category in the first synthetic image set to obtain a fourth synthetic image set; determine the total number of defect-free images based on the number of images in the fourth synthetic image set and a preset coefficient value, and extract images from the second synthetic image set based on the total number of defect-free images to obtain a fifth synthetic image set; and combine the fourth synthetic image set and the fifth synthetic image set to obtain a third synthetic image set. A data set integration module is used to construct a target data set based on the real images in the second real image set and the synthetic images in the third synthetic image set, so as to train a detection model based on the target data set.

8. An electronic device, characterized in that: The electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the dataset construction method according to any one of claims 1 to 6.

9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the dataset construction method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Face forgery detection method based on multi-feature fusion network

    CN118015714A

  • Artificial intelligence generated image detection method and device, storage medium and electronic equipment

    CN119741396A