diff --git a/src/Vocabulary.cpp b/src/Vocabulary.cpp index 9f0eff3..971a913 100644 --- a/src/Vocabulary.cpp +++ b/src/Vocabulary.cpp @@ -3,10 +3,12 @@ #include "quicklz.h" #include #include "timers.h" + +const int MAX_ITERATION = 100; + namespace DBoW3{ // -------------------------------------------------------------------------- - Vocabulary::Vocabulary (int k, int L, WeightingType weighting, ScoringType scoring) : m_k(k), m_L(L), m_weighting(weighting), m_scoring(scoring), @@ -263,9 +265,11 @@ void Vocabulary::HKmeansStep(NodeId parent_id, // to check if clusters move after iterations std::vector last_association, current_association; - - while(goon) + + int count = 0; + while(goon && count < MAX_ITERATION) { + count++; // 1. Calculate clusters if(first_time)