The number of magnetic tiles with surface defects is limited,and abnormal visual features are diversely distributed.The existing supervised detection methods that rely on target features cannot effectively detect undefined defects.The non-uniform and non-periodic distribution of normal texture on the surface of magnetic tiles makes it difficult for classical reconstruction networks to accurately reconstruct the normal features,resulting in poor performance of related unsupervised detection methods.The multi-head attention-based masked image inpaint network(MIINet)was utilized to extract image features over long distances,capture global information and enhance the repair capability of images.The vision saliency algorithm was used to suppress the texture information of the magnetic tile surface and emphasize the defect area,enabling the binary value algorithm to accurately segment the suspected defect region.MIINet was utilized to repair the suspected defect region in the image.The residual image and structural similarity of the before and after repair images were selected to achieve defect detection and defect judgment.Compared with the classical unsupervised method,the accuracy of the proposed surface defect detection method for repairing the suspected defect area was increased by 2.36%,and the F1 value was increased by 1.62%.