Segmentation of the shank gastrocnemius (Gas) and soleus (Sol) muscles in ultrasound (US) images allows to extract the muscle features, which are important for the early diagnosis of muscle atrophy. The automatic segmentation of the muscles is a challenging task, and deep learning (DL) provides a solution to this problem, which can effectively extract representative features from the muscle regions and background of the images. In this study, we propose ResTU-net, an automatic segmentation method based on improved U-net network, to segment the Gas and Sol muscles in shank US images. This network uses the deep residual neural network (Resnet) as the sublayer unit of each layer of a U-net, and can effectively combine the features of each layer with those of the next layer to meet the challenges of poor US image quality and low contrast. In addition, dilated convolution is used instead of the pooling layer in the network to prevent information loss during training. Experiments were performed on 3350 shank US images from 23 Sprague Dawley (SD) rats, among them, 2650 shank US images were used for network training and 700 for network validation. Compared with state-of-the-art networks, the experimental results show that the method can achieved the best segmentation capability results and a mean Dice similarity coefficient (DSC) of the Gas and Sol muscles of 94.82% and 90.72%, respectively. This work indicates that the proposed fully automatic segmentation method may be accurately and efficiently applied to Gas and Sol muscles segmentation in shank US images.