This invention provides a method, apparatus, device, and medium for pattern defect detection and repair. The method includes: preprocessing an input image to obtain a preprocessed image; extracting pattern units from the preprocessed image and calculating parameters for characterizing the
pattern space and feature patterns; detecting and locating defects based on the
feature vector of the standard unit and the average adjacent spacing; generating a repaired image block; and fusing the repaired image block with the original image. The aim is to completely solve the core pain points of traditional methods, such as strong reliance on manual intervention, high defect
miss rate, poor repair effect, and weak scene adaptability.