| With the rapid development of economy and science and technology,the social demand for industrial production is increasing.Nowadays,the problems of high cost,low qualified rate,weak technology and short supply of key parts restrict the development of modern industry.In addition,due to the problems of manufacturing process and forging technology,some workpieces produced in the workshop have defects,which affect the ornamental value and use value of workpieces.At present,the defect detection of workpieces is still based on manual detection,which consumes human resources and has a high detection error rate.In order to solve the above problems,the defect detection method is improved through deep learning to reduce the production cost.This paper proposes a defect detection algorithm based on improved Faster R-CNN.The algorithm selects Faster RCNN as the basic architecture,uses Res Net50 as the backbone network,and introduces deformable convolution,deformable region pooling,feature pyramid and context information to improve the accuracy of the defect detection algorithm.After training the model on the open data set and comparing the training results of YOLO,Faster RCNN,Mask R-CNN and other models,it is found that the improved model has the best effect,the map is 97.10,and the detection speed of a single image is 0.692 seconds,which can meet the needs of industrial production.Finally,this paper uses CCD camera,processor and other simple equipment to design automatic workpiece defect detection device,so as to liberate human resources and reduce production costs.The research contents of this paper are as follows(1)First of all,due to the lack of light and dust in the factory workshop,there is a lot of noise in the collected workpiece image,which affects the accuracy of the defect detection model in the later stage.In order to solve this problem,two kinds of noise reduction measures are adopted: one is to filter the noise through image filtering,mainly including median filtering,mean filtering,adaptive filtering and bilateral filtering;the other is to enhance the image through dark channel defogging.(2)Secondly,considering the irregular shape of defects,conventional convolution neural network can not accurately extract the irregular features,so deformable convolution and deformable region pooling are introduced.These two operations can automatically calculate the displacement variable of each pixel to find the most suitable position for feature extraction,so as to change the receptive field into polygon and enhance the ability of irregular feature extraction.(3)Moreover,the sizes of different defect categories are different,and the size of the feature graph is smaller than the original image after feature extraction through the backbone network Res Net50.The feature extracted from the too small candidate box has no discrimination ability,which will affect the performance of the defect detection model.Therefore,feature pyramid structure is introduced to combine low-level structure information with high-level semantic information to improve the accuracy of category detection and location.(4)In addition,the area of some defects is small,so it is difficult to extract features.In this paper,context information is introduced,and the information between structures is used to extract features of micro defects better.By expanding the area of the candidate region of RPN output and adding Ro I pooling layer,the expanded region is mapped to the corresponding feature map,and then the features of the expanded Ro I feature and the original Ro I feature are fused,and finally the classification and regression operation is carried out. |