Commit 385f69a1 authored by Jordi Inglada's avatar Jordi Inglada

BUG: check for the coherence of sizes of probas in the batch case

parent c04a826d
...@@ -340,7 +340,13 @@ ImageClassificationFilter<TInputImage, TOutputImage, TMaskImage> ...@@ -340,7 +340,13 @@ ImageClassificationFilter<TInputImage, TOutputImage, TMaskImage>
} }
if(computeProbaMap) if(computeProbaMap)
{ {
probaValues = probas->GetMeasurementVector(labIt.GetInstanceIdentifier()); //The probas may have different size than the m_NumberOfClasses set by the user
auto tempProbaValues = probas->GetMeasurementVector(labIt.GetInstanceIdentifier());
for(auto i=0; i<m_NumberOfClasses; ++i)
{
if(i<tempProbaValues.Size()) probaValues[i] = tempProbaValues[i];
else probaValues[i] = 0;
}
} }
++labIt; ++labIt;
} }
......
...@@ -137,7 +137,6 @@ SharkRandomForestsMachineLearningModel<TInputValue,TOutputValue> ...@@ -137,7 +137,6 @@ SharkRandomForestsMachineLearningModel<TInputValue,TOutputValue>
} }
if (proba != nullptr) if (proba != nullptr)
{ {
ProbaSampleType prob{static_cast<unsigned int>(probas.size())};
for(size_t i =0; i< probas.size();i++) for(size_t i =0; i< probas.size();i++)
{ {
//probas contain the N class probability indexed between 0 and N-1 //probas contain the N class probability indexed between 0 and N-1
......
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