Correct format for 'field names for training features' using TrainVectorClassifier

Hi,

I am trying to use the TrainVectorClassifier tool in OTB toolbox using QGIS, to train my classifier, before applying the classifier to a complete segmentation of the image.

I am running into the following error, which seems to be related to the format that I am entering the field names:

(FATAL): itk::ERROR: ListViewParameter(0000023D23F80210): Value meanB0, meanB1, meanB2 not found in the list of choices: label, nbPixels, meanB0, meanB1, meanB2, meanB3, meanB4, meanB5, meanB6, meanB7, meanB8, varB0, varB1, varB2, varB3, varB4, varB5, varB6, varB7, varB8, CLASS.

I am not sure what the correct format is when typing the list of fieldnames? To use quotes for strings, or returns like a list format?

So far, the tool has only run successfully if I simply enter one value, such as:
meanB0

When I try to add more field names, in any format, the tool fails.
E.g. meanB0, meanB1, etc.
Or
meanB0
meanB1
etc.

Please could someone advise if this issue is known, or how to fix it?
I have Googled the error and found a few reports of the same error, but could not find the solution.

Many many thanks in advance for your help,
Jen

Hello,

For me it works when I put quotes around the list : “meanB0 meanB1 meanB2”.

(I am using QGIS 3.0, otb develop branch, and qgis-otb-plugin master branch)

This is not a very elegant way to handle parameter list thought…

Cédric

Hi Cédric,

Thanks very much! The algorithm runs successfully with that format.

Regards,
Jen

Hi, Jennifer!

I have the same problem. However, I am typing the correct form.

“TrainVectorClassifier: itk::ERROR: ListViewParameter(0000024E574FB340): Value tex_0, tex_1, tex_2, tex_3, tex_4, tex_5, tex_6, tex_7 not found in the list of choices: id, cl, originfid, tex_0, tex_1, tex_2, tex_3, tex_4, tex_5, tex_6, tex_7.”

Looking at the logs, it looks like you separated values with commas. In your case the correct formatting should be :

"tex_0 tex_1 tex_2 tex_3 tex_4 tex_5 tex_6 tex_7"

Is it what you wrote ?

Cédric

Hi!

It’s in this format. But the error continues

Hello,

I am very late to this, however I am having the same issue. I am putting the details in in the following format:

“mean_0 stdev_0 min_0 max_0 mean_1 stdev_1 min_1 max_1 mean_2 stdev_2 min_2 max_2 mean_3 stdev_3 min_3 max_3”

However I just get the following error:

‘2021-12-02 16:51:41 (FATAL) TrainVectorClassifier: itk::ERROR: ListViewParameter(00000261B91DA510): Value mean_0 not found in the list of choices: .’

Does anyone know why this might be?
Any help would be greatly appreciated.

Hello @Warburt4 ,

which OTB version are you using ?

The error message

Value mean_0 not found in the list of choices: .

means that the application did not find any field with a compatible type in the input vector, i.e:

  • OFTInteger, OFTInteger64 or OFTReal for the features
  • OFTString, OFTInteger, OFTInteger64, OFTReal for the class

are the fields of your input vector stored in one of these types ?

Cédric

Hello,

This is what type my data is showing:

How do I go about making them compatible?

Thanks,
Ellie

Hello,

I don’t see what’s wrong with this vector data. Can you tell me which version of OTB are you using ? I will try to reproduce your test case. Is the input vector the output of the ZonalStatistics application ? (just guessing looking at the field names)

Cédric

1 Like

Hello,

Yes, I thought they were in the correct format. I am using version OTB 7.4.0 I believe. The input vector is a shapefile of selected features from the zonal statistics application output (training sites that I have selected).

Thank you very much.

Ellie

Hello @Warburt4,

sorry I forgot about this thread.

I don’t understand why the TrainVectorClassifier fails, as the field types look correct. I just tried to run Segmentation, ZonalStatistics and TrainVectorClassifier and had no problem selecting the fields.

Something you can try is to run the mapla program (it can be found in your OTB installation folder). This is a GUI for OTB applications. From there you can launch the TrainVectorClassifier and open the vector data. If everything works correctly the available fields should be updated automatically and Mapla should display something like:

Whether or not the fields appear can help us identify if the problem comes from the OTB QGIS plugin, or from OTB itself.

It would help me investigate this if you can provide me with the following informations:

  • The vector data format you are using. I tested with shapefiles, but maybe your issue is specific to certain formats ?
  • The QGIS version you are using. The handling of vector data fields has recently changed in the OTB QGIS plugin. But I don’t think this is the cause of your problem as I tested with both an old QGIS and the development version.
  • If that’s possible, can you provide the vector data you are using, or a subset of it, so I can reproduce the bug by myself ?

Cédric

A try a OBIA classification with RF algorithm. But a found the same @Warburt4´s problem:

Value b1_0 not found in the list of choices: .

The ZonalStatistics from QGIS result in layer with codification win-1254 . ZonalStatistics from OTB result in ISO 8859-1. I dont know whats happen. Why attribute column is not recognized by the training & classificacion routines.

I’ve past this issus by changing my field TYPE FROM REAL TO INTEGER and creating a new GPKG with THE REPAIR GEOMETRY TOOL.

In OTB8.0 the only way to determine the Field names for training features is by checking the boxes of each field retrieved from the training file. There is no text field available for typing the correct syntax of the list of field names. I’m getting the same fatal error:

2022-04-05 09:44:45 (FATAL) TrainVectorClassifier: itk::ERROR: FieldParameter(0x25ad820): Value ['b1_stdev', 'b2_stdev'] not found in the list of choices: DN, b1_sum, b1_mean, b1_median, b1_stdev, b1_min, b1_max, b1_varianc, b2_sum, b2_mean, b2_median, b2_stdev, b2_min, b2_max, b2_varianc, Classe.

image

With current Qgis master and OTB-8.0.1 for Linux I fail to reproduce the current issue. Could you please share with me a sample dataset and details how you configure your treatment ?

What version of QGIS do you use?