Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Fwd: CGAL classification

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Fwd: CGAL classification


Chronological Thread 
  • From: Dmitry Anisimov <>
  • To:
  • Subject: Re: [cgal-discuss] Fwd: CGAL classification
  • Date: Mon, 9 Mar 2020 11:41:48 +0100
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=None ; spf=None
  • Ironport-phdr: 9a23:Y71BcBI3dZV9lRlxb9mcpTZWNBhigK39O0sv0rFitYgXLfTxwZ3uMQTl6Ol3ixeRBMOAtKIC1rKempujcFJDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBWB6kG1uDUdExG6OQtuLfnuAabTid623qa84c79eQJN0Ra4YK9oPV2fqwTKt8wRn8M2JqMw1gHY5HJOev9XwGR2DV2emBPx+t2h8pdo7yNKqrQq8MsWAvayRLgxUbENVGduCGsy/sC+7UCfHzvK3WMVVyAtqjQNGxLMtkioUZr2tybmrPtz0SKGOtfnC7szXGb6tvY5eFrTkC4CcgUB3iTSg810grhcpUj49RNyxIvZfJuEOvN1YqTHbJURQm8TBp8MBRwEOZu1as40N8REPetcqNOh9QRIqBzkQwylBeeqzSJUwHjo3es83vhzSQw=

Ok, good, then it is not a Kernel. Could you please tell me then on where it comes from in the Region Growing (RG) part? 
What I mean is which part of the RG causes the call of the Kernel function and hence the assertion.

Thanks,
Dmitry

-- 
Dmitry Anisimov, PhD
R&D Engineer
GeometryFactory - https://geometryfactory.com/

On 9 Mar 2020 at 10:57 +0100, Zhang Jinwei <>, wrote:
Hi Dmitry,

Thanks for your quick reply. I tried again following your tips, and unfortunately it still produced the same error. Perhaps due to other reasons?

Jinwei

Hi Jinwei,

Try to change your Kernel to the inexact one:

If you simply copy pasted the example, then you are currently running it with the Exact_predicates_exact_constructions_kernel. 
Try to use the Exact_predicates_inexact_constructions_kernel or Simple_cartesian<double>. Do not forget to include it as
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>

Cheers,
Dmitry

-- 
Dmitry Anisimov, PhD
R&D Engineer
GeometryFactory - https://geometryfactory.com/

On 9 Mar 2020 at 10:26 +0100, Zhang Jinwei <>, wrote:
Hello Simon,

Thanks for your reply last time. It was the problem of the data format.

Now I encountered another problem, when I trying to run the example code of region_growing_on_polygon_mesh.cpp in the shape detection package for mesh segmentation. 

Still, using the example dataset is fine, but I tried to input another test dataset myself, it turns to collapse. This time I just compared the .off format of the files, they have definitely the same. I have tried several different datasets, and had the same errors. So it seems to be bugs in the codes, isn’t it?

Please see the error information in the attachment. Thank you very much!

Look forward to your reply!

Best regards,
Jinwei Zhang

<IMG_7046.jpg>


Hello Zhang,

As explained in the manual https://doc.cgal.org/latest/Classification/classCGAL_1_1Classification_1_1ETHZ_1_1Random__forest__classifier.html#a7c0b299cb5829f598f395bcc16df72fa the expected format for the ground truth range that you give to the train() function is, for each input point, the index of its expected label in the Label_set that you used.

Judging by the breakpoint you provided, the ground truth that you pass probably contains indices which exceed the Label_set number of labels (I'm mostly guessing as you don't provide any code/data for context).

Points with label value -1 are ignored, but there's no problem in giving a fully labeled dataset to the random forest.

Best regards,

--   
Simon Giraudot, PhD
R&D Engineer
GeometryFactory - http://geometryfactory.com/
Le 29/02/2020 à 09:03, Zhang Jinwei a écrit :
Dear Simon, 

Thanks for your kindly reply. After reading your demo codes, I have already fixed several errors due to the file format. Now the problem occurs at the training step, where the break point locates in node.hpp from the ETHZ random forest package. If I use the example training dataset, everything is ok. However, when use my own labeled point clouds, it encounter such errors. 

So may I ask whether there is a specific definition of the format of the training dataset? In my dataset, everything point has a label in terms of integer number, denoting different classes. In your example dataset, just part of points are labeled and others with default value -1. Then I am just wondering, isn’t it allowed to give a fully labeled dataset to random forest? Or perhaps any other reasons?

Thank you again for your help.

Regards,
Jinwei



Dear Zhang,

Le 28/02/2020 à 08:00, Zhang Jinwei a écrit :

1. Could you please specify the format and content of your generated config file after classifier training?
As I said, the format is an ASCII file compressed in a GZ archive. Same as the GZ files provided by CGAL. They *are* binary files, the fact that you can open them with a text reader is probably a feature of your text reader which may be able to decompress GZ archives on the fly an display the content of the

