Data processing method, device and equipment

Generating adversarial samples through the gradient weighted class activation mapping algorithm and diffusion model solves the problem of adversarial attacks on machine learning models, improves the robustness and accuracy of the model, and provides an explainable adversarial sample generation process.

CN118762252APending Publication Date: 2024-10-11ANT GROUP CO LTD

Patent Information

Application Number
CN202411244910.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-05
Publication Date
2024-10-11

AI Technical Summary

Technical Problem

It is difficult for existing technologies to effectively resist adversarial attacks on machine learning models, especially by generating adversarial samples, resulting in insufficient robustness and accuracy of the model.

Method used

The gradient weighted class activation mapping algorithm and diffusion model are used to generate adversarial samples. By iteratively adding noise data to images or business data, the noise is removed to restore the target data, and adversarial samples are generated based on masks to improve the robustness of the model. performance and accuracy.

Benefits of technology

It improves the robustness and accuracy of the model, can more effectively resist adversarial attacks, and provides an explainable adversarial sample generation process in the face of malicious data manipulation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118762252A_ABST
    Figure CN118762252A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a data processing method, device and equipment. The method comprises the following steps: acquiring an image sequence formed by noise adding images which are sequentially generated by iteratively adding noise data into image data; determining a first mask corresponding to an area where a preset object is located in the image data through a gradient weighting class activation mapping algorithm, and generating a second mask based on the first mask; for any two adjacent noise-added images in the image sequence, inputting a first noise-added image generated later in the two noise-added images into a pre-trained first diffusion model, and removing noise data in the first noise-added image through the first diffusion model to recover a remaining second noise-added image in the two noise-added images, a corresponding target image is obtained; generating an antagonistic sample based on the target image, the first mask, the second mask and the second noise-added image; and carrying out model training on a risk identification model based on the generated adversarial sample.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This document relates to the field of computer technology, and in particular to a data processing method, device and equipment. Background Art

[0002] With the continuous development of network technology and terminal technology, machine learning has become a hot topic. In addition, as people pay more and more attention to their own privacy data, machine learning models not only need to protect users' privacy data from being leaked, but also need to deal with attacks from various malicious data.

[0003] Attackers can send modified and harmful data samples to deceive the model training device to launch adversarial attacks on the model. To this end, it is necessary to provide a better way to generate adversarial samples, which can not only achieve the purpose of resisting the above-mentioned various attacks, but also improve the accuracy and robustness of the model. Summary of the invention

[0004] The purpose of the embodiments of this specification is to provide a better method for generating adversarial samples, which can not only achieve the purpose of resisting the above-mentioned various attacks, but also improve the accuracy and robustness of the model.

[0005] In order to implement the above technical solution, the embodiments of this specification are implemented as follows: A data processing method provided in an embodiment of the present specification includes: obtaining an image sequence consisting of noisy images generated in sequence by iteratively adding noise data to image data. Determine a first mask corresponding to an area where a preset object contained in the image data is located by a gradient weighted class activation mapping algorithm, and generate a second mask based on the first mask. For any two adjacent noisy images in the image sequence, input the first noisy image generated later in the two noisy images into a pre-trained first diffusion model, remove the noise data in the first noisy image by the first diffusion model to restore the remaining second noisy image in the two noisy images, and obtain a corresponding target image; generate an adversarial sample of the image data based on the target image, the first mask, the second mask and the second noisy image. Model training is performed on a risk identification model in the business corresponding to the image data based on multiple adversarial samples generated based on the noisy images contained in the image sequence.

[0006] A data processing method provided in an embodiment of the present specification comprises: obtaining a data sequence consisting of noisy data sequentially generated by iteratively adding noise data to the business data of a target business. Determine a first mask corresponding to the area where a preset object contained in the business data is located by a gradient weighted class activation mapping algorithm, and generate a second mask based on the first mask. For any two adjacent noisy data in the data sequence, input the first noisy data generated later in the two noisy data into a pre-trained first diffusion model, remove the noise data in the first noisy data by the first diffusion model to restore the remaining second noisy data in the two noisy data, and obtain the corresponding target data; generate adversarial samples of the business data based on the target data, the first mask, the second mask and the second noisy data. Model training is performed on the target model in the target business based on multiple adversarial samples generated based on the noisy data contained in the data sequence.

[0007] The embodiment of the present specification provides a data processing device, the device comprising: an image sequence acquisition module, which acquires an image sequence consisting of noisy images generated in sequence by iteratively adding noise data to the image data. An image mask determination module, which determines the first mask corresponding to the area where the preset object contained in the image data is located by a gradient weighted class activation mapping algorithm, and generates a second mask based on the first mask. An adversarial sample generation module, for any two adjacent noisy images in the image sequence, inputs the first noisy image generated later in the two noisy images into a pre-trained first diffusion model, removes the noise data in the first noisy image by the first diffusion model to restore the remaining second noisy image in the two noisy images, and obtains the corresponding target image; based on the target image, the first mask, the second mask and the second noisy image, generates an adversarial sample of the image data. A model training module, which performs model training on the risk identification model in the business corresponding to the image data based on multiple adversarial samples generated from the noisy images contained in the image sequence.

[0008] A data processing device provided in an embodiment of the present specification comprises: a data sequence acquisition module, which acquires a data sequence composed of noisy data generated in sequence by iteratively adding noise data to the business data of the target business. A mask determination module, which determines the first mask corresponding to the area where the preset object contained in the business data is located through a gradient weighted class activation mapping algorithm, and generates a second mask based on the first mask. An adversarial sample generation module, for any two adjacent noisy data in the data sequence, inputs the first noisy data generated later in the two noisy data into a pre-trained first diffusion model, removes the noise data in the first noisy data through the first diffusion model to restore the remaining second noisy data in the two noisy data, and obtains the corresponding target data; based on the target data, the first mask, the second mask and the second noisy data, generates an adversarial sample of the business data. A training module, which performs model training on the target model in the target business based on multiple adversarial samples generated from the noisy data contained in the data sequence.

[0009] The embodiment of the present specification provides a data processing device, the data processing device includes: a processor; and a memory arranged to store computer executable instructions, the executable instructions when being executed, cause the processor to: obtain an image sequence consisting of noisy images generated in sequence by iteratively adding noise data to the image data. Determine the first mask corresponding to the area where the preset object contained in the image data is located by the gradient weighted class activation mapping algorithm, and generate a second mask based on the first mask. For any two adjacent noisy images in the image sequence, input the first noisy image generated later in the two noisy images into a pre-trained first diffusion model, remove the noise data in the first noisy image by the first diffusion model to restore the remaining second noisy image in the two noisy images, and obtain the corresponding target image; generate an adversarial sample of the image data based on the target image, the first mask, the second mask and the second noisy image. Model training is performed on the risk identification model in the business corresponding to the image data based on multiple adversarial samples generated based on the noisy images contained in the image sequence.

[0010] A data processing device provided in an embodiment of the present specification includes: a processor; and a memory arranged to store computer executable instructions, wherein when the executable instructions are executed, the processor is caused to: obtain a data sequence consisting of noise data generated by iteratively adding noise data to the business data of the target business. The first mask corresponding to the area where the preset object contained in the business data is located is determined by the gradient weighted class activation mapping algorithm, and a second mask is generated based on the first mask. For any two adjacent noised data in the data sequence, the first noised data generated later in the two noised data is input into a pre-trained first diffusion model, and the noise data in the first noised data is removed by the first diffusion model to restore the remaining second noised data in the two noised data to obtain the corresponding target data; based on the target data, the first mask, the second mask and the second noised data, an adversarial sample of the business data is generated. The target model in the target business is trained based on multiple adversarial samples generated from the noised data contained in the data sequence.

[0011] The embodiment of the present specification also provides a storage medium, which is used to store computer executable instructions. When the executable instructions are executed by the processor, the following process is implemented: an image sequence consisting of noisy images generated in sequence by iteratively adding noise data to the image data is obtained. A first mask corresponding to the area where the preset object contained in the image data is located is determined by a gradient weighted class activation mapping algorithm, and a second mask is generated based on the first mask. For any two adjacent noisy images in the image sequence, the first noisy image generated later in the two noisy images is input into a pre-trained first diffusion model, and the noise data in the first noisy image is removed by the first diffusion model to restore the remaining second noisy image in the two noisy images to obtain a corresponding target image; based on the target image, the first mask, the second mask and the second noisy image, an adversarial sample of the image data is generated. A risk identification model in the business corresponding to the image data is trained based on multiple adversarial samples generated based on the noisy images contained in the image sequence.

[0012] The embodiment of this specification also provides a storage medium, which is used to store computer executable instructions. When the executable instructions are executed by the processor, the following process is implemented: obtain a data sequence consisting of noisy data generated by iteratively adding noise data to the business data of the target business. Determine the first mask corresponding to the area where the preset object contained in the business data is located by the gradient weighted class activation mapping algorithm, and generate a second mask based on the first mask. For any two adjacent noisy data in the data sequence, the first noisy data generated later in the two noisy data is input into the pre-trained first diffusion model, and the noise data in the first noisy data is removed by the first diffusion model to restore the remaining second noisy data in the two noisy data to obtain the corresponding target data; based on the target data, the first mask, the second mask and the second noisy data, generate an adversarial sample of the business data. Model training is performed on the target model in the target business based on multiple adversarial samples generated from the noisy data contained in the data sequence.

[0013] The embodiment of the present specification also provides a computer program product, including a computer program, which implements the following process when executed by a processor: obtaining an image sequence consisting of noisy images generated in sequence by iteratively adding noise data to the image data. Determine a first mask corresponding to the area where the preset object contained in the image data is located by a gradient weighted class activation mapping algorithm, and generate a second mask based on the first mask. For any two adjacent noisy images in the image sequence, input the first noisy image generated later in the two noisy images into a pre-trained first diffusion model, remove the noise data in the first noisy image by the first diffusion model to restore the remaining second noisy image in the two noisy images, and obtain a corresponding target image; based on the target image, the first mask, the second mask and the second noisy image, generate an adversarial sample of the image data. Model training is performed on a risk identification model in the business corresponding to the image data based on multiple adversarial samples generated from the noisy images contained in the image sequence.

[0014] The embodiment of this specification also provides a computer program product, including a computer program, which implements the following process when executed by a processor: obtain a data sequence consisting of noisy data generated in sequence by iteratively adding noise data to the business data of the target business. Determine the first mask corresponding to the area where the preset object contained in the business data is located by the gradient weighted class activation mapping algorithm, and generate a second mask based on the first mask. For any two adjacent noisy data in the data sequence, the first noisy data generated later in the two noisy data is input into a pre-trained first diffusion model, and the noise data in the first noisy data is removed by the first diffusion model to restore the remaining second noisy data in the two noisy data to obtain the corresponding target data; based on the target data, the first mask, the second mask and the second noisy data, generate an adversarial sample of the business data. Model training is performed on the target model in the target business based on multiple adversarial samples generated from the noisy data contained in the data sequence. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the technical solutions in the embodiments of this specification or the prior art, the drawings required for use in the embodiments or the prior art description will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative labor. Figure 1 This is an embodiment of a data processing method of this specification; Figure 2 A schematic diagram of a data processing process of this specification; Figure 3 This is another data processing method embodiment of the present specification; Figure 4 A schematic diagram of another data processing process of this specification; Figure 5 This is another data processing method embodiment of the present specification; Figure 6 This is a schematic diagram of the structure of a data processing system in this specification; Figure 7 This is another data processing method embodiment of the present specification; Figure 8 This is another data processing method embodiment of the present specification; Fig. 9 This is an embodiment of a data processing device of the present specification; Fig.10 Another data processing device embodiment of the present specification; Fig.11 This is an embodiment of a data processing device in this specification. DETAILED DESCRIPTION

