Commit a89299ac authored by marina.kolpakova's avatar marina.kolpakova

store result to xml.

parent bfa26fd4
...@@ -73,6 +73,13 @@ struct Config ...@@ -73,6 +73,13 @@ struct Config
cvRound(modelWinSize.width * octave), cvRound(modelWinSize.height * octave)); cvRound(modelWinSize.width * octave), cvRound(modelWinSize.height * octave));
} }
string resPath(ivector::const_iterator it) const
{
char s[65];
sprintf(s, "%d", *it);
return std::string(cascadeName) + s + ".xml";
}
// Paths to a rescaled data // Paths to a rescaled data
string trainPath; string trainPath;
string testPath; string testPath;
......
...@@ -129,6 +129,7 @@ public: ...@@ -129,6 +129,7 @@ public:
virtual ~Octave(); virtual ~Octave();
virtual bool train(const Dataset& dataset, const FeaturePool& pool, int weaks, int treeDepth); virtual bool train(const Dataset& dataset, const FeaturePool& pool, int weaks, int treeDepth);
virtual void write( CvFileStorage* fs, string name) const;
int logScale; int logScale;
......
...@@ -297,6 +297,11 @@ bool sft::Octave::train(const Dataset& dataset, const FeaturePool& pool, int wea ...@@ -297,6 +297,11 @@ bool sft::Octave::train(const Dataset& dataset, const FeaturePool& pool, int wea
} }
void sft::Octave::write( CvFileStorage* fs, string name) const
{
CvBoost::write(fs, name.c_str());
}
// ========= FeaturePool ========= // // ========= FeaturePool ========= //
sft::FeaturePool::FeaturePool(cv::Size m, int n) : model(m), nfeatures(n) sft::FeaturePool::FeaturePool(cv::Size m, int n) : model(m), nfeatures(n)
{ {
......
...@@ -46,6 +46,8 @@ ...@@ -46,6 +46,8 @@
#include <sft/octave.hpp> #include <sft/octave.hpp>
#include <sft/config.hpp> #include <sft/config.hpp>
#include <opencv2/core/core_c.h>
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
using namespace sft; using namespace sft;
...@@ -128,7 +130,10 @@ int main(int argc, char** argv) ...@@ -128,7 +130,10 @@ int main(int argc, char** argv)
if (boost.train(dataset, pool, cfg.weaks, cfg.treeDepth)) if (boost.train(dataset, pool, cfg.weaks, cfg.treeDepth))
{ {
std::cout << "Octave " << *it << " was successfully trained..." << std::endl; std::cout << "Octave " << *it << " was successfully trained..." << std::endl;
CvFileStorage* fout = cvOpenFileStorage(cfg.resPath(it).c_str(), 0, CV_STORAGE_WRITE);
boost.write(fout, cfg.cascadeName);
// strong.push_back(octave); // strong.push_back(octave);
cvReleaseFileStorage( &fout);
} }
} }
......
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