Monitoring the morphology of blood leukocytes, plays an important role in medical research, especially in the treatment of diseases such as immunodeficiency. Traditional manual detection methods are susceptible to numerous interference factors. Therefore, blood cells are often segmented using deep-learning algorithms. This study proposes a U-Net model based on a combination of an attention mechanism and dilated convolutions. First, the traditional convolution in a double convolutional module in a network is replaced by dilated convolution, and multi-scale features are obtained by expanding the receptive field. Second, after each convolution layer in the upsampling layer, an attention mechanism module is combined to refine the adaptive features and improve the segmentation performance of the model. Finally, the RAdam optimizer was used to enhance the robustness of the learning rate variations. Through the ablation experiment of the three improvement directions, it was concluded that all three improvement directions had a positive effect on the segmentation result, and the improvement was the most effective when the three improvements were combined. The experimental results show that compared with the original U-Net model, the segmentation indicators of blood leukocytes, intersection over union (IOU), recall and accuracy were increased by 5.1%, 5.7% and 1.2%, respectively, which more accurately segmented blood leukocytes, which may be used for a greater degree of auxiliary leukocyte detection in the application of immunodeficiency and other diseases.