| Defect detection is an important part of the manufacturing in the industrial field.However,traditional manual-based defect detection methods are plagued with low efficiency,high cost and poor stability.Computer vision-based defect detection methods can effectively solve the above problems.Deep learning-based defect detection methods,in particular.have superior performance in complex scenes with various irregular defects and therefore play a crucial role in the field of defect detection in industry,making research on the application of deep learning in industrial defect detection of great practical significance.In this paper,we focused on the surface defect problem of mobile phone back covers in the industrial production process,and conducted corresponding research from the perspectives of object detection and instance segmentation,We proposed corresponding improved algorithms based on the original model.Specifically,we use Mask RCNN model to complete the instance segmentation of mobile phone back cover defects.For the characteristics that Mask RCNN model detects before segments,the detection stage is based on the anchor,and the problem of inaccurate prior information of the default anchor of the model,we used K-means algorithm to generate the anchor that is more adapted to the dataset of this paper.For the reasons of K-means algorithm generated anchor does not consider the matching level with the feature map to be assigned,the classification K-means algorithm is proposed to generate the anchor of the defect size according to the way of classify first and then clustering.The experimental results showed a significant improvement in the detection of small defects with the clustering algorithm,and the classification K-means algorithm achieved the best network detection performance.Additionally,we compare the improved Mask RCNN model with the Solov2 model,and the results show that our improved model achieves higher detection accuracy.Furthermore,we used the Yolov5 model to complete the object detection of mobile phone back cover defects,and enhance its feature extraction capability by incorporating attention mechanisms,including SE,CA,and CBAM,into its Backbone and Neck networks.The results showed that adding the attention mechanism can improve the detection accuracy of the model,and the model performs best when adding the CA attention mechanism to the Neck.We also compare improved Yolov5 model with the Yolox model and find that they have similar inference speeds,but improved Yolov5 model achieves higher detection accuracy. |