void AppendDataFunctor::operator()(const TrainingData::meta_datum_t &metaDatum, const TrainingData::integral_channels_t &integralImage) { if(datumIndex >= dataStore->getMaxNumExamples()) { throw std::runtime_error("AppendDataFunctor::operator() has been called " "more times than the data store memory allocation allows"); } dataStore->setDatum(datumIndex, metaDatum, integralImage); datumIndex += 1; return; }
AppendDataFunctor::AppendDataFunctor(TrainingData::shared_ptr dataStore_) : datumIndex(dataStore_->getNumExamples()), dataStore(dataStore_) { // nothing to do here return; }
void calcMinMaxFeatureResponses(TrainingData::shared_ptr trainData, MinOrMaxFeaturesResponsesSharedPointer minvs, MinOrMaxFeaturesResponsesSharedPointer maxvs){ const FeaturesResponses &featuresResponses = trainData->getFeatureResponses(); for (size_t featureIndex = 0; featureIndex < trainData->getFeaturesPoolSize(); ++featureIndex) { if (trainData->_validFeatures[featureIndex] == false) continue; int minv = std::numeric_limits<int>::max(); int maxv = -std::numeric_limits<int>::max(); for (size_t exampleIndex = 0; exampleIndex < trainData->getNumExamples(); ++exampleIndex) { const int val = featuresResponses[featureIndex][exampleIndex]; minv = std::min(val, minv); maxv = std::max(val, maxv); } // end of "for each example" (*maxvs)[featureIndex] = maxv; (*minvs)[featureIndex] = minv; } // end of "for each feature" }