我們提出了一種結合資料增強技術和語義資訊的方法,以解決動態環境中因定位誤差增加而導致的視覺定位問題。視覺定位在自動駕駛車輛、機器人和增強現實 (AR) / 虛擬現實 (VR) 等應用中至關重要。然而,在動態環境中,特別是有頻繁人員移動的情況下,定位的準確性和穩定性往往會顯著下降。 為了解決這個問題,採用了資料增強中的隨機擦除方法。隨機擦除通過隨機遮擋圖像的一部分,讓模型學習更多樣化的特徵,從而提高模型的穩定性。然而,我們認為模型應該學習更有用的特徵。因此進一步結合了語義分割技術,以提取圖像中的人員區域,並對這些區域進行特殊處理。 這種結合的方法旨在提高模型在動態環境中的適應性,確保在實際應用中的定位準確性。我們在具有不同動態變化的室內環境(工廠)數據集中進行了實驗。實驗結果顯示,該方法減少了因人員移動而導致的定位誤差。在有人的區域,我們的方法將平移誤差最多降低了35.8\%,旋轉誤差幾乎維持一致,並提高了系統的穩定性。此外,在靜態環境中,我們的方法保持了高精度,展示了其在實際工廠使用場景中的適應性。;We proposes a method that combines data augmentation techniques with semantic information to address the issue of increased positioning errors in visual localization caused by dynamic environments. Visual localization is crucial in applications such as autonomous vehicles, robotics, and augmented reality (AR) / virtual reality (VR). However, in dynamic environments, especially where there is frequent human movement, localization accuracy and stability often significantly decline. To solve this problem, we adopted the Random Erasing technique from data augmentation. Random Erasing simulates object movement or occlusion by randomly masking parts of the image, allowing the model to learn more diverse features and improve its robustness in dynamic environments. However, we believe the model should learn more useful features. Therefore, we further integrated semantic segmentation techniques to extract human regions in the images and applied special processing to these areas. This combined approach aims to enhance the model′s adaptability in dynamic environments, ensuring localization accuracy in practical applications. We conducted experiments on our datasets with varying dynamic characteristics in indoor environment like factory. Experimental results show that this method reduces localization errors caused by human movement. In areas with human movement, our method reduces translation errors by at least 35.8 \% and improves system stability. Additionally, in static environments, our method maintains high accuracy, demonstrating its adaptability across various settings.