Re: [otb-users] TrainVectorClassifier: cannot find fieldname in sqlite vector file

2018-10-31 Thread karamvasisk
Thanks a lot for the support Efi and Argyros :)
Let stay in touch
Kleanthis

-- 
-- 
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to otb-users@googlegroups.com
To unsubscribe from this group, send email to
otb-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to otb-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [otb-users] TrainVectorClassifier: cannot find fieldname in sqlite vector file

2018-10-30 Thread Argyros Argyridis
Dear Kleanthis,

You can try to run the TrainVectorClassifier as a system command through
Python from the os.system command.

Kind regards,
Argyros

On Tue, Oct 30, 2018 at 11:08 AM Efi Konstantinidou 
wrote:

> Hey Kleanthis, don't know about python but will be trying it in the near
> future for my project. We can stay in touch through otb users.
> Much success,
> Efi
>
> On Tue, Oct 30, 2018 at 10:33 AM  wrote:
>
>> Thanks a lot for the reply Efi. I was able to run the
>> TrainVectorClassifier
>> 
>> application successfully on the command line. It worked for sqlite and
>> shp formats.
>> However i don`t understand why it fails in python. Is it the reading of
>> the vector file?
>> Thanks a lot,
>> Kleanthis
>>
>> --
>> --
>> Check the OTB FAQ at
>> http://www.orfeo-toolbox.org/FAQ.html
>>
>> You received this message because you are subscribed to the Google
>> Groups "otb-users" group.
>> To post to this group, send email to otb-users@googlegroups.com
>> To unsubscribe from this group, send email to
>> otb-users+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/otb-users?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "otb-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to otb-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> --
> Check the OTB FAQ at
> http://www.orfeo-toolbox.org/FAQ.html
>
> You received this message because you are subscribed to the Google
> Groups "otb-users" group.
> To post to this group, send email to otb-users@googlegroups.com
> To unsubscribe from this group, send email to
> otb-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/otb-users?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "otb-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to otb-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to otb-users@googlegroups.com
To unsubscribe from this group, send email to
otb-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to otb-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [otb-users] TrainVectorClassifier: cannot find fieldname in sqlite vector file

2018-10-30 Thread Efi Konstantinidou
Hey Kleanthis, don't know about python but will be trying it in the near
future for my project. We can stay in touch through otb users.
Much success,
Efi

On Tue, Oct 30, 2018 at 10:33 AM  wrote:

> Thanks a lot for the reply Efi. I was able to run the
> TrainVectorClassifier
> 
> application successfully on the command line. It worked for sqlite and
> shp formats.
> However i don`t understand why it fails in python. Is it the reading of
> the vector file?
> Thanks a lot,
> Kleanthis
>
> --
> --
> Check the OTB FAQ at
> http://www.orfeo-toolbox.org/FAQ.html
>
> You received this message because you are subscribed to the Google
> Groups "otb-users" group.
> To post to this group, send email to otb-users@googlegroups.com
> To unsubscribe from this group, send email to
> otb-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/otb-users?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "otb-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to otb-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to otb-users@googlegroups.com
To unsubscribe from this group, send email to
otb-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to otb-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [otb-users] TrainVectorClassifier: cannot find fieldname in sqlite vector file

