Ask Your Question
3

OpenCV 3.0 (contrib) Integral Channel Features

asked 2015-01-22 04:25:52 -0600

verified.human gravatar image

I was happy to see that there is an implementation of the Integral Channel Features + WaldBoost algorithm implemented in OpenCV 3.0. This code is currently in the opencv_contrib repository. Unfortunately I have problems to get it working. When I am trying to train the classifier using the following code it looks like something is happening because I see "1/3 - 2/3 ..." as progress indicator in the console. However the function crashes with the following error message:

OpenCV Error: Assertion failed (count > 0) in generateFeatures, file /Users/Development/libraries/opencv_contrib/modules/xobjdetect/src/acffeature.cpp, line 237 libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /Users/Development/libraries/opencv_contrib/modules/xobjdetect/src/acffeature.cpp:237: error: (-215) count > 0 in function generateFeatures

This assertion is made in this file: https://github.com/Itseez/opencv_cont...

I was wondering whether this ICF implementation is usable or very unstable pre-alpha code? Maybe someone can shine some like upon this or hint me into the direction of why the training does not work.

void ChannelFeaturesDetector::trainDetector(string objectDirectory, string backgroundDirectory) {

vector<cv::String> objectFilenames;
objectFilenames.push_back(cv::String("/Users/Development/data/KITTI_benchmark/car_rear_100x80/Car_000000.png"));
objectFilenames.push_back(cv::String("/Users/Development/data/KITTI_benchmark/car_rear_100x80/Car_000005.png"));
objectFilenames.push_back(cv::String("/Users/Development/data/KITTI_benchmark/car_rear_100x80/Car_000010.png"));

vector<cv::String> backgroundFilenames;
backgroundFilenames.push_back(cv::String("/Users/Development/data/KITTI_benchmark/negatives_100x80/000000.png"));
backgroundFilenames.push_back(cv::String("/Users/Development/data/KITTI_benchmark/negatives_100x80/000001.png"));
backgroundFilenames.push_back(cv::String("/Users/Development/data/KITTI_benchmark/negatives_100x80/000002.png"));

// Parameters for ICF training
ICFDetectorParams params;
params.model_n_rows = 56;
params.model_n_cols = 56;
params.is_grayscale = false;

ICFDetector detector;
detector.train(objectFilenames, backgroundFilenames, params); }
edit retag flag offensive close merge delete

Comments

1

can you try to set more of the params ?

the default settings are broken, ie, int feature_count is set to (UINT_MAX), which results in -1 (that's your negative count there, so please set this explicitly, like it was done in the adas examples)

ICFDetectorParams params;
params.feature_count = 42000;  // parser.get<int>("feature_count");
params.weak_count    = 200;    // parser.get<int>("weak_count");
params.bg_per_image  = 5;     // parser.get<int>("bg_per_image");
params.model_n_rows  = imsiz;
params.model_n_cols  = imsiz;
params.features_type = "icf";
params.alpha         = 0.15f; // default: 0.02
berak gravatar imageberak ( 2015-01-22 05:52:07 -0600 )edit
2

Thanks, you are right. The default parameters are incorrect. Settings all of them manually works indeed.

verified.human gravatar imageverified.human ( 2015-01-22 06:56:58 -0600 )edit
1

there are some more pitfalls, i guess.

  • it never checks, if the bg-images are valid, or large enough (must be larger that the modelsize, else it'll just crash)
  • http://code.opencv.org/issues/4007#no...
  • it does not tell you why it stopped the training. (all negatives eaten up ? optimal threshhold reached ?)
  • it does not tell you the reached threshold at all. (adding some more debugging printouts will help)

there might be only less than a dozen folks in this world, who tried to use this so far, so, please report back anything

(also, i'm very curious about your experience with it ;)

berak gravatar imageberak ( 2015-01-22 07:29:45 -0600 )edit

Well, I think the documentation is very limited at this point. Some examples:

  1. ICFDetector::detect() --> what is the threshold parameter? (probably threshold of weak learner)
  2. Setting the scaleFactor to 1.0 causes an infinite loop (or very long at least) for ICFDetector::detect()

I will report back if I have some results out of the classifier.

verified.human gravatar imageverified.human ( 2015-01-29 09:39:43 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-07-16 21:23:24 -0600

And I find that there is something wrong in ICFDetector::write(...). Then I modify it like this : fs << "{"; ====>>> fs << "model" << "{";

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-01-22 04:25:52 -0600

Seen: 3,478 times

Last updated: Jan 22 '15