[0016] The embodiments of this specification provide a method, device and equipment for processing data.

[0017] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.

[0018] The embodiments of this specification provide a construction mechanism for adversarial samples for model training. With the continuous development of network technology and terminal technology, machine learning has become a hot topic. In addition, as people pay more and more attention to their privacy data, the machine learning model not only needs to protect the user's privacy data from being leaked, but also needs to deal with attacks from various malicious data. An attacker can deceive the model training device by sending modified and harmful data samples to launch an adversarial attack on the model. Generally, there are two types of adversarial attacks, namely non-directional attacks and directional attacks. Non-directional attacks are intended to reduce the overall performance of the model and can be regarded as Byzantine attacks that cause model performance to deteriorate or model training to fail. Targeted attacks, which can also be called backdoor attacks, are intended to modify the model behavior on certain specific data instances selected by the attacker (for example, identifying images of cats as dogs), while keeping the model performance on other data instances unaffected. Both non-directional and directional attacks can lead to catastrophic consequences. Therefore, attackers and their harmful model updates or model training processes must be detected in a timely manner and removed from the machine learning system to prevent the generation of risky models.

[0019] Generally, abnormal data can be identified by analyzing the statistical characteristics of the data. An effective way is to identify and detect abnormal or malicious data by analyzing the statistical characteristics of the data such as mean, variance, Z-Score, interquartile range (IQR), density estimation, histogram, box plot, Mahalanobis distance and cluster analysis. Although this method is simple and intuitive, with low computational overhead, it is suitable for preliminary screening and detection of abnormal data. However, their detection capabilities for complex adversarial samples are limited, and it is difficult to deal with disguised malicious data. Therefore, it is usually necessary to combine more complex detection algorithms to improve the accuracy and robustness of detection.

[0020] The detection method based on traditional machine learning is used to identify abnormal data, that is, using decision trees, random forests, support vector machines, K-nearest neighbors, Gaussian mixture models, linear regression and logistic regression, isolation forests, principal component analysis, clustering algorithms, and naive Bayes algorithms to identify abnormal or malicious data by learning the normal patterns of data. This method has the advantages of high efficiency and easy implementation, but may perform poorly when processing high-dimensional and complex data. Therefore, it is usually necessary to combine deep learning or other integrated algorithms to improve the accuracy and robustness of detection.

[0021] In the field of machine learning, malicious data detection faces unique challenges. Common detection methods have limited effectiveness when dealing with complex and high-dimensional data, so deep learning-based methods have gradually become mainstream. Deep learning's powerful representation ability and automatic feature extraction capabilities make it perform well in malicious data detection, especially in adversarial attack detection. Adversarial attacks refer to attackers adding small and imperceptible perturbations to the original data, thereby misleading the target model to give incorrect outputs. This attack has caused major security issues in the fields of computer vision and machine learning, challenging the robustness of models. Adversarial attacks are not only used to undermine model performance, but also to improve applications such as transfer learning, deep learning interpretability, privacy protection, and federated learning. The generation of adversarial samples is usually achieved through optimization problems, that is, finding an adversarial sample that the classifier misclassifies it while ensuring that the perturbation between the sample and the original data is minimized. Common adversarial attack algorithms include fast gradient sign method, projected gradient descent, Carlini-Wagner attack, and other variants. The above algorithms generate adversarial samples by optimizing within the p-distance range of the data. Although deep learning-based methods perform well in malicious data detection, they still face some challenges. For example, the generation and detection of adversarial samples require a lot of computing resources, and in practical applications, attackers may constantly adjust their attack strategies to bypass detection. Therefore, it is necessary to continuously improve the detection algorithm to improve its robustness and generalization ability. In addition, the selection of appropriate proxy models and distance metrics is also a key issue. These choices will directly affect the detection effect and need to be optimized according to the specific application scenario. To this end, the embodiment of this specification provides a better way to generate adversarial samples. A diffusion model is used to synthesize an unlimited number of natural adversarial samples based on gradient-weighted class activation mapping. By controlling the potential variables in the denoising process under adversarial guidance, the diffusion model can generate natural and powerful adversarial samples, making the existing model unable to resist these attacks. In addition, this method is more natural and less detectable. They show a smaller perception distance and enjoy a higher success rate. Unlike adversarial training, the use of adversarial training shows that the model can obtain the robustness of the threat model that is invisible during the training process. For specific processing, please refer to the specific content in the following embodiment.

[0022] like Figure 1 As shown, an embodiment of this specification provides a method for processing data, and the execution subject of the method may be a terminal device or a server, etc., wherein the terminal device may be a mobile terminal device such as a mobile phone, a tablet computer, or a computer device such as a laptop or a desktop computer, or an IoT device (specifically such as a smart watch, an IoT device, a vehicle-mounted device, etc.), etc., wherein the server may be an independent server, or a server cluster composed of multiple servers, etc., and the server may be a background server for a financial service or an online shopping service, etc., or a background server for an application, etc. In this embodiment, a detailed description is given by taking the execution subject as a server as an example. For the case where the execution subject is a terminal device, please refer to the following server case processing, which will not be repeated here. The method may specifically include the following steps: In step S102, a data sequence consisting of noise-added data sequentially generated by iteratively adding noise data to the business data of the target business is obtained.

[0023] Among them, the target business can be any business, for example, the target business can be such as risk prevention and control business (or risk identification business), identity identification business, biometric identification business, etc., which can be set according to actual conditions. Business data can be determined according to different target businesses. For example, if the target business is a risk prevention and control business (or risk identification business) in the financial field, then the corresponding business data may include relevant data generated in the process of the user performing the specified business, such as the user's account information, transaction time, transaction location, transaction amount, historical transaction data, etc. For another example, if the target business is a risk prevention and control business (or risk identification business) in the fields of medical monitoring or smart home, then the corresponding business data may include relevant data generated in the process of the user using the specified device (medical device or smart home device, etc.), such as the user's account information, the time of the specified operation, the time series data of different operations, historical interaction data, etc. For another example, if the target business is an identity identification business (or biometric identification business) in the fields of finance, medical monitoring or smart home, then the corresponding business data may include relevant data generated in the process of the user performing the specified business, such as the user's account information, identification time, the acquired user identity data, historical interaction data, etc., which can be set according to actual conditions, and the embodiments of this specification do not limit this. Business data may include many different forms, for example, business data may be text data, images, videos, audios, etc., or a combination of the above multiple different types of data (such as a combination of file data and images, etc.), etc., which may be set according to actual conditions. Noise data may include many forms, for example, the noise data may be Gaussian noise data (i.e., data that satisfies Gaussian distribution), data that satisfies normal distribution, data that satisfies uniform distribution or Poisson distribution, etc., which may be set according to actual conditions.

[0024] In implementation, the business data of the target business can be obtained. In actual applications, the business data of the target business can be obtained in a variety of different ways. For example, the business data generated by the user's current execution of the target business can be obtained, or the historical business data of a specified time period or that meets preset conditions can be obtained from the historical business data generated by the user's execution of the target business. The obtained historical business data can be used as the business data of the target business, etc. The specific setting can be based on actual conditions. After the business data is obtained in the above manner, the business data can be used as the original data, and then the noise-added data can be generated from the original data. Specifically, an iterative formula can be pre-set, and the corresponding noise-added data can be calculated in sequence through the iterative formula. For example, the iterative formula can be as follows

[0025] Wherein, n is a positive integer greater than or equal to 1, Can represent business data, represents the nth noise-added data, represents the noise data corresponding to the nth noise-added data, and are coefficients respectively.

[0026] Through the above iterative formula, business data can be Substituting into the above iterative formula, we get the noise-added data , and then add the noise data Substituting into the above iterative formula, we get the noise-added data , and then add the noise data Substituting into the above iterative formula, we get the noise-added data , and so on, we can get the noise data respectively , Noise data , Noise data , ...noise data , Noise data , and then we can get the data series .

[0027] It should be noted that the above iteration formula is only an optional iteration formula. In practical applications, in addition to the above iteration formula, a variety of different iteration formulas and corresponding iteration methods may also be included. For example,

[0028] in, k , l is a constant, etc., which can be set according to actual conditions, and the embodiments of this specification do not limit this.

[0029] In step S104, a first mask corresponding to the region where the preset object contained in the business data is located is determined by a gradient weighted class activation mapping algorithm, and a second mask is generated based on the first mask.

[0030] Among them, the gradient weighted class activation mapping algorithm multiplies the gradient of the output category (equivalent to the output data of a specific convolutional layer) with the output data of the network layer, and then averages the multiplication results to obtain a "rough" heat map, which can be enlarged and superimposed on the original data to show the area where the model is most concerned in classification. The gradient weighted class activation mapping algorithm can be implemented in the following way, namely: a convolutional layer can be selected as the source of explanation. Usually, the last convolutional layer of the model network can be selected because it contains both high-level features and retains spatial information; through forward propagation, the score of the category to be explained can be obtained; this score is calculated relative to the gradient of the selected convolutional layer output; for each channel of the convolutional layer, the channel is weighted using the global average of the above gradient; the result is a weighted heat map with the same spatial dimension as the convolutional layer. The preset object can be set according to the actual situation, such as one or more characters in the image, or a word or sentence in the text.

[0031] In implementation, Figure 2 As shown, in order to generate an image that can successfully deceive an image risk discrimination model (which may be a discriminator for discriminating real images from fake images, etc.), while preferably retaining the salient objects in the original image, a gradient weighted class activation mapping algorithm can be used to identify the salient areas in the above-mentioned business data. The salient area is the area where the preset object is located. A corresponding mask (i.e., a first mask) can be set based on the salient area. Specifically, the above-mentioned salient area can be determined by the processing method or processing steps of the above-mentioned gradient weighted class activation mapping algorithm, and then the first mask is determined, which will not be repeated here.

[0032] The second mask can be generated based on the first mask in a variety of ways. For example, the first mask can be mapped based on a preset mapping relationship to obtain a corresponding mask as the second mask, or the first mask can be normalized and the result can be used as the second mask, or the first mask can be standardized and the result can be used as the second mask, or the first mask can be averaged and the result can be used as the second mask, etc. The specific settings can be based on actual conditions, and the embodiments of this specification are not limited to this.

