Due to the defects of raw materials,instability of machinery and equipment,insufficient operation level of workers and other reasons,quality defects inevitably occur in the manufacturing process of cosmetic cotton.Enterprises pay more and more attention to the quality detection of cosmetic cotton.At present,most enterprises still use manual inspection to detect the defects of cosmetic cotton,which has the problem of low detection efficiency and accuracy.Machine vision technology can solve the problem of manual detection well,so it is particularly urgent to carry out defect detection of cosmetic cotton pieces with machine vision.This paper takes the white square cosmetic cotton pad as the research object,focuses on the defect detection algorithm of cosmetic cotton pads based on machine vision,and realizes the defect detection of common cosmetic cotton pads.The specific research is as follows:(1)The overall design of defect detection system for cosmetic cotton pieceCombined with the actual demand of cosmetic cotton piece defect detection,a cosmetic cotton flake defect detection scheme of based on machine vision is devised,and the composition of the detection system is analyzed,and the various components of the detection system are introduced.(2)Design of image enhancement and segmentation algorithm for cosmetic cotton piecesBased on the analysis of overall situation of the image of the cosmetic cotton piece,an image enhancement algorithm is designed for the defect characteristics of the cosmetic cotton piece.In order to prevent the influence of the background on the defect detection of the whole group of cosmetic cotton pieces,an improved Bi SENet image segmentation algorithm of the whole group of cosmetic cotton pieces is proposed.In the image enhancement algorithm,radial brightening,MSRCR and CLAHE algorithms are used to enhance the image of cosmetic cotton pads.The results show that the color and texture features of the enhanced image are more obvious.In the image segmentation algorithm,on the basis of Bi SENet,Mobile Net v2 network is used as the basic network,and the attention mechanism is embedded to improve the feature extraction ability of the defect features of cosmetic cotton pads.The pyramid pooling module is introduced to obtain more dimensional information of the cotton chip image,which can solve the problem of poor edge segmentation.The weighted loss function is used to optimize the original loss function to improve the segmentation accuracy.The experimental results show that the average intersection and merge ratio of the algorithm can reach 99.1%,and the detection frame rate can reach 54.3fps.The overall performance of the algorithm is significantly better than the original Bi SENet algorithm,which has better effect on image edge segmentation and can better achieve the segmentation and extraction of the whole group of cosmetic cotton image.(3)Design of defect detection algorithm for whole group cosmetic cotton piecesAccording to the defect characteristics and detection scenarios of the whole group of cosmetic cotton pads,an improved YOLOX defect detection algorithm for the whole group of cosmetic cotton pads is proposed.In the improved YOLOX algorithm,SA-Res2 Block residual module embedded with self attention mechanism is used to improve the ability to extract small target defect features.An improved parallel convolution module is introduced to improve the reasoning speed of the model.A loss function is constructed to reduce the impact of sample imbalance and improve the accuracy of box regression.The experimental results indicate that the mean detection rate of the algorithm in this paper can achieve 91.3%,the recall rate can achieve 85.6%,and the detection frame rate can achieve 75.8 fps.The overall performance is significantly better than the original YOLOX algorithm,and the defects of the whole group of cosmetic cotton flakes can be accurately detected.(4)Design of defect detection algorithm for single cosmetic cotton piecesAiming at the defect characteristics of single cosmetic cotton piece,a defect detection algorithm of single cosmetic cotton piece improved Mask R-CNN(mask region evolutionary network)is proposed.Res Net50 is used as feature extraction network,and depth convolution is introduced to improve the learning ability of defect features.The multi information fusion feature pyramid network is designed to improve the detection of small defects,the attention mechanism module is introduced to reduce the phenomenon of missing and false detection,and the improved loss function is constructed to reduce the impact of sample imbalance.The experimental results prove that the average detection rate of the improved Mask R-CNN model attained 95.7%,and the recall rate attained 88.1%.The overall performance is significantly better than the original Mask R-CNN,Faster R-CNN,SSD and YOLOv5 algorithm models,which can accurately detect common single cotton sheet defects,and have a good effect on single cosmetic cotton sheet defect detection. |