An AI-based image dataset generation method, device, equipment, and storage medium

CN121616910BActive Publication Date: 2026-10-09HANGZHOU DBAPPSECURITY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511852460.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-09
Publication Date
2026-10-09
Estimated Expiration
2045-12-09

AI Technical Summary

Technical Problem

例如,HE在密文域执行加法、乘法、矩阵乘、卷积等算子的计算速度通常比明文慢10²–106倍,且密文体积可膨胀至明文的 10³–105 倍;MPC需多方频繁交互,通信负担较明文环境提升百倍以上,导致在大规模图像任务中难以满足实时性要求

Benefits of technology

[0044] Therefore, this application first needs to utilize a preset AI text image generator to generate a synthetic image set based on text prompts. Then, the embedding vectors in the synthetic image set are extracted, and the extracted first initial embedding vector is normalized to obtain the first embedding vector to be processed. Second, the semantic class center and the corresponding class safety radius of each image category in the client's local real image set are determined. Then, the contrast filter, similarity calibrator, and noise data filter in the preset contrastive utility function are used to determine the distribution similarity and class distinction between the first embedding vector to be processed and the local real image set based on the semantic class center and class safety radius, obtaining the corresponding distribution similarity score and class distinction result. Then, the current candidate sample set is determined based on the distribution similarity score and class distinction result. Then, the normal samples that meet the preset high-quality conditions and the rejection samples that meet the preset low-quality conditions are selected from the current candidate sample set using a preset index mechanism and a preset probability selection method. Preference pairs are constructed based on the normal samples and rejection samples. Finally, the initial image generator is adjusted using the DPO algorithm based on the preference pairs, and the obtained target image generator is used to iteratively optimize the normal samples and rejection samples to obtain the target image dataset. This improves the efficiency of generating image datasets based on AI, thereby enhancing the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121616910B_ABST
    Figure CN121616910B_ABST
Patent Text Reader

Abstract

The application discloses an AI-based image dataset generation method and device, equipment and storage medium, relates to the technical field of artificial intelligence, and comprises the following steps: generating a synthetic image set based on a preset AI text image generator and a text prompt word, extracting and normalizing embedded vectors in the synthetic image set, determining semantic class centers and class safety radii corresponding to each image category in a local real image set of a client, determining the distribution similarity and category distinction of the embedded vectors and the local real image set based on the semantic class centers and the class safety radii by using a preset contrast utility function, determining a current candidate sample set, selecting normal samples and rejected samples from the current candidate sample set by using a preset exponential mechanism, and constructing a preference pair; and adjusting an initial image generator by using a DPO algorithm to iteratively optimize the normal samples and the rejected samples to obtain a target image dataset, so that the efficiency of image dataset generation is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to an AI-based method, apparatus, device, and storage medium for generating image datasets. Background Technology

[0002] Currently, in the development of AI (Artificial Intelligence) models in fields such as intelligent manufacturing, autonomous driving, medical imaging, and security monitoring, the image quality of the test and validation sets directly determines the credibility of performance evaluations. Standard model development processes require dividing the original dataset into training, validation, and test sets, fine-tuning parameters on the validation set, and finally evaluating the results on the test set. However, in many application scenarios, image data itself possesses strong privacy and security attributes: for example, medical images such as CT (Computed Tomography) and MRI (Magnetic Resonance Imaging) involve personal biometric information and are strictly restricted by regulations; security monitoring and traffic images contain facial, license plate, and location information, involving citizen privacy; industrial inspection images and satellite remote sensing data often contain commercial or national security secrets. Such highly sensitive data cannot be freely transmitted or stored in the research and development environment. Even after desensitization or obfuscation, identifiable features may still remain, posing a risk of privacy leakage.

[0003] To address this issue, some studies have attempted to employ homomorphic encryption (HE), secure multi-party computation (MPC), or federated learning (FL) techniques to protect data security and privacy. While these methods can theoretically achieve joint computation in encrypted or distributed environments, their computational and communication overhead is extremely high. For example, HE operations on ciphertext, performing addition, multiplication, matrix multiplication, and convolution, are typically 10²–10 times slower than on plaintext. 6 The ciphertext volume can be expanded to 10³–10 times that of the plaintext. 5The communication burden of MPC (Multi-Process Communication) is more than 100 times higher than that of plaintext environments due to frequent interactions between multiple parties, making it difficult to meet real-time requirements in large-scale image tasks. Furthermore, because HE (Heap and Graph) and MPC lack visual feedback and real-time debugging capabilities in their dense-state operations, developers cannot observe the model's convergence trend in real time during training or debugging. If an anomaly occurs, it often takes hours or days to detect, resulting in wasted computing power and the loss of the human-machine collaboration window, thus hindering their widespread adoption in real-world systems. Meanwhile, although academia and industry have been continuously exploring artificial data synthesis techniques in recent years, such as templated simulation, rendering engines, or Generative Adversarial Networks (GANs), significant limitations remain. Templates and rendering methods can only cover limited scenes and are insufficient to reproduce complex lighting, textures, and occlusion relationships; while GAN-type models can generate high-resolution images, the lack of distribution constraints often leads to false textures or structural distortions; data generated by different synthesis methods deviates significantly from the real distribution, resulting in inconsistent model performance during debugging and deployment.

[0004] In other words, this contradiction of "unavailable real data and unreliable synthetic data" makes it impossible for developers to obtain reliable model performance feedback, which seriously hinders the iterative optimization and secure deployment of AI systems in highly sensitive fields.

[0005] As can be seen from the above, how to improve the efficiency of image dataset generation in the process of AI-based image dataset generation is an urgent problem to be solved. Summary of the Invention

[0006] In view of this, the purpose of this invention is to provide an AI-based image dataset generation method, apparatus, device, and storage medium, which can improve the efficiency of image dataset generation in the AI-based image dataset generation process. The specific solution is as follows:

[0007] Firstly, this application provides an AI-based image dataset generation method, including:

[0008] A set of synthesized images is generated using a preset AI text image generator based on text prompts. Then, the embedding vectors in the synthesized image set are extracted, and the extracted first initial embedding vector is normalized to obtain the first embedding vector to be processed.

[0009] The semantic class center and class safety radius corresponding to each image category in the client's local real image set are determined. Then, using the contrast filter, similarity calibrator, and noisy data filter in the preset contrastive utility function, the distribution similarity and category distinction of the first embedding vector to be processed and the local real image set are determined based on the semantic class center and the class safety radius, and the corresponding distribution similarity score and category distinction result are obtained. The class safety radius is the maximum value of the Euclidean distance from each real image in each image category to the semantic class center.

[0010] The current candidate sample set is determined based on the distribution similarity score and the category distinction result. Then, normal samples that meet the preset high-quality conditions and rejection samples that meet the preset low-quality conditions are selected from the current candidate sample set using a preset index mechanism and a preset probability selection method. Preference pairs are constructed based on the normal samples and the rejection samples.

[0011] The initial image generator is adjusted using the DPO algorithm and based on the preferences to iteratively optimize the normal samples and the rejected samples using the obtained target image generator, thereby obtaining the target image dataset.

[0012] Optionally, the step of generating a synthetic image set using a preset AI text image generator based on text prompts, and then extracting the embedding vectors from the synthetic image set to normalize the extracted first initial embedding vectors to obtain a first embedding vector to be processed includes:

[0013] A preset text-to-image generator is used to generate images of preset text prompts, resulting in several composite images corresponding to the preset text prompts. A composite image set is then determined based on each composite image. The preset text prompts include domain names and corresponding category labels.

[0014] Each synthesized image in the synthesized image set is mapped to a semantic embedding space using a preset image encoder to obtain a mapping result. An initial embedding vector corresponding to each mapping result is determined. Then, the Euclidean distance between each initial embedding vector is determined. The norm of the initial embedding vector is adjusted based on the initial embedding vector, the Euclidean distance, and a preset cropping threshold to obtain a first embedding vector to be processed.

[0015] Optionally, determining the semantic class center and the corresponding class safety radius for each image category in the client's local real image set includes:

[0016] The client is invoked to perform embedding vector extraction on each real image in the local real image set to obtain a second initial embedding vector, and each of the second initial embedding vectors is normalized to obtain a second embedding vector to be processed.

[0017] Determine the arithmetic mean of all the second embedding vectors to be processed in the same category, and set the arithmetic mean as the semantic class center corresponding to the category; the semantic class center is used to characterize the feature distribution corresponding to the category.

[0018] Determine the Euclidean distance between the semantic class center and each of the second embedding vectors to be processed, and set the Euclidean distance with the largest value among the Euclidean distances as the class safety radius corresponding to the class.

[0019] Optionally, the step of utilizing a contrast filter, similarity calibrator, and noisy data filter in a preset contrastive utility function, and determining the distribution similarity and category distinction between the first embedded vector to be processed and the local real image set based on the semantic class center and the class safety radius, to obtain the corresponding distribution similarity score and category distinction result, includes:

[0020] The first distance between the first embedding vector to be processed and the corresponding semantic class center is determined using the comparison filter and based on the semantic class center. The second distance between the remaining first embedding vectors to be processed and the semantic class center is also determined. Then, it is determined whether the first distance is less than the second distance and the corresponding class safety radius, respectively, to obtain the distance judgment result.

[0021] If the distance judgment result indicates that the first distance is not less than the second distance or the corresponding class safety radius, then the synthesized image corresponding to the first embedding vector to be processed is discarded;

[0022] If the distance judgment result indicates that the first distance is less than the second distance or the corresponding class safety radius, then the similarity calibrator is called to normalize the first distance to obtain a normalized result. Then, based on a preset calibration factor and a preset micro constant, the normalized result is mapped to a preset score interval to obtain the distribution similarity score between the first embedded vector to be processed and the corresponding semantic class center.

[0023] Based on the class safety radius and the second initial embedding vector, the actual safety margin and discrimination scale corresponding to the real image are determined. Based on the actual safety margin and the discrimination scale, the margin ratio corresponding to the real image is determined. Then, a noise data filter is constructed using the margin ratio and a preset risk threshold. The noise data filter is used to filter each real image in the local real image set based on a preset judgment threshold to obtain the class discrimination result.

[0024] Optionally, the step of determining the current candidate sample set based on the distribution similarity score and the category distinction result, and then selecting normal samples that meet preset high-quality conditions and rejection samples that meet preset low-quality conditions from the current candidate sample set using a preset index mechanism and a preset probability selection method, and constructing preference pairs based on the normal samples and the rejection samples, includes:

[0025] The positive sample utility function in the contrastive utility function is used, and the corresponding positive sample utility function value is determined based on the distribution similarity score and the category discrimination result. Similarly, the negative sample utility function in the contrastive utility function is used, and the corresponding negative sample utility function value is determined based on the distribution similarity score, the category discrimination result, and the positive sample utility function value. This is used to determine the current candidate sample set based on the positive and negative sample utility function values. The positive sample utility function value reflects the consistency of data distribution and category discriminability between the synthesized image and the real image; the negative sample utility function value reflects the semantic shift and discriminative vulnerability of the synthesized image.

[0026] A first sensitivity upper bound and a second sensitivity upper bound are determined for the utility function of the positive sample and the utility function of the negative sample, respectively. Then, a preset index mechanism and a preset probability selection method are used to select normal samples that meet preset high-quality conditions and rejection samples that meet preset low-quality conditions from the current candidate sample set based on the first sensitivity upper bound and the second sensitivity upper bound, so as to construct preference pairs based on the normal samples and the rejection samples. The preset index mechanism is an index mechanism based on differential privacy.

[0027] Optionally, the step of utilizing the DPO algorithm and adjusting the initial image generator based on the preferences includes:

[0028] The log-odds ratio difference between the current image generation strategy and the preset reference image generation strategy is determined using the DPO algorithm and based on the preference pair. This log-odds ratio difference is then scaled using a preset temperature parameter to obtain a scaled result. The scaled result is then processed using the Sigmoid function to obtain the preference probability value. The current image generation strategy includes the probability distribution of images generated by the image generation model under preset conditions. The preset reference image generation strategy is used to constrain the optimization process of the image generation model.

[0029] A preference optimization loss function is constructed based on the preference probability value. The negative expectation of the preference probability value is calculated using the preference optimization loss function to obtain the log loss. Then, the parameters corresponding to the initial image generator are adjusted using a preset gradient descent method based on the log loss to obtain the target image generator.

[0030] Optionally, the step of iteratively optimizing the normal samples and the rejected samples using the obtained target image generator to obtain the target image dataset includes:

[0031] The normal samples are input into the target image generator to process them and obtain an initial output result. Then, the rejection samples are used to adjust the initial output result to obtain the output result to be processed.

[0032] Determine whether the output result to be processed meets the preset constraints. If the output result to be processed meets the preset constraints, then set the output result to be processed as the target image dataset corresponding to the text prompt word.

[0033] If the output result to be processed does not meet the preset constraints, the output result to be processed is set as a new current candidate sample set, and the process jumps back to the step of selecting normal samples that meet the preset high-quality conditions and rejection samples that meet the preset low-quality conditions from the current candidate sample set using a preset index mechanism and a preset probability selection method, until the output result to be processed meets the preset constraints.

[0034] Secondly, this application provides an AI-based image dataset generation apparatus, comprising:

[0035] The embedding vector extraction module is used to generate a synthetic image set using a preset AI text image generator and based on text prompts, and then extract the embedding vectors in the synthetic image set, and normalize the extracted first initial embedding vector to obtain the first embedding vector to be processed.

[0036] The class safety radius determination module is used to determine the semantic class center and the corresponding class safety radius for each image category in the client's local real image set. Then, using the contrast filter, similarity calibrator, and noise data filter in the preset contrastive utility function, and based on the semantic class center and the class safety radius, the first embedding vector to be processed and the local real image set are used to determine the distribution similarity and class distinction, and obtain the corresponding distribution similarity score and class distinction result; the class safety radius is the maximum value of the Euclidean distance from each real image in each image category to the semantic class center;

[0037] The preference pair construction module is used to determine the current candidate sample set based on the distribution similarity score and the category distinction result, and then select normal samples that meet the preset high quality conditions and rejection samples that meet the preset low quality conditions from the current candidate sample set using a preset index mechanism and a preset probability selection method, and construct preference pairs based on the normal samples and the rejection samples.

[0038] The image dataset generation module is used to adjust the initial image generator based on the DPO algorithm and the preferences, and to iteratively optimize the normal samples and the rejected samples using the obtained target image generator to obtain the target image dataset.