[0033] In step S106, for any two adjacent noisy data in the data sequence, the first noisy data generated later among the two noisy data is input into a pre-trained first diffusion model, and the noise data in the first noisy data is removed by the first diffusion model to restore the remaining second noisy data among the two noisy data to obtain the corresponding target data; based on the target data, the first mask, the second mask and the second noisy data, an adversarial sample of the business data is generated.

[0034] In implementation, the data sequence includes the noised data arranged in sequence according to the time sequence of generation. As mentioned above, the data sequence is , we can select any two adjacent noise-added data from the above data sequence, such as ( )、( )、( ), etc., two adjacent noisy data include the noisy data generated first and the noisy data generated later. In this embodiment, the noisy data generated later can be recorded as the first noisy data, and the noisy data generated first can be recorded as the second noisy data.

[0035] According to the actual situation, the model architecture of the first diffusion model can be pre-built through a variety of different algorithms or networks. The first diffusion model can be used to gradually restore the business data (i.e., the original data). That is, the first diffusion model can convert the input noise data into Restore to the data before the noise-added data entered in the data sequence, that is, the noise-added data , then the first diffusion model can also input the noise data Restore to business data For example, the first diffusion model can input the noisy data Restore to the data before the noise-added data entered in the data sequence, that is, the noise-added data , then the first diffusion model can also input the noise data Restore to the data before the noise-added data entered in the data sequence, that is, the noise-added data , ..., the first diffusion model can input the noisy data Restore to the data before the noise-added data entered in the data sequence, that is, the noise-added data , then the first diffusion model can also input the noise data Restore to business data etc., that is . The algorithm or network for constructing the model architecture of the first diffusion model may include multiple types. For example, the first diffusion model may be constructed by a convolutional neural network, or the first diffusion model may be constructed by the generator in the generator and the discriminator in the generative adversarial network GAN, or the first diffusion model may be constructed by a frequency domain recovery algorithm, an inverse filtering recovery algorithm, etc., which may be set specifically according to actual conditions. After constructing the model architecture of the first extended model in the above manner, a specified training sample may be obtained. The data type of the training sample may be determined according to the algorithm or specific network for constructing the first extended model. The training sample may be used to train the first extended model until the preset loss function converges to obtain the trained first extended model. For example, if the first diffusion model is constructed by the generator in the generative adversarial network GAN, the training sample and the corresponding label information may be obtained. Then, the training sample and the corresponding label information may be used to jointly train the generator and the discriminator to obtain the trained generator as the first diffusion model. If the first diffusion model is constructed by the inverse filtering recovery algorithm, the input data required by the inverse filtering recovery algorithm may be obtained. The input data may be input into the inverse filtering recovery algorithm for calculation, and finally the value of the unknown parameter in the inverse filtering recovery algorithm may be obtained, thereby obtaining the first diffusion model.

[0036] like Figure 2 As shown, for any two adjacent noisy data in the data sequence, based on the above content, the noisy data generated later in the two noisy data is the first noisy data, and the noisy data generated earlier is the second noisy data. The first noisy data in the two noisy data can be input into the first diffusion model after the above training, and the noise data in the first noisy data can be removed by the first diffusion model to restore the second noisy data, and finally the corresponding target data is obtained. Based on the target data, the first mask, the second mask and the second noisy data, adversarial samples of business data can be generated in a variety of different ways. For example, the target data and the second mask can be used to obtain the corresponding result through a preset algorithm (such as a matrix multiplication algorithm or a fusion algorithm (specifically, the target data and each data in the first mask are calculated by weighted calculation, etc.)), and then the first mask and the second noisy data can be used to obtain the corresponding result through a predetermined algorithm (such as a matrix multiplication algorithm or a fusion algorithm (specifically, the target data and each data in the first mask are calculated by weighted calculation, etc.)), and then the two results can be fused again using a specified algorithm to obtain the corresponding result, and the final result can be used as an adversarial sample of business data.

[0037] The above-mentioned specific processing of generating adversarial samples of business data based on target data, the first mask, the second mask and the second noisy data is only an optional processing method. In practical applications, it can also be implemented in many other different ways, which can be set according to actual conditions. The embodiments of this specification do not limit this.

[0038] Since the first mask and the second mask in the above processing are masks determined based on the salient areas in the above business data, after processing with the first mask or the second mask, the salient areas in the processed data can be highlighted, thereby improving the similarity between the generated adversarial samples and the original data (i.e., business data), so as to better retain the salient objects in the original data, and at the same time, it can also process features that have low relevance to data processing, such as background texture, shape or object.

[0039] In step S108, model training is performed on a target model in the target business based on multiple adversarial samples generated based on the noisy data included in the data sequence.

[0040] In implementation, the processing of the above step S106 can be repeated until the data processing in the data sequence is completed or the required amount of data reaches a specified threshold, and finally a plurality of adversarial samples can be obtained. After that, the target model in the target business can be trained based on the plurality of adversarial samples. In this way, since the significant area similarity between the obtained adversarial samples and the original data (i.e., business data) is high, and other features with low relevance to data processing are appropriately weakened, the generated plurality of adversarial samples can improve the accuracy and robustness of the target model in the target business. Moreover, when facing malicious data manipulation, tracing the source is the most important thing. The generation process of the first diffusion model is a process of gradually reducing noise data. This process of generating adversarial samples is explainable to a certain extent, and the details of adversarial sample generation at each step can be easily understood.

[0041] The embodiment of the present specification provides a data processing method, which obtains a data sequence composed of noisy data sequentially generated by iteratively adding noise data to the business data of the target business, and then determines a first mask corresponding to an area where a preset object contained in the business data is located through a gradient weighted class activation mapping algorithm, and generates a second mask based on the first mask. After that, for any two adjacent noisy data in the data sequence, the first noisy data generated later in the two noisy data is input into a pre-trained first diffusion model, and the noise data in the first noisy data is removed by the first diffusion model to restore the second noisy data remaining in the two noisy data to obtain the corresponding target data. Based on the target data, the first mask, the second mask and the second noisy data, a second mask can be generated. Data, generate adversarial samples of business data, and finally, the target model in the target business can be trained based on multiple adversarial samples generated by the noisy data contained in the data sequence. In this way, since the significant area similarity between the obtained adversarial samples and the original data (ie, business data) is high, and other features with low relevance to data processing are appropriately weakened, the generated multiple adversarial samples can improve the accuracy and robustness of the target model in the target business. Moreover, when facing malicious data manipulation, tracing the source is the most important thing. The generation process of the first diffusion model is a process of gradually reducing noise data. This process of generating adversarial samples is explainable to a certain extent, and it is easy to understand the details of adversarial sample generation at each step.

[0042] In practical applications, the specific processing methods of the above step S102 can be varied. An optional processing method is provided below, such as Figure 3 As shown, the processing may specifically include the following steps S1022 and S1024.

[0043] In step S1022, business data in the target business is obtained.

[0044] In step S1024, the business data is input into a pre-trained second diffusion model, and noise data is iteratively added to the business data through the second diffusion model to obtain a data sequence consisting of sequentially generated noise data, where the noise data satisfies a normal distribution.

[0045] Among them, the model structure of the second diffusion model can be the same or similar to that of the first diffusion model, but the model parameters contained in the two may be different, and the values ​​of the model parameters are also different. In actual applications, the second diffusion model may also be a model completely different from the first diffusion model (that is, the model structure is different, and the values ​​of the model parameters contained therein are also different). The specific setting can be based on actual conditions, and the embodiments of this specification do not limit this.

[0046] In implementation, Figure 4As shown, the model architecture of the second diffusion model is pre-built through a variety of different algorithms or networks. The second diffusion model can be used to gradually add noise data to the business data to generate noise-added data, that is, the second diffusion model can add noise data to the input business data. Add noise data to generate noisy data , then the second diffusion model can also add noise to the data Add noise data to generate noisy data , ..., the second diffusion model can be used to add noise to the data Add noise data to generate noisy data Etc. The algorithm or network for constructing the model architecture of the second diffusion model may include multiple types. For example, the second diffusion model may be constructed by a convolutional neural network, or the second diffusion model may be constructed by a generator in a generator and a discriminator in a generative adversarial network GAN, or the second diffusion model may be constructed by a frequency domain recovery algorithm, an inverse filtering recovery algorithm, etc., which may be specifically set according to actual conditions. After constructing the model architecture of the second extended model in the above manner, the specified training samples may be obtained. The data type of the training samples may be determined according to the algorithm or specific network for constructing the second extended model. For details, please refer to the above-mentioned related content.

[0047] For example, after obtaining the business data in the above manner, the business data can be used as the original data, and then the original data can be promoted to the second diffusion model to generate the noisy data. Specifically, the second diffusion model can be pre-trained, and the corresponding noisy data can be calculated in sequence through the second diffusion model and the business data. Specifically, the second diffusion model can calculate the corresponding noisy data in the form of the following iterative formula, and the iterative formula is as follows:

[0048] in, t For time, Can represent business data, Represents the time step t The noisy data, Represents the time step t The noise data corresponding to the noise-added data is is the noise increment coefficient corresponding to the noise data at time step t, which can usually be a small value. , among which represents the mean, In practical applications, , that is, the noise data can satisfy the standard normal distribution. By iteratively adding noise data to the business data through the above second extended model, the image sequence is finally obtained. .

[0049] Based on the above content, in the above step S106, the first noisy data generated later in the two noisy data is input into the pre-trained first diffusion model, and the noise data in the first noisy data is removed by the first diffusion model to restore the remaining second noisy data in the two noisy data. The specific processing of obtaining the corresponding target data may include: like Figure 4 As shown, the first diffusion model can realize the reverse process of the second diffusion model. The first diffusion model can gradually remove the noise data to restore the original data (ie, business data). The goal of the first diffusion model can be to learn a model , this model can reverse the forward process of the second diffusion model, and the formula description can be as follows:

[0050] in, can be a neural network that estimates the The noisy data, is a parameter in the neural network. The first noise-added data of the two noise-added data is input into the first diffusion model. The first diffusion model can be obtained by the above-mentioned learned model. Or, through the processing method described in the above formula, with the goal of restoring the second noisy data, the noise data in the first noisy data is removed to obtain the corresponding target data.

[0051] In practical applications, the specific processing methods of the above step S108 can be varied. An optional processing method is provided below, such as Figure 5 As shown, the processing may specifically include the following steps S1082 to S1086.

[0052] In step S1082, model training is performed on the target model based on multiple adversarial samples generated based on the noisy data contained in the above data sequence to obtain a trained target model.

[0053] In practice, Federated Learning is an emerging distributed machine learning paradigm that aims to improve overall model performance by collaboratively training machine learning models without disclosing the private data of clients. In a typical federated learning setting, the server is responsible for maintaining the global model and coordinating the training process of multiple clients (such as mobile devices). Each client retains the original data in its local storage and only transmits local model updates to the server for instant aggregation. Since there is no exchange of private data during the training process, federated learning provides strong privacy guarantees for participating clients. This feature has made federated learning widely used in edge computing, finance, healthcare and other fields.

