Lumbar disc herniation (LDH) is a common clinical condition causing lower back and leg pain. Accurate segmentation of the lumbar discs is crucial for assessing and diagnosing LDH. Magnetic resonance imaging (MRI) can reveal the condition of articular cartilage. However, manual segmentation of MRI images is burdensome for physicians and needs to be more efficient. In this study, we propose a method that combines UNet and superpixel segmentation to address the problem of loss of detailed information in the feature extraction phase, leading to poor segmentation results at object edges. The aim is to provide a reproducible solution for diagnosing patients with lumbar disc herniation. We suggest using the network structure of UNet. Firstly, dense blocks are inserted into the UNet network, and training is performed using the Swish activation function. The Dense-UNet model extracts semantic features from the images and obtains rough semantic segmentation results. Then, an adaptive-scale superpixel segmentation algorithm is applied to segment the input images into superpixel images. Finally, high-level abstract semantic features are fused with the detailed information of the superpixels to obtain edge-optimized semantic segmentation results. Evaluation of a private dataset of multifidus muscles in magnetic resonance images demonstrates that compared to other segmentation algorithms, this algorithm exhibits better semantic segmentation performance in detailed areas such as object edges. Compared to UNet, it achieves a 9.5% improvement in the Dice Similarity Coefficient (DSC) and an 11.3% improvement in the Jaccard Index (JAC). The experimental results indicate that this algorithm improves segmentation performance while reducing computational complexity.