Photoacoustic imaging is a new noninvasive medical imaging method in recent years. It combines the advantages of high resolution and rich contrast of optical imaging with the advantages of high penetration depth of acoustic imaging. It can provide safe, high-resolution and high – contrast imaging. As an important branch of photoacoustic imaging, photoacoustic microscopy can achieve higher-resolution imaging. However, the poor axial resolution relative to lateral resolution has always been a limitation. In recent years, deep learning has shown certain advantages in processing of photoacoustic image. Therefore, this paper proposes to integrate the U-net semantic segmentation model with the simulation platform of photoacoustic microscopy based on K-Wave to improve the axial resolution of photoacoustic microscopy. Firstly, the dataset (including B-scans and their corresponding ground truth images) required for deep learning is obtained by using the simulation platform of photoacoustic microscopy based on K-Wave. The dataset is randomly divided into training set and test set with a ratio of 7:1. In the training process, the B-scans are used as the input of U-Net based convolutional neural network architecture, while the ground truth images are the desired output of the neural network. Experimental measurements were performed on carbon nanoparticles, which measured an increase in axial resolution by a factor of ~ 4.2. This method further improves the axial resolution, which helps to obtain the structural features of the tissue more accurately, and provides theoretical guidance for the treatment and diagnosis of diseases.