fixes for soft cascade training app
This commit is contained in:
@@ -69,6 +69,7 @@ void sft::Config::write(cv::FileStorage& fs) const
|
||||
<< "outXmlPath" << outXmlPath
|
||||
|
||||
<< "seed" << seed
|
||||
<< "featureType" << featureType
|
||||
<< "}";
|
||||
}
|
||||
|
||||
@@ -99,6 +100,7 @@ void sft::Config::read(const cv::FileNode& node)
|
||||
outXmlPath = (std::string)node["outXmlPath"];
|
||||
|
||||
seed = (int)node["seed"];
|
||||
featureType = (std::string)node["featureType"];
|
||||
}
|
||||
|
||||
void sft::write(cv::FileStorage& fs, const string&, const Config& x)
|
||||
@@ -153,7 +155,8 @@ std::ostream& sft::operator<<(std::ostream& out, const Config& m)
|
||||
|
||||
<< std::setw(14) << std::left << "cascadeName" << m.cascadeName << std::endl
|
||||
<< std::setw(14) << std::left << "outXmlPath" << m.outXmlPath << std::endl
|
||||
<< std::setw(14) << std::left << "seed" << m.seed << std::endl;
|
||||
<< std::setw(14) << std::left << "seed" << m.seed << std::endl
|
||||
<< std::setw(14) << std::left << "featureType" << m.featureType << std::endl;
|
||||
|
||||
return out;
|
||||
}
|
@@ -121,6 +121,9 @@ struct Config
|
||||
// seed for random generation
|
||||
int seed;
|
||||
|
||||
// channel feature type
|
||||
string featureType;
|
||||
|
||||
// // bounding rectangle for actual example into example window
|
||||
// cv::Rect exampleWindow;
|
||||
};
|
||||
|
@@ -104,7 +104,7 @@ int main(int argc, char** argv)
|
||||
fso << cfg.cascadeName
|
||||
<< "{"
|
||||
<< "stageType" << "BOOST"
|
||||
<< "featureType" << "ICF"
|
||||
<< "featureType" << cfg.featureType
|
||||
<< "octavesNum" << (int)cfg.octaves.size()
|
||||
<< "width" << cfg.modelWinSize.width
|
||||
<< "height" << cfg.modelWinSize.height
|
||||
@@ -118,7 +118,12 @@ int main(int argc, char** argv)
|
||||
int nfeatures = cfg.poolSize;
|
||||
cv::Size model = cfg.model(it);
|
||||
std::cout << "Model " << model << std::endl;
|
||||
cv::Ptr<cv::FeaturePool> pool = cv::FeaturePool::create(model, nfeatures);
|
||||
|
||||
int nchannels = (cfg.featureType == "HOG6MagLuv") ? 10: 8;
|
||||
|
||||
std::cout << "number of feature channels is " << nchannels << std::endl;
|
||||
|
||||
cv::Ptr<cv::FeaturePool> pool = cv::FeaturePool::create(model, nfeatures, nchannels);
|
||||
nfeatures = pool->size();
|
||||
|
||||
|
||||
@@ -130,7 +135,9 @@ int main(int argc, char** argv)
|
||||
|
||||
typedef cv::Octave Octave;
|
||||
|
||||
cv::Ptr<Octave> boost = Octave::create(boundingBox, npositives, nnegatives, *it, shrinkage, nfeatures);
|
||||
cv::Ptr<cv::ChannelFeatureBuilder> builder = cv::ChannelFeatureBuilder::create(cfg.featureType);
|
||||
std::cout << "Channel builder " << builder->info()->name() << std::endl;
|
||||
cv::Ptr<Octave> boost = Octave::create(boundingBox, npositives, nnegatives, *it, shrinkage, nfeatures, builder);
|
||||
|
||||
std::string path = cfg.trainPath;
|
||||
sft::ScaledDataset dataset(path, *it);
|
||||
|
@@ -137,7 +137,7 @@ BoostedSoftCascadeOctave::BoostedSoftCascadeOctave(cv::Rect bb, int np, int nn,
|
||||
int w = boundingBox.width;
|
||||
int h = boundingBox.height;
|
||||
|
||||
integrals.create(poolSize, (w / shrinkage + 1) * (h / shrinkage * 10 + 1), CV_32SC1);
|
||||
integrals.create(poolSize, (w / shrinkage + 1) * (h / shrinkage * builder->totalChannels() + 1), CV_32SC1);
|
||||
}
|
||||
|
||||
BoostedSoftCascadeOctave::~BoostedSoftCascadeOctave(){}
|
||||
|
Reference in New Issue
Block a user