Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Haar Cascade training not working as intended

Hi all!

I am looking to create a Haar classifier to find aerial pictures of cows in fields. I have around 1800 positive images picked out from source images of 800 x 800. It is hard to pick out a minimum samples in anything less than 800x800, as these images are taken from very high up in the air. I have an arbitrary number of negative images (6000 just in case)

I have:

  1. A dat file listing the ROIs for my positive images (./dir/to/pos n_samples x1 y1 w h)
  2. A dat file listing the negative images (./dir to neg)
  3. A .vec produced by opencv_createsamples which reads from 1. in this list

Running opencv_traincascade with 800 x 800 images and the above criteria runs out of memory on my computer and is therefore a dead end.

A workaround I attempted was to crop the positives from the 800x800 and scale the cropped positives and negatives to a smaller size (24x24 - 50x50) and train on this. Running opencv_traincascade in this way trained over the course of minutes to hours depending upon the number of negatives. However, what is produced fails miserably at picking out the positive images.

I have checked my positive samples and there appear to be no false positives in the sample. I believe a potential problem is that, at the (24x24 - 50x50) scale, some of the positives are black blobs due to being so small in the first place.

Can I get some guidance as to the best way to proceed to get this to work? I get the impression a more powerful computer is required but I would like to know if there is a tactic for these type of situations that would be useful to know.

Many thanks!

Haar Cascade training not working as intended

Hi all!

I am looking to create a Haar classifier to find aerial pictures of cows in fields. I have around 1800 positive images picked out from source images of 800 x 800. It is hard to pick out a minimum samples in anything less than 800x800, as these images are taken from very high up in the air. I have an arbitrary number of negative images (6000 just in case)

I have:

  1. A dat file listing the ROIs for my positive images (./dir/to/pos n_samples x1 y1 w h)x1_ROI y1_ROI w_ROI h_ROI)
  2. A dat file listing the negative images (./dir to neg)
  3. A .vec produced by opencv_createsamples which reads from 1. in this list

Running opencv_traincascade with 800 x 800 images and the above criteria runs out of memory on my computer and is therefore a dead end.

A workaround I attempted was to crop the positives from the 800x800 and scale the cropped positives and negatives to a smaller size (24x24 - 50x50) and train on this. Running opencv_traincascade in this way trained over the course of minutes to hours depending upon the number of negatives. However, what is produced fails miserably at picking out the positive images.

I have checked my positive samples and there appear to be no false positives in the sample. I believe a potential problem is that, at the (24x24 - 50x50) scale, some of the positives are black blobs due to being so small in the first place.

Can I get some guidance as to the best way to proceed to get this to work? I get the impression a more powerful computer is required but I would like to know if there is a tactic for these type of situations that would be useful to know.

Many thanks!

Haar Cascade training not working as intended

Hi all!

I am looking to create a Haar classifier to find aerial pictures of cows in fields. I have around 1800 positive images picked out from source images of 800 x 800. It is hard to pick out a minimum samples in anything less than 800x800, as these images are taken from very high up in the air. I have an arbitrary number of negative images (6000 just in case)

I have:

  1. A dat file listing the ROIs for my positive images (./dir/to/pos n_samples n_ROIs x1_ROI y1_ROI w_ROI h_ROI)
  2. A dat file listing the negative images (./dir to neg)
  3. A .vec produced by opencv_createsamples which reads from 1. in this list

Running opencv_traincascade with 800 x 800 images and the above criteria runs out of memory on my computer and is therefore a dead end.

A workaround I attempted was to crop the positives from the 800x800 and scale the cropped positives and negatives to a smaller size (24x24 - 50x50) and train on this. Running opencv_traincascade in this way trained over the course of minutes to hours depending upon the number of negatives. However, what is produced fails miserably at picking out the positive images.

I have checked my positive samples and there appear to be no false positives in the sample. I believe a potential problem is that, at the (24x24 - 50x50) scale, some of the positives are black blobs due to being so small in the first place.

Can I get some guidance as to the best way to proceed to get this to work? I get the impression a more powerful computer is required but I would like to know if there is a tactic for these type of situations that would be useful to know.

Many thanks!

Haar Cascade training not working as intended

Hi all!

I am looking to create a Haar classifier to find aerial pictures of cows in fields. I have around 1800 positive images picked out from source images of 800 x 800. It is hard to pick out a minimum samples in anything less than 800x800, as these images are taken from very high up in the air. I have an arbitrary number of negative images (6000 just in case)

I have:

  1. A dat file listing the ROIs for my positive images (./dir/to/pos n_ROIs x1_ROI y1_ROI w_ROI h_ROI)
  2. A dat file listing the negative images (./dir to neg)
  3. A .vec produced by opencv_createsamples which reads from 1. in this list

Running opencv_traincascade with 800 x 800 images and the above criteria runs out of memory on my computer and is therefore a dead end.

A workaround I attempted was to crop the positives ROIs from the 800x800 and scale the cropped positives and negatives to a smaller size (24x24 - 50x50) and train on this. Running opencv_traincascade in this way trained over the course of minutes to hours depending upon the number of negatives. However, what is produced fails miserably at picking out the positive images.

I have checked my positive samples and there appear to be no false positives in the sample. I believe a potential problem is that, at the (24x24 - 50x50) scale, some of the positives are black blobs due to being so small in the first place.

Can I get some guidance as to the best way to proceed to get this to work? I get the impression a more powerful computer is required but I would like to know if there is a tactic for these type of situations that would be useful to know.

Many thanks!