The currently mature vision SLAM loop closure detection algorithms, when applied to dynamic scenes, often suffer from mismatching of feature points due to interference from pedestrians or other moving objects, thereby disrupting the consistency of the map. To solve this problem, this paper proposes an enhanced visual SLAM loop closure detection algorithm suitable for indoor dynamic scenes. Firstly, we propose the BSENet (Bottleneck with Squeeze and Excitation Network) convolutional network to replace the convolutional modules in the U-Net + + model, thereby enhancing the semantic segmentation model's ability to process complex features. Secondly, we dynamically allocate weights to each semantic information using the motion levels of semantic information and the centroid coordinates of K-means clustering. Finally, the similarity between key frames and candidate frames is calculated based on these weights, and the results of this calculation are used to enhance the loop closure detection algorithm's performance in dynamic scenes. Experimental results show that the improved U-Net + + model has increased its MIoU (Mean Intersection over Union) to 76.9% on the validation set and reduced its loss to 0.172. In contrast, the traditional bag-of-words-based loop closure detection algorithm only achieved a maximum similarity of 0.262 for images identified as loop closures, whereas the enhanced loop closure detection algorithm achieved a similarity of 0.757 for loop closure photos, enabling accurate identification of loop closures in dynamic scenes.