trainHog opencv sample loading negative images failes

asked 2018-05-31 16:37:30 -0600

alexandratuu@gmail.com gravatar image

updated 2018-05-31 16:38:21 -0600

I am trying to train the Inria dataset with trainHog opencv sample, while I load negative images with function:

void load_images(const String & dirname, vector< Mat > & img_lst, bool showImages = false) { vector< String > files; glob(dirname, files);

for (size_t i = 0; i < files.size(); ++i)
{
    Mat img = imread(files[i]); // preia imagine
    if (img.empty())            // treci peste daca este imagine invalida
    {
        cout << files[i] << " is invalid!" << endl;
        continue;
    }

    if (showImages)
    {
        imshow("image", img);
        waitKey(1);
    }

    if (i == files.size() - 1)
    {
        cout << "wtf is happening" << i;
    }
    cout << i << endl;

    img_lst.push_back(img);
    if (i == files.size() - 1)
    {
        cout << "has been pushed";
    }
}

}

I have 2000 positives and used to have almost 120000 negative, something happens when I get to imagescount -1, my exe gets somehow stopped, it doesn't pass the image before last one, and I can t understand what is the problem, same thing happens with 80000 images. What am I doing wrong.

tried debugging and somehow my last image gets into that vector but after when he passes this function and loading is finished nothing happens my console is like waiting, is a problem of my memory? I have to many images?Process memory gets to4.0 GB? What im doing wrong? should i have less images? how many?

edit retag flag offensive close merge delete