Comments (13)
test this sample is ok
SSE2NEON.h from https://github.com/jratcliff63367/sse2neon/blob/master/SSE2NEON.h
Any suggestion for the error? Thanks
from staple.
Memory is corrupted. Please refer to this issue #1. You can try disable compiler optimize option, compile and run it again. Or you have to track how the content of those address mentioned in the assertion is changed, add some variables to memorize their values and compare them with current values at some checkpoints.
from staple.
I used a memery error check tool, error report
==18014== Memcheck, a memory error detector
==18014== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==18014== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==18014== Command: build/stapleCC
==18014==
bg_area.width 96 bg_area.height 95
fg_area.width 40 fg_area.height 39
area_resize_factor 1.5707 norm_bg_area.width 151 norm_bg_area.height 149
norm_target_sz.width 76 norm_target_sz.height 74
norm_pwp_search_area.width 150 norm_pwp_search_area.height 148
wxhxc = 151 x 149 x 3
==18014== Invalid read of size 16
==18014== at 0x40993C: gradHist(float*, float*, float*, int, int, int, int, int, bool) (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== by 0x40A5D4: fhog(float*, float*, float*, int, int, int, int, int, float) (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== by 0x40A95A: fhog(float*, float*, int, int, int, int*, int*, int*, int, int, float, bool) (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== by 0x40B558: fhog28(cv::Mat&, cv::Mat const&, int, int, float, bool) (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== by 0x40F3F1: STAPLE_TRACKER::getFeatureMap(cv::Mat&, char const*, cv::Mat&) (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== by 0x419895: STAPLE_TRACKER::tracker_staple_train(cv::Mat const&, bool) (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== by 0x40588E: main (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== Address 0x1dc6f99c is 98,556 bytes inside a block of size 98,568 alloc'd
==18014== at 0x4C2E858: calloc (vg_replace_malloc.c:711)
==18014== by 0x40A59D: fhog(float*, float*, float*, int, int, int, int, int, float) (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== by 0x40A95A: fhog(float*, float*, int, int, int, int*, int*, int*, int, int, float, bool) (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== by 0x40B558: fhog28(cv::Mat&, cv::Mat const&, int, int, float, bool) (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== by 0x40F3F1: STAPLE_TRACKER::getFeatureMap(cv::Mat&, char const*, cv::Mat&) (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== by 0x419895: STAPLE_TRACKER::tracker_staple_train(cv::Mat const&, bool) (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== by 0x40588E: main (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014==
==18014== Invalid write of size 8
==18014== at 0x40994B: gradHist(float*, float*, float*, int, int, int, int, int, bool) (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== by 0x40A5D4: fhog(float*, float*, float*, int, int, int, int, int, float) (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== by 0x40A95A: fhog(float*, float*, int, int, int, int*, int*, int*, int, int, float, bool) (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== by 0x40B558: fhog28(cv::Mat&, cv::Mat const&, int, int, float, bool) (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== by 0x40F3F1: STAPLE_TRACKER::getFeatureMap(cv::Mat&, char const*, cv::Mat&) (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== by 0x419895: STAPLE_TRACKER::tracker_staple_train(cv::Mat const&, bool) (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== by 0x40588E: main (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== Address 0x1dc6f9a4 is 98,564 bytes inside a block of size 98,568 alloc'd
==18014== at 0x4C2E858: calloc (vg_replace_malloc.c:711)
==18014== by 0x40A59D: fhog(float*, float*, float*, int, int, int, int, int, float) (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== by 0x40A95A: fhog(float*, float*, int, int, int, int*, int*, int*, int, int, float, bool) (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== by 0x40B558: fhog28(cv::Mat&, cv::Mat const&, int, int, float, bool) (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== by 0x40F3F1: STAPLE_TRACKER::getFeatureMap(cv::Mat&, char const*, cv::Mat&) (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== by 0x419895: STAPLE_TRACKER::tracker_staple_train(cv::Mat const&, bool) (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
==18014== by 0x40588E: main (in /home/mrsy/project/track/STAPLE-master/build/stapleCC)
from staple.
I writed a sample with opencv, only read a image and resize to 1280*720 , call getSubwindow fhog28 fhog31, have the same error
int main(){
Mat image = imread("lena.jpg",IMREAD_COLOR);
for (int i = 0; i < 100; i++)
{
//Mat fhog_feature = fhog(image);
//vector<Mat> feats;
//split(fhog_feature, feats);
cv::Mat resized;
//cv::resize(image, resized, cv::Size(960, 640), 0, 0, cv::INTER_AREA);
cv::resize(image, resized, cv::Size(1280, 720), 0, 0, cv::INTER_AREA);
//cv::resize(image, resized, cv::Size(151, 149), 0, 0, cv::INTER_AREA);
cv::Point_<float> centerCoor = cv::Point_<float>(514.5, 439);
//cv::Point_<float> centerCoor = cv::Point_<float>(510.5, 411);
cv::Size norm_bg_area = cv::Size(151, 149);
cv::Size bg_area = cv::Size(96, 95);
cv::Mat im_patch_bg;
getSubwindow(resized, centerCoor, norm_bg_area, bg_area, im_patch_bg);
cv::MatND xt;
fhog28(xt, im_patch_bg, 4, 9);
std::cout<<"##############fhog28 = "<<i<<std::endl;
cv::MatND temp;
fhog31(temp, im_patch_bg, 4, 9);
std::cout<<"##############fhog31 = "<<i<<std::endl;
}
#if 0
for (size_t i = 0; i < feats.size(); i++) {
cout<<feats[i]<<endl;
imshow("feat", feats[i]);
waitKey();
}
#endif
return 0;
}
from staple.
test are all on ubuntu16.04
if resized image to cv::Size(151, 149) , then call fhog28 fhog32, No error occured
from staple.
So in your sample code, the error is caused by wrong image size. From Valgrind output, it points to function gradHist. You can figure out which line of code is the source of message "==18014== Invalid read of size 16". Please check aMalloc and aFree function, do some change to debug. If you are running tracking code in single thread, maybe you can change aMalloc/aFree function to use a global static array as memory buffer for test.
from staple.
pdollar/toolbox#8
is this issue ?
from staple.
I read the post, but not very clear about the author's idea. It's better add some print around gradHist code lines to find the root cause.
from staple.
modify code below can run without err
// main rows, has top and bottom bins, use SSE for minor speedup
if( softBin<0 )
for( ; ; y++ )
{
std::cout<<"###########x = "<< x << "y = "<< y <<std::endl;
yb0 = (int) yb;
if(yb0>=hb-1)
break;
GHinit;
//_m0=sse::SET(M0[y]);
if(hasLf)
{
//_m=sse::SET(0,0,ms[1],ms[0]);
//GH(H0+O0[y],_m,_m0);
H0[O0[y]] += M0[y]*ms[0];
//H0[O0[y] + 3] += M0[y]*ms[1];
}
if(hasRt)
{
//_m=sse::SET(0,0,ms[3],ms[2]);
//GH(H0+O0[y]+hb,_m,_m0);
H0[O0[y]+hb] += M0[y]*ms[3];
//H0[O0[y]+hb + 3] += M0[y]*ms[2];
}
std::cout<<"o0[y] = "<<O0[y]<<" O0[y]+hb = "<< O0[y]+hb<<std::endl;
}
from staple.
test with sequence is ok
from staple.
Nice 👍
from staple.
But I don't know if this calculation of hog features is correct, it is not very clear that the hog principle
from staple.
You can compare the result with PC's program. But make sure opencv is the same version.
from staple.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from staple.