# Vector Classifier

**URL:** <https://forum.orfeo-toolbox.org/t/vector-classifier/1112>\
**Category:** OTB Usage\
**Created:** [July 14, 2021, 6:59pm UTC](https://forum.orfeo-toolbox.org/t/vector-classifier/1112 "2021-07-14T18:59:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Treasurepeace1](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/t/b5a626/32.png) [@Treasurepeace1](https://forum.orfeo-toolbox.org/u/Treasurepeace1)\
**Post date:** [July 14, 2021, 6:59pm UTC](https://forum.orfeo-toolbox.org/t/vector-classifier/1112/1 "2021-07-14T18:59:54Z")

</div>

Hello, good evening all,

I’m doing an **Object based image classification** , i used LSMS segmentation to do the segmentation, I also created **5 training samples** but Vector Classifier returned just one class.

What could be the problem

---

<div class="post-metadata">

**Author:** ![josman](https://forum.orfeo-toolbox.org/user_avatar/forum.orfeo-toolbox.org/josman/32/1618_2.png) [@josman](https://forum.orfeo-toolbox.org/u/josman)\
**Post date:** [July 15, 2021, 5:48am UTC](https://forum.orfeo-toolbox.org/t/vector-classifier/1112/2 "2021-07-15T05:48:40Z")

</div>

Dear @Treasurepeace1,  
Could you share with us the logs of the processing? And also tell us which version of OTB you are using and how you run the applications (command line, malpa, QGIS)?

---

<div class="post-metadata">

**Author:** ![Treasurepeace1](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/t/b5a626/32.png) [@Treasurepeace1](https://forum.orfeo-toolbox.org/u/Treasurepeace1)\
**Post date:** [July 15, 2021, 7:35am UTC](https://forum.orfeo-toolbox.org/t/vector-classifier/1112/3 "2021-07-15T07:35:38Z")

</div>

![vectorlog](https://forum.orfeo-toolbox.org/uploads/default/original/1X/4319175da4f195fd7d196c7053b62f535c381ee1.png)  
 ![trainingvector log](https://forum.orfeo-toolbox.org/uploads/default/original/1X/9a07910f9de73cf837ae6ee7c58ba2110fb78ef9.png)

I used OTB 7.0.0 standalone

The first image is the log for the Vector classifier and the second is the train-vector classifier

---

<div class="post-metadata">

**Author:** ![josman](https://forum.orfeo-toolbox.org/user_avatar/forum.orfeo-toolbox.org/josman/32/1618_2.png) [@josman](https://forum.orfeo-toolbox.org/u/josman)\
**Post date:** [July 15, 2021, 7:52am UTC](https://forum.orfeo-toolbox.org/t/vector-classifier/1112/4 "2021-07-15T07:52:30Z")

</div>

It appears that the result of the training step was not successful. Indeed, according to the logs, all the indicators (precision, recall, F-score) a set to zero. Are you sure your training set is not empty? May share a screen shot of the input to give to the trainer?

---

<div class="post-metadata">

**Author:** ![Treasurepeace1](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/t/b5a626/32.png) [@Treasurepeace1](https://forum.orfeo-toolbox.org/u/Treasurepeace1)\
**Post date:** [July 15, 2021, 9:17am UTC](https://forum.orfeo-toolbox.org/t/vector-classifier/1112/5 "2021-07-15T09:17:15Z")

</div>

I’m attempting to repeat the process and I’m having this error. This us for the train vector classifier

 ![error](https://forum.orfeo-toolbox.org/uploads/default/original/1X/636a82b04ecb07c1619a9cba5441ef05043aa863.png)

---

<div class="post-metadata">

**Author:** ![Treasurepeace1](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/t/b5a626/32.png) [@Treasurepeace1](https://forum.orfeo-toolbox.org/u/Treasurepeace1)\
**Post date:** [July 16, 2021, 11:54am UTC](https://forum.orfeo-toolbox.org/t/vector-classifier/1112/6 "2021-07-16T11:54:11Z")

</div>

@josman

I attempted to repeat the process and I got this error. This is for the train vector classifier…

 ![error](https://forum.orfeo-toolbox.org/uploads/default/original/1X/636a82b04ecb07c1619a9cba5441ef05043aa863.png)

---

<div class="post-metadata">

**Author:** ![josman](https://forum.orfeo-toolbox.org/user_avatar/forum.orfeo-toolbox.org/josman/32/1618_2.png) [@josman](https://forum.orfeo-toolbox.org/u/josman)\
**Post date:** [July 16, 2021, 1:40pm UTC](https://forum.orfeo-toolbox.org/t/vector-classifier/1112/7 "2021-07-16T13:40:34Z")

</div>

The TrainVectorClassifier takes a vector dataset as input. Providing a _tif_ file doesn’t seems like a good idea. We usually use _shp_, _geojson_, _gpkg_ or _sqlite_ files as input.

---

<div class="post-metadata">

**Author:** ![Treasurepeace1](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/t/b5a626/32.png) [@Treasurepeace1](https://forum.orfeo-toolbox.org/u/Treasurepeace1)\
**Post date:** [July 19, 2021, 10:44am UTC](https://forum.orfeo-toolbox.org/t/vector-classifier/1112/8 "2021-07-19T10:44:43Z")

</div>

Thanks @josman I’ve corrected it.

But I had this error while using the **vector classifier**

 ![vectorclass](https://forum.orfeo-toolbox.org/uploads/default/original/1X/94b3bc3a920d3333eb6f028994254a216994b2e6.png)  
This is the input data

 ![log](https://forum.orfeo-toolbox.org/uploads/default/original/1X/15d466e375d7cd00373291c77586cee7b07a7ba9.png)  
This the log from the input data

 ![v](https://forum.orfeo-toolbox.org/uploads/default/original/1X/64604a57202fc9400ea1bef7265e23ab60d426fb.png)  
Log from monteverdi application