[0054] Although federated learning has significant advantages in protecting data privacy, its system is vulnerable to attacks by malicious clients, which has become a major obstacle to its practical deployment. In a federated learning system, the server cannot manage the behavior of clients and cannot access their private data. Therefore, malicious clients can deceive the server by sending modified and harmful model updates and launch adversarial attacks on the global model.

[0055] Adversarial attacks can generally include two types, namely non-targeted attacks and targeted attacks. Non-targeted attacks aim to degrade the overall performance of the model and can be regarded as Byzantine attacks that lead to deterioration of model performance or failure of model training. Targeted attacks, also known as backdoor attacks, aim to modify the model behavior on certain specific data instances selected by the attacker while keeping the model performance on other data instances unaffected. Both non-targeted and targeted attacks can lead to catastrophic consequences. Therefore, attackers and their harmful model updates must be detected in a timely manner and removed from the federated learning system to prevent malicious model corruption and the distribution of inappropriate training incentives to malicious clients.

[0056] Malicious data detection based on generative adversarial networks: Generative adversarial networks (GANs) are used to generate adversarial samples for malicious data detection, but this method has difficulties in generating high-quality adversarial samples. Generative adversarial networks are used to generate large amounts of synthetic but unreal data. As an alternative to variational autoencoders, GANs have the ability to generate high-quality data and are widely used in data set expansion and creation, especially in the wave of machine learning-driven technologies, where data demand is huge. Due to the high cost of data acquisition and annotation, GANs have become a powerful tool, especially when data is scarce, to help train new machine learning systems. GANs consist of two parts: a generator and a discriminator. The task of the generator is to generate samples that look real, while the task of the discriminator is to distinguish whether these samples are real samples or generated samples. Through adversarial training, the generator continuously improves the quality of the generated samples, making it difficult for the discriminator to distinguish between real and fake samples. Ultimately, the generator is able to generate highly realistic synthetic data. GANs use adversarial training between generators and discriminators to generate a large number of synthetic malicious samples to enhance the data set and improve the robustness of intrusion detection systems. By generating adversarial samples, recognition models can be effectively trained to cope with complex attack patterns. However, the training process based on GAN may be unstable, and the adversarial training between the generator and the discriminator requires careful adjustment of hyperparameters and network structure to ensure model convergence and generate high-quality samples; in addition, the quality of the generated synthetic data directly affects the performance of the detection model. If the quality of the generated data is not high, it may mislead the recognition model and reduce its practical application effect; in addition, the training process of GAN requires a lot of computing resources and time, especially when processing large-scale data sets, which may limit its application in resource-constrained environments; moreover, the generated adversarial samples may lack interpretability, making it difficult to intuitively understand the attack behavior, which increases the difficulty of model debugging and optimization. Therefore, although the malicious data detection method based on GAN has significant advantages in enhancing the data set and improving the robustness of the recognition model, some problems still need to be solved and optimized in practical applications to achieve more stable and efficient malicious data detection. Based on this, the target model in the embodiment of this specification can be a model in the server in federated learning. In federated learning, the target model in the server is easily attacked by the update information of the target model provided by the malicious client. For this reason, adversarial samples can be constructed through the processing of the above steps S102 to S106 to train the target model in the server in federated learning, and finally obtain the trained target model. In this way, the trained target model has higher accuracy and stronger robustness.

[0057] It should be noted that the above-mentioned federated learning can be applied to any smart devices and applications that adopt the federated learning framework, especially applications deployed on edge devices (such as smart phones, IoT devices, Internet of Vehicles, etc.), which may include but are not limited to smart home systems, medical monitoring equipment, autonomous driving systems, financial risk control systems, etc.

[0058] In step S1084, knowledge distillation training is performed on the trained target model to obtain a distillation model.

[0059] In implementation, since the structure of the target model in the server is very complex, the model parameters are very large, and a large amount of storage space and model running space are required, if the target model is directly applied to the client, the client will consume a lot of resources when running the target model. For this reason, the trained target model can be subjected to knowledge distillation to reduce the size of the target model and obtain a model suitable for client operation. Specifically, the trained target model can be used as a teacher model, and the model used by the client can be used as a student model. Then, based on the teacher model, the student model can be trained for knowledge distillation through knowledge distillation. Finally, the trained student model can be obtained. The trained student model is the distillation model.

[0060] In step S1086, the distillation model is sent to a plurality of different edge-side clients respectively to process the business data of the target business received by the edge-side clients.

[0061] Among them, the edge-side client can be an application on an edge device (such as a smart phone, IoT device, Internet of Vehicles, etc.), which can specifically include but is not limited to smart home systems, medical monitoring equipment, autonomous driving systems, financial risk control systems, etc.

[0062] In implementation, Figure 6 As shown, the server can distribute the distillation model in the server to multiple different edge clients based on the relevant communication protocols of federated learning. After receiving the distillation model, the edge client can deploy it in the target business. When a user executes the target business, the acquired business data can be input into the distillation model for processing to obtain corresponding results. For example, the user's vital signs data can be collected through a variety of different sensors in the medical monitoring equipment, and the vital signs data can be input into the distillation model for analysis to obtain output results of whether to issue an early warning to medical staff, etc. The specific settings can be based on actual conditions, and the embodiments of this specification are not limited to this.

[0063] In practical applications, there may be various specific processing methods for generating the second mask based on the first mask in the above step S104. An optional processing method is provided below, which may specifically include the following: normalizing the first mask to obtain the second mask.

[0064] In implementation, the gradient weighted class activation mapping algorithm can help localize the salient areas in the business data (i.e., the areas where the preset objects contained in the business data are located), and then the localization is further normalized to [0,1] to become a mask of a salient object (i.e., the second mask).

[0065] In practical applications, the specific processing methods for generating adversarial samples of business data based on the target data, the first mask, the second mask and the second noisy data in the above step S106 can be varied. An optional processing method is provided below, which can specifically include the processing of the following steps S1062 to S1066.

[0066] In step S1062, corresponding gradient information is determined based on the target data through a back propagation algorithm.

[0067] In implementation, Figure 7 As shown, the first noise-added data is an image , the target data obtained is image , through the back-propagation algorithm, the corresponding gradient information can be obtained.

[0068] In step S1064, first intermediate data is determined based on the gradient information and the second mask.

[0069] In implementation, Figure 7 As shown, the above gradient information can be multiplied by the second mask, and the obtained result is used as the first intermediate data.

[0070] In step S1066, interpolation processing is performed between the second noisy image and the first intermediate data based on the first mask to generate an adversarial sample of the business data.

