The invention relates to the technical field of
computer vision and
anomaly detection, and particularly provides a cable surface
anomaly detection method and device based on an
unsupervised algorithm, and the method comprises the following steps: S1, collecting a cable image, and carrying out
Gaussian filtering denoising, CLAHE
algorithm brightness normalization, Sobel
edge extraction and Otsu segmentation preprocessing; s2, improving ResNet50, and performing model pre-training through a contrast learning framework; s3, non-defect cable features are extracted based on the pre-training model, and after abnormal patch filtering and greedy
core set compression, a feature
library is constructed by using FAISS; s4, preprocessing a to-be-detected image, extracting features, and calculating a
cosine similarity with the feature
library to obtain a patch-level abnormal
score; s5, dynamically adjusting a threshold value based on the similarity of the
core set, and realizing abnormal segmentation in combination with expansion
corrosion; and S6, outputting a result according to the abnormal patch proportion. Compared with the prior art, the cable fine defect identification capability and detection robustness can be improved, the marking cost is reduced, and the method is suitable for industrial cable quality detection.