| With the continuous development of machine vision,machine vision is gradually applied to various fields.Machine vision can greatly improve production efficiency and product quality,reduce time and labor costs,while reducing the impact of artificially generated uncertainties on the quality control effect.Surface defect detection is in the application of machine vision on the most used a function,can be online detection of the product surface information,whether the surface has scratches,damage,oil and dust,injection molding parts have no c orner dissatisfaction,etc.,so that in the production process on the inferior products out,to ensure the stability of product quality.Combustible gas detector plays an important role in daily production life,is an industrial gas leak detection alarm device in the industrial combustible gas and toxic gas safety detection instruments.It can be fixedly installed indoors and in dangerous places with measured gas leaks to play the role of on-site monitoring.In this paper,machine vision technology is applied to establish a new machine vision detection system for the appearance defects of combustible gas detectors,while avoiding the interference of complex production environment and improving the detection accuracy.According to the size and detection distance of the combustible gas detector,the hardware selection of the machine vision inspection system is carried out,including industrial camera,industrial lens,industrial light source,etc.The selected industrial camera was also calibrated using the Zhang’s calibration method to remove the effects of distortion caused by the industrial lens process.The industrial camera driver software was used to image the appearance defects of the combustible gas detector.Different dataset types were created in different ways for different algorithms,and data enhancement was performed for both types of datasets using geometric transformations such as translation transform,rotation transform,mirror transform,and deflation transform to expand the dataset of combustible gas detectors.In addition,a variety of background segmentation algorithms are selected,and different algorithms are used to segment the background of the processed combustible gas detector dataset.Based on the output results and experimental data,the semantic segmentation algorithm U-Net++ is selected to process the background of the combustible gas detector dataset.The Dense Net121 structure is applied to replace the feature extraction part of the semantic segmentation algorithm U-Net++ to achieve better feature extraction effect.The ordinary convolution is replaced by the depth-separable convolution,and the parameters of U-Net++ are reduced to realize the lightweight processing of U-Net++.The loss function of U-Net++ is optimized for the loss function of U-Net++,and the Dice loss function is used for the calculation of loss to make U-Net++ iterate better during training.On the basis of using U-Net++ for segmenting the finished background,a variety of target detection algorithms were selected to detect the appearance defects of combustible gas detectors using different algorithms,and based on the output results and experimental data,YOLO-X was selected as the algorithm for the appearance defects of combustible gas detectors,and on this basis,the Ghost Net structure was applied to lighten YOLO-X,and the While retaining the original features,the features are extracted and the network parameters are reduced,and the loss function of YOLO-X is replaced,and the location of the target frame can be obtained more accurately by using CIo U to calculate the loss.The final improved YOLO-X achieves 97.4% and96.8% of the experimental results in terms of accuracy and MAP.The experimental results show that the machine vision inspection system established in this experiment meets the needs of appearance defect detection of combustible gas detectors. |