2. Could you explain in detail how you generate such files, e.g. b9_cluster_config and b9_mesh_config?
They were generated using the `save_configuration()` method, there are no tricks or hidden formulas here. (The line in the demo I used to generate them: https://github.com/CGAL/cgal/blob/master/Polyhedron/demo/Polyhedron/Plugins/Classification/Item_classification_base.h#L182 )

3. As described in your example codes named example_generation_training, the output of the trained classifier is written in a .xml format, isn’t it?
You're talking about a different classifier (Sum of weighted features) which uses a different format. This is not related to the ETHZ Random Forest which uses the GZ format.

4. If so, how could I utilize the .xml as input for classification? Because the load_configuration function requires stream files.
XML files for Sum Of Weighted Features and GZ from ETHZ Random Forest are not compatible at all.

At this moment, I am stopped at this training and classifying step because of these confusions, even though I have my own training datasets. I really need your help and would appreciate for your explanation.

I'm doing my best to figure what's going on, but it's very complicated to help without seeing the actual code (not just 2 lines copied in a mail), the cmake output or the actual error. The screenshot of the breakpoint comes from a deep code in Boost and is not related to CGAL, the problem probably comes before that.

If you can provide more information I can investigate more.

Best,

Simon


Thank you very much! Looking forward to your reply!

Best regards,
Jinwei

Dear Mr. Jinwei,

Le 21/02/2020 à 05:56, Zhang Jinwei a écrit :

For output configuration file I use:
std::ofstream fconfig(“classifier_config.gz”);
classifier.save_configuration(fconfig);
fconfig.close();
Note that on some OS (Windows for example), you need to specify the tag std::ios_base::binary so that the binary output is correctly written. That might be the source of your error here?

However, when I tried to produce and load my own configuration file by using save_ and load_configuration function, then I encountered  an exception errors which jumps to the boost serialization library file. I compared the file I produced with the file in your example, and I found your configuration file is ascii format while mine is binary format. So how did you generate the configuration file of the trained classifier?
You must be mistaken, the configuration files provided with CGAL are also binary (to be precise: they are compressed archives containing an ASCII file).

Another question: as shown in the examples, the cluster and mesh can also be classified by the package. But there is no example to show how to export them? In which format?
If you are talking about the configuration file, then it's no different from the point set case, the save_configuration + load_configuration should work all the same.
And how to export the results of cluster and mesh with the colors and labels?

If your clusters are defined on a CGAL::Point_set_3 (as is done in the example of the user manual), then you can just propagate the labels back to the inliers of each cluster and color them similarly to what is done in the point sets example.

For the mesh, if your are using a CGAL::Surface_mesh (as is done in the example of the user manual), then you can also generate a color for each face. The API is slightly different from Point_set: in Point_set, you need to define 3 properties of type unsigned char "r", "g" and "b", whereas for Surface_mesh, you need to define 1 face property of type CGAL::Color "v:color". Then, use CGAL::write_ply to save your mesh to the PLY format: https://doc.cgal.org/latest/Surface_mesh/group__PkgSurface__mesh.html#ga77bbb79d449c981895eedb6c3c23bd14

I hope this helps.

Best regards,

--   
Simon Giraudot, PhD
R&D Engineer
GeometryFactory - http://geometryfactory.com/

If you could give me help and suggestions, I would really appreciate it!

Thank you very much! Looking forward to your reply!

Best regards,
Jinwei



Hello,

Sorry you encountered trouble with CGAL Classification.

What version of CGAL are you using? Also, can you share a source code + the full error messages?

Best regards,


--   
Simon Giraudot, PhD
R&D Engineer
GeometryFactory - http://geometryfactory.com/
Le 18/02/2020 à 19:12, Zhang Jinwei a écrit :
Dear Ms./Mr.,

Thank you for providing us this CGAL open source library. I am a research engineer working in the field of urban reconstruction.

I faced a problem, when I used the package Classification for point cloud and mesh classification. I want to train the classifier, and then classify the point cloud data by the trained classifier. 

So, firstly I used the example training dataset training_b9.ply, for training step by using ETHZ random forest, and save the configuration by function save_configuration as .gz file. And secondly, I load the produced configuration from last step using load_configuration, and classify the data by this trained classifier. 

However,  when I saved and loaded the configuration of classifier, it came out an unhandeled exception: boost::archive::archive_exception. I just used the example data file training_b9.ply for the whole procedure. 

So could you explain me what the reason is? And could you please help me and give me suggestions on how to solve it? What do I need to notice when I doing training and classification using configuration file? It would be better if you could provide me more examples in detail. 

Thank you very much for your support! Looking forward to your kindly reply!

Best regards,
Jinwei Zhang







Archive powered by MHonArc 2.6.18.

Top of Page