diff --git a/Code/Learning/otbListSampleGenerator.h b/Code/Learning/otbListSampleGenerator.h
index cad4d03f5e635aa388ac14a75898c5e48bab573f..a49c4d05b204984af2d991ac185675709e275deb 100644
--- a/Code/Learning/otbListSampleGenerator.h
+++ b/Code/Learning/otbListSampleGenerator.h
@@ -169,7 +169,6 @@ private:
   bool           m_PolygonEdgeInclusion; // if true take into consideration pixel which are on polygon edge
                                            //  useful, when dealing with small polygon area (1 or two pixels)
                                            // false by default
-  unsigned short m_NumberOfClasses;
   std::string    m_ClassKey;
   double         m_ClassMinSize;
 
diff --git a/Code/Learning/otbListSampleGenerator.txx b/Code/Learning/otbListSampleGenerator.txx
index 913711ad6fb0d26390988025eddd91074959ad98..1a0bd4b1f846d54475362c13edc9fad668ce1b6e 100644
--- a/Code/Learning/otbListSampleGenerator.txx
+++ b/Code/Learning/otbListSampleGenerator.txx
@@ -65,7 +65,6 @@ ListSampleGenerator<TImage, TVectorData>
   m_MaxValidationSize(-1),
   m_ValidationTrainingProportion(0.0),
   m_PolygonEdgeInclusion(false),
-  m_NumberOfClasses(0),
   m_ClassKey("Class"),
   m_ClassMinSize(-1)
 {
@@ -280,13 +279,11 @@ ListSampleGenerator<TImage, TVectorData>
       }
 
     m_ClassMinSize = minSize;
-    m_NumberOfClasses = m_ClassesSize.size();
     }
   else
     {
     otbWarningMacro("no polygon found");
     m_ClassMinSize = 0;
-    m_NumberOfClasses = 0;
     }
 }