OpponentSIFT descriptor failure (Bug #1588)


Added by Alexandre Benoit over 5 years ago. Updated almost 2 years ago.


Status:Open Start date:
Priority:Low Due date:
Assignee:- % Done:

0%

Category:features2d
Target version:Next Hackathon
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

Hi,
I encounter systematic error when using the OpponentSIFT descriptor when using a Dense grid analysis.
Note, it does not fail when using the OpponentSURF descriptor or when using a simple SIFT descriptor

The code and error report are below.
I also have a question regarding SIFT and SURF : how do these implementations differentiate from the official research libraries : are there any difference from precision and/or computation efficiency considerations ?

Once again, thanks a lot for all the contributors of this wonderful library !

From the code side, here is how i setup the dense grid:
// dense grid setup
_featureDetector = new cv::DenseFeatureDetector(cv::DenseFeatureDetector::Params(1.f, 1, 2.5f, 9));
// descriptor setup
_descExtractor = cv::DescriptorExtractor::create( _ddmParams.descriptorType ); // where _ddmParams.descriptorType is the String "OpponentSIFT", "OpponentSURF", "SIFT" or any other compatible
// when running analysis
_descExtractor->compute( colorImage, imageKeypoints, currentImageDescriptors);

Here is the valgrind report at the error place:

==> grabbing from colorImage input (h,w,channels,elemnSize1 => nbKeypoints): 240, 320, 3, 1=> 69
31790 Invalid read of size 4
31790 at 0x5D45DE5: cv::OpponentColorDescriptorExtractor::computeImpl(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) const (in /usr/local/lib/libopencv_features2d.so.2.3.2)
31790 by 0x5D4008A: cv::DescriptorExtractor::compute(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) const (in /usr/local/lib/libopencv_features2d.so.2.3.2)
31790 by 0x4179ED: TrecVidBOWsystem::_grabbDescriptors(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) (TrecVidBOWsystem.h:484)
31790 by 0x41BCED: TrecVidBOWtrainer_Experimetal::processSubshotList_SingleFrame(cv::Mat const&, Subshot const&, int const&) (TrecVidBOWtrainer_Experimetal.h:75)
31790 by 0x40CE50: TrecVidSubshotListProcessor::processSubshotList(TrecVidSubshotListProcessor::SUBSHOTLISTFAILUREPROCESS) (TrecVidSubshotListProcessor.cpp:216)
31790 by 0x419640: TrecVidBOWtrainer::trainVocabulary(int, char**) (TrecVidBOWtrainer.h:132)
31790 by 0x410188: main (buildVocabulary.cpp:29)
31790 Address 0x193ac4f8 is 0 bytes after a block of size 264 alloc'd
31790 at 0x4C28973: operator new(unsigned long) (vg_replace_malloc.c:261)
31790 by 0x4EC95DD: std::vector<int, std::allocator<int> >::_M_fill_insert(+gnu_cxx::+normal_iterator<int*, std::vector<int, std::allocator<int> > >, unsigned long, int const&) (in /usr/local/lib/libopencv_core.so.2.3.2)
31790 by 0x5D4678C: cv::OpponentColorDescriptorExtractor::computeImpl(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) const (in /usr/local/lib/libopencv_features2d.so.2.3.2)
31790 by 0x5D4008A: cv::DescriptorExtractor::compute(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) const (in /usr/local/lib/libopencv_features2d.so.2.3.2)
31790 by 0x4179ED: TrecVidBOWsystem::_grabbDescriptors(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) (TrecVidBOWsystem.h:484)
31790 by 0x41BCED: TrecVidBOWtrainer_Experimetal::processSubshotList_SingleFrame(cv::Mat const&, Subshot const&, int const&) (TrecVidBOWtrainer_Experimetal.h:75)
31790 by 0x40CE50: TrecVidSubshotListProcessor]]::processSubshotList(TrecVidSubshotListProcessor::SUBSHOTLISTFAILUREPROCESS) (TrecVidSubshotListProcessor.cpp:216)
31790 by 0x419640: TrecVidBOWtrainer]]::trainVocabulary(int, char**) (TrecVidBOWtrainer.h:132)
31790 by 0x410188: main (buildVocabulary.cpp:29)
31790
31790 Invalid read of size 4
31790 at 0x5D45DF8: cv::OpponentColorDescriptorExtractor::computeImpl(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) const (in /usr/local/lib/libopencv_features2d.so.2.3.2)
31790 by 0x5D4008A: cv::DescriptorExtractor::compute(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) const (in /usr/local/lib/libopencv_features2d.so.2.3.2)
31790 by 0x4179ED: TrecVidBOWsystem::_grabbDescriptors(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) (TrecVidBOWsystem.h:484)
31790 by 0x41BCED: TrecVidBOWtrainer_Experimetal::processSubshotList_SingleFrame(cv::Mat const&, Subshot const&, int const&) (TrecVidBOWtrainer_Experimetal.h:75)
31790 by 0x40CE50: TrecVidSubshotListProcessor::processSubshotList(TrecVidSubshotListProcessor::SUBSHOTLISTFAILUREPROCESS) (TrecVidSubshotListProcessor.cpp:216)
31790 by 0x419640: TrecVidBOWtrainer::trainVocabulary(int, char**) (TrecVidBOWtrainer.h:132)
31790 by 0x410188: main (buildVocabulary.cpp:29)


