Ask Your Question

Revision history [back]

Here is a code that could help. This is assuming your setup is like in the well-known sentdex tutorial: everything is in a folder called opencv_workspace, which contains a folder with your negatives (called 'negs'), and a folder called 'info' where your positive samples are going to go. In this case, all your positives are in a folder called 'pos'. What this code does, is run the opencv_createsamples command for each positive you have in the 'pos' folder, each with it's own info.lst. Then it combines the separate info.lst files into one big info.lst file, and creates the vector file. When I applied it in my case, it worked, except for a small bug where a couple of positives won't be included in the .vec file (specifically, number_of_negatives*2 % number_of_positives) because of a parse error. I don't know how to fix that, but if you have thousands of positives, it'll be a tiny number so it shouldn't matter. You can have as many positives as you want and you won't have to do any manual labor. I attached a picture of the code because otherwise this website renders the text, which changes the code and stops you from copy-pasting. image description