[0071] In implementation, Figure 7 As shown, the second noise-added data (i.e., image ) is multiplied by the first mask to obtain the corresponding result (such as Figure 7 Then, the first intermediate data can be added to the above-obtained result, and the obtained result can be used as an adversarial sample of the business data.

[0072] In practical applications, the first diffusion model can be obtained by model training in the following manner, and details can be found in the processing of the following steps A2 to A6.

[0073] In step A2, a sample data sequence consisting of noisy data samples sequentially generated by iteratively adding noise data to historical business data is obtained.

[0074] The specific processing process of the above-mentioned step A2 can refer to the relevant content of the above-mentioned step S102. In addition, the specific processing of the above-mentioned step A2 can also be implemented in the following manner, namely: obtaining historical business data in the target business; inputting the above-mentioned historical business data into the second diffusion model, and iteratively adding noise data to the historical business data through the second diffusion model to obtain a sample data sequence composed of sequentially generated noisy data samples, and the noise data can satisfy the normal distribution. The specific processing process can refer to the above-mentioned relevant content, which will not be repeated here.

[0075] In step A4, for any two adjacent noisy data samples in the sample data sequence, the first noisy data sample generated later than the two noisy data samples is input into the first diffusion model, and the noise data in the first noisy data sample is removed by the first diffusion model to restore the second noisy data sample remaining in the two noisy data samples to obtain the corresponding target data sample; the target data sample and the historical business data are input into the discriminator corresponding to the first diffusion model to obtain the corresponding output result, based on the output result, the corresponding loss information is determined by a preset loss function, and the parameters of the first diffusion model and the discriminator are adjusted based on the loss information.

[0076] In implementation, a generative adversarial network can be used to construct a first diffusion model. Specifically, the first diffusion model can be used as a generator in a generative adversarial network, and a corresponding discriminator can be constructed at the same time. In this way, a generative adversarial network is formed by the first diffusion model and the discriminator. Based on the relevant contents of the above-mentioned steps S1022 and S1024, for any two adjacent noisy data samples in the sample data sequence, the first noisy data sample generated later from the two noisy data samples is input into the first diffusion model, and the noise data in the first noisy data sample is removed by the first diffusion model to restore the second noisy data sample remaining in the two noisy data samples to obtain the corresponding target data sample. The target data sample and the historical business data are input into the discriminator corresponding to the first diffusion model to obtain the corresponding output result. In practical applications, adversarial guidance can be introduced into the first diffusion model, and the first diffusion model can be used to generate natural adversarial samples, which involves iteratively solving the following optimization problem:

[0077] For any two adjacent noised data samples in the sample data sequence, the previously disturbed latent variables Denoising and then introducing a spoof discriminator It starts with an adversarial perturbation of , so it forms a saddle point solution that attempts to minimize the negative log-likelihood log using the first diffusion model , while adding the discriminator The adversarial loss ,in is the predicted label, express and The distance between.

[0078] To optimize , we can use the projected gradient descent attack, by iterating Come find The approximate solution of , the formula is described as follows:

[0079] express Projection onto the 2-norm ball. We further use the normalized softmax intersection loss function as the maximization objective function L instead of the traditional intersection loss function, as it has been shown to be more effective in generating successful attacks than alternative proxy losses. Let Represents the above process, where , , Can be assigned Finally, let ,in The strength of the adversarial guidance is adjusted, which means that the injected adversarial perturbation is always smaller than the noise scale used for the added noisy data, and is reduced wrt the variance schedule to ensure the naturalness of the synthesized samples.

[0080] Through the above method, it is possible to determine the corresponding loss information based on the output result through a preset loss function, and then adjust the parameters of the first diffusion model and the discriminator based on the loss information to obtain the first diffusion model and the discriminator after parameter adjustment. Through the above method, the parameters of the first diffusion model and the discriminator can be iteratively adjusted.

[0081] In step A6, the parameters of the first diffusion model and the discriminator are adjusted by using the noisy data samples in the sample data sequence to jointly train the first diffusion model and the discriminator until the above loss function converges to obtain the trained first diffusion model.

[0082] In practical applications, the first diffusion model is a model built based on the denoising autoencoder DAE (Denoise Autoencoder). DAE can be composed of an encoder and a decoder. The encoder can be used to map the input data to a low-dimensional representation, while the decoder restores the low-dimensional representation to be as close to the original data as possible. The objective function corresponding to the above loss function is that the similarity between the historical business data and the target data sample is greater than the preset similarity threshold.

[0083] The similarity threshold is set according to actual conditions. For example, the similarity threshold may be 90% or 85%.

[0084] In practical applications, the second diffusion model may be a model constructed based on a denoising autoencoder DAE.

[0085] In this embodiment, the target business may be risk prevention and control business (or risk identification business), identity recognition business, biometrics business, image recognition business, etc. in the financial field; it may also be risk prevention and control business (or risk identification business), identity recognition business, biometrics business, data monitoring and alarm business, etc. in the medical monitoring field; it may also be risk prevention and control business (or risk identification business), identity recognition business, biometrics business, data monitoring and alarm business, etc. in the smart home field; and the specific business may be set according to actual conditions. Business data can be determined according to different target businesses. For example, if the target business is a risk prevention and control business (or risk identification business) in the financial field, the corresponding business data may include relevant data generated during the user's transaction process, such as the user's account information, transaction time, transaction location, transaction amount, historical transaction data, etc. For another example, if the target business is a data monitoring and alarm business in the fields of medical monitoring or smart home, the corresponding business data may include relevant data generated during the user's use of a specified device (medical device or smart home device, etc.), such as the user's account information, the time of a specified operation, the timing sequence data of different operations, the currently monitored data, the alarm history record, the historical interaction data, etc. For another example, if the target business is an identity recognition business (or biometric recognition business) in the fields of finance, medical monitoring or smart home, the corresponding business data may include relevant data generated during the user's execution of the specified business, such as the user's account information, identification time, acquired user identity data, historical interaction data, etc., which can be set according to actual conditions, and the embodiments of this specification do not limit this. Business data may include multiple different forms, for example, business data may be text data, images, videos, audios, etc., or a combination of the above multiple different types of data (such as a combination of file data and images, etc.), etc., which may be set according to actual conditions. Noise data may include multiple forms, for example, the noise data may be Gaussian noise data (i.e., data that satisfies Gaussian distribution), data that satisfies normal distribution, data that satisfies uniform distribution or Poisson distribution, etc., which may be set according to actual conditions. The target model may be set according to different businesses, for example, if the target business is a risk identification business in a certain field (such as the financial field, medical monitoring field, smart home field, etc.), the target model may be a risk identification model; if the target business is an identity identification business in a certain field, the target model may be an identity identification model; if the target business is a biometric business in a certain field, the target model may be a biometric model (such as a facial recognition model, etc.); if the target business is an image recognition business in the financial field, the target model may be an image recognition model; if the target business is a data monitoring and alarm business in the medical monitoring field or the smart home field, the target model may be a monitoring and alarm model, etc., which may be set according to actual conditions.

[0086] The embodiment of the present specification provides a data processing method, which obtains a data sequence composed of noisy data sequentially generated by iteratively adding noise data to the business data of the target business, and then determines a first mask corresponding to an area where a preset object contained in the business data is located through a gradient weighted class activation mapping algorithm, and generates a second mask based on the first mask. After that, for any two adjacent noisy data in the data sequence, the first noisy data generated later in the two noisy data is input into a pre-trained first diffusion model, and the noise data in the first noisy data is removed by the first diffusion model to restore the second noisy data remaining in the two noisy data to obtain the corresponding target data. Based on the target data, the first mask, the second mask and the second noisy data, a second mask can be generated. Data, generate adversarial samples of business data, and finally, the target model in the target business can be trained based on multiple adversarial samples generated by the noisy data contained in the data sequence. In this way, since the significant area similarity between the obtained adversarial samples and the original data (ie, business data) is high, and other features with low relevance to data processing are appropriately weakened, the generated multiple adversarial samples can improve the accuracy and robustness of the target model in the target business. Moreover, when facing malicious data manipulation, tracing the source is the most important thing. The generation process of the first diffusion model is a process of gradually reducing noise data. This process of generating adversarial samples is explainable to a certain extent, and it is easy to understand the details of adversarial sample generation at each step.

[0087] The following is a detailed description of a data processing method provided in an embodiment of this specification in combination with a specific application scenario, wherein the target business may be a risk identification business in the financial field, and the business data may include relevant data of user transactions. In this embodiment, image data is taken as an example, and the image data may include screenshots of information interactions between the two parties to the transaction, images of user transaction behaviors, etc. The noise data may be data that satisfies the standard normal distribution.

[0088] like Figure 8As shown, an embodiment of this specification provides a method for processing data, and the execution subject of the method may be a terminal device or a server, etc., wherein the terminal device may be a mobile terminal device such as a mobile phone, a tablet computer, or a computer device such as a laptop or a desktop computer, or an IoT device (specifically such as a smart watch, a vehicle-mounted device, etc.), etc., wherein the server may be an independent server, or a server cluster composed of multiple servers, etc., and the server may be a background server for a financial service or an online shopping service, etc., or a background server for an application, etc. In this embodiment, a detailed description is given by taking the execution subject as a server as an example. For the case where the execution subject is a terminal device, please refer to the following server case processing, which will not be repeated here. The method may specifically include the following steps: In step S802, an image sequence consisting of noisy images sequentially generated by iteratively adding noise data to the image data is obtained.

[0089] In step S804, a first mask corresponding to a region where a preset object is located contained in the image data is determined by a gradient weighted class activation mapping algorithm, and a second mask is generated based on the first mask.

[0090] In implementation, a salient area in the image data (i.e., an area where a preset object contained in the image data is located) can be identified through a gradient weighted class activation mapping algorithm, a first mask can be determined based on the salient area, and then a second mask can be generated based on the first mask. For details, please refer to the relevant content of the above-mentioned step S104, which will not be repeated here.

[0091] In step S806, for any two adjacent noisy images in the image sequence, the first noisy image generated later is input into a pre-trained first diffusion model, and the noise data in the first noisy image is removed by the first diffusion model to restore the remaining second noisy image in the two noisy images to obtain a corresponding target image; based on the target image, the first mask, the second mask and the second noisy image, an adversarial sample of the image data is generated.

[0092] In step S808, a risk identification model in the business corresponding to the image data is trained based on a plurality of adversarial samples generated based on the noisy images included in the image sequence.

[0093] The specific processing process of the above steps S802 to S808 can be performed by referring to the above related content and will not be repeated here.

[0094] The embodiment of the present specification provides a data processing method, which obtains an image sequence consisting of noisy images sequentially generated by iteratively adding noise data to image data, and then determines a first mask corresponding to a region where a preset object contained in the image data is located through a gradient weighted class activation mapping algorithm, and generates a second mask based on the first mask. After that, for any two adjacent noisy images in the image sequence, the first noisy image generated later of the two noisy images is input into a pre-trained first diffusion model, and the noise data in the first noisy image is removed through the first diffusion model to restore the remaining second noisy image in the two noisy images to obtain a corresponding target image. Based on the target image, the first mask, the second mask, and the second noisy image, an image processing method can be generated. Adversarial samples of image data, finally, multiple adversarial samples generated based on the noisy images contained in the image sequence can be used to train the risk identification model in the business corresponding to the image data. In this way, since the significant area similarity between the obtained adversarial samples and the original data (ie, image data) is high, and other features with low relevance to data processing are appropriately weakened, the generated multiple adversarial samples can improve the accuracy and robustness of the risk identification model in the business. Moreover, when facing malicious data manipulation, tracing the source is the most important thing. The generation process of the first diffusion model is a process of gradually reducing noise data. This process of generating adversarial samples is explainable to a certain extent, and the details of the adversarial sample generation at each step can be easily understood.

[0095] In this embodiment, the specific processing method of the above step S802 can be various. An optional processing method is provided below, which can specifically include the processing of the following steps B2 and B4.

[0096] In step B2, image data in the risk identification service is obtained.

[0097] In step B4, the image data is input into a pre-trained second diffusion model, and noise data is iteratively added to the image data through the second diffusion model to obtain an image sequence consisting of sequentially generated noisy images.

[0098] The specific processing procedures of the above steps B2 and B4 can be performed by referring to the above related contents, which will not be described in detail here.

[0099] In this embodiment, the specific processing method of the above step S808 can be various. An optional processing method is provided below, which can specifically include the processing of the following steps C2 to C6.

[0100] In step C2, the risk identification model is trained based on a plurality of adversarial samples generated from the noisy images contained in the image sequence to obtain a trained risk identification model.

[0101] In step C4, knowledge distillation training is performed on the trained risk identification model to obtain a target risk identification model.

[0102] In step C6, the target risk identification model is sent to a plurality of different edge-side clients respectively, so as to perform risk identification processing on the image data of the risk identification service received by the edge-side clients.

[0103] The specific processing process of the above steps C2 to C6 can be performed by referring to the above related content, and will not be repeated here.

[0104] In this embodiment, the specific processing method for generating the second mask based on the first mask in the above step S804 can be various. An optional processing method is provided below, which can specifically include the following: normalizing the first mask to obtain the second mask. The specific processing process can be performed with reference to the above related content, which will not be repeated here.

[0105] In this embodiment, the specific processing method for generating adversarial samples of image data based on the target image, the first mask, the second mask and the second noisy image in the above step S806 can be various. An optional processing method is provided below, which can specifically include the processing of the following steps D2 to D6.

[0106] In step D2, based on the target image, corresponding gradient information is determined by a back propagation algorithm.

[0107] In step D4, first intermediate data is determined based on the above-mentioned gradient information and the second mask.

[0108] In step D6, an interpolation process is performed between the second noisy image and the first intermediate data based on the first mask to generate an adversarial sample of the image data.

[0109] The specific processing process of the above steps D2 to D6 can be performed by referring to the above related content, which will not be repeated here.

[0110] In this embodiment, the first diffusion model can be obtained by model training in the following manner, and details can be found in the processing of the following steps E2 to E6.

[0111] In step E2, a sample image sequence consisting of noisy image samples sequentially generated by iteratively adding noise data to historical image data is obtained.

[0112] In step E4, for any two adjacent noisy image samples in the sample image sequence, the first noisy image sample generated later is input into the first diffusion model, and the noise data in the first noisy image sample is removed by the first diffusion model to restore the remaining second noisy image sample in the two noisy image samples to obtain the corresponding target image sample; the target image sample and the historical image data are input into the discriminator corresponding to the first diffusion model to obtain the corresponding output result, based on the output result, the corresponding loss information is determined by a preset loss function, and the parameters of the first diffusion model and the discriminator are adjusted based on the loss information.

[0113] In step E6, the parameters of the first diffusion model and the discriminator are adjusted by using the noisy image samples in the sample image sequence to jointly train the first diffusion model and the discriminator until the above loss function converges to obtain the trained first diffusion model.

[0114] The specific processing process of the above steps E2 to E6 can be performed by referring to the above related content, which will not be repeated here.

[0115] In this embodiment, the first diffusion model is a model constructed based on the denoising autoencoder DAE, and the objective function corresponding to the above loss function is that the similarity between the historical image data and the target image sample is greater than the preset similarity threshold. The specific processing process can be performed by referring to the above related content, which will not be repeated here. The second diffusion model is a model constructed based on the denoising autoencoder DAE.

[0116] It should be noted that the above is only a case where the target business is a risk identification business in the financial field, and the business data includes relevant data of user transactions. In this embodiment, image data is taken as an example, and the image data may include screenshots of information interaction between the two parties to the transaction, images of user transaction behaviors, etc. The noise data is a specific application scenario of data that meets the standard normal distribution. In actual applications, the specific application scenarios are not limited to the above scenarios, and may also include a variety of different scenarios. For example, as mentioned above, the target business may be a risk prevention and control business, identity recognition business, biometrics business, image recognition business, etc. in the financial field, or a risk prevention and control business (or risk identification) in the field of medical monitoring. business), identity recognition business, biometrics business, data monitoring and alarm business, etc., can also be risk prevention and control business (or risk recognition business), identity recognition business, biometrics business, data monitoring and alarm business, etc. in the smart home field, and the corresponding business data is not only image data, but can also be text data, video, audio, etc., and can also be a combination of the above-mentioned multiple different types of data (such as a combination of file data and images, etc.), etc., and the noise data is not limited to satisfying the standard normal distribution, but can also satisfy Gaussian distribution, normal distribution, uniform distribution, Poisson distribution, etc. The specific processing processes of the above-mentioned various scenarios can be executed by referring to the above-mentioned related content, and will not be repeated here.

