Commit ede33148 authored by Guillaume Pasero's avatar Guillaume Pasero

Merge branch 'detect-empty-samples' into 'develop'

BUG: #1582: detect empty training data

See merge request !232
parents b3cb60bd 9566e26b
......@@ -334,12 +334,17 @@ private:
std::string outputBase = outputPath.substr(0, outputPath.find_last_of('.'));
std::string outputExt = outputPath.substr(outputPath.find_last_of('.'), std::string::npos);
unsigned int overflowCount = 0;
bool noSamples=true;
for (unsigned int i=0 ; i<nbInputs ; i++ )
{
// Print results
oss.str(std::string(""));
oss << " className requiredSamples totalSamples rate" << std::endl;
oss << " className requiredSamples totalSamples rate\n";
MapRateType rates = m_CalculatorList->GetRatesByClass(i);
if(!rates.empty())
{
noSamples = false;
}
MapRateType::const_iterator itRates = rates.begin();
for(; itRates != rates.end(); ++itRates)
{
......@@ -358,6 +363,10 @@ private:
oss << outputBase << "_" << i+1 << outputExt;
m_CalculatorList->GetNthElement(i)->Write(oss.str());
}
if (noSamples)
{
otbAppLogFATAL("No samples found in the inputs!");
}
if (overflowCount)
{
std::string plural(overflowCount>1?"s":"");
......
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