[0039] Thirdly, this application provides an electronic device, comprising:

[0040] Memory, used to store computer programs;

[0041] A processor is used to execute the computer program to implement the aforementioned AI-based image dataset generation method.

[0042] Fourthly, this application provides a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the aforementioned AI-based image dataset generation method.

[0043] As can be seen from the above, before generating the AI-based image dataset, this application needs to use a preset AI text image generator to generate a synthetic image set based on text prompts. Then, the embedding vectors in the synthetic image set are extracted, and the extracted first initial embedding vector is normalized to obtain the first embedding vector to be processed. The semantic class centers and corresponding class safety radii for each image category in the client's local real image set are determined. Then, the contrast filter, similarity calibrator, and noise data filter in the preset contrastive utility function are used to normalize the first embedding vector to be processed based on the semantic class centers and class safety radii. The distribution similarity and category distinction are determined by comparing the image with a local real image set, resulting in corresponding distribution similarity scores and category distinction results. Based on the distribution similarity scores and category distinction results, the current candidate sample set is determined. Then, a preset index mechanism and a preset probability selection method are used to select normal samples that meet preset high-quality conditions and rejection samples that meet preset low-quality conditions from the current candidate sample set. A preference pair is constructed based on the normal samples and rejection samples. The DPO algorithm is used and the initial image generator is adjusted based on the preference pair. The obtained target image generator is then used to iteratively optimize the normal samples and rejection samples to obtain the target image dataset.

[0044] Therefore, this application first needs to utilize a preset AI text image generator to generate a synthetic image set based on text prompts. Then, the embedding vectors in the synthetic image set are extracted, and the extracted first initial embedding vector is normalized to obtain the first embedding vector to be processed. Second, the semantic class center and the corresponding class safety radius of each image category in the client's local real image set are determined. Then, the contrast filter, similarity calibrator, and noise data filter in the preset contrastive utility function are used to determine the distribution similarity and class distinction between the first embedding vector to be processed and the local real image set based on the semantic class center and class safety radius, obtaining the corresponding distribution similarity score and class distinction result. Then, the current candidate sample set is determined based on the distribution similarity score and class distinction result. Then, the normal samples that meet the preset high-quality conditions and the rejection samples that meet the preset low-quality conditions are selected from the current candidate sample set using a preset index mechanism and a preset probability selection method. Preference pairs are constructed based on the normal samples and rejection samples. Finally, the initial image generator is adjusted using the DPO algorithm based on the preference pairs, and the obtained target image generator is used to iteratively optimize the normal samples and rejection samples to obtain the target image dataset. This improves the efficiency of generating image datasets based on AI, thereby enhancing the user experience. Attached Figure Description

[0045] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0046] Figure 1 This is a flowchart of an AI-based image dataset generation method disclosed in this application;

[0047] Figure 2 This application discloses a specific AI-based image dataset generation method flowchart;

[0048] Figure 3 This is a schematic diagram of the structure of an AI-based image dataset generation device disclosed in this application;

[0049] Figure 4 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation

[0050] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0051] Currently, in the development of AI models in fields such as intelligent manufacturing, autonomous driving, medical imaging, and security monitoring, the image quality of the test and validation sets directly determines the reliability of performance evaluation. However, in many application scenarios, image data itself possesses strong privacy and security attributes. This contradiction—"real data is unavailable, and synthetic data is unreliable"—makes it impossible for developers to obtain reliable model performance feedback, severely hindering the iterative optimization and secure deployment of AI systems in highly sensitive fields. Therefore, this application provides an AI-based image dataset generation method that can improve the efficiency of image dataset generation in the AI-based image dataset generation process.

[0052] See Figure 1 As shown, this embodiment of the invention discloses an AI-based image dataset generation method, including:

[0053] Step S11: Use a preset AI text image generator to generate a synthetic image set based on text prompts, then extract the embedding vectors in the synthetic image set, and normalize the extracted first initial embedding vector to obtain the first embedding vector to be processed.

[0054] In this embodiment, the objective of this application is to generate a synthetic image dataset that satisfies differential privacy (DP) constraints. The aforementioned datasets are distributed as closely as possible to the local private datasets. And can effectively support and Downstream multi-class classification tasks belonging to the same domain. Therefore, the target synthetic dataset The following two core conditions must be met simultaneously: (1) Class distinguishability: The generated images should be able to reflect the significant differences between different classes to ensure that they can be used for class recognition and discrimination in the downstream model; (2) High distribution similarity: The feature distribution of the synthetic data should be as close as possible to the distribution of real private images to maintain task relevance.

[0055] It is worth mentioning that the flowchart for generating AI-based image datasets is as follows: Figure 2 As shown: First, an initial set of image samples is randomly generated for each category using a black-box generative image API (Text-to-Image API). It's worth noting that the API can generate an initial synthetic image based on a simple text prompt T, where T only contains domain and category labels without any complex prompt design, for example: T="“An image of a leather surface with cutting defects”". Then, the generated set is continuously optimized through multiple iterative steps. (For the sake of simplifying the notation, the iteration superscript is omitted) In each iteration, given an existing set of synthetic images... and a pre-trained image encoder The (Encoder) system needs to be from... Select high-quality prototype samples and low-quality samples These samples are from private data Feedback guidance and through the index mechanism Make a selection. Then, use the prototype sample. and To fine-tune the image to the input image The generator aims to make the model tend to generate preferred sample styles / features, refine and regenerate synthetic datasets to form the next generation of candidate image datasets. .

[0056] This allows the synthesized image to gradually approximate the distribution of private data. Similar to traditional PE methods, this application embodiment also assumes access to a generative API ( and The server side is an honest but curious entity; that is, it adheres to the protocol and performs generation tasks but may infer the distribution and content of client-side private data through changes in the results. Therefore, the system design must ensure differential privacy protection throughout the entire process. It is worth mentioning that the core of the entire evolutionary cycle lies in how to select the most representative prototype sample. and Then, based on the aforementioned differential privacy index mechanism, the system can extract data from the synthetic dataset. According to the utility scores of each sample Perform probability sampling:

[0057] ;

[0058] in, Represents a privacy budget; This refers to the sensitivity of the utility function; This refers to the measurement of generated samples. Compared to private data The utility function.

[0059] Furthermore, to avoid wasting information on "scoring low" and to directly align the generation strategy, this application embodiment utilizes DPO (Direct Preference Optimization, a technique for aligning large language models) to optimize each suggestion. The highest-rated sample The generator is then paired with lower-scoring samples y^- to form preference pairs, and then the generator is made to be more inclined to output the same values ​​by learning the odds ratio. For style samples, the objective function expression is:

[0060] ;

[0061] in, For the current generator, For reference generator (fixed checkpoint), For temperature coefficient, It is Sigmoid.

[0062] It is worth mentioning that, in order to clearly describe the technical solutions in the embodiments of this application, key symbols and system settings are first uniformly defined:

[0063] Private dataset: denoted as ,in These are category labels. The dataset is stored locally on each data holder's (client's) machine.

[0064] Candidate synthetic dataset (round t): denoted as It is generated by the central server calling the API of the generative model.

[0065] Image embedding model: employing a pre-trained visual encoder (e.g., CLIP, DINO), mapping images to a d-dimensional semantic embedding space. The embedding vectors of the private and synthetic images are denoted as... and .

