Commit 77238ec3 authored by Guillaume Pasero's avatar Guillaume Pasero

BUG: #1582: detect empty training data

parent 50254d3c
......@@ -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;
MapRateType rates = m_CalculatorList->GetRatesByClass(i);
if(rates.size())
{
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