Diamond particle clarity detection method based on CBAM-ResNet50 - Wenqian FEI; Fengxia ZHAO; Quanbin DU; Qinghai WANG (Jin'gangshi yu moliao moju gongcheng)
Objectives: With the improvement of production technology, the traditional diamond particle cleanliness detection method can no longer meet the requirements of high precision, high quality and high automation in the diamond industry due to its low efficiency and poor accuracy. The rapid development of computer technology, optical, and electronic technologies has led to the widespread application of visual inspection and deep learning in image classification and detection, providing new methods for diamond clarity detection. Therefore, based on transfer learning and combined with the convolutional block attention module (CBAM) attention mechanism and the feature pyramid network (FPN) structure, an improved ResNet50 diamond particle clarity detection algorithm, CBAM-ResNet50, is proposed. Methods: The CBAM-RESnet50 clarity detection algorithm uses ResNet50 as the backbone network and adds CBAM to each layer of the backbone network to improve the feature extraction ability of the model. In addition, the FPN structure is integrated into Layer 3 and Layer 4 of the backbone network, where part of the extracted features are aggregated to address the issues of losing features of small and medium-sized targets during the sampling process. At the same time, the transfer learning method is introduced to optimize the model's initial parameters with a cross-entropy loss function, thereby improving the generalization ability and robustness of the model. Moreover, multi-angle diamond images are collected on a diamond clarity detection device, a diamond particle clarity dataset is established, and the improved CBAM-ResNet50 network model is experimentally compared and verified using the data set. Results: Firstly, when compared with other classic mainstream network models, the accuracy of the CBAM-ResNet50 model during training is 99.2%, and the precision is 99.7%, ourperforming the classification results of other network models and significantly improving the identification ability for diamond particle clarity detection. The average detection time of the CBAM-ResNet50 model is 0.01629s, which meets the real-time requirements for industrial detection. Secondly, the CBAM-ResNet50 model is evaluated and ablated on diamond particles of various grades. The results show that the CBAM-ResNet50 model achieves an accuracy of over 99.2%, a classification recall rate of over 98.7%, specificity of over 99.7%, and an F1 score of over 99.2% for classifying diamonds of different grades. The ablation experiment results show that adding the CBAM attention mechanism and FPN feature fusion module significantly improves the classification performance of different grades of diamond particles. The ResNet50+CBAM model achieves a classification accuracy and recall rate of 100.0% for A and E grade diamonds, indicating that the CBAM module helps focus the network's attention on the black impurity features inside the diamond particles, reduces attention to irrelevant information, and improves classification accuracy. The CBAM-ResNet50, with the addition of the FPN feature fusion module, further enhances the classification accuracy and recall rate for B, C, and D grade diamonds. This improvement suggests that the FPN fuses both high-level and low-level feature information, enriching the small target features in the feature map, and enhances classification performance for B, C, and D grade diamonds with similar characteristics. Conclusions: Deep learning technology has been applied to the cleanliness detection of diamond particles, with the ResNet50 network, known for its strong feature extraction ability, serving as the backbone model. Based on the cleanliness features in diamond particle images, the CBAM attention mechanism, the FPN feature fusion module, transfer learning, and the entropy loss function are respectively integrated to address the challenges of insufficient feature extraction, the loss of small target features, and limited generalization in network models. By comparing experiments with other mainstream networks and conducting network ablation experiments, the impact of various improvements on the performance of the diamond particle cleanliness classification network is studied, confirming the effectiveness of the improved network model.