[0066] Similarity metric: L2 distance (Euclidean distance) is used. To ensure the sensitivity of subsequent differential privacy mechanisms remains controllable, all embedding vectors are... Normalization or cropping.

[0067] Generative API: Includes text-to-image generators (For initialization) and image-to-image generator (Used for iterative optimization and refinement).

[0068] First, an initial candidate synthetic sample set is generated on the server side: An initial synthetic dataset is generated using a generation API (such as Text-to-Image or Image-to-Image).

[0069] ;

[0070] Each sample has a corresponding class label. Each type of generation =32 samples, the prompt consists of class label and domain name. Next, the initial synthetic dataset Each image in Extract the embedding and then normalize it:

[0071] ;

[0072] in, The preset pruning threshold is used to limit the maximum impact of a single sample on the overall statistics, thereby controlling global sensitivity.

[0073] Then, the above candidate sample set is sent to the client.

[0074] Specifically, a set of synthesized images is generated using a preset AI text-to-image generator based on text prompts. Then, the embedding vectors in the synthesized image set are extracted, and the extracted first initial embedding vector is normalized to obtain the first embedding vector to be processed. This process may include: generating images of preset text prompts using a preset text-to-image generator to obtain several synthesized images corresponding to the preset text prompts, and determining a set of synthesized images based on each synthesized image; the preset text prompts include domain names and corresponding category labels; mapping each synthesized image in the set of synthesized images to a semantic embedding space using a preset image encoder to obtain mapping results, and determining the initial embedding vectors corresponding to each mapping result; then determining the Euclidean distance between each initial embedding vector, and adjusting the norm of the initial embedding vectors based on the initial embedding vectors, the Euclidean distance, and a preset cropping threshold to obtain the first embedding vector to be processed.

[0075] Step S12: Determine the semantic class center and class safety radius corresponding to each image category in the local real image set of the client. Then, use the contrast filter, similarity calibrator and noise data filter in the preset contrastive utility function, and determine the distribution similarity and category distinction between the first embedded vector to be processed and the local real image set based on the semantic class center and the class safety radius to obtain the corresponding distribution similarity score and category distinction result; the class safety radius is the maximum value of the Euclidean distance from each real image in each image category to the semantic class center.

[0076] In this embodiment, the local category centers in the client are invoked to calculate class-safe distances: the client is invoked and the semantic center and inter-class safe distance in the embedding space are calculated for each category in the private dataset. The semantic center is obtained by calculating the statistical values ​​of private samples of the same class. Then, local embedding extraction and normalization are performed: the client is invoked to process the private dataset... Each image in Extract the embeddings and perform normalization:

[0077] ;

[0078] in, This is the preset cropping threshold.

[0079] In one specific implementation, the process for calculating the local class center is as follows: For each category In this embodiment of the application, the local average embedding vector needs to be calculated as the semantic class center:

[0080] ;

[0081] in, It belongs to the category The number of samples. It's worth noting that the above steps yield the private class center set:

[0082] ;

[0083] Subsequently, this application embodiment needs to calculate the class safety radius: for each class To measure the spatial distribution range of samples within a class, the maximum Euclidean distance from all samples in each class to the class center is calculated and defined as the class safety radius:

[0084] ;

[0085] The radius described above describes the natural diffusion range of local private data, which is subsequently used to determine whether the generated sample exceeds the class's safety boundary. This leads to the set of private class safety radii: .

[0086] Specifically, determining the semantic class center and the corresponding class safety radius for each image category in the client's local real image set can include: calling the client to perform embedding vector extraction on each real image in the local real image set to obtain a second initial embedding vector, and normalizing each second initial embedding vector to obtain a second embedding vector to be processed; determining the arithmetic mean of all second embedding vectors to be processed in the same category, and setting the arithmetic mean as the semantic class center corresponding to the category; the semantic class center is used to represent the feature distribution corresponding to the category; determining the Euclidean distance between the semantic class center and each second embedding vector to be processed, and setting the Euclidean distance with the largest value among the Euclidean distances as the class safety radius corresponding to the category.

[0087] It is worth mentioning that this application embodiment designs a contrastive utility function for evaluating the quality of synthesized images under strict privacy protection. Furthermore, the aforementioned utility function consists of four core components: a contrast filter... Similarity calibrator and noise data filter .in, , Together, they form a positive sample screening mechanism to construct a high-quality candidate set. ;and and This constitutes a negative sample screening mechanism to identify potential noisy sample sets. .

[0088] Among them, the contrast filter For cross-class discriminative constraints: To ensure that the generated image can clearly distinguish different classes in the embedding space and avoid class ambiguity or confusion, the class centers generated in step one are used to calculate the embedding of the synthesized image. Its corresponding class center Is the distance less than the minimum distance to the centers of all other categories?

[0089] ;

[0090] Among them, if This indicates that the synthesized image has high discriminative power between categories and a stronger correlation with its target category than other categories, allowing it to proceed to the subsequent intra-category screening stage; if The sample was discarded directly.

[0091] Similarity calibrator Used for distribution consistency modeling; additionally, in the initial stage, the synthetic data domain... and private data domain There are significant differences between them. If only discriminative power is emphasized... However, ignoring the similarity to real data will not effectively narrow this inter-domain gap. Therefore, it is necessary to further calculate the similarity between the synthesized image of the comparison filter and the private class center:

[0092] ;

