train cascade [closed]
I was trying to include traincascade utility into my Windows application, simply by recreating nessesary files and creating all parameters of CvCascadeClassifier inside my own code. I worked for create_scamples, so i guessed it should do for a quick haar cascade trainer.
void CTrainer::Train(CascadeTrainingParams params)
{
CvCascadeClassifier classifier;
CvCascadeParams cascadeParams;
CvCascadeBoostParams stageParams;
Ptr<CvFeatureParams> featureParams[] = { Ptr<CvFeatureParams>(new CvHaarFeatureParams),
Ptr<CvFeatureParams>(new CvLBPFeatureParams),
Ptr<CvFeatureParams>(new CvHOGFeatureParams)
};
cascadeParams.stageType = CvCascadeParams::BOOST;
cascadeParams.featureType = 0; //means Haar
cascadeParams.winSize = cv::Size(25,25);
stageParams.boost_type = cv::Boost::GENTLE;
stageParams.minHitRate = 0.999;
stageParams.maxFalseAlarm = 0.5;
stageParams.weight_trim_rate = 0.95;
stageParams.max_depth = 1;
stageParams.weak_count = 100;
CvHaarFeatureParams* pPar = ((CvHaarFeatureParams*)(CvFeatureParams*)featureParams[0]);
pPar->mode = CvHaarFeatureParams::BASIC;
bool bret = classifier.train(params.outputData, params.vecfile, params.bgfile, params.nPos, params.nNeg, params.nprecalcFeatureBufferSizeMB, params.nprecalcIdxBufferSizeMB, params.nStages, cascadeParams, *featureParams[0], stageParams);
TRACE(bret ? _T("Trained\n"): _T("Denied\n"));
}
but it always gets access violation at void CvCascadeBoostTrainData::precalculate() in parallel_for( BlockedRange(0, minNum), FeatureValAndIdxPrecalc(featureEvaluator, buf, &valCache, sample_count, is_buf_16u!=0) );
my builded utility (opencv_traincascade.exe) have access violation too.
Does any one have any ideas about this mess? People all over internet use this utility. This could not be a matter of poorly builded library (if it was the case, it simply wouldn't build).
Why, but just why, would you want to rebuilt (clone/copy) a working tool? But to answer, you screwed the memory management somewhere, and figuring out where exactly can be a huge challenge.