Classifications of welding defects are a multi-classification problem of unbalanced samples and the feature distribution of unbalanced samples also vary. Feature selection is needed to acquire more discriminating features and improve the recognition rate of rare samples. In order to complete the parameter optimization and selection of feature subset at the same time, the support vector machine was selected as the classifier to evaluate feature subset, and the artificial immune system algorithm was used to search reliable features and optimize the parameters of support vector machine. This algorithm was applied to classify and identify common welding defects such as pore, slag inclusion, crack, incomplete fusion, the lack of penetration and pseudo-defect on eight types of weld defect dataset, including mild steel butt welding, mild steel fillet welding, mild steel T-shape welding, mild steel lap welding, stainless steel butt welding, stainless steel fillet welding, stainless steel T-shape welding, and stainless steel lap welding, and was compared with direct classification result with no feature selection and under different feature selections and classification algorithms. Results indicated that the average classification accuracy rate of welding defects of pore, slag inclusion, crack, incomplete fusion, lack of penetration and pseudo-defect was (96.21±0.67) %, average sensitive value was (85.43±1.65) %, and had an obvious increase compared with traditional algorithms of correlation-based feature selection algorithm (CFS), minimum redundancy maximum relevance algorithm (mRMR), rough condition mutual information algorithm (RCMI), and the combination of Bayes and classification and regression tree (CART) on the basis of pertinence. Therefore, the proposed algorithm is superior to traditional classification methods.