This article aims to improve the deep-learning-based surface defect recognition. In actual manufacturing processes, there are issues such as data imbalance, insufficient diversity, and poor quality of augmented data in the collected image data for product defect recognition. A novel defect generation method with multiple loss functions, DG2GAN is presented in this paper. This method employs cycle consistency loss to generate defect images from a large number of defect-free images, overcoming the issue of imbalanced original training data. DJS optimized discriminator loss is introduced in the added discriminator to encourage the generation of diverse defect images. Furthermore, to maintain diversity in generated images while improving image quality, a new DG2 adversarial loss is proposed with the aim of generating high-quality and diverse images. The experiments demonstrated that DG2GAN produces defect images of higher quality and greater diversity compared with other advanced generation methods. Using the DG2GAN method to augment defect data in the CrackForest and MVTec datasets, the defect recognition accuracy increased from 86.9 to 94.6%, and the precision improved from 59.8 to 80.2%. The experimental results show that using the proposed defect generation method can obtain sample images with high quality and diversity and employ this method for data augmentation significantly enhances surface defect recognition technology.