History

Updated by Alexander Shishkov over 5 years ago

  • Description changed from Hi, I encounter systematic error when using the [[OpponentSIFT]] descriptor w... to Hi, I encounter systematic error when using the OpponentSIFT descriptor when ... More

Updated by Alexandre Benoit over 5 years ago

Here are some more valgrind informations :
When encountering the error, with the current trunk revision:

[swscaler @ 0x14ac97d0]No accelerated colorspace conversion found from yuv420p to bgr24.
VideoProcessor::getFrame: frame acquired, size (h,w,channels,elemSize1) : 240, 320, 3, 1
8269
8269 Process terminating with default action of signal 11 (SIGSEGV)
8269 Access not within mapped region at address 0x2577635E8
8269 at 0x5D1FED7: cv::OpponentColorDescriptorExtractor::computeImpl(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) const (in /usr/local/lib/libopencv_features2d.so.2.3.3)
8269 by 0x5D1962A: cv::DescriptorExtractor::compute(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) const (in /usr/local/lib/libopencv_features2d.so.2.3.3)

There are also some warnings :

8269 Conditional jump or move depends on uninitialised value(s)
8269 at 0x652A306: __ieee754_atan2 (e_atan2.c:205)
8269 by 0x65419F4: atan2 (w_atan2.c:36)
8269 by 0x5D05A61: calc_grad_mag_ori(_IplImage*, int, int, double*, double*) (in /usr/local/lib/libopencv_features2d.so.2.3.3)
8269 by 0x5D068CC: calc_feature_oris(CvSeq*, _IplImage***) (in /usr/local/lib/libopencv_features2d.so.2.3.3)
8269 by 0x5D06F94: recalculateAngles(std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, _IplImage***, int, int) (in /usr/local/lib/libopencv_features2d.so.2.3.3)
8269 by 0x5D0A44A: cv::SIFT::operator()(cv::Mat const&, cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&, bool) const (in /usr/local/lib/libopencv_features2d.so.2.3.3)
8269 by 0x5D1EB52: cv::SiftDescriptorExtractor::computeImpl(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) const (in /usr/local/lib/libopencv_features2d.so.2.3.3)
8269 by 0x5D1962A: cv::DescriptorExtractor::compute(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) const (in /usr/local/lib/libopencv_features2d.so.2.3.3)
8269 by 0x5D1F58B: cv::OpponentColorDescriptorExtractor::computeImpl(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) const (in /usr/local/lib/libopencv_features2d.so.2.3.3)
8269 by 0x5D1962A: cv::DescriptorExtractor::compute(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) const (in /usr/local/lib/libopencv_features2d.so.2.3.3)

Updated by Alexandre Benoit over 5 years ago

When using OpenCV in debug mode, here are more details (with code lines)

18958 Process terminating with default action of signal 11 (SIGSEGV)
18958 Access not within mapped region at address 0x2B8A73E28
18958 at 0x5FF24ED: cv::OpponentColorDescriptorExtractor::computeImpl(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) const (descriptors.cpp:407)
18958 by 0x5FEF4C6: cv::DescriptorExtractor::compute(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) const (descriptors.cpp:69)
18958 by 0x41C033: MyObject::_grabbDescriptors(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) (TrecVidBOWsystem.h:491)

Updated by Alexandre Benoit over 5 years ago

It seems that the bug reported above is related to the length of used vectors in

1void OpponentColorDescriptorExtractor::computeImpl( const Mat& bgrImage, vector<KeyPoint>& keypoints, Mat& descriptors ) const:

When using OpponentSURF, all channels keypoints (coponents of vectorchannelKeypoints in the code) have the same size which is the one provided by the parameter vector "keypoints"... so it works fine in this case.
However, when using OpponentSIFT, the channelKeypoints vector exhibits different vector size for each channel and this leads to a buffer overflow in the following loops:

1while( channelKeypoints[2][idxs[2][cp[2]]].class_id &lt; maxInitIdx && cp[2] &lt; channelKeypoints[2].size() ) { cp[2]++; }

hope it helps

Updated by Alexander Shishkov over 5 years ago

  • Target version deleted ()

Updated by Alexander Shishkov about 5 years ago

  • Assignee deleted (Vadim Pisarevsky)

Updated by Alexander Shishkov about 5 years ago

  • Target version deleted ()

Updated by Vadim Pisarevsky over 4 years ago

  • Target version deleted ()

Updated by Kirill Kornyakov over 4 years ago

  • Target version set to Next Hackathon

Updated by Maksim Shabunin almost 2 years ago

Issue has been transferred to GitHub: https://github.com/Itseez/opencv/issues/4328

Also available in: Atom PDF