What is "User defined input centroids"?

I’m triing to follow this video https://www.youtube.com/watch?v=ufSQ2SgSIV4 to perform image classification but I’m having problems because there is newer version of Orfeo installed on my PC and there are some new fields added. When I try to use TrainImagesClassifier I get error “Wrong or missing paremeter: User defined input centroids”. I left this field empty because I don’t know what shout I put there. In video that I follow that field doesn’t exist.
Does anyone can help me? What should I do to make this correctly?

I have same problem. In Object-based classification, TrainVectorClassifer requests text file of centroids, but the format is not clear for me. I appreciate it if someone would indicate a sample text of centroids for input.

Copy paste of my answer in this post :

Hello,

I’m assuming you are using OTB through QGIS, as I can only reproduce your produce using the QGIS plugin.

I think this is a bug, this parameter should only be available when using the kmeans algorithm (the result of this algorithm are dependent on the initial centroids) and should not be mandatory anyway. I will make a fix in OTB. In the meantime you have two workaround :

  1. Set a value to the “User definied input centroids” (any string will work). The application should start correctly, and the parameter will be ignored, you should have the following log :
WARNING: Parameter -classifier.sharkkm.centroids.in will be ignored because -classifier is libsvm.
  1. Use another wrapper (monteverdi, command line, python …). I think this bug only applies on the QGIS plugin.

Hope that helps,
Cédric

I still don’t get any output. I should get model and confusion matrix that is going to be used for image classification but nothing happens. When I click “Run” window just closes and there is no output in folder where it sholuld be. What is the problem?

Are you able to run any OTB application ? Even the most simple ones (e.g. Smoothing).

Which version of the pluging are you using (looking at your screenshot, it seems that you are using an old version of the plugin).

Cédric

Smoothing is working okay, I get output like I should but classification is not working.
Now I installed the most recent version of QGIS 3.10 and still I get some errors like this:

These are options I choose before running algorithm :

Hi! I am having the same problem. Did you manage to solve it? Is it a bug for the OTB-QGIS plugin?
Thanks

Hi Clau,
Yes, a bug has been reported (https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/issues/2002) and an OTB 7.1 will soon be released : it will correct this bug.
For the moment, you can fix a value that will be ignored if the classifier does not need it.

Hope that helps ! Best regards,

Yannick

Hi Yannick,

Thank you so much for the answer. Yes, I noticed that as soon as you give anything to the Centroids tab, the classifiers works (ignoring it).

Best
Claudia

Ce bug a été corrigé dans la version 7.1.