In industrial production, defect detection is one of the key methods to control the quality of mechanical design products. Although defect detection algorithms based on traditional machine learning can greatly improve detection efficiency, manual feature extraction is required and the design process is complicated. With the rapid development of CNN, major breakthroughs have been made in computer vision. Therefore, building a surface defect detection algorithm for mechanical design products based on DCNNs plays a very important role in improving industrial production efficiency. This paper studies the surface defect detection algorithm of mechanical products based on deep convolutional neural network, focusing on solving two types of problems: defect recognition and defect segmentation. Aiming at the problem of defect recognition, this paper studies a defect recognition algorithm based on fully convolutional block detection. This algorithm introduces the idea of block detection into the ResNet fully convolutional neural network. While realizing the local discrimination mechanism, it overcomes the shortcomings of the traditional block detection receptive field. Compared with the original ResNet image classification algorithm, this algorithm has stronger generalization ability and detection ability of small defects. Aiming at the problem of defect segmentation, this paper studies a defect segmentation algorithm based on improved Deeplabv3+.