[0093] in, , All of the current class The maximum and minimum distances between the synthesized image and the class center; This is a calibration factor that controls the steepness of the score distribution. To prevent the differential constant from division by zero, the original distance is mapped to a different value through distance normalization and exponential scaling. The interval ensures the most similar sample ( ) Achieve the highest score Least Dissimilar Samples ( Get the lowest score By adjusting The value allows for flexible control over the degree of preference in selection.

[0094] Positive sample utility function To ensure consistency between inter-class discriminative power and intra-class distribution, a positive sample utility function is defined:

[0095] ;

[0096] Among them, if ,but ;like ,but A higher score indicates that the sample is closer to the target class distribution. This score serves as the utility criterion for positive sample selection in the subsequent index mechanism, used to probabilistically extract high-quality candidates from the generated sample set to form a privacy-preserving positive sample set. .

[0097] Noise Data Filter Used in contrast filter The generated samples, under the constraints, already possess basic cross-class discriminative ability, but may still exhibit semantic ambiguity, discriminative fragility, or distributional shifts. If such samples are used for model optimization, they may cause the generator's convergence direction to deviate, resulting in "phantom samples" or semantic drift problems. Specifically, the inter-class safety margin is defined as:

[0098] ;

[0099] according to Definition, Only guarantee:

[0100] ;

[0101] Among them, inter-class safety margin It can only be guaranteed to be positive, but its lower bound is not restricted. When When the value is extremely small (i.e., the sample is almost equidistant from the two class centers), although the sample is classified as "this class," it is actually in the inter-class boundary region. This makes it highly sensitive to slight perturbations (such as differential privacy noise or generator fine-tuning jitter), easily leading to discrimination flipping or cross-class confusion. Assume... , If the sample is in ,but , ,so But margin Extremely small.

[0102] Therefore, this application embodiment designs a noise data filter. This is used to identify and suppress such high-risk samples. First, a geometric normalization margin ratio is introduced:

[0103] ;

[0104] In the above formula, the numerator is the actual safety margin of the current sample; the denominator is the natural distinguishing scale of the class (inter-class distance + intra-class divergence). This represents the relative safety proportion of samples in the "between-class – within-class" geometric space. Based on this, a noisy data filter is defined:

[0105] ;

[0106] It is worth mentioning that when When a sample is deemed high-risk (discriminatively fragile or semantically drifting), it is labeled as a negative sample; when When a sample is deemed safe, it can be included in the positive sample set. In this way, the above definition requires no external hyperparameters, relying only on the geometric relationship between the class center and radius. It can adaptively adjust the safety boundary under different class distribution densities, thereby improving discrimination stability and reproducibility.

[0107] In this embodiment, the present application embodiment can utilize the negative sample utility function. , among which, The judgment is positive (cross-class discriminant property is satisfied) and If a sample is determined to be noise, it can be considered a negative sample.

[0108] Furthermore, to suppress the sampling probability of the generator in these regions, a negative sample utility function is defined:

[0109] ;

[0110] in, This represents the output of the similarity calibrator, used to measure the consistency between a sample and a private distribution; Used to characterize the "semantic shift" of a sample, and to measure its degree of anomalousness. When a sample is judged to be noise ( And the similarity is low. )hour, A higher value indicates that it should not be sampled or used in training; if higher or ,but Approaching 0, no negative constraints are generated.

[0111] Specifically, using a pre-defined contrastive utility function with a contrast filter, similarity calibrator, and noisy data filter, and based on semantic class centers and class-safe radii, the distribution similarity and class distinction between the first embedding vector to be processed and the local real image set are determined, yielding the corresponding distribution similarity score and class distinction result. This can include: using a contrast filter and based on semantic class centers to determine a first distance between the first embedding vector to be processed and its corresponding semantic class center, and determining a second distance between the remaining first embedding vectors to be processed and their semantic class centers; then determining whether the first distance is less than the second distance and the corresponding class-safe radius, respectively, to obtain a distance judgment result; if the distance judgment result indicates that the first distance is not less than the second distance or the corresponding class-safe radius, then the vector corresponding to the first embedding vector to be processed is discarded. The image is generated; if the distance judgment result indicates that the first distance is less than the second distance or the corresponding class safety radius, the similarity calibrator is called to normalize the first distance to obtain the normalized result. Then, based on the preset calibration factor and the preset micro constant, the normalized result is mapped to the preset score interval to obtain the distribution similarity score between the first embedding vector to be processed and the corresponding semantic class center; based on the class safety radius and the second initial embedding vector, the actual safety margin and the discrimination scale corresponding to the real image are determined, and the margin ratio corresponding to the real image is determined based on the actual safety margin and the discrimination scale. Then, the margin ratio and the preset risk threshold are used to construct a noise data filter, and the noise data filter is used to filter each real image in the local real image set based on the preset judgment threshold to obtain the class discrimination result.

[0112] Step S13: Determine the current candidate sample set based on the distribution similarity score and the category distinction result. Then, select normal samples that meet the preset high-quality conditions and rejection samples that meet the preset low-quality conditions from the current candidate sample set using a preset index mechanism and a preset probability selection method. Construct preference pairs based on the normal samples and the rejection samples.

[0113] In this embodiment, the privacy protection based on the exponential mechanism is adopted: under strict differential privacy constraints, the embodiment can select high-quality positive and negative samples from the candidate set in a probabilistic manner according to the definition of the positive and negative sample utility function, thereby avoiding the problem of signal distortion under strong noise in the traditional Gaussian mechanism.

[0114] In addition, for the candidate set generated from the previous round of model snapshots Each sample in The comparative utility of the embodiments in this application needs to be calculated. as well as Then determine the upper bound of the sensitivity of the positive and negative sample utility functions. as well as (This upper bound can be obtained through embedding clipping and class center analysis), and probabilistic sampling is performed using an exponential mechanism. The probabilities of being selected as a positive or negative sample are respectively:

[0115] ;

[0116] ;

[0117] in, This is the privacy budget allocated in this round of selection operations.

[0118] Through the above mechanism, the embodiments of this application can perform sampling to generate a prototype sample set. (Efficient sample usage), and simultaneously collect a set of rejection samples for subsequent preference optimization. (Inefficient sample).

[0119] In one specific implementation, the embodiments of this application may select samples with approximately the top-1 sampling probability in each category, and the corresponding expression is as follows:

[0120] ;

[0121] The aforementioned samples constitute the positive sample set, which will serve as the next image-to-image generator. The input guides the distribution to be closer to the private data. Similarly, this application embodiment requires negative sample selection:

[0122] ;

[0123] Specifically, the current candidate sample set is determined based on the distribution similarity score and category distinction result. Then, a preset index mechanism and a preset probability selection method are used to select normal samples that meet preset high-quality conditions and rejection samples that meet preset low-quality conditions from the current candidate sample set. A preference pair is then constructed based on the normal samples and rejection samples. This can include: using the positive sample utility function in the comparative utility function and determining the corresponding positive sample utility function value based on the distribution similarity score and category distinction result; and using the negative sample utility function in the comparative utility function and determining the corresponding negative sample utility function value based on the distribution similarity score, category distinction result, and positive sample utility function value. This is used to determine the positive sample utility function value and the negative sample utility function value. The function value determines the current candidate sample set; among which, the positive sample utility function value is used to reflect the consistency of data distribution and class discriminability between the synthetic image and the real image; the negative sample utility function value is used to reflect the semantic shift and discriminative vulnerability of the synthetic image; the first sensitivity upper bound and the second sensitivity upper bound corresponding to the positive sample utility function and the negative sample utility function are determined respectively; then, using a preset index mechanism and a preset probability selection method, and based on the first sensitivity upper bound and the second sensitivity upper bound, normal samples that meet the preset high-quality conditions and rejection samples that meet the preset low-quality conditions are selected from the current candidate sample set to construct preference pairs based on normal samples and rejection samples; the preset index mechanism is an index mechanism based on differential privacy.

[0124] Step S14: Using the DPO algorithm and adjusting the initial image generator based on the preferences, the obtained target image generator is used to iteratively optimize the normal samples and the rejected samples to obtain the target image dataset.

[0125] In this embodiment, the generator update is based on direct preference optimization, and the corresponding objective is to make full use of the contrast signal provided by the positive and negative sample pairs, and to directly and stably align the generation strategy through the DPO objective function, so as to overcome the defects of information waste and mode collapse in traditional methods.

[0126] Subsequently, this embodiment of the application needs to construct preference pairs, that is, construct the preference pairs in this iteration (ignoring the iteration identifier (t) in the upper right corner) based on the results obtained above. ,in, , .

[0127] Then, the data is optimized using DPO, that is, the generative model (or its controllable subsystem) is fine-tuned using the direct preference optimization loss function:

[0128] ;

[0129] in, This represents the generation strategy to be optimized (e.g., the log probability or surrogate score of the generation model in producing an image under given conditions). It is a fixed reference strategy (usually a snapshot of the model before fine-tuning) used to prevent the optimization process from deviating too far from the initial capabilities. It's a temperature parameter. It is the Sigmoid function.

[0130] Specifically, adjusting the initial image generator using the DPO algorithm and based on preference pairs can include: determining the log-odds ratio difference between the current image generation strategy and a preset reference image generation strategy using the DPO algorithm and based on preference pairs; scaling the log-odds ratio difference using a preset temperature parameter to obtain a scaling result; and then processing the scaling result using the Sigmoid function to obtain a preference probability value. Here, the current image generation strategy includes the probability distribution of images generated by the image generation model under preset conditions; the preset reference image generation strategy is used to constrain the optimization process of the image generation model; a preference optimization loss function is constructed based on the preference probability value; the preference optimization loss function is used to calculate the negative expectation of the preference probability value to obtain a log loss; and then a preset gradient descent method is used to adjust the parameters corresponding to the initial image generator based on the log loss to obtain the target image generator.

[0131] In this embodiment, the application requires iterative evolution based on image-to-image generation. The goal of this iterative evolution is to utilize the optimized generation strategy, using the selected high-quality prototype samples as a benchmark, to generate a next-generation candidate synthetic dataset that is more diverse and has a more consistent distribution. Subsequently, this application requires applying the updated generation strategy to the image-to-image generation interface. To the positive sample set and negative sample set The samples in the dataset undergo controlled mutation and refinement to generate a candidate set for the next iteration. .

[0132] Specifically, the obtained target image generator is used to iteratively optimize normal samples and rejection samples to obtain a target image dataset. This can include: inputting normal samples into the target image generator to process the normal samples and obtain an initial output result; then adjusting the initial output result using rejection samples to obtain the output result to be processed; determining whether the output result to be processed meets preset constraints; if the output result to be processed meets the preset constraints, then setting the output result to be processed as the target image dataset corresponding to the text prompt word; if the output result to be processed does not meet the preset constraints, then setting the output result to be processed as a new current candidate sample set, and jumping back to the step of selecting normal samples that meet the preset high-quality conditions and rejection samples that meet the preset low-quality conditions from the current candidate sample set using a preset index mechanism and a preset probability selection method, until the output result to be processed meets the preset constraints.

[0133] As can be seen from the above, the embodiments of this application first need to use a preset AI text image generator to generate a synthetic image set based on text prompts, and then extract the embedding vectors in the synthetic image set to normalize the extracted first initial embedding vectors to obtain the first embedding vector to be processed; secondly, determine the semantic class center and the corresponding class safety radius for each image category in the client's local real image set, and then use the comparison filter, similarity calibrator and noise data filter in the preset comparative utility function, and compare the first embedding vector to be processed with the local real image set based on the semantic class center and class safety radius. The process involves determining distribution similarity and category distinction, obtaining corresponding distribution similarity scores and category distinction results. Then, based on these results, a current candidate sample set is determined. A preset index mechanism and a preset probability selection method are used to select normal samples that meet preset high-quality criteria and rejection samples that meet preset low-quality criteria from the current candidate sample set. Preference pairs are then constructed based on these normal and rejection samples. Finally, the DPO algorithm is used to adjust the initial image generator based on the preference pairs, iteratively optimizing the normal and rejection samples using the obtained target image generator to obtain the target image dataset. This approach improves the efficiency of image dataset generation in the AI-based image dataset generation process, thereby enhancing the user experience.

[0134] As can be seen from the above embodiments, this application generates image datasets based on comparative utility functions and AI. Therefore, the above process will be further described.

[0135] In this embodiment, since constructing a high-quality, high-coverage image dataset that meets actual business needs is crucial for training accurate and robust intelligent analysis models in the field of security monitoring, the AI-based image dataset generation method proposed in this application provides an efficient, controllable, and semantically aligned synthetic data solution for the security monitoring field. First, a pre-set AI text image generator generates a large number of synthetic monitoring images based on text prompts containing specific security scenarios, such as pedestrians in a nighttime parking lot, crowds at a subway station entrance, and perimeter intrusion detection, forming an initial synthetic image set. Then, the semantic embedding vectors of the images are extracted and normalized to facilitate subsequent distribution alignment and filtering operations. On the client side, based on a local real security monitoring image set, such as labeled images of various abnormal behaviors, vehicle types, and face occlusion categories, the semantic class center and its class safety radius for each category are calculated to characterize the distribution range and boundaries of the real data. Subsequently, a pre-set comparative utility function, combined with a comparative filter, a similarity calibrator, and a noise data filter, is used to evaluate the distribution similarity and class distinction between the synthetic images and real security images. This allows for the effective selection of synthetic samples that closely resemble real-world monitoring scenarios and possess clear category differentiation, while filtering out semantically ambiguous or noisy data that deviates from actual monitoring scenarios. Building upon this, a differential privacy-preserving index mechanism is used to probabilistically select high-quality normal samples, such as clearly identifiable images of abnormal behavior, and low-quality rejected samples, such as blurry, occluded, or scene-incompatible images, thus constructing preference pairs.

[0136] Furthermore, this application employs a direct preference optimization algorithm and iteratively adjusts the image generation model based on preference pairs, enabling it to gradually learn to generate synthetic images that better meet the needs of security monitoring operations and possess greater discriminative power. Through multiple iterative optimizations, the final generated target image dataset not only expands the coverage of the original real data but also simulates various complex, rare, or high-risk security scenarios while protecting privacy. This effectively enhances the generalization ability and robustness of subsequent trained models such as behavior recognition, object detection, and face recognition, providing high-quality data support for the continuous optimization of intelligent security systems.

[0137] Accordingly, see Figure 3 As shown, this application also provides an AI-based image dataset generation apparatus, comprising:

[0138] The embedding vector extraction module 13 is used to generate a synthetic image set using a preset AI text image generator and based on text prompt words, and then extract the embedding vectors in the synthetic image set to normalize the extracted first initial embedding vector to obtain the first embedding vector to be processed.

[0139] The class safety radius determination module 12 is used to determine the semantic class center and the corresponding class safety radius for each image category in the local real image set of the client. Then, it uses the contrast filter, similarity calibrator and noise data filter in the preset contrastive utility function, and performs distribution similarity and category distinction determination on the first embedding vector to be processed and the local real image set based on the semantic class center and the class safety radius to obtain the corresponding distribution similarity score and category distinction result; the class safety radius is the maximum value of the Euclidean distance from each real image in each image category to the semantic class center;

[0140] The preference pair construction module 13 is used to determine the current candidate sample set based on the distribution similarity score and the category distinction result, and then select normal samples that meet the preset high quality conditions and rejection samples that meet the preset low quality conditions from the current candidate sample set using a preset index mechanism and a preset probability selection method, and construct preference pairs based on the normal samples and the rejection samples.

[0141] The image dataset generation module 14 is used to adjust the initial image generator based on the DPO algorithm and the preferences, so as to use the obtained target image generator to iteratively optimize the normal samples and the rejected samples to obtain the target image dataset.

[0142] In some specific embodiments, the embedding vector extraction module 11 may specifically include:

[0143] A composite image set generation unit is used to generate images of preset text prompts using a preset text-to-image generator, to obtain several composite images corresponding to the preset text prompts, and to determine a composite image set based on each composite image; the preset text prompts include domain names and corresponding category labels;

[0144] The Euclidean distance determination unit is used to map each synthetic image in the synthetic image set to the semantic embedding space using a preset image encoder to obtain the mapping result, determine the initial embedding vector corresponding to each mapping result, determine the Euclidean distance between each initial embedding vector, and adjust the norm of the initial embedding vector based on the initial embedding vector, the Euclidean distance and a preset cropping threshold to obtain the first embedding vector to be processed.

[0145] In some specific embodiments, the class safety radius determination module 12 may specifically include:

[0146] The embedding vector normalization processing unit is used to call the client to perform embedding vector extraction operations on each real image in the local real image set to obtain a second initial embedding vector, and to normalize each of the second initial embedding vectors to obtain a second embedding vector to be processed.

[0147] A semantic class center determination unit is used to determine the arithmetic mean of all the second embedding vectors to be processed in the same category, and set the arithmetic mean as the semantic class center corresponding to the category; the semantic class center is used to characterize the feature distribution corresponding to the category.

[0148] The class safety radius generation unit is used to determine the Euclidean distance between the semantic class center and each of the second embedding vectors to be processed, and to set the Euclidean distance with the largest value among the Euclidean distances as the class safety radius corresponding to the class.

[0149] In some specific embodiments, the class safety radius determination module 12 may specifically include:

[0150] The distance judgment result determination unit is used to determine the first distance between the first embedded vector to be processed and the corresponding semantic class center using the comparison filter and based on the semantic class center, and to determine the second distance between the remaining first embedded vectors to be processed and the semantic class center, and then to determine whether the first distance is less than the second distance and the corresponding class safety radius, respectively, to obtain the distance judgment result;

[0151] A synthetic image generation unit is configured to discard the synthetic image corresponding to the first embedding vector if the distance judgment result indicates that the first distance is not less than the second distance or the corresponding class safety radius;

[0152] The normalization result generation unit is used to call the similarity calibrator to normalize the first distance if the distance judgment result indicates that the first distance is less than the second distance or the corresponding class safety radius, to obtain the normalization result, and then map the normalization result to a preset score interval based on a preset calibration factor and a preset micro constant to obtain the distribution similarity score between the first embedded vector to be processed and the corresponding semantic class center.

[0153] The category distinction result generation unit is used to determine the actual safety margin and distinction scale corresponding to the real image based on the class safety radius and the second initial embedding vector, to determine the margin ratio corresponding to the real image based on the actual safety margin and the distinction scale, and then to construct a noise data filter using the margin ratio and a preset risk threshold, and to use the noise data filter and a preset judgment threshold to filter each real image in the local real image set to obtain the category distinction result.

[0154] In some specific implementations, the preference for building module 13 may specifically include:

[0155] A utility function value generation unit is used to determine the corresponding positive sample utility function value by utilizing the positive sample utility function in the comparative utility function and based on the distribution similarity score and the category discrimination result; and to determine the corresponding negative sample utility function value by utilizing the negative sample utility function in the comparative utility function and based on the distribution similarity score, the category discrimination result, and the positive sample utility function value, so as to determine the current candidate sample set based on the positive sample utility function value and the negative sample utility function value; wherein, the positive sample utility function value is used to reflect the consistency of data distribution and category discrimination between the synthesized image and the real image; the negative sample utility function value is used to reflect the semantic shift degree and discriminative vulnerability of the synthesized image;

[0156] The preference pair construction unit is used to determine the first and second sensitivity upper bounds corresponding to the utility functions of the positive and negative samples, respectively. Then, using a preset index mechanism and a preset probability selection method, it selects normal samples that meet preset high-quality conditions and rejection samples that meet preset low-quality conditions from the current candidate sample set based on the first and second sensitivity upper bounds, so as to construct preference pairs based on the normal samples and the rejection samples. The preset index mechanism is a differential privacy-based index mechanism.

[0157] In some specific embodiments, the image dataset generation module 14 may specifically include:

[0158] A preference probability value generation unit is used to determine the log-odds ratio difference between the current image generation strategy and a preset reference image generation strategy based on the preference pair using the DPO algorithm, and to scale the log-odds ratio difference using a preset temperature parameter to obtain a scaling result. Then, the scaling result is processed using a Sigmoid function to obtain the preference probability value. The current image generation strategy includes the probability distribution result of the image generation model generating images under preset conditions; the preset reference image generation strategy is used to constrain the optimization process of the image generation model.

[0159] The target image generator generation unit is used to construct a preference optimization loss function based on the preference probability value, and to use the preference optimization loss function to calculate the negative expectation of the preference probability value to obtain the log loss. Then, it uses a preset gradient descent method and adjusts the parameters corresponding to the initial image generator based on the log loss to obtain the target image generator.

[0160] In some specific embodiments, the image dataset generation module 14 may specifically include:

[0161] The output result adjustment unit is used to input the normal sample into the target image generator, so as to process the normal sample using the target image generator to obtain an initial output result, and then adjust the initial output result using the rejection sample to obtain the output result to be processed;

[0162] An image dataset determination unit is used to determine whether the output result to be processed meets the preset constraints. If the output result to be processed meets the preset constraints, the output result to be processed is set as the target image dataset corresponding to the text prompt word.

[0163] The step jump unit is used to set the output result to be processed as a new current candidate sample set if the output result to be processed does not meet the preset constraint conditions, and then jump back to the step of selecting normal samples that meet the preset high-quality conditions and rejection samples that meet the preset low-quality conditions from the current candidate sample set using the preset index mechanism and preset probability selection method, until the output result to be processed meets the preset constraint conditions.

[0164] Furthermore, embodiments of this application also disclose an electronic device, Figure 4 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the AI-based image dataset generation method disclosed in any of the foregoing embodiments. Furthermore, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0165] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.

