Commit 1bf696f3 authored by marina.kolpakova's avatar marina.kolpakova

fixes for soft cascade training app

parent 445f39a4
...@@ -69,6 +69,7 @@ void sft::Config::write(cv::FileStorage& fs) const ...@@ -69,6 +69,7 @@ void sft::Config::write(cv::FileStorage& fs) const
<< "outXmlPath" << outXmlPath << "outXmlPath" << outXmlPath
<< "seed" << seed << "seed" << seed
<< "featureType" << featureType
<< "}"; << "}";
} }
...@@ -99,6 +100,7 @@ void sft::Config::read(const cv::FileNode& node) ...@@ -99,6 +100,7 @@ void sft::Config::read(const cv::FileNode& node)
outXmlPath = (std::string)node["outXmlPath"]; outXmlPath = (std::string)node["outXmlPath"];
seed = (int)node["seed"]; seed = (int)node["seed"];
featureType = (std::string)node["featureType"];
} }
void sft::write(cv::FileStorage& fs, const string&, const Config& x) 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) ...@@ -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 << "cascadeName" << m.cascadeName << std::endl
<< std::setw(14) << std::left << "outXmlPath" << m.outXmlPath << 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; return out;
} }
\ No newline at end of file
...@@ -121,6 +121,9 @@ struct Config ...@@ -121,6 +121,9 @@ struct Config
// seed for random generation // seed for random generation
int seed; int seed;
// channel feature type
string featureType;
// // bounding rectangle for actual example into example window // // bounding rectangle for actual example into example window
// cv::Rect exampleWindow; // cv::Rect exampleWindow;
}; };
......
...@@ -104,7 +104,7 @@ int main(int argc, char** argv) ...@@ -104,7 +104,7 @@ int main(int argc, char** argv)
fso << cfg.cascadeName fso << cfg.cascadeName
<< "{" << "{"
<< "stageType" << "BOOST" << "stageType" << "BOOST"
<< "featureType" << "ICF" << "featureType" << cfg.featureType
<< "octavesNum" << (int)cfg.octaves.size() << "octavesNum" << (int)cfg.octaves.size()
<< "width" << cfg.modelWinSize.width << "width" << cfg.modelWinSize.width
<< "height" << cfg.modelWinSize.height << "height" << cfg.modelWinSize.height
...@@ -118,7 +118,12 @@ int main(int argc, char** argv) ...@@ -118,7 +118,12 @@ int main(int argc, char** argv)
int nfeatures = cfg.poolSize; int nfeatures = cfg.poolSize;
cv::Size model = cfg.model(it); cv::Size model = cfg.model(it);
std::cout << "Model " << model << std::endl; 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(); nfeatures = pool->size();
...@@ -130,7 +135,9 @@ int main(int argc, char** argv) ...@@ -130,7 +135,9 @@ int main(int argc, char** argv)
typedef cv::Octave Octave; 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; std::string path = cfg.trainPath;
sft::ScaledDataset dataset(path, *it); sft::ScaledDataset dataset(path, *it);
......
...@@ -137,7 +137,7 @@ BoostedSoftCascadeOctave::BoostedSoftCascadeOctave(cv::Rect bb, int np, int nn, ...@@ -137,7 +137,7 @@ BoostedSoftCascadeOctave::BoostedSoftCascadeOctave(cv::Rect bb, int np, int nn,
int w = boundingBox.width; int w = boundingBox.width;
int h = boundingBox.height; 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(){} BoostedSoftCascadeOctave::~BoostedSoftCascadeOctave(){}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment