Human sensor data collected during walking exhibits significant inter-individual variability, which often degrades the performance of deep learning models when classifying the locomotion environments of unseen subjects. To address this, we interpret such inter-subject variability as a domain shift and apply domain generalization techniques to mitigate its impact on classification accuracy. We investigated two widely adopted methods for addressing domain shift: Correlation Alignment (CORAL) and Domain Adversarial Neural Networks (DANN). Using signals from two thigh-mounted IMUs that measure hip joint angle and angular velocity, we classified four types of locomotion: level walking, ±5° incline/decline walking, and stair ascent/descent. Data was collected from five participants, and user-independent evaluations were conducted to assess model generalization to unseen individuals. A baseline convolutional neural network (CNN) achieved a classification accuracy of 96.58% ± 0.46% (mean ± SD across leave-one-group-out folds). Incorporating CORAL and DANN improved the accuracy to 96.96% ± 0.36% and 97.00% ± 0.83%, respectively, while a combined model using both techniques achieved 97.76% ± 0.87%. These findings demonstrate that domain generalization methods can effectively mitigate domain shift and enhance classification robustness, supporting their potential integration into wearable robotic systems such as exosuits for subject-independent locomotion mode classification.