diff --git a/Modules/Applications/AppClassification/include/otbTrainSharkKMeans.hxx b/Modules/Applications/AppClassification/include/otbTrainSharkKMeans.hxx
index d56a83c81552a319ccf26195f318c0e5a5948022..872391ee73f28bf6633958d0c0ed1d9670871177 100644
--- a/Modules/Applications/AppClassification/include/otbTrainSharkKMeans.hxx
+++ b/Modules/Applications/AppClassification/include/otbTrainSharkKMeans.hxx
@@ -111,6 +111,10 @@ void LearningApplicationBase<TInputValue, TOutputValue>::TrainSharkKMeans(
       shark::Normalizer<> normalizer(scaleRV, offsetRV);
       centroidData = normalizer(centroidData);
     }
+
+    if (centroidData.numberOfElements() != k)
+      otbAppLogWARNING( "The input centroid file will not be used because it contains " << centroidData.numberOfElements() <<
+      " points, which is different than from the requested number of class: " << k <<".");
     
     classifier->SetCentroidsFromData( centroidData);
   }