gustavofuhr / opencv_dollar_detector

This is a port of Dóllar person detector to OpenCV in C++
7 stars 6 forks source link

Segfaulting in GradientMagnitudeChannel.cpp:83 #2

Open drewm1980 opened 8 years ago

drewm1980 commented 8 years ago

With this configuration:

resizeImage 0.5 firstFrame 0 lastFrame 100000 detectorFileName ../opencv_dollar_detector/AcfCaltechDetector.xml dataSetDirectory /home/awagner/4009_PedestrianTracking/data/town_centre_frames/frames_original displayDetections true saveFrames false saveDetectionsInText false outputFolder ./out saveLog false logFilename ./out/smart.txt useCalibration false projectionMatrix 1105.12 -334.65 123.805 -1.86236e+06 -39.7711 20.6844 870.094 -5.12857e+06 0.736718 0.533257 0.146093 -2129.47 supressionThreshold 0.0 maxPedestrianWorldHeight 2100.0 minPedestrianWorldHeight 1400.0

Pointing to a .png image dump of the town centre video Compiled either in Debug or RelWithDebInfo Ubuntu 14.04 x86-64

I am getting the following segfault:

Program received signal SIGSEGV, Segmentation fault. 0x000000000042f91c in gradMag (I=0x1c7e610, M=0x1cb4cb0, O=0x7a23e0, h=68, w=120, d=3, full=false) at /home/awagner/4009_PedestrianTracking/gustavo_pipeline/opencv_dollar_detector/src/GradientMagnitudeChannel.cpp:83 83 if( O!=0 ) for( y=0; y<h; y++ ) O[x_h+y] = acost[(int)Gx[y]]; (gdb) p (int)Gx[y] $1 = 0 (gdb) p acost[0] $2 = 1.57079637 (gdb) p x_h+y $3 = 0 (gdb) p O[0] $4 = -1.72523904e+33 (gdb) l 78 if(O) _Gx[y] = MUL( MUL(_Gx[y],_m), SET(acMult) ); 79 if(O) _Gx[y] = XOR( _Gx[y], AND(_Gy[y], SET(-0.f)) ); 80 }; 81 memcpy( M+x_h, M2, h_sizeof(float) ); 82 // compute and store gradient orientation (O) via table lookup 83 if( O!=0 ) for( y=0; y<h; y++ ) O[x_h+y] = acost[(int)Gx[y]]; 84 if( O!=0 && full ) { 85 y1=((~size_t(O+x_h)+1)&15)/4; y=0; 86 for( ; y<y1; y++ ) O[y+x_h]+=(Gy[y]<0)_PI; 87 for( ; y<h-4; y+=4 ) STRu( O[y+x*h], (gdb) p Gx[0] $6 = -nan(0x400000) (gdb) p Gx[y] $7 = -nan(0x400000)

It's suspicious that Gx contains a nan value, but I don't see immediately how that would cause the segfault...

I was able to run the detector at some other image sizes, including this one at least once, which is also odd.

drewm1980 commented 8 years ago

Valgring has another clue:

==554== Use of uninitialised value of size 8 ==554== at 0x42F91C: gradMag(float, float, float, int, int, int, bool) (GradientMagnitudeChannel.cpp:83) ==554== by 0x42FE7B: GradientMagnitudeChannel::mGradMag(float, int, int, int) (GradientMagnitudeChannel.cpp:169) ==554== by 0x432372: Pyramid::computeSingleScaleChannelFeatures(float*, int, int) (Pyramid.cpp:417) ==554== by 0x430CC0: Pyramid::computeFeaturePyramid(cv::Mat, bool) (Pyramid.cpp:104) ==554== by 0x422EE4: Detector::acfDetect(std::vector<std::string, std::allocator >, std::string, int, int) (Detector.cpp:737) ==554== by 0x41C4E4: main (Opencv_Dollar_Detector.cpp:52)