[0117] The embodiment of the present specification provides a data processing method, which obtains an image sequence consisting of noisy images sequentially generated by iteratively adding noise data to image data, and then determines a first mask corresponding to a region where a preset object contained in the image data is located through a gradient weighted class activation mapping algorithm, and generates a second mask based on the first mask. After that, for any two adjacent noisy images in the image sequence, the first noisy image generated later of the two noisy images is input into a pre-trained first diffusion model, and the noise data in the first noisy image is removed through the first diffusion model to restore the remaining second noisy image in the two noisy images to obtain a corresponding target image. Based on the target image, the first mask, the second mask, and the second noisy image, an image processing method can be generated. Adversarial samples of image data, finally, multiple adversarial samples generated based on the noisy images contained in the image sequence can be used to train the risk identification model in the business corresponding to the image data. In this way, since the significant area similarity between the obtained adversarial samples and the original data (ie, image data) is high, and other features with low relevance to data processing are appropriately weakened, the generated multiple adversarial samples can improve the accuracy and robustness of the risk identification model in the business. Moreover, when facing malicious data manipulation, tracing the source is the most important thing. The generation process of the first diffusion model is a process of gradually reducing noise data. This process of generating adversarial samples is explainable to a certain extent, and the details of the adversarial sample generation at each step can be easily understood.

[0118] The above is a data processing method provided in the embodiments of this specification. Based on the same idea, the embodiments of this specification also provide a data processing device, such as Fig. 9 shown.

[0119] The data processing device includes: an image sequence acquisition module 901, an image mask determination module 902, an adversarial sample generation module 903 and a model training module 904, wherein: An image sequence acquisition module 901 acquires an image sequence consisting of noisy images sequentially generated by iteratively adding noise data to image data; An image mask determination module 902 determines a first mask corresponding to a region where a preset object contained in the image data is located by using a gradient weighted class activation mapping algorithm, and generates a second mask based on the first mask; The adversarial sample generation module 903 inputs a first noisy image generated later in the two noisy images into a pre-trained first diffusion model for any two adjacent noisy images in the image sequence, removes noise data in the first noisy image by using the first diffusion model to restore the remaining second noisy image in the two noisy images, and obtains a corresponding target image; and generates an adversarial sample of the image data based on the target image, the first mask, the second mask and the second noisy image; The model training module 904 performs model training on a risk identification model in the business corresponding to the image data based on a plurality of adversarial samples generated from the noisy images contained in the image sequence.

[0120] In the embodiment of this specification, the image sequence acquisition module 901 includes: An image acquisition unit, which acquires image data in the service; The image sequence acquisition unit inputs the image data into a pre-trained second diffusion model, iteratively adds noise data to the image data through the second diffusion model, and obtains an image sequence consisting of sequentially generated noisy images, wherein the noise data satisfies a normal distribution.

[0121] In the embodiment of this specification, the second diffusion model has the same model structure as the first diffusion model, but different model parameters, and the noise data satisfies a standard normal distribution.

[0122] In the embodiment of this specification, the model training module 904 includes: A training unit, performing model training on the risk identification model based on a plurality of adversarial samples generated from the noisy images included in the image sequence to obtain a trained risk identification model; A knowledge distillation unit performs knowledge distillation training on the trained risk identification model to obtain a target risk identification model; The model publishing unit sends the target risk identification model to a plurality of different edge-side clients respectively, so as to perform risk identification processing on the image data of the business received by the edge-side clients.

[0123] In the embodiment of this specification, the image mask determination module 902 performs normalization processing on the first mask to obtain a second mask.

[0124] In the embodiment of this specification, the adversarial sample generation module 903 includes: A gradient determination unit, based on the target image, determines corresponding gradient information through a back propagation algorithm; A processing unit, based on the gradient information and the second mask, determines first intermediate data; An adversarial sample generating unit performs interpolation processing between the second noisy image and the first intermediate data based on the first mask to generate an adversarial sample of the image data.

[0125] In the embodiment of this specification, the device further includes: A sample image sequence acquisition module is used to acquire a sample image sequence consisting of noise-added image samples sequentially generated by iteratively adding noise data to historical image data; A data processing module, for any two adjacent noisy image samples in the sample image sequence, inputs a first noisy image sample generated later from the two noisy image samples into the first diffusion model, removes noise data from the first noisy image sample through the first diffusion model to restore the remaining second noisy image sample from the two noisy image samples, and obtains a corresponding target image sample; inputs the target image sample and the historical image data into a discriminator corresponding to the first diffusion model to obtain a corresponding output result, determines corresponding loss information based on the output result through a preset loss function, and adjusts parameters of the first diffusion model and the discriminator based on the loss information; A joint training module adjusts the parameters of the first diffusion model and the discriminator through the noisy image samples in the sample image sequence to jointly train the first diffusion model and the discriminator until the loss function converges to obtain a trained first diffusion model.

[0126] In an embodiment of the present specification, the first diffusion model is a model constructed based on a denoising autoencoder DAE, and the objective function corresponding to the loss function is that the similarity between the historical image data and the target image sample is greater than a preset similarity threshold.

[0127] The embodiment of the present specification provides a data processing device, which obtains an image sequence consisting of noisy images sequentially generated by iteratively adding noise data to image data, and then determines a first mask corresponding to a region where a preset object contained in the image data is located through a gradient weighted class activation mapping algorithm, and generates a second mask based on the first mask. After that, for any two adjacent noisy images in the image sequence, the first noisy image generated later of the two noisy images is input into a pre-trained first diffusion model, and the noise data in the first noisy image is removed through the first diffusion model to restore the remaining second noisy image of the two noisy images to obtain a corresponding target image. Based on the target image, the first mask, the second mask, and the second noisy image, an image processing device can be generated. Adversarial samples of image data, finally, multiple adversarial samples generated based on the noisy images contained in the image sequence can be used to train the risk identification model in the business corresponding to the image data. In this way, since the significant area similarity between the obtained adversarial samples and the original data (ie, image data) is high, and other features with low relevance to data processing are appropriately weakened, the generated multiple adversarial samples can improve the accuracy and robustness of the risk identification model in the business. Moreover, when facing malicious data manipulation, tracing the source is the most important thing. The generation process of the first diffusion model is a process of gradually reducing noise data. This process of generating adversarial samples is explainable to a certain extent, and the details of the adversarial sample generation at each step can be easily understood.

[0128] Based on the same idea, the embodiment of this specification also provides a data processing device, such as Fig.10 shown.

[0129] The data processing device includes: a data sequence acquisition module 1001, a mask determination module 1002, an adversarial sample generation module 1003 and a training module 1004, wherein: A data sequence acquisition module 1001 acquires a data sequence consisting of noise-added data sequentially generated by iteratively adding noise data to the business data of the target business; The mask determination module 1002 determines a first mask corresponding to a region where a preset object contained in the business data is located by using a gradient weighted class activation mapping algorithm, and generates a second mask based on the first mask; The adversarial sample generation module 1003 inputs the first noisy data generated later in the two noisy data into a pre-trained first diffusion model for any two adjacent noisy data in the data sequence, removes the noise data in the first noisy data by using the first diffusion model to restore the remaining second noisy data in the two noisy data, and obtains the corresponding target data; and generates an adversarial sample of the business data based on the target data, the first mask, the second mask and the second noisy data; The training module 1004 performs model training on the target model in the target business based on multiple adversarial samples generated by the noisy data included in the data sequence.

[0130] In the embodiments of this specification, the target business includes risk identification business, identity identification business, biometric identification business and image recognition business in the financial field, as well as data monitoring and alarm business in the medical monitoring field, and data monitoring and alarm business in the smart home field; the business data includes one or more of text data, image data, video data and audio data; the noise data satisfies a preset data distribution, and the data distribution includes one or more of Gaussian distribution, normal distribution, uniform distribution and Poisson distribution.

[0131] In the embodiment of this specification, the data sequence acquisition module 1001 includes: A data acquisition unit, which acquires the business data in the target business; The data sequence acquisition unit inputs the business data into a pre-trained second diffusion model, and iteratively adds noise data to the business data through the second diffusion model to obtain a data sequence consisting of sequentially generated noise-added data, wherein the noise data satisfies a normal distribution.

[0132] In the embodiment of this specification, the second diffusion model has the same model structure as the first diffusion model, but different model parameters, and the noise data satisfies a standard normal distribution.

[0133] In the embodiment of this specification, the training module 1004 includes: A training unit, performing model training on the target model based on a plurality of adversarial samples generated by the noise-added data contained in the data sequence to obtain a trained target model; A distillation unit, performing knowledge distillation training on the trained target model to obtain a distillation model; The model publishing unit sends the distillation model to a plurality of different edge-side clients respectively, so as to process the business data of the target business received by the edge-side clients.

[0134] In the embodiment of this specification, the mask determination module 1002 performs normalization processing on the first mask to obtain a second mask.

[0135] In the embodiment of this specification, the adversarial sample generation module 1003 includes: A gradient determination unit, based on the target data, determines corresponding gradient information through a back propagation algorithm; A processing unit, based on the gradient information and the second mask, determines first intermediate data; An adversarial sample generating unit performs interpolation processing between the second noisy data and the first intermediate data based on the first mask to generate an adversarial sample of the business data.

[0136] In the embodiment of this specification, the device further includes: A sample acquisition module, which acquires a sample data sequence consisting of noise-added data samples sequentially generated by iteratively adding noise data to historical business data; A data processing module, for any two adjacent noisy data samples in the sample data sequence, inputs a first noisy data sample generated later from the two noisy data samples into the first diffusion model, removes noise data from the first noisy data sample through the first diffusion model to restore the second noisy data sample remaining from the two noisy data samples, and obtains a corresponding target data sample; inputs the target data sample and the historical business data into a discriminator corresponding to the first diffusion model to obtain a corresponding output result, determines corresponding loss information based on the output result through a preset loss function, and adjusts parameters of the first diffusion model and the discriminator based on the loss information; A joint training module adjusts the parameters of the first diffusion model and the discriminator through the noisy data samples in the sample data sequence to jointly train the first diffusion model and the discriminator until the loss function converges to obtain a trained first diffusion model.

