|
@@ -135,13 +135,27 @@ void MultiDataset::selectExamples ( const std::string & examples_command,
|
|
/** MultiDataset ------- constructor */
|
|
/** MultiDataset ------- constructor */
|
|
MultiDataset::MultiDataset( const Config *conf , LabeledSetFactory *pSetFactory)
|
|
MultiDataset::MultiDataset( const Config *conf , LabeledSetFactory *pSetFactory)
|
|
{
|
|
{
|
|
|
|
+ //read all blocks from our config file
|
|
std::set<string> blocks;
|
|
std::set<string> blocks;
|
|
conf->getAllBlocks ( blocks );
|
|
conf->getAllBlocks ( blocks );
|
|
|
|
+
|
|
|
|
+#ifdef DEBUG_MultiDataset
|
|
|
|
+ std::cerr << "found the following config blocks: " << std::endl;
|
|
|
|
+ for ( std::set<string>::const_iterator blockIt = blocks.begin(); blockIt != blocks.end(); blockIt++)
|
|
|
|
+ {
|
|
|
|
+ std::cerr << *blockIt << " ";
|
|
|
|
+ }
|
|
|
|
+ std::cerr << std::endl;
|
|
|
|
+#endif
|
|
|
|
|
|
lfl.setFactory( pSetFactory );
|
|
lfl.setFactory( pSetFactory );
|
|
|
|
|
|
|
|
+ //for every dataset (e.g., train and test), we store a single confog file
|
|
map<string, Config> dsconfs;
|
|
map<string, Config> dsconfs;
|
|
|
|
+ //for every dataset (e.g., train and test), we store the position of the file directory
|
|
map<string, string> dirs;
|
|
map<string, string> dirs;
|
|
|
|
+
|
|
|
|
+ //first of all, remove all blocks which do correspond to specified datasets, i.e., that do not contain a "dataset" entry
|
|
for ( set<string>::iterator i = blocks.begin();
|
|
for ( set<string>::iterator i = blocks.begin();
|
|
i != blocks.end(); )
|
|
i != blocks.end(); )
|
|
{
|
|
{
|
|
@@ -165,7 +179,17 @@ MultiDataset::MultiDataset( const Config *conf , LabeledSetFactory *pSetFactory)
|
|
i++;
|
|
i++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+#ifdef DEBUG_MultiDataset
|
|
|
|
+ std::cerr << "found the following datasets within all config blocks: " << std::endl;
|
|
|
|
+ for ( std::set<string>::const_iterator blockIt = blocks.begin(); blockIt != blocks.end(); blockIt++)
|
|
|
|
+ {
|
|
|
|
+ std::cerr << *blockIt << " ";
|
|
|
|
+ }
|
|
|
|
+ std::cerr << std::endl;
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
+ //is there a dataset specified that contains images for both, training and testing?
|
|
if ( blocks.find("traintest") != blocks.end() )
|
|
if ( blocks.find("traintest") != blocks.end() )
|
|
{
|
|
{
|
|
LabeledSet ls_base;
|
|
LabeledSet ls_base;
|
|
@@ -217,11 +241,13 @@ MultiDataset::MultiDataset( const Config *conf , LabeledSetFactory *pSetFactory)
|
|
datasets["train"] = ls_train;
|
|
datasets["train"] = ls_train;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //now read files for every specified dataset (e.g., train and test)
|
|
for ( set<string>::const_iterator i = blocks.begin();
|
|
for ( set<string>::const_iterator i = blocks.begin();
|
|
i != blocks.end();
|
|
i != blocks.end();
|
|
i++ )
|
|
i++ )
|
|
{
|
|
{
|
|
std::string name = *i;
|
|
std::string name = *i;
|
|
|
|
+ std::cerr << "read: " << name << std::endl;
|
|
if ( classnames.find(name) != classnames.end() )
|
|
if ( classnames.find(name) != classnames.end() )
|
|
continue;
|
|
continue;
|
|
|
|
|
|
@@ -254,8 +280,11 @@ MultiDataset::MultiDataset( const Config *conf , LabeledSetFactory *pSetFactory)
|
|
#endif
|
|
#endif
|
|
classnames[name].readFromConfig ( dsconfs[name], classselection );
|
|
classnames[name].readFromConfig ( dsconfs[name], classselection );
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+#ifdef DEBUG_MultiDataset
|
|
|
|
+ std::cerr << "we set up everything to read this dataset - so now call lfl.get" << std::endl;
|
|
|
|
+#endif
|
|
|
|
+
|
|
lfl.get ( dirs[name],
|
|
lfl.get ( dirs[name],
|
|
dsconfs[name],
|
|
dsconfs[name],
|
|
classnames[name],
|
|
classnames[name],
|
|
@@ -270,6 +299,10 @@ MultiDataset::MultiDataset( const Config *conf , LabeledSetFactory *pSetFactory)
|
|
fprintf (stderr, "MultiDataset: all information about %s set obtained ! (size %d)\n", name.c_str(), ls_base.count() );
|
|
fprintf (stderr, "MultiDataset: all information about %s set obtained ! (size %d)\n", name.c_str(), ls_base.count() );
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
+#ifdef DEBUG_MultiDataset
|
|
|
|
+ std::cerr << "we now call selectExamples to pick only a subset if desired" << std::endl;
|
|
|
|
+#endif
|
|
|
|
+
|
|
std::string examples = conf->gS(name, "examples", "all *" );
|
|
std::string examples = conf->gS(name, "examples", "all *" );
|
|
selectExamples ( examples, ls_base, ls, dummy, classnames[name] );
|
|
selectExamples ( examples, ls_base, ls, dummy, classnames[name] );
|
|
|
|
|