Hi, thank you for your answer.
I did not compile OTB myself because I am not the administrator of the computer. But my colleague installed openCV3 and we checked that the openCV 3 library were used. The otb_OpenCV_api.h file was not empty, so this corroborates that openCV3 is used. Here is my hypothesis, even if I am not sure at all: If you tell me that the working model is openCV2 and the non working model is OpenCV3, it could mean that the training phase ( otb::RandomForestsMachineLearningModel ) is actually OK for 6.1 and yields an OpenCV 3 model, but my classification phase is not working BECAUSE IT IS OPENCV2 (Which would explain why I can use a model from the previous versions of my application). Can you confirm that the "not working" model looks like openCV3 ? However, when I check the libs with ldd, both the otbcli_ImageClassifier and my application are using the same (V3) libs for openCV libopencv_core.so.3.1 => /usr/lib64/libopencv_core.so.3.1 (0x00007f55744a3000) libopencv_ml.so.3.1 => /usr/lib64/libopencv_ml.so.3.1 (0x00007f55741e8000) while my previous version (older OTB) used the v2 libopencv_ml.so.2.4 => /home/tom/libs/OTB/install/lib/libopencv_ml.so.2.4 (0x00007f1c2b9a2000) libopencv_core.so.2.4 => /home/tom/libs/OTB/install/lib/libopencv_core.so.2.4 (0x00007f1c2b55e000) So this would mean that the openCV RF works with a openCV 2 model predicting with OpenCV3, but not with the OpenCV3 model predicting with OpenCV3 ? I am very confused. Le vendredi 18 août 2017 16:06:37 UTC+2, Guillaume Pasero a écrit : > > Hi, > > The file "otb_opencv_api.h" is generated from "otb_opencv_api.h.in" when > compiling the OTB : if you use opencv 3 then OTB_OPENCV_3 is defined, > otherwise, the file is empty. > > Could you give some details on how you compile OTB? > > Your working model file seems to be generated by OpenCV 2. > Guillaume > > On 08/18/2017 12:17 PM, Julien Radoux wrote: > > Hello, > > I have an unexpected segmentation fault with random forest classifier in > OTB6.1. > > > I had an error compiling RF forest classifier due to the compiler not > finding otb_opencv_api.h. It could be solved by adding the path of the > include dir with ccmake, but I wonder what is the purpose of this file: it > seems to set a variable OPENCV_3, but it is not actually checking if > open_cv v3 is there (in my case, I use an external open_cv3). > > Now it gives me a systematic segmentation fault (on previous version, I > had sometimes a segmentation fault, but not always, and I was hoping that > the next version would solve the problem). The problem seems to come from > my training step: I can run the models of my previous version with > otbcli_ImageClassifier, but it doesn't work with the new models (which has > a different structure, see below) > > NOT working > > %YAML:1.0 > opencv_ml_rtrees: > is_classifier: 1 > var_all: 5 > var_count: 4 > ord_var_count: 4 > cat_var_count: 1 > training_params: > use_surrogates: 0 > max_categories: 10 > regression_accuracy: 9.9999997764825821e-03 > max_depth: 15 > min_sample_count: 25 > cross_validation_folds: 0 > nactive_vars: 0 > global_var_idx: 1 > var_idx: [ 0, 1, 2, 3 ] > var_type: [ 0, 0, 0, 0, 1 ] > cat_ofs: [ 0, 0, 0, 0, 0, 0, 0, 0 ] > class_labels: [ 1, 6, 7, 12, 13, 17, 19, 22, 24 ] > missing_subst: [ 0., 0., 0., 0., 0. ] > oob_error: 2.4000992032737081e-01 > ntrees: 75 > > WORKING > %YAML:1.0 > my_random_trees: !!opencv-ml-random-trees > nclasses: 9 > nsamples: 88071 > nactive_vars: 2 > oob_error: 2.4195188071840054e-01 > ntrees: 75 > is_classifier: 1 > var_all: 4 > var_count: 4 > ord_var_count: 4 > cat_var_count: 0 > training_params: > use_surrogates: 0 > max_categories: 10 > max_depth: 15 > min_sample_count: 25 > cross_validation_folds: 0 > priors: !!opencv-matrix > rows: 1 > cols: 9 > dt: d > data: [ 1., 1., 1., 1., 1., 1., 1., 1., 1. ] > var_type: [ 0, 0, 0, 0 ] > cat_count: !!opencv-matrix > rows: 1 > cols: 1 > dt: i > data: [ 9 ] > cat_map: !!opencv-matrix > rows: 1 > cols: 9 > dt: i > data: [ 1, 6, 7, 12, 13, 17, 19, 22, 24 ] > trees: > > > -- > -- > 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-...@googlegroups.com > <javascript:> > To unsubscribe from this group, send email to > otb-users+...@googlegroups.com <javascript:> > 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+...@googlegroups.com <javascript:>. > For more options, visit https://groups.google.com/d/optout. > > > -- > <http://www.c-s.fr> *Guillaume PASERO* > Responsable technique > *Business Unit ESPACE & GeoInformation - Département Payload Data & > Applications* > > *CS Systèmes d'Information* > Parc de la Grande Plaine - 5, Rue Brindejonc des Moulinais - BP 15872 > 31506 Toulouse Cedex 05 - FRANCE > +33 561 17 64 21 - guillaum...@c-s.fr <javascript:> > -- -- 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.