[0137] In an embodiment of the present specification, the first diffusion model is a model constructed based on a denoising autoencoder DAE, and the objective function corresponding to the loss function is that the similarity between the historical business data and the target data sample is greater than a preset similarity threshold.

[0138] The embodiment of the present specification provides a data processing device, which obtains a data sequence composed of noisy data sequentially generated by iteratively adding noise data to the business data of the target business, and then determines a first mask corresponding to an area where a preset object contained in the business data is located through a gradient weighted class activation mapping algorithm, and generates a second mask based on the first mask. After that, for any two adjacent noisy data in the data sequence, the first noisy data generated later in the two noisy data is input into a pre-trained first diffusion model, and the noise data in the first noisy data is removed by the first diffusion model to restore the second noisy data remaining in the two noisy data to obtain the corresponding target data. Based on the target data, the first mask, the second mask and the second noisy data, a second mask can be generated. Data, generate adversarial samples of business data, and finally, the target model in the target business can be trained based on multiple adversarial samples generated by the noisy data contained in the data sequence. In this way, since the significant area similarity between the obtained adversarial samples and the original data (ie, business data) is high, and other features with low relevance to data processing are appropriately weakened, the generated multiple adversarial samples can improve the accuracy and robustness of the target model in the target business. Moreover, when facing malicious data manipulation, tracing the source is the most important thing. The generation process of the first diffusion model is a process of gradually reducing noise data. This process of generating adversarial samples is explainable to a certain extent, and it is easy to understand the details of adversarial sample generation at each step.

[0139] The above is a data processing device provided in the embodiment of this specification. Based on the same idea, the embodiment of this specification also provides a data processing device, such as Fig.11 shown.

[0140] The data processing device may be a terminal device or a server, etc. provided for the above-mentioned embodiment.

[0141] The data processing device may have relatively large differences due to different configurations or performances, and may include one or more processors 1101 and memory 1102, and the memory 1102 may store one or more storage applications or data. Among them, the memory 1102 may be a short-term storage or a persistent storage. The application stored in the memory 1102 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the data processing device. Furthermore, the processor 1101 may be configured to communicate with the memory 1102, and execute a series of computer executable instructions in the memory 1102 on the data processing device. The data processing device may also include one or more power supplies 1103, one or more wired or wireless network interfaces 1104, one or more input and output interfaces 1105, and one or more keyboards 1106.

[0142] Specifically in this embodiment, the data processing device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions for the data processing device, and the one or more programs are configured to be executed by one or more processors, including computer executable instructions for performing the following: Acquire an image sequence consisting of noisy images sequentially generated by iteratively adding noise data to the image data; Determine a first mask corresponding to a region where a preset object contained in the image data is located by using a gradient weighted class activation mapping algorithm, and generate a second mask based on the first mask; For any two adjacent noisy images in the image sequence, input a first noisy image generated later from the two noisy images into a pre-trained first diffusion model, remove noise data from the first noisy image through the first diffusion model to restore the remaining second noisy image from the two noisy images, and obtain a corresponding target image; based on the target image, the first mask, the second mask and the second noisy image, generate an adversarial sample of the image data; Model training is performed on a risk identification model in the business corresponding to the image data based on multiple adversarial samples generated from the noisy images contained in the image sequence.

[0143] In addition, specifically in this embodiment, the data processing device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions in the data processing device, and the one or more programs are configured to be executed by one or more processors, including computer executable instructions for performing the following: Acquire a data sequence consisting of noise-added data sequentially generated by iteratively adding noise data to the business data of the target business; Determine a first mask corresponding to a region where a preset object contained in the business data is located by using a gradient weighted class activation mapping algorithm, and generate a second mask based on the first mask; For any two adjacent noisy data in the data sequence, input the first noisy data generated later from the two noisy data into a pre-trained first diffusion model, remove the noise data in the first noisy data by the first diffusion model to restore the remaining second noisy data in the two noisy data, and obtain corresponding target data; based on the target data, the first mask, the second mask and the second noisy data, generate an adversarial sample of the business data; Model training is performed on a target model in the target business based on multiple adversarial samples generated from the noisy data contained in the data sequence.

[0144] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the data processing device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0145] The embodiment of the present specification provides a data processing device, which obtains an image sequence consisting of noisy images sequentially generated by iteratively adding noise data to image data, and then determines a first mask corresponding to a region where a preset object contained in the image data is located through a gradient weighted class activation mapping algorithm, and generates a second mask based on the first mask. Thereafter, for any two adjacent noisy images in the image sequence, the first noisy image generated later of the two noisy images is input into a pre-trained first diffusion model, and the noise data in the first noisy image is removed through the first diffusion model to restore the remaining second noisy image of the two noisy images to obtain a corresponding target image. Based on the target image, the first mask, the second mask, and the second noisy image, an image processing device can be generated. Adversarial samples of image data, finally, multiple adversarial samples generated based on the noisy images contained in the image sequence can be used to train the risk identification model in the business corresponding to the image data. In this way, since the significant area similarity between the obtained adversarial samples and the original data (ie, image data) is high, and other features with low relevance to data processing are appropriately weakened, the generated multiple adversarial samples can improve the accuracy and robustness of the risk identification model in the business. Moreover, when facing malicious data manipulation, tracing the source is the most important thing. The generation process of the first diffusion model is a process of gradually reducing noise data. This process of generating adversarial samples is explainable to a certain extent, and the details of the adversarial sample generation at each step can be easily understood.

[0146] Furthermore, based on the above Figures 1 to 8In one embodiment, the present specification further provides a storage medium for storing computer executable instruction information. In a specific embodiment, the storage medium may be a USB flash drive, an optical disk, a hard disk, etc. When the computer executable instruction information stored in the storage medium is executed by the processor, the following process can be implemented: Acquire an image sequence consisting of noisy images sequentially generated by iteratively adding noise data to the image data; Determine a first mask corresponding to a region where a preset object contained in the image data is located by using a gradient weighted class activation mapping algorithm, and generate a second mask based on the first mask; For any two adjacent noisy images in the image sequence, input a first noisy image generated later from the two noisy images into a pre-trained first diffusion model, remove noise data from the first noisy image through the first diffusion model to restore the remaining second noisy image from the two noisy images, and obtain a corresponding target image; based on the target image, the first mask, the second mask and the second noisy image, generate an adversarial sample of the image data; Model training is performed on a risk identification model in the business corresponding to the image data based on multiple adversarial samples generated from the noisy images contained in the image sequence.

[0147] In addition, in another specific embodiment, the storage medium may be a USB flash drive, an optical disk, a hard disk, etc., and the computer executable instruction information stored in the storage medium can implement the following process when executed by the processor: Acquire a data sequence consisting of noise-added data sequentially generated by iteratively adding noise data to the business data of the target business; Determine a first mask corresponding to a region where a preset object contained in the business data is located by using a gradient weighted class activation mapping algorithm, and generate a second mask based on the first mask; For any two adjacent noisy data in the data sequence, input the first noisy data generated later from the two noisy data into a pre-trained first diffusion model, remove the noise data in the first noisy data by the first diffusion model to restore the remaining second noisy data in the two noisy data, and obtain corresponding target data; based on the target data, the first mask, the second mask and the second noisy data, generate an adversarial sample of the business data; Model training is performed on a target model in the target business based on multiple adversarial samples generated from the noisy data contained in the data sequence.

[0148] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the above-mentioned storage medium embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0149] The embodiment of the present specification provides a storage medium, which obtains an image sequence consisting of noisy images sequentially generated by iteratively adding noise data to image data, and then determines a first mask corresponding to a region where a preset object contained in the image data is located through a gradient weighted class activation mapping algorithm, and generates a second mask based on the first mask. After that, for any two adjacent noisy images in the image sequence, the first noisy image generated later in the two noisy images is input into a pre-trained first diffusion model, and the noise data in the first noisy image is removed through the first diffusion model to restore the remaining second noisy image in the two noisy images to obtain a corresponding target image. Image data can be generated based on the target image, the first mask, the second mask, and the second noisy image. According to the adversarial samples, finally, the risk identification model in the business corresponding to the image data can be trained based on multiple adversarial samples generated based on the noisy images contained in the image sequence. In this way, since the significant area similarity between the obtained adversarial samples and the original data (ie, image data) is high, and other features with low relevance to data processing are appropriately weakened, the generated multiple adversarial samples can improve the accuracy and robustness of the risk identification model in the business. Moreover, when facing malicious data manipulation, tracing the source is the most important thing. The generation process of the first diffusion model is a process of gradually reducing noise data. This process of generating adversarial samples is explainable to a certain extent, and it is easy to understand the details of the adversarial sample generation at each step.

[0150] Furthermore, based on the above Figures 1 to 8 In one or more embodiments of the present specification, a computer program product is provided, including a computer program. When the computer program in the computer program product is executed by a processor, the following process can be implemented: Acquire an image sequence consisting of noisy images sequentially generated by iteratively adding noise data to the image data; Determine a first mask corresponding to a region where a preset object contained in the image data is located by using a gradient weighted class activation mapping algorithm, and generate a second mask based on the first mask; For any two adjacent noisy images in the image sequence, input a first noisy image generated later from the two noisy images into a pre-trained first diffusion model, remove noise data from the first noisy image through the first diffusion model to restore the remaining second noisy image from the two noisy images, and obtain a corresponding target image; based on the target image, the first mask, the second mask and the second noisy image, generate an adversarial sample of the image data; Model training is performed on a risk identification model in the business corresponding to the image data based on multiple adversarial samples generated from the noisy images contained in the image sequence.

[0151] In addition, in another specific embodiment, the computer program product includes a computer program, and when the computer program in the computer program product is executed by a processor, it can implement the following process: Acquire a data sequence consisting of noise-added data sequentially generated by iteratively adding noise data to the business data of the target business; Determine a first mask corresponding to a region where a preset object contained in the business data is located by using a gradient weighted class activation mapping algorithm, and generate a second mask based on the first mask; For any two adjacent noisy data in the data sequence, input the first noisy data generated later from the two noisy data into a pre-trained first diffusion model, remove the noise data in the first noisy data by the first diffusion model to restore the remaining second noisy data in the two noisy data, and obtain corresponding target data; based on the target data, the first mask, the second mask and the second noisy data, generate an adversarial sample of the business data; Model training is performed on a target model in the target business based on multiple adversarial samples generated from the noisy data contained in the data sequence.

