Aiming at the problems of low segmentation accuracy of small targets, high computational complexity, and slow convergence in the U-Net, an U-Net network based on dilated convolution and reconstructed sampling units (DSU-Net) is constructed. In the DSU-Net, in order to increase the receptive field of image feature extraction and fuse multi-scale information, dilated convolutional layers with different dilation rates are designed; in view of the shortcoming of losing a large amount of semantic information during the pooling process, sampling units which combine pooling and convolution are constructed, and depthwise separable convolution is used for feature extraction, thereby enhancing the feature extraction capability of the neural network and reducing the computational cost. The experimental results of two public medical image datasets show that DSU-Net has better segmentation performance than the U-Net, the ResU-Net, the R2U-Net and the U-Net++ on the three metrics of IoU, Dice Coeff and F1 Score. Finally, the DSU-Net is applied to the visual measurement of gear pitting. The results show that the proposed method can calculate the gear pitting area ratio more accurately, so as to solve the problem of efficiently and accurately detecting gear failure in the gear contact fatigue test.