2018-10-30 Thread karamvasisk
Thanks a lot for the reply Efi. I was able to run the TrainVectorClassifier 

 
application successfully on the command line. It worked for sqlite and shp 
formats.
However i don`t understand why it fails in python. Is it the reading of the 
vector file?
Thanks a lot,
Kleanthis

-- 
-- 
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to otb-users@googlegroups.com
To unsubscribe from this group, send email to
otb-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to otb-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [otb-users] TrainVectorClassifier: cannot find fieldname in sqlite vector file

2018-10-29 Thread Efi Konstantinidou
Hi Kleanthis,

Just a suggestion, have you tried running TrainVectorClassifier on
Monteverdi (gui) first? Had a similar issue with that tool and kind of
better understood the format of the input data through Monteverdi. After
that it also run successfully on the command line - haven't tried python
yet. My 5p.
Liten

On Sat, Oct 27, 2018 at 8:50 PM  wrote:

> Hello everyone,
> Recently i discovered OTB and i am really happy using it. I find some
> difficulties to understand how to use TrainVectorClassifier
> 
> .
> I will present to you each step i performed successfully:
>
>- At start i downloaded this
>
> 
>shp file from naturalearthdata.com.
>- After the unzip i opened in QGIS and i saved as sqlite format.
>- The fields from the attribute table of the shp that i am interested
>in are: scalerank, labelrank and adm0_dif
>- I want to train a classifier according to this recipe
>
>
> otbcli_TrainVectorClassifier -io.vd samples.sqlite
>  -cfield CODE
>  -io.out model.rf
>  -classifier rf
>  -feat perimeter area width
>
> ---I wrote this python 2.7 script (*test.py*) in order to run the 
> TrainVectorClassifier application.
>
> import os
>
> os.environ["PYTHONPATH"] =
> "/home/kleanthis/bin/otb/OTB-6.6.0-Linux64/lib/python"
>
>
> input_polygons='/home/kleanthis/Projects/BUA_classification/2_Processing/Obia_experiments/test_sqlite/ne_110m_admin_0_countries.sqlite'
>
>
> import otbApplication
>
> TrainVectorClassifier =
> otbApplication.Registry.CreateApplication("TrainVectorClassifier")
>
> TrainVectorClassifier.SetParameterString('io.vd', input_polygons)
>
> TrainVectorClassifier.SetParameterString('cfield', 'adm0_dif')
>
> TrainVectorClassifier.SetParameterStringList("feat",
> ["labelrank","scalerank"] )
>
> TrainVectorClassifier.SetParameterString("classifier", "rf")
>
> TrainVectorClassifier.SetParameterString("io.out",
> "/home/kleanthis/Projects/classification/2_Processing/Obia_experiments/Label_segments/rfModel.rf")
>
> TrainVectorClassifier.ExecuteAndWriteOutput()
>
>
>
> ---The *error* that pops up is the following one:
>
> runfile('/home/kleanthis/Projects/BUA_classification/00_SCR/test.py', 
> wdir='/home/kleanthis/Projects/BUA_classification/00_SCR')
> Reloaded modules: otbApplication, _otbApplication
> Traceback (most recent call last):
>
>   File "", line 1, in 
> runfile('/home/kleanthis/Projects/BUA_classification/00_SCR/test.py', 
> wdir='/home/kleanthis/Projects/BUA_classification/00_SCR')
>
>   File 
> "/home/kleanthis/miniconda3/envs/spyderakos/lib/python2.7/site-packages/spyder_kernels/customize/spydercustomize.py",
>  line 678, in runfile
> execfile(filename, namespace)
>
>   File 
> "/home/kleanthis/miniconda3/envs/spyderakos/lib/python2.7/site-packages/spyder_kernels/customize/spydercustomize.py",
>  line 98, in execfile
> builtins.execfile(filename, *where)
>
>   File "/home/kleanthis/Projects/BUA_classification/00_SCR/test.py", line 16, 
> in 
> TrainVectorClassifier.SetParameterString('cfield', 'adm0_dif')
>
>   File 
> "/home/kleanthis/bin/otb/OTB-6.6.0-Linux64/lib/python/otbApplication.py", 
> line 1475, in SetParameterString
> def SetParameterString(self, *args): return 
> _otbApplication.Application_SetParameterString(self, *args)
>
> RuntimeError: Exception thrown in otbApplication 
> Application_SetParameterString: 
> /home/otbval/dashboard/otb/src/Modules/Wrappers/ApplicationEngine/src/otbWrapperListViewParameter.cxx:141:
> itk::ERROR: ListViewParameter(0x55cb7c94f6f0):* Cannot find adm0_dif*
>
>
> Any advice, suggestion is welcome :)
>
> Thanks in advance,
> Kleanthis
>
>
>
>
>
> --
> --
> Check the OTB FAQ at
> http://www.orfeo-toolbox.org/FAQ.html
>
> You received this message because you are subscribed to the Google
> Groups "otb-users" group.
> To post to this group, send email to otb-users@googlegroups.com
> To unsubscribe from this group, send email to
> otb-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/otb-users?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "otb-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to otb-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to otb-users@googlegroups.com
To unsubscribe from this group, send email to