Hi,i got problems when i'm training ICFDetector too. I debuged to find that it will say :
" Opencv error:Assertion failed ((unsigned)i < (unsigned)cn) in cv::Vec<float,6>::operator []"
when running to
" void computeChannels(InputArray image, vector<mat>& channels)"
Mat_<Vec6f> hist = Mat_<Vec6f>::zeros(grad.rows, grad.cols);
//const float to_deg = 180 / 3.1415926f;
for (int row = 0; row < grad.rows; ++row) {
for (int col = 0; col < grad.cols; ++col) {
//float angle = atan2(row_der(row, col), col_der(row, col)) * to_deg;
float angle = angles(row, col);
if (angle < 0)
angle += 180;
int ind = (int)(angle / 30);
// If angle == 180, prevent index overflow
if (ind == 6)
ind = 5;
hist(row, col)[ind] = grad(row, col) * 255;
}
}
i have set the params ,dont know why it happened; and here is my code
ICFDetectorParams params;
params.feature_count = 2000; // parser.get<int>("feature_count");42000
params.weak_count = 100; // parser.get<int>("weak_count"); 200
params.bg_per_image = 5; // parser.get<int>("bg_per_image");
params.model_n_rows = 128;
params.model_n_cols = 64;
params.features_type = "icf";
params.alpha = 0.15f; // default: 0.02
icf.train(pos_fileNames,bg_fileNames,params);
Can u tell me any problems?