[0152] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the above-mentioned computer program product embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0153] The embodiment of the present specification provides a computer program product, which obtains an image sequence consisting of noisy images sequentially generated by iteratively adding noise data to image data, and then determines a first mask corresponding to a region where a preset object contained in the image data is located through a gradient weighted class activation mapping algorithm, and generates a second mask based on the first mask. Thereafter, for any two adjacent noisy images in the image sequence, the later generated first noisy image of the two noisy images is input into a pre-trained first diffusion model, and the noise data in the first noisy image is removed through the first diffusion model to restore the remaining second noisy image of the two noisy images to obtain a corresponding target image. Based on the target image, the first mask, the second mask, and the second noisy image, an image sequence can be generated. Adversarial samples of image data, finally, multiple adversarial samples generated based on the noisy images contained in the image sequence can be used to train the risk identification model in the business corresponding to the image data. In this way, since the significant area similarity between the obtained adversarial samples and the original data (ie, image data) is high, and other features with low relevance to data processing are appropriately weakened, the generated multiple adversarial samples can improve the accuracy and robustness of the risk identification model in the business. Moreover, when facing malicious data manipulation, tracing the source is the most important thing. The generation process of the first diffusion model is a process of gradually reducing noise data. This process of generating adversarial samples is explainable to a certain extent, and the details of the adversarial sample generation at each step can be easily understood.

[0154] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0155] In the 1990s, it was very clear whether the improvement of a technology was hardware improvement (for example, improvement of the circuit structure of diodes, transistors, switches, etc.) or software improvement (improvement of the method flow). However, with the development of technology, many improvements of the method flow today can be regarded as direct improvements of the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be implemented with a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming themselves, without having to ask chip manufacturers to design and make dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0156] The controller may be implemented in any suitable manner, for example, the controller may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (e.g., software or firmware) executable by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, and the memory controller may also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that, in addition to implementing the controller in a purely computer-readable program code manner, the controller may be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller may be considered as a hardware component, and the devices for implementing various functions included therein may also be considered as structures within the hardware component. Or even, the devices for implementing various functions may be considered as both software modules for implementing the method and structures within the hardware component.

[0157] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0158] For the convenience of description, the above devices are described in terms of functions and are divided into various units. Of course, when implementing one or more embodiments of this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0159] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, one or more embodiments of this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

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

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

[0162] These computer program instructions may also be loaded onto a computer or other programmable device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0163] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0164] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0165] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined in this article, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0166] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0167] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, one or more embodiments of this specification may be in the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Furthermore, one or more embodiments of this specification may be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0168] One or more embodiments of the present specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0169] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0170] The above description is only an embodiment of this specification and is not intended to limit this document. For those skilled in the art, this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification should be included in the scope of the claims of this specification.

Claims

1. A method for processing data, the method comprising: Acquire an image sequence consisting of noisy images sequentially generated by iteratively adding noise data to the image data; Determine a first mask corresponding to a region where a preset object contained in the image data is located by using a gradient weighted class activation mapping algorithm, and generate a second mask based on the first mask; For any two adjacent noisy images in the image sequence, a first noisy image generated later in the two noisy images is input into a pre-trained first diffusion model, and the noise data in the first noisy image is removed by the first diffusion model to restore the remaining second noisy image in the two noisy images to obtain a corresponding target image; generating an adversarial sample of the image data based on the target image, the first mask, the second mask, and the second noisy image; Model training is performed on a risk identification model in the business corresponding to the image data based on multiple adversarial samples generated from the noisy images contained in the image sequence.

2. The method according to claim 1, wherein the step of acquiring an image sequence consisting of noisy images sequentially generated by iteratively adding noise data to the image data comprises: Acquiring image data in the business; The image data is input into a pre-trained second diffusion model, and noise data is iteratively added to the image data through the second diffusion model to obtain an image sequence consisting of sequentially generated noisy images, wherein the noise data satisfies a normal distribution. 3 . The method according to claim 2 , wherein the second diffusion model has the same model structure as the first diffusion model but different model parameters, and the noise data satisfies a standard normal distribution.

4. According to the method of claim 1, the step of training a risk identification model in a business corresponding to the image data based on a plurality of adversarial samples generated based on the noisy images contained in the image sequence comprises: Performing model training on the risk identification model based on a plurality of adversarial samples generated from the noisy images contained in the image sequence to obtain a trained risk identification model; Performing knowledge distillation training on the trained risk identification model to obtain a target risk identification model; The target risk identification model is sent to a plurality of different edge-side clients respectively, so as to perform risk identification processing on the image data of the business received by the edge-side clients.

5. The method according to claim 1, wherein generating a second mask based on the first mask comprises: The first mask is normalized to obtain a second mask.

6. The method according to claim 1 or 5, wherein generating an adversarial sample of the image data based on the target image, the first mask, the second mask and the second noisy image comprises: Based on the target image, determining corresponding gradient information through a back propagation algorithm; Determining first intermediate data based on the gradient information and the second mask; An interpolation process is performed between the second noisy image and the first intermediate data based on the first mask to generate an adversarial sample of the image data.

7. The method according to claim 1, further comprising: Acquire a sample image sequence consisting of noisy image samples sequentially generated by iteratively adding noise data to historical image data; For any two adjacent noisy image samples in the sample image sequence, a first noisy image sample generated later from the two noisy image samples is input into the first diffusion model, and noise data in the first noisy image sample is removed by the first diffusion model to restore the remaining second noisy image sample from the two noisy image samples to obtain a corresponding target image sample; the target image sample and the historical image data are input into a discriminator corresponding to the first diffusion model to obtain a corresponding output result, corresponding loss information is determined based on the output result by a preset loss function, and parameters of the first diffusion model and the discriminator are adjusted based on the loss information; The parameters of the first diffusion model and the discriminator are adjusted by using the noisy image samples in the sample image sequence to jointly train the first diffusion model and the discriminator until the loss function converges to obtain a trained first diffusion model.

8. According to the method of claim 7, the first diffusion model is a model constructed based on a denoising autoencoder DAE, and the objective function corresponding to the loss function is that the similarity between the historical image data and the target image sample is greater than a preset similarity threshold.

9. A method for processing data, the method comprising: Acquire a data sequence consisting of noise-added data sequentially generated by iteratively adding noise data to the business data of the target business; Determine a first mask corresponding to a region where a preset object contained in the business data is located by using a gradient weighted class activation mapping algorithm, and generate a second mask based on the first mask; For any two adjacent noisy data in the data sequence, inputting the first noisy data generated later from the two noisy data into a pre-trained first diffusion model, removing the noise data in the first noisy data by using the first diffusion model to restore the remaining second noisy data in the two noisy data, and obtaining corresponding target data; Generate an adversarial sample of the business data based on the target data, the first mask, the second mask, and the second noisy data; Model training is performed on a target model in the target business based on multiple adversarial samples generated from the noisy data contained in the data sequence.

10. According to the method of claim 9, the target business includes risk identification business, identity identification business, biometric identification business and image recognition business in the financial field, as well as data monitoring and alarm business in the medical monitoring field, and data monitoring and alarm business in the smart home field; the business data includes one or more of text data, image data, video data and audio data; the noise data satisfies a preset data distribution, and the data distribution includes one or more of Gaussian distribution, normal distribution, uniform distribution and Poisson distribution.

11. A data processing device, the device comprising: An image sequence acquisition module, which acquires an image sequence consisting of noisy images sequentially generated by iteratively adding noise data to the image data; An image mask determination module determines a first mask corresponding to a region where a preset object contained in the image data is located by using a gradient weighted class activation mapping algorithm, and generates a second mask based on the first mask; an adversarial sample generation module, for any two adjacent noisy images in the image sequence, inputting a first noisy image generated later from the two noisy images into a pre-trained first diffusion model, removing noise data from the first noisy image through the first diffusion model to restore a second noisy image remaining from the two noisy images, and obtaining a corresponding target image; generating an adversarial sample of the image data based on the target image, the first mask, the second mask, and the second noisy image; A model training module performs model training on a risk identification model in the business corresponding to the image data based on multiple adversarial samples generated from the noisy images contained in the image sequence.

12. A data processing device, the device comprising: A data sequence acquisition module, which acquires a data sequence consisting of noise-added data sequentially generated by iteratively adding noise data to the business data of the target business; A mask determination module, which determines a first mask corresponding to a region where a preset object contained in the business data is located by using a gradient weighted class activation mapping algorithm, and generates a second mask based on the first mask; an adversarial sample generation module, for any two adjacent noisy data in the data sequence, inputting a first noisy data generated later from the two noisy data into a pre-trained first diffusion model, removing the noise data from the first noisy data by using the first diffusion model to restore the remaining second noisy data from the two noisy data, and obtaining corresponding target data; Generate an adversarial sample of the business data based on the target data, the first mask, the second mask, and the second noisy data; A training module performs model training on a target model in the target business based on multiple adversarial samples generated by the noise-added data contained in the data sequence.

13. A data processing device, the data processing device comprising: processor; as well as a memory arranged to store computer executable instructions which, when executed, cause the processor to: Acquire an image sequence consisting of noisy images sequentially generated by iteratively adding noise data to the image data; Determine a first mask corresponding to a region where a preset object contained in the image data is located by using a gradient weighted class activation mapping algorithm, and generate a second mask based on the first mask; For any two adjacent noisy images in the image sequence, a first noisy image generated later in the two noisy images is input into a pre-trained first diffusion model, and the noise data in the first noisy image is removed by the first diffusion model to restore the remaining second noisy image in the two noisy images to obtain a corresponding target image; generating an adversarial sample of the image data based on the target image, the first mask, the second mask, and the second noisy image; Model training is performed on a risk identification model in the business corresponding to the image data based on multiple adversarial samples generated from the noisy images contained in the image sequence.

14. A data processing device, the data processing device comprising: processor; as well as a memory arranged to store computer executable instructions which, when executed, cause the processor to: Acquire a data sequence consisting of noise-added data sequentially generated by iteratively adding noise data to the business data of the target business; Determine a first mask corresponding to a region where a preset object contained in the business data is located by using a gradient weighted class activation mapping algorithm, and generate a second mask based on the first mask; For any two adjacent noisy data in the data sequence, inputting the first noisy data generated later from the two noisy data into a pre-trained first diffusion model, removing the noise data in the first noisy data by using the first diffusion model to restore the remaining second noisy data in the two noisy data, and obtaining corresponding target data; Generate an adversarial sample of the business data based on the target data, the first mask, the second mask, and the second noisy data; Model training is performed on a target model in the target business based on multiple adversarial samples generated from the noisy data contained in the data sequence.

Citation Information

Patent Citations

  • Method for annotating disease onset area by using semi-supervised learning and diagnostic system for executing same

    CN116134535A

  • Unrestricted adversarial sample generation method and device, electronic equipment and storage medium

    CN116152087A

  • Robust adversarial noise elimination method based on complementary mask

    CN116739915A

  • Retina detachment area positioning method and system based on weak supervised learning

    CN118037650A

  • Crop remote sensing image segmentation method based on patch level classification label

    CN118314352A

Cited By

  • Automatic driving scene risk assessment method fusing diffusion model and random forest

    CN121233964A

  • An autonomous driving scene risk assessment method fusing diffusion model and random forest

    CN121233964B