[0166] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0167] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the AI-based image dataset generation method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs capable of performing other specific tasks.

[0168] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned disclosed AI-based image dataset generation method. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.

[0169] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0170] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0171] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0172] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0173] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. An AI-based image dataset generation method, characterized in that, include: A set of synthesized images is generated using a preset AI text image generator based on text prompts. Then, the embedding vectors in the synthesized image set are extracted, and the extracted first initial embedding vector is normalized to obtain the first embedding vector to be processed. The semantic class center and class safety radius corresponding to each image category in the local real image set of the client are determined. Then, the contrast filter, similarity calibrator and noise data filter in the preset contrastive utility function are used to determine the distribution similarity and class distinction between the first embedded vector to be processed and the local real image set based on the semantic class center and the class safety radius, so as to obtain the corresponding distribution similarity score and class distinction result. The class safety radius is the maximum value of the Euclidean distances from each real image in each of the image categories to the semantic class center; The current candidate sample set is determined based on the distribution similarity score and the category distinction result. Then, normal samples that meet the preset high-quality conditions and rejection samples that meet the preset low-quality conditions are selected from the current candidate sample set using a preset index mechanism and a preset probability selection method. Preference pairs are constructed based on the normal samples and the rejection samples. The initial image generator is adjusted using the DPO algorithm and based on the preferences to iteratively optimize the normal samples and the rejected samples using the obtained target image generator, thereby obtaining the target image dataset.

