Added/Removed some debug info

This commit is contained in:
matlabbe
2015-10-14 14:40:18 -04:00
parent c18b3842b9
commit b8382fe5bd
3 changed files with 11 additions and 16 deletions

View File

@@ -3903,6 +3903,7 @@ Signature * Memory::createSignature(const SensorData & data, const Transform & p
if(_parallelized) if(_parallelized)
{ {
UDEBUG("Start dictionary update thread");
preUpdateThread.start(); preUpdateThread.start();
} }
@@ -3916,12 +3917,14 @@ Signature * Memory::createSignature(const SensorData & data, const Transform & p
// convert to grayscale // convert to grayscale
if(data.imageRaw().channels() > 1) if(data.imageRaw().channels() > 1)
{ {
UDEBUG("convert to grayscale...");
cv::cvtColor(data.imageRaw(), imageMono, cv::COLOR_BGR2GRAY); cv::cvtColor(data.imageRaw(), imageMono, cv::COLOR_BGR2GRAY);
} }
else else
{ {
imageMono = data.imageRaw(); imageMono = data.imageRaw();
} }
UDEBUG("Set ROI...");
cv::Rect roi = Feature2D::computeRoi(imageMono, _roiRatios); cv::Rect roi = Feature2D::computeRoi(imageMono, _roiRatios);
if(!data.depthOrRightRaw().empty() && data.stereoCameraModel().isValid()) if(!data.depthOrRightRaw().empty() && data.stereoCameraModel().isValid())
@@ -3933,6 +3936,7 @@ Signature * Memory::createSignature(const SensorData & data, const Transform & p
{ {
subPixelOn = true; subPixelOn = true;
} }
UDEBUG("Generating keypoints...");
keypoints = _feature2D->generateKeypoints(imageMono, roi); keypoints = _feature2D->generateKeypoints(imageMono, roi);
t = timer.ticks(); t = timer.ticks();
if(stats) stats->addStatistic(Statistics::kTimingMemKeypoints_detection(), t*1000.0f); if(stats) stats->addStatistic(Statistics::kTimingMemKeypoints_detection(), t*1000.0f);
@@ -4019,6 +4023,7 @@ Signature * Memory::createSignature(const SensorData & data, const Transform & p
{ {
subPixelOn = true; subPixelOn = true;
} }
UDEBUG("Generating keypoints...");
keypoints = _feature2D->generateKeypoints(imageMono, roi); keypoints = _feature2D->generateKeypoints(imageMono, roi);
t = timer.ticks(); t = timer.ticks();
if(stats) stats->addStatistic(Statistics::kTimingMemKeypoints_detection(), t*1000.0f); if(stats) stats->addStatistic(Statistics::kTimingMemKeypoints_detection(), t*1000.0f);
@@ -4080,6 +4085,7 @@ Signature * Memory::createSignature(const SensorData & data, const Transform & p
else else
{ {
//RGB only //RGB only
UDEBUG("Generating keypoints...");
keypoints = _feature2D->generateKeypoints(imageMono, roi); keypoints = _feature2D->generateKeypoints(imageMono, roi);
t = timer.ticks(); t = timer.ticks();
if(stats) stats->addStatistic(Statistics::kTimingMemKeypoints_detection(), t*1000.0f); if(stats) stats->addStatistic(Statistics::kTimingMemKeypoints_detection(), t*1000.0f);
@@ -4199,7 +4205,9 @@ Signature * Memory::createSignature(const SensorData & data, const Transform & p
if(_parallelized) if(_parallelized)
{ {
UDEBUG("Joining dictionary update thread...");
preUpdateThread.join(); // Wait the dictionary to be updated preUpdateThread.join(); // Wait the dictionary to be updated
UDEBUG("Joining dictionary update thread... thread finished!");
} }
std::list<int> wordIds; std::list<int> wordIds;

View File

@@ -47,7 +47,6 @@
#include "rtflann/util/allocator.h" #include "rtflann/util/allocator.h"
#include "rtflann/util/random.h" #include "rtflann/util/random.h"
#include "rtflann/util/saving.h" #include "rtflann/util/saving.h"
#include "rtabmap/utilite/ULogger.h"
namespace rtflann namespace rtflann
@@ -142,7 +141,7 @@ public:
void addPoints(const Matrix<ElementType>& points, float rebuild_threshold = 2) void addPoints(const Matrix<ElementType>& points, float rebuild_threshold = 2)
{ {
UASSERT(points.cols==veclen_); assert(points.cols==veclen_);
size_t old_size = size_; size_t old_size = size_;
extendDataset(points); extendDataset(points);
@@ -151,7 +150,6 @@ public:
buildIndex(); buildIndex();
} }
else { else {
UDEBUG("Add to trees (%d)", trees_);
for (size_t i=old_size;i<size_;++i) { for (size_t i=old_size;i<size_;++i) {
for (int j = 0; j < trees_; j++) { for (int j = 0; j < trees_; j++) {
addPointToTree(tree_roots_[j], i); addPointToTree(tree_roots_[j], i);
@@ -254,13 +252,12 @@ protected:
*/ */
void buildIndexImpl() void buildIndexImpl()
{ {
UDEBUG("");
// Create a permutable array of indices to the input vectors. // Create a permutable array of indices to the input vectors.
std::vector<int> ind(size_); std::vector<int> ind(size_);
for (size_t i = 0; i < size_; ++i) { for (size_t i = 0; i < size_; ++i) {
ind[i] = int(i); ind[i] = int(i);
} }
UDEBUG("");
mean_ = new DistanceType[veclen_]; mean_ = new DistanceType[veclen_];
var_ = new DistanceType[veclen_]; var_ = new DistanceType[veclen_];
@@ -271,10 +268,8 @@ protected:
std::random_shuffle(ind.begin(), ind.end()); std::random_shuffle(ind.begin(), ind.end());
tree_roots_[i] = divideTree(&ind[0], int(size_) ); tree_roots_[i] = divideTree(&ind[0], int(size_) );
} }
UDEBUG("");
delete[] mean_; delete[] mean_;
delete[] var_; delete[] var_;
UDEBUG("");
} }
void freeIndex() void freeIndex()

View File

@@ -39,7 +39,6 @@
#include "rtflann/util/result_set.h" #include "rtflann/util/result_set.h"
#include "rtflann/util/dynamic_bitset.h" #include "rtflann/util/dynamic_bitset.h"
#include "rtflann/util/saving.h" #include "rtflann/util/saving.h"
#include "rtabmap/utilite/ULogger.h"
namespace rtflann namespace rtflann
{ {
@@ -125,15 +124,12 @@ public:
*/ */
virtual void buildIndex() virtual void buildIndex()
{ {
UDEBUG("");
freeIndex(); freeIndex();
UDEBUG("");
cleanRemovedPoints(); cleanRemovedPoints();
UDEBUG("");
// building index // building index
buildIndexImpl(); buildIndexImpl();
UDEBUG("");
size_at_build_ = size_; size_at_build_ = size_;
} }
@@ -144,9 +140,7 @@ public:
*/ */
virtual void buildIndex(const Matrix<ElementType>& dataset) virtual void buildIndex(const Matrix<ElementType>& dataset)
{ {
UDEBUG("");
setDataset(dataset); setDataset(dataset);
UDEBUG("");
this->buildIndex(); this->buildIndex();
} }
@@ -769,7 +763,6 @@ protected:
void extendDataset(const Matrix<ElementType>& new_points) void extendDataset(const Matrix<ElementType>& new_points)
{ {
size_t new_size = size_ + new_points.rows; size_t new_size = size_ + new_points.rows;
UDEBUG("size=%d, new_size=%d, removed_=%d", size_, new_size, removed_?1:0);
if (removed_) { if (removed_) {
removed_points_.resize(new_size); removed_points_.resize(new_size);
ids_.resize(new_size); ids_.resize(new_size);
@@ -783,7 +776,6 @@ protected:
} }
} }
size_ = new_size; size_ = new_size;
UDEBUG("last_id_=%d", last_id_);
} }