Commit 4daea35f authored by Guillaume Pasero's avatar Guillaume Pasero

BUG: fix hazardous label counting

parent 7e7ea1b5
......@@ -111,6 +111,7 @@ public:
typedef typename ModelType::TargetSampleType TargetSampleType;
typedef typename ModelType::TargetListSampleType TargetListSampleType;
typedef typename ModelType::TargetValueType TargetValueType;
#ifdef OTB_USE_OPENCV
typedef otb::RandomForestsMachineLearningModel<InputValueType, OutputValueType> RandomForestType;
......
......@@ -168,16 +168,14 @@ LearningApplicationBase<TInputValue,TOutputValue>
}
else
{
TargetSampleType currentLabel = 0, prevLabel = 0;
std::set<TargetValueType> labelSet;
TargetSampleType currentLabel;
for (unsigned int itLab = 0; itLab < trainingLabeledListSample->Size(); ++itLab)
{
currentLabel = trainingLabeledListSample->GetMeasurementVector(itLab);
if ((currentLabel != prevLabel) || (itLab == 0))
{
++nbClasses;
}
prevLabel = currentLabel;
labelSet.insert(currentLabel[0]);
}
nbClasses = labelSet.size();
layerSizes.push_back(nbClasses);
}
......
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