2. The AI-based image dataset generation method according to claim 1, characterized in that, The process involves using a preset AI text image generator to generate a synthetic image set based on text prompts, then extracting the embedding vectors from the synthetic image set, and normalizing the extracted first initial embedding vectors to obtain a first embedding vector to be processed, including: A preset text-to-image generator is used to generate images of preset text prompts, resulting in several composite images corresponding to the preset text prompts. A composite image set is then determined based on each composite image. The preset text prompts include domain names and corresponding category labels. Each synthesized image in the synthesized image set is mapped to a semantic embedding space using a preset image encoder to obtain a mapping result. An initial embedding vector corresponding to each mapping result is determined. Then, the Euclidean distance between each initial embedding vector is determined. The norm of the initial embedding vector is adjusted based on the initial embedding vector, the Euclidean distance, and a preset cropping threshold to obtain a first embedding vector to be processed.

3. The AI-based image dataset generation method according to claim 1, characterized in that, The determination of the semantic class center and the corresponding class safety radius for each image category in the client's local real image set includes: The client is invoked to perform embedding vector extraction on each real image in the local real image set to obtain a second initial embedding vector, and each of the second initial embedding vectors is normalized to obtain a second embedding vector to be processed. Determine the arithmetic mean of all the second embedding vectors to be processed in the same category, and set the arithmetic mean as the semantic class center corresponding to the category; the semantic class center is used to characterize the feature distribution corresponding to the category. Determine the Euclidean distance between the semantic class center and each of the second embedding vectors to be processed, and set the Euclidean distance with the largest value among the Euclidean distances as the class safety radius corresponding to the class.

