The application discloses a steel surface defect
image generation algorithm based on coordinate attention and multi-scale texture edge guidance, which comprises the following steps: S1, obtaining a steel surface defect image dataset, and performing a pretreatment operation on image data in the dataset; S2, based on the steel surface defect image dataset pretreated in step S1, preparing a
diffusion model training dataset; S3, constructing a
diffusion image enhancement model based on multi-scale texture-edge guidance, wherein the
diffusion image enhancement model comprises a forward diffusion process, a
noise prediction network and a reverse denoising
generation process, and a multi-scale texture-
edge structure enhancement module and a coordinate attention module are introduced into the
noise prediction network; S4, based on the training dataset obtained in step S2, training the diffusion
image enhancement model to obtain a
noise prediction network for reverse denoising; S5, based on the trained noise prediction network, obtaining an enhanced steel surface defect image by using a structure-guided
img2
img defect generation mode; and S6, merging the enhanced steel surface defect image with the original steel surface defect image, constructing an expanded steel surface defect detection dataset, and performing experiments and evaluation on the enhancement effect. The application can enhance the defect
edge structure expression while maintaining the continuity of the steel surface background texture, generate steel surface defect images with clear texture, reasonable structure and diversity, thereby effectively expanding the existing steel surface defect detection dataset and improving the
training effect of the subsequent defect detection model.