mirror of
https://github.com/introlab/rtabmap.git
synced 2026-10-08 19:17:45 +08:00
Removed AutoUpdate parameter, not needed
This commit is contained in:
@@ -264,7 +264,6 @@ class RTABMAP_CORE_EXPORT Parameters
|
|||||||
RTABMAP_PARAM(Kp, NewWordsComparedTogether, bool, true, "When adding new words to dictionary, they are compared also with each other (to detect same words in the same signature).");
|
RTABMAP_PARAM(Kp, NewWordsComparedTogether, bool, true, "When adding new words to dictionary, they are compared also with each other (to detect same words in the same signature).");
|
||||||
RTABMAP_PARAM(Kp, FlannIndexSaved, bool, false, uFormat("Save FLANN index during localization session (when %s=false). The FLANN index will be saved to database after the first time localization mode is used, then on next sessions, the index is reloaded from the database instead of being rebuilt again. This can save significant loading time when the visual word dictionary is big (>1M words). Note that if the dictionary is modified (parameters or data), the index will be rebuilt and saved again on the next session. Ignored on initialization if %s is enabled.", kMemIncrementalMemory().c_str(), kMemInitWMWithAllNodes().c_str()).c_str());
|
RTABMAP_PARAM(Kp, FlannIndexSaved, bool, false, uFormat("Save FLANN index during localization session (when %s=false). The FLANN index will be saved to database after the first time localization mode is used, then on next sessions, the index is reloaded from the database instead of being rebuilt again. This can save significant loading time when the visual word dictionary is big (>1M words). Note that if the dictionary is modified (parameters or data), the index will be rebuilt and saved again on the next session. Ignored on initialization if %s is enabled.", kMemIncrementalMemory().c_str(), kMemInitWMWithAllNodes().c_str()).c_str());
|
||||||
RTABMAP_PARAM(Kp, SerializeWithChecksum, bool, true, "On serialization of the FLANN index, compute checksum of the data used by the FLANN index. This adds a slight overhead on serialization/deserialization to make sure that the dictionary data correspond to same data used when the index was built.");
|
RTABMAP_PARAM(Kp, SerializeWithChecksum, bool, true, "On serialization of the FLANN index, compute checksum of the data used by the FLANN index. This adds a slight overhead on serialization/deserialization to make sure that the dictionary data correspond to same data used when the index was built.");
|
||||||
RTABMAP_PARAM(Kp, AutoUpdate, bool, true, "Automatically update on any parameter changes affecting the structure of the dictionary. Otherwise, it is updated only when triggered externally (i.e., deferring initialization time).");
|
|
||||||
RTABMAP_PARAM(Kp, SubPixWinSize, int, 3, "See cv::cornerSubPix().");
|
RTABMAP_PARAM(Kp, SubPixWinSize, int, 3, "See cv::cornerSubPix().");
|
||||||
RTABMAP_PARAM(Kp, SubPixIterations, int, 0, "See cv::cornerSubPix(). 0 disables sub pixel refining.");
|
RTABMAP_PARAM(Kp, SubPixIterations, int, 0, "See cv::cornerSubPix(). 0 disables sub pixel refining.");
|
||||||
RTABMAP_PARAM(Kp, SubPixEps, double, 0.02, "See cv::cornerSubPix().");
|
RTABMAP_PARAM(Kp, SubPixEps, double, 0.02, "See cv::cornerSubPix().");
|
||||||
|
|||||||
+26
-9
@@ -435,10 +435,14 @@ void Memory::loadDataFromDb(bool postInitClosingEvents)
|
|||||||
_dbDriver->getLastWordId(id);
|
_dbDriver->getLastWordId(id);
|
||||||
_vwd->setLastWordId(id);
|
_vwd->setLastWordId(id);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
_dummyDictionary = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_dbDriver->load(*_vwd, false);
|
_dbDriver->load(*_vwd, false);
|
||||||
|
_dummyDictionary = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -446,6 +450,7 @@ void Memory::loadDataFromDb(bool postInitClosingEvents)
|
|||||||
if(_dummyDictionary)
|
if(_dummyDictionary)
|
||||||
{
|
{
|
||||||
UWARN("A dummy dictionary is requested but %s is false, loading the dictionary as usual.", Parameters::kMemInitWMWithAllNodes().c_str());
|
UWARN("A dummy dictionary is requested but %s is false, loading the dictionary as usual.", Parameters::kMemInitWMWithAllNodes().c_str());
|
||||||
|
_dummyDictionary = false;
|
||||||
}
|
}
|
||||||
UDEBUG("load words");
|
UDEBUG("load words");
|
||||||
// load the last dictionary
|
// load the last dictionary
|
||||||
@@ -453,11 +458,11 @@ void Memory::loadDataFromDb(bool postInitClosingEvents)
|
|||||||
}
|
}
|
||||||
UDEBUG("%d words loaded!", _vwd->getUnusedWordsSize());
|
UDEBUG("%d words loaded!", _vwd->getUnusedWordsSize());
|
||||||
UDEBUG("Dictionary memory usage: %ld Bytes", _vwd->getMemoryUsed());
|
UDEBUG("Dictionary memory usage: %ld Bytes", _vwd->getMemoryUsed());
|
||||||
if(_vwd->isAutoUpdateEnabled()) {
|
if(!_dummyDictionary) {
|
||||||
_vwd->update();
|
_vwd->update();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
UDEBUG("Dictionary update skipped (%s=true)", Parameters::kKpAutoUpdate().c_str());
|
UDEBUG("Dictionary update skipped (dummy dictionary is enabled)");
|
||||||
}
|
}
|
||||||
if(postInitClosingEvents) UEventsManager::post(new RtabmapEventInit(uFormat("Loading dictionary, done! (%d words)", (int)_vwd->getUnusedWordsSize())));
|
if(postInitClosingEvents) UEventsManager::post(new RtabmapEventInit(uFormat("Loading dictionary, done! (%d words)", (int)_vwd->getUnusedWordsSize())));
|
||||||
|
|
||||||
@@ -519,6 +524,24 @@ void Memory::loadDataFromDb(bool postInitClosingEvents)
|
|||||||
UWARN("%s", msg.c_str());
|
UWARN("%s", msg.c_str());
|
||||||
if(postInitClosingEvents) UEventsManager::post(new RtabmapEventInit(msg));
|
if(postInitClosingEvents) UEventsManager::post(new RtabmapEventInit(msg));
|
||||||
|
|
||||||
|
if(_dummyDictionary)
|
||||||
|
{
|
||||||
|
UWARN("Dummy dictionary cannot be used when repairing the dictionary, disabling dummy dictionary.");
|
||||||
|
for(std::map<int, Signature *>::const_iterator i=signatures.begin(); i!=signatures.end(); ++i)
|
||||||
|
{
|
||||||
|
Signature * s = this->_getSignature(i->first);
|
||||||
|
UASSERT(s != 0);
|
||||||
|
if(!s->isEnabled())
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this->disableWordsRef(s->id());
|
||||||
|
}
|
||||||
|
_vwd->deleteUnusedWords();
|
||||||
|
_vwd->clear();
|
||||||
|
_dummyDictionary = false;
|
||||||
|
}
|
||||||
|
|
||||||
//remove all words ref
|
//remove all words ref
|
||||||
|
|
||||||
const std::map<int, VisualWord *> & addedWords = _vwd->getVisualWords();
|
const std::map<int, VisualWord *> & addedWords = _vwd->getVisualWords();
|
||||||
@@ -584,12 +607,7 @@ void Memory::loadDataFromDb(bool postInitClosingEvents)
|
|||||||
UWARN("%s", msg.c_str());
|
UWARN("%s", msg.c_str());
|
||||||
if(postInitClosingEvents) UEventsManager::post(new RtabmapEventInit(msg));
|
if(postInitClosingEvents) UEventsManager::post(new RtabmapEventInit(msg));
|
||||||
_memoryChanged = true; // This will force rtabmap to save back the dictionary even if we don't process any new data
|
_memoryChanged = true; // This will force rtabmap to save back the dictionary even if we don't process any new data
|
||||||
if(_vwd->isAutoUpdateEnabled()) {
|
_vwd->update();
|
||||||
_vwd->update();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
UDEBUG("Dictionary update skipped (%s=true)", Parameters::kKpAutoUpdate().c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -636,7 +654,6 @@ void Memory::setDummyDictionary(bool enabled)
|
|||||||
UINFO("Dummy dictionary disabled.");
|
UINFO("Dummy dictionary disabled.");
|
||||||
}
|
}
|
||||||
_dummyDictionary = enabled;
|
_dummyDictionary = enabled;
|
||||||
_vwd->setAutoUpdate(!_dummyDictionary);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Memory::saveFlannIndex(bool postInitClosingEvents)
|
void Memory::saveFlannIndex(bool postInitClosingEvents)
|
||||||
|
|||||||
@@ -73,8 +73,7 @@ VWDictionary::VWDictionary(const ParametersMap & parameters) :
|
|||||||
useDistanceL1_(false),
|
useDistanceL1_(false),
|
||||||
_flannIndex(new FlannIndex()),
|
_flannIndex(new FlannIndex()),
|
||||||
_modified(true),
|
_modified(true),
|
||||||
_strategy(kNNBruteForce),
|
_strategy(kNNBruteForce)
|
||||||
_autoUpdate(true)
|
|
||||||
{
|
{
|
||||||
this->setNNStrategy((NNStrategy)Parameters::defaultKpNNStrategy());
|
this->setNNStrategy((NNStrategy)Parameters::defaultKpNNStrategy());
|
||||||
this->parseParameters(parameters);
|
this->parseParameters(parameters);
|
||||||
@@ -122,12 +121,7 @@ void VWDictionary::parseParameters(const ParametersMap & parameters)
|
|||||||
_dataTree = cv::Mat();
|
_dataTree = cv::Mat();
|
||||||
_notIndexedWords = uKeysSet(_visualWords);
|
_notIndexedWords = uKeysSet(_visualWords);
|
||||||
_removedIndexedWords.clear();
|
_removedIndexedWords.clear();
|
||||||
if(_autoUpdate) {
|
this->update();
|
||||||
this->update();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
UDEBUG("Dictionary update skipped (%s=true)", Parameters::kKpAutoUpdate().c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(incrementalDictionary)
|
if(incrementalDictionary)
|
||||||
@@ -272,12 +266,7 @@ void VWDictionary::setFixedDictionary(const std::string & dictionaryPath)
|
|||||||
_dictionaryPath = dictionaryPath;
|
_dictionaryPath = dictionaryPath;
|
||||||
_newDictionaryPath = dictionaryPath;
|
_newDictionaryPath = dictionaryPath;
|
||||||
_incrementalDictionary = false;
|
_incrementalDictionary = false;
|
||||||
if(_autoUpdate) {
|
this->update();
|
||||||
this->update();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
UDEBUG("Dictionary update skipped (%s=true)", Parameters::kKpAutoUpdate().c_str());
|
|
||||||
}
|
|
||||||
UWARN("Loaded %d words!", (int)_visualWords.size());
|
UWARN("Loaded %d words!", (int)_visualWords.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -356,12 +345,7 @@ bool VWDictionary::setNNStrategy(NNStrategy strategy)
|
|||||||
_dataTree = cv::Mat();
|
_dataTree = cv::Mat();
|
||||||
_notIndexedWords = uKeysSet(_visualWords);
|
_notIndexedWords = uKeysSet(_visualWords);
|
||||||
_removedIndexedWords.clear();
|
_removedIndexedWords.clear();
|
||||||
if(_autoUpdate) {
|
this->update();
|
||||||
this->update();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
UDEBUG("Dictionary update skipped (%s=true)", Parameters::kKpAutoUpdate().c_str());
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -198,7 +198,6 @@ int main(int argc, char * argv[])
|
|||||||
// Add some optimizations (soft set, can be overriden by arguments)
|
// Add some optimizations (soft set, can be overriden by arguments)
|
||||||
inputParams.insert(ParametersPair(Parameters::kMemLoadVisualLocalFeaturesOnInit(), "false")); // don't need features already loaded in RAM
|
inputParams.insert(ParametersPair(Parameters::kMemLoadVisualLocalFeaturesOnInit(), "false")); // don't need features already loaded in RAM
|
||||||
inputParams.insert(ParametersPair(Parameters::kMemIncrementalMemory(), "true")); // should be incremental to update links
|
inputParams.insert(ParametersPair(Parameters::kMemIncrementalMemory(), "true")); // should be incremental to update links
|
||||||
inputParams.insert(ParametersPair(Parameters::kKpAutoUpdate(), "false")); // don't build the dictionary (don't need it)
|
|
||||||
|
|
||||||
std::string dbPath = argv[argc-1];
|
std::string dbPath = argv[argc-1];
|
||||||
if(!UFile::exists(dbPath))
|
if(!UFile::exists(dbPath))
|
||||||
|
|||||||
@@ -154,7 +154,6 @@ int main(int argc, char * argv[])
|
|||||||
ParametersMap inputParams;
|
ParametersMap inputParams;
|
||||||
inputParams.insert(ParametersPair(Parameters::kMemInitWMWithAllNodes(), "true")); // load the whole map in RAM
|
inputParams.insert(ParametersPair(Parameters::kMemInitWMWithAllNodes(), "true")); // load the whole map in RAM
|
||||||
inputParams.insert(ParametersPair(Parameters::kMemLoadVisualLocalFeaturesOnInit(), "false")); // don't need features already loaded in RAM
|
inputParams.insert(ParametersPair(Parameters::kMemLoadVisualLocalFeaturesOnInit(), "false")); // don't need features already loaded in RAM
|
||||||
inputParams.insert(ParametersPair(Parameters::kKpAutoUpdate(), "false")); // don't build the dictionary (don't need it)
|
|
||||||
|
|
||||||
std::string dbPath = argv[argc-1];
|
std::string dbPath = argv[argc-1];
|
||||||
if(!UFile::exists(dbPath))
|
if(!UFile::exists(dbPath))
|
||||||
|
|||||||
Reference in New Issue
Block a user