4. The AI-based image dataset generation method according to claim 3, characterized in that, The method utilizes a contrast filter, similarity calibrator, and noise data filter in a preset contrastive utility function, and determines the distribution similarity and category distinction between the first embedded vector to be processed and the local real image set based on the semantic class center and the class safety radius, to obtain the corresponding distribution similarity score and category distinction result, including: The first distance between the first embedding vector to be processed and the corresponding semantic class center is determined using the comparison filter and based on the semantic class center. The second distance between the remaining first embedding vectors to be processed and the semantic class center is also determined. Then, it is determined whether the first distance is less than the second distance and the corresponding class safety radius, respectively, to obtain the distance judgment result. If the distance judgment result indicates that the first distance is not less than the second distance or the corresponding class safety radius, then the synthesized image corresponding to the first embedding vector to be processed is discarded; If the distance judgment result indicates that the first distance is less than the second distance or the corresponding class safety radius, then the similarity calibrator is called to normalize the first distance to obtain a normalized result. Then, based on a preset calibration factor and a preset micro constant, the normalized result is mapped to a preset score interval to obtain the distribution similarity score between the first embedded vector to be processed and the corresponding semantic class center. Based on the class safety radius and the second initial embedding vector, the actual safety margin and discrimination scale corresponding to the real image are determined. Based on the actual safety margin and the discrimination scale, the margin ratio corresponding to the real image is determined. Then, a noise data filter is constructed using the margin ratio and a preset risk threshold. The noise data filter is used to filter each real image in the local real image set based on a preset judgment threshold to obtain the class discrimination result.

5. The AI-based image dataset generation method according to claim 4, characterized in that, The process involves determining the current candidate sample set based on the distribution similarity score and the category distinction result, then selecting normal samples that meet preset high-quality conditions and rejection samples that meet preset low-quality conditions from the current candidate sample set using a preset index mechanism and a preset probability selection method, and constructing preference pairs based on the normal samples and the rejection samples, including: The positive sample utility function in the contrastive utility function is used, and the corresponding positive sample utility function value is determined based on the distribution similarity score and the category discrimination result. Similarly, the negative sample utility function in the contrastive utility function is used, and the corresponding negative sample utility function value is determined based on the distribution similarity score, the category discrimination result, and the positive sample utility function value. This is used to determine the current candidate sample set based on the positive and negative sample utility function values. The positive sample utility function value reflects the consistency of data distribution and category discriminability between the synthesized image and the real image; the negative sample utility function value reflects the semantic shift and discriminative vulnerability of the synthesized image. A first sensitivity upper bound and a second sensitivity upper bound are determined for the utility function of the positive sample and the utility function of the negative sample, respectively. Then, a preset index mechanism and a preset probability selection method are used to select normal samples that meet preset high-quality conditions and rejection samples that meet preset low-quality conditions from the current candidate sample set based on the first sensitivity upper bound and the second sensitivity upper bound, so as to construct preference pairs based on the normal samples and the rejection samples. The preset index mechanism is an index mechanism based on differential privacy.

6. The AI-based image dataset generation method according to claim 5, characterized in that, The process of using the DPO algorithm and adjusting the initial image generator based on the preferences includes: The log-odds ratio difference between the current image generation strategy and the preset reference image generation strategy is determined using the DPO algorithm and based on the preference pair. This log-odds ratio difference is then scaled using a preset temperature parameter to obtain a scaled result. The scaled result is then processed using the Sigmoid function to obtain the preference probability value. The current image generation strategy includes the probability distribution of images generated by the image generation model under preset conditions. The preset reference image generation strategy is used to constrain the optimization process of the image generation model. A preference optimization loss function is constructed based on the preference probability value. The negative expectation of the preference probability value is calculated using the preference optimization loss function to obtain the log loss. Then, the parameters corresponding to the initial image generator are adjusted using a preset gradient descent method based on the log loss to obtain the target image generator.

7. The AI-based image dataset generation method according to any one of claims 1 to 6, characterized in that, The obtained target image generator is used to iteratively optimize the normal samples and the rejected samples to obtain the target image dataset, including: The normal samples are input into the target image generator to process them and obtain an initial output result. Then, the rejection samples are used to adjust the initial output result to obtain the output result to be processed. Determine whether the output result to be processed meets the preset constraints. If the output result to be processed meets the preset constraints, then set the output result to be processed as the target image dataset corresponding to the text prompt word. If the output result to be processed does not meet the preset constraints, the output result to be processed is set as a new current candidate sample set, and the process jumps back to the step of selecting normal samples that meet the preset high-quality conditions and rejection samples that meet the preset low-quality conditions from the current candidate sample set using a preset index mechanism and a preset probability selection method, until the output result to be processed meets the preset constraints.

8. An AI-based image dataset generation device, characterized in that, include: The embedding vector extraction module is used to generate a synthetic image set using a preset AI text image generator and based on text prompts, and then extract the embedding vectors in the synthetic image set, and normalize the extracted first initial embedding vector to obtain the first embedding vector to be processed. The class safety radius determination module is used to determine the semantic class center and the corresponding class safety radius for each image category in the local real image set of the client. Then, using the contrast filter, similarity calibrator and noise data filter in the preset contrastive utility function, the first embedding vector to be processed and the local real image set are determined based on the semantic class center and the class safety radius to determine the distribution similarity and class distinction, and obtain the corresponding distribution similarity score and class distinction result. The class safety radius is the maximum value of the Euclidean distances from each real image in each of the image categories to the semantic class center; The preference pair construction module is used to determine the current candidate sample set based on the distribution similarity score and the category distinction result, and then select normal samples that meet the preset high quality conditions and rejection samples that meet the preset low quality conditions from the current candidate sample set using a preset index mechanism and a preset probability selection method, and construct preference pairs based on the normal samples and the rejection samples. The image dataset generation module is used to adjust the initial image generator based on the DPO algorithm and the preferences, and to iteratively optimize the normal samples and the rejected samples using the obtained target image generator to obtain the target image dataset.

9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the AI-based image dataset generation method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, Used to store a computer program, wherein the computer program, when executed by a processor, implements the AI-based image dataset generation method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Vegetation graph model training method, image generation method, device and medium

    CN119849658A

  • Text generation image diffusion model enhancement method based on multi-target preference optimization

    CN120655780A