Abstract:The existing methods for segmenting CT images of castings with weak edges have problems of difficulty, low precision and poor robustness. To address these issues, this article proposes a U-shaped network segmentation algorithm that fuses residual module and mixed attention mechanism. Firstly, the algorithm is based on U-Net. The deep residual networks ( ResNets) is established as the backbone of the network to solve the inadequate feature extraction capability of the original U-Net. Then, the improved hybrid attention mechanism is introduced, and it characterize the target region and the channel to improve the network sensitivity. Finally, a new loss function (FD loss) combining Focal loss and Dice loss is used to mitigate the negative effects of sample imbalance. The performance of the algorithm is evaluated by using the 120 valve body dataset. The experimental results show that the pixel accuracy ( PA) and intersection over union (IoU) of the proposed algorithm for casting segmentation reach 98. 72% and 97. 40% , which are better than the those of the original U-Net and other mainstream semantic segmentation algorithms. This work provides a new idea for the weak edge segmentation problem.