# TrainImagesClassifier: ERROR

**URL:** <https://forum.orfeo-toolbox.org/t/trainimagesclassifier-error/542>\
**Category:** OTB Usage\
**Created:** [January 28, 2020, 12:33am UTC](https://forum.orfeo-toolbox.org/t/trainimagesclassifier-error/542 "2020-01-28T00:33:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pedromspereira](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/p/a9adbd/32.png) [@pedromspereira](https://forum.orfeo-toolbox.org/u/pedromspereira)\
**Post date:** [January 28, 2020, 12:33am UTC](https://forum.orfeo-toolbox.org/t/trainimagesclassifier-error/542/1 "2020-01-28T00:33:20Z")

</div>

Hello,

I am trying to use OTB to run a image classification, but the algorithm fails at:

(FATAL) TrainImagesClassifier: itk::ERROR: StatisticsXMLFileReader(000001CBDFD81DA0): is a wrong Extension FileName : Expected .xml

here’s the full log:

Versão do QGIS: 3.10.1-A Coruña  
Código de revisão do QGIS: ef24c526da  
Versão do Qt: 5.11.2  
Versão do GDAL: 3.0.2  
Versão do GEOS: 3.8.0-CAPI-1.13.1  
Versão do PROJ: Rel. 6.2.1, November 1st, 2019  
Algoritmo de processamento…  
Algoritmo ‘TrainImagesClassifier’ iniciando…  
Entrada de parâmetros:  
{ ‘io.il’ : [‘G:/Oceanauta/001\_Projetos\_Orçamentos/004\_2019/002\_Projetos\_2019/Aguas de sauipe/ortofoto/Aguas-Sauipe\_transparent\_mosaic\_group1.tif’], ‘io.vd’ : [‘G:/Oceanauta/001\_Projetos\_Orçamentos/004\_2019/002\_Projetos\_2019/Aguas de sauipe/ortofoto/training\_set.shp’], ‘io.valid’ : ‘’, ‘io.imstat’ : ‘C:\Users\pedro\OneDrive\Área de Trabalho\stats.xml’, ‘io.out’ : ‘C:/Users/pedro/OneDrive/Área de Trabalho/output.model’, ‘io.confmatout’ : ‘C:/Users/pedro/OneDrive/Área de Trabalho/confusion.csv’, ‘cleanup’ : True, ‘sample.mt’ : 1000, ‘sample.mv’ : 1000, ‘sample.bm’ : 1, ‘sample.vtr’ : 0.5, ‘sample.vfn’ : ‘LABEL’, ‘elev.dem’ : ‘’, ‘elev.geoid’ : ‘’, ‘elev.default’ : 0, ‘classifier’ : ‘libsvm’, ‘classifier.libsvm.k’ : ‘rbf’, ‘classifier.libsvm.m’ : ‘csvc’, ‘classifier.libsvm.c’ : 1, ‘classifier.libsvm.nu’ : 0.5, ‘classifier.libsvm.opt’ : False, ‘classifier.libsvm.prob’ : False, ‘classifier.sharkkm.centroids.in’ : ‘random’, ‘classifier.sharkkm.centroids.stats’ : ‘’, ‘classifier.sharkkm.centroids.out’ : ‘C:/Users/pedro/OneDrive/Área de Trabalho/centroids.txt’, ‘rand’ : 0 }  
WARNING: Parameter -classifier.sharkkm.centroids.in will be ignored because -classifier is libsvm.  
WARNING: Parameter -classifier.sharkkm.centroids.out will be ignored because -classifier is libsvm.  
2020-01-27 20:04:52 (INFO) TrainImagesClassifier: Default RAM limit for OTB is 256 MB  
2020-01-27 20:04:52 (INFO) TrainImagesClassifier: GDAL maximum cache size is 1628 MB  
2020-01-27 20:04:52 (INFO) TrainImagesClassifier: OTB will use at most 12 threads  
2020-01-27 20:04:52 (INFO) TrainImagesClassifier: Polygon analysis…  
2020-01-27 20:04:52 (INFO) TrainImagesClassifier: Elevation management: setting default height above ellipsoid to 0 meters  
2020-01-27 20:04:52 (INFO): Estimated memory for full processing: 188097MB (avail.: 256 MB), optimal image partitioning: 735 blocks  
2020-01-27 20:04:52 (INFO): Estimation will be performed in 735 blocks of 72389x116 pixels  
Analyze polygons…: 100% [**] (2s)  
2020-01-27 20:04:54 (INFO) TrainImagesClassifier: Sampling rates…  
2020-01-27 20:04:54 (INFO) TrainImagesClassifier: Sampling strategy : fit the number of samples based on the smallest class  
2020-01-27 20:04:54 (INFO) TrainImagesClassifier: Sampling rates for image 1 : className requiredSamples totalSamples rate  
10 29074 418745 0.0694313  
20 29074 763391 0.0380853  
30 29074 56101 0.518244  
40 29074 29074 1  
50 29074 114194 0.254602  
60 29074 481561 0.0603745  
2020-01-27 20:04:54 (INFO) TrainImagesClassifier: Sample selection…  
2020-01-27 20:04:54 (INFO) TrainImagesClassifier: Elevation management: setting default height above ellipsoid to 0 meters  
2020-01-27 20:04:54 (INFO) TrainImagesClassifier: Sampling strategy : set number of samples for each class  
2020-01-27 20:04:54 (INFO) TrainImagesClassifier: Sampling rates : className requiredSamples totalSamples rate  
10 29074 418745 0.0694313  
20 29074 763391 0.0380853  
30 29074 56101 0.518244  
40 29074 29074 1  
50 29074 114194 0.254602  
60 29074 481561 0.0603745  
2020-01-27 20:04:54 (INFO): Estimated memory for full processing: 188097MB (avail.: 256 MB), optimal image partitioning: 735 blocks  
2020-01-27 20:04:54 (INFO): Estimation will be performed in 750 blocks of 2896x2896 pixels  
Selecting positions with periodic sampler…: 100% [**] (6s)  
2020-01-27 20:05:00 (INFO) TrainImagesClassifier: Sample extraction…  
2020-01-27 20:05:05 (INFO): Estimated memory for full processing: 282145MB (avail.: 256 MB), optimal image partitioning: 1103 blocks  
2020-01-27 20:05:05 (INFO): Estimation will be performed in 1092 blocks of 72389x78 pixels  
Extracting sample values…: 100% [**] (6m 40s)  
2020-01-27 20:11:46 (INFO): Estimated memory for full processing: 188097MB (avail.: 256 MB), optimal image partitioning: 735 blocks  
2020-01-27 20:11:46 (INFO): Estimation will be performed in 750 blocks of 2896x2896 pixels  
Split samples between training and validation…: 100% [**] (47s)  
2020-01-27 20:12:34 (INFO) TrainImagesClassifier: Model training…  
2020-01-27 20:12:34 (FATAL) TrainImagesClassifier: itk::ERROR: StatisticsXMLFileReader(000001CBDFD81DA0): is a wrong Extension FileName : Expected .xml  
Tarefa executada em 464.62 segundos  
Resultados:  
{‘classifier.sharkkm.centroids.out’: 'C:/Users/pedro/OneDrive/Área de ’  
‘Trabalho/centroids.txt’,  
‘io.confmatout’: ‘C:/Users/pedro/OneDrive/Área de Trabalho/confusion.csv’,  
‘io.out’: ‘C:/Users/pedro/OneDrive/Área de Trabalho/output.model’}

---

<div class="post-metadata">

**Author:** ![remi.cresson](https://forum.orfeo-toolbox.org/user_avatar/forum.orfeo-toolbox.org/remi.cresson/32/1270_2.png) [@remi.cresson](https://forum.orfeo-toolbox.org/u/remi.cresson)\
**Post date:** [January 29, 2020, 7:42am UTC](https://forum.orfeo-toolbox.org/t/trainimagesclassifier-error/542/2 "2020-01-29T07:42:14Z")

</div>

Hi Pedro,  
It looks like the application can not read the stats.xml.  
Maybe its related to the path of the file: can you retry in avoiding special characters and spaces in paths ? (“Área de Trabalho”–\>“area\_de\_trabalho”)
