Few-Shot Metal Surface Defect Classification Based on Contrastive Learning
The existing few-shot classification methods are limited to inducing intra class commonalities from each round of support information,ignoring inter class correlations and category information carried by the samples themselves during the iteration process.Due to the fine and varied texture of metal damage,the resulting feature distribution has small inter class distance and large intra class distance.A few-shot metal surface damage classification method based on an inner and outer two-layer training model architecture is proposed,as the poor aggregation of feature distribution leads to a decrease in the performance of few-shot classification and a decrease in the generalization of new classes.The inner model uses metric methods to complete the metal classification task,while the outer model incorporates bimodal features as signals in the feature space.In the new mapping space,category label information is used to supervise the comparison of image features from different categories and optimize the feature distribution,resulting in improved inter-class discrimination and intra-class aggregation.During the training phase,the external model enhances the representation ability of the original space through backpropagation contrastive loss,thereby enhancing the measurement level of the internal model and improving classification accuracy.Additionally,the use of category embedding as a dynamic category center effectively reduces noise interference in small sample problems and enhances model generalization performance.Experimental results on three commonly used metal damage datasets,GC10,NEU,and APSD,demonstrate that the proposed method achieves superior classification accuracy compared to mainstream methods such as ProtoNet,MatchingNet,and RelationNet.In particular,the generalization ability of new categories is significantly improved.Under the 5-way 5-shot setting,the classification accuracy is by at least 5.24,1.39,and 6.37 percentage points,with classification error reduction rates of 36.00%,17.94%,and 66.15%,respectively.Specifically,the accuracy of new class classification increases from 36.53%,82.43%,and 31.89%to 69.12%,91.57%,and 48.23%,respectively.Under the 5-way 1-shot setting,the classification accuracy is improved by at least 8.34,3.01,and 4.61 percentage points,with classification error reduction rates of 28.32%,23.37%,and 46.57%,respectively.
metal surface defectcontrastive learningmetric learningmeta-learningfew-shot classification