The invention discloses an adversarial sample generation method and an evaluation method for robustness evaluation of an AIGI
detector, and relates to the technical field of robustness evaluation. A pre-trained substitution model is selected and comprises a feature extractor and a classifier, K additional models are added behind the feature extractor in parallel, and a Bayesian model is constructed and used for simulating an attacked model; performing
frequency domain attack on the Bayesian model by using the adversarial sample, during each
attack, adding disturbance to the
spatial domain of the original adversarial sample, converting the original adversarial sample from the
spatial domain to the
frequency domain, performing random spectrum transformation, and according to an
attack optimization target, calculating a
frequency domain gradient for updating the adversarial sample; furthermore, the frequency domain attack and the space domain attack are mixed, the space domain gradient is calculated during each attack, the frequency domain gradient and the space domain gradient are added and averaged to obtain a uniform
gradient direction, the
gradient direction is used to update the adversarial sample, and the final adversarial sample is obtained after the set iteration attack times. According to the method, an adversarial sample is generated by using a frequency-based post-training Bayesian attack (FPBA), so that high-quality attacks with certain generalization ability are performed on the AIGI
detector, and the robustness of the AIGI
detector is evaluated under white-box attacks and black-box attacks.