In order to solve the problem of localization loss that an autonomous mobile robot may encounter in indoor environment, an improved Monte Carlo localization algorithm is proposed in this paper. The algorithm can identify the state of the robot by real-time monitoring of the mean weight changes of the particles and introduce more high-weight particles through the divergent sampling function when the robot is in the state of localization loss. The observation model will make the particle set slowly approach to the real position of the robot and the new particles are then sampled to reach the position. The loss self-recovery experiments of different algorithms under different experimental scenarios are presented in this paper.