With the wide application of deep learning, the security classification models are increasingly challenged. A defense method based on an additional generative adversarial network is proposed for the security of deep learning applications in the field of the image class. In this paper, a new generative adversarial network model is designed as an additional layer, and a divine frequent differential equation network is used as a classification model, and the input samples are reconstructed using the additional generative adversarial network to remove adversarial perturbations before inputting them to the classification network, to achieve the defense function. It is experimentally demonstrated that the additional layer can reconstruct the input samples in a timely and efficient manner, and the reconstructed new samples have both the correct class probability distribution and remain highly similar to the input images. Feeding it into the classification model will give correct classification results. This defense method has good generality and generalization, and can protect against different attack techniques in a short time.