The loop-closure detection module in visual SLAM eliminates cumulative error from the front-end by detecting the fact that the camera passes through the same place as it passed before, providing the back-end optimization with constraints among longer intervals apart from neighboring frames, resulting in globally consistent trajectories and maps. In order to solve the problem of time-consuming and poor robustness existed in feature point matching based loop-closure detection algorithm, the article uses the Bag-of-words model based on ORB features to find loop-closure and performs spatial consistency verification on results. Firstly, the ORB feature points of image data sets are clustered to construct a dictionary. In order to complete query operations within logarithmic time, the data structure of k-ary tree is adopted. K-means++ clustering is implemented layer by layer to ensure uniform clustering. Afterwards with words bag, an image is expressed by a vector. The article uses Term Frequency-Inverse Document Frequency to assess the importance of each word so as to obtain an more effective description. Finally, the article select key frames to implement the detection. In this way repetitive detection of similar loops can be avoided and coverage of the entire environment can be guaranteed .The L1 norm is used to calculate the similarity scores between key frames. The scores are normalized using a priori similarity thus avoiding the introduction of absolute similarity thresholds, which makes the algorithm more adaptable. To remove wrong loop-closure, the spatial consistency test based on Pose Graph optimization is performed on detection results. Experiments show that the loop-closure detection algorithm used in the article has a good recall rate when the accuracy rate is high.