A
small sample industrial
product defect classification method based on two-stage transfer learning comprises the following steps: S1, collecting positive and negative samples to form a
data set; S21,expanding the number of the negative samples in the
data set by 2-3 times by using an image data enhancement means, randomly selecting positive samples of which the number is equivalent to the numberof the expanded negative samples, and forming a data subset of which the number is balanced; S22, forming another
data set subset by using the remaining positive samples; S31, selecting a CNN detection model, and carrying out first-stage training; S32, carrying out training in the second stage on the data set subset containing the remaining positive samples and the expanded negative samples; andS4, after the model training in the step S32 is converged, testing the classification performance of the model on the
test set, if the requirements are met, performing
online test, otherwise, repeatedly dividing the data subsets and the model training process, and repeating the steps S21 to S32 until the requirements are met. The method has the following beneficial effects: 1, the method has defect image high-dimensional features with better performance; 2, the representation capability of the model on an industrial
product image is improved; and 3, the model training strategy has good universality.