Commit 4d99cea2 authored by Cresson Remi's avatar Cresson Remi
Browse files

ENH: fix bug with nodata

parent e3494494
......@@ -197,8 +197,14 @@ public:
SamplerType::Pointer sampler = SamplerType::New();
sampler->SetInputVectorData(GetParameterVectorData("vec"));
sampler->SetField(GetParameterAsString("field"));
sampler->SetRejectPatchesWithNodata(GetParameterInt("usenodata")==1);
sampler->SetNodataValue(GetParameterFloat("nodataval"));
if (GetParameterInt("usenodata")==1)
{
otbAppLogINFO("Rejecting samples that have at least one no-data value");
sampler->SetRejectPatchesWithNodata(true);
float ndval = GetParameterFloat("nodataval");
otbAppLogINFO("No-data value: " << ndval);
sampler->SetNodataValue(ndval);
}
for (auto& bundle: m_Bundles)
{
sampler->PushBackInputWithPatchSize(bundle.m_ImageSource.Get(), bundle.m_PatchSize);
......
......@@ -20,6 +20,10 @@ template <class TInputImage, class TVectorData>
TensorflowSampler<TInputImage, TVectorData>
::TensorflowSampler()
{
m_NumberOfAcceptedSamples = 0;
m_NumberOfRejectedSamples = 0;
m_RejectPatchesWithNodata = false;
m_NodataValue = 0;
}
template <class TInputImage, class TVectorData>
......@@ -199,7 +203,7 @@ TensorflowSampler<TInputImage, TVectorData>
hasBeenSampled = false;
break;
}
if (hasBeenSampled)
if (!hasBeenSampled)
break;
}
......
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