Subject: CGAL users discussion list
List archive
- From: Zhang Jinwei <>
- To:
- Subject: Re: [cgal-discuss] Fwd: CGAL classification
- Date: Sat, 29 Feb 2020 16:58:28 +0800
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:horRPxFG7awD7XSGDHAyHJ1GYnF86YWxBRYc798ds5kLTJ7zpMuwAkXT6L1XgUPTWs2DsrQY0raQ4vGrADZYqb+681k8M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aFRrwLxd6KfroEYDOkcu3y/qy+5rOaAlUmTaxe7x/IAi5oAnLssQbhYRuJrsvxhfVv3BFZ/lYyWR0KF2cmBrx+t2+94N5/SRKvPIh+c9AUaHkcKk9ULdVEjcoPX0r6cPyrRXMQheB6XUaUmUNjxpHGBPF4w3gXpfwqST1qOxw0zSHMMLsTLA0XTOi77p3SBLtlSwKOSI1/H3Rh8dtiq9QvRCvqAFlw4PMb46VOvhxcKPTc90ZWGRPQNpeWjdbAo+gdYYCFfYNMfpaooT7ulAArQG+BQ6pBO73yTBIhmX53as10+88FQ/G3QogHtwQv3TVsd74M6USXvquzKnPyzXPdfFW2Dn86YjIaB8hp/6MUKl/ccrU00YvFgfFgk+MpoziOjOYz+IAuHWV4epnUOKgkW8nqwdprzigx8cslonJhp8OxVze6Sp5x4M1KcWkR050e9GkFIFctyaAN4t5Ws8iTH9nuCE/yrIYpZ67ZigLyJo9yBHDd/yHdJKI4xL5WOmNJjd4gXRoc6+8iRaq6UWs1PHwW82u3FtJridJiMTAu3EM2hDJ5cWLVP1w9Vq71zmVzQDc8ORELFg0laXFL54hxaY9lp8JvkTCGi/6gUT2jKiLekk99Oil5Prrbq/ppp+bMI90hQX+Pbo0lsOjBuQ4NxACX2md+euiyL3u5VP1TKlOg/EskaTUsIrWKdkaq6O4GQNY3Zgv5w66Dzi80dQYmXcHLEhCeBKCl4XpOUvBIOv/Dfe5mViskjlqxvHGPrL7BJXNIWPOkLjkfbln6k5czBA/wsxY55JREr0BOu78WlfttNzECR80KxC7w+n9B9V5z48RRGOPArSFP6PPql+I/fkiI/KMZY8QoDbyMeIp5//ojX8jmF8SZ7Ol3ZUNaCPwIvMzKEqQZT/gg8wKDHwRlgs4Vu3jzlOYAhBJYHPnbaI14D5zKoOgEorCDtSviaeG2mG5AY9Wb2ZJIl+JGHbsMY6DXqFfO2qpPsZ9n2lcBvCaQIg72ET27V6o+/9cNuPRvxYgm9fm3dlx6ffUkEhrpzNxBsWZlWqKSjMtxz5ad3oNxKl65HdF5BKD3Kx/2aEKENVS47ZIVV5/O8KGieN9DN/2V0TKedLbEA/6EOXjOik4S5cK+/FLe1x0QozwgRXK3i7sCLgQxeSG
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,JinweiDear Zhang,
Le 28/02/2020 à 08:00, Zhang Jinwei a écrit :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
1. Could you please specify the format and content of your generated config file after classifier training?
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 )
2. Could you explain in detail how you generate such files, e.g. b9_cluster_config and b9_mesh_config?
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.
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?
XML files for Sum Of Weighted Features and GZ from ETHZ Random Forest are not compatible at all.
4. If so, how could I utilize the .xml as input for classification? Because the load_configuration function requires stream files.
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 :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?
For output configuration file I use:std::ofstream fconfig(“classifier_config.gz”);classifier.save_configuration(fconfig);fconfig.close();You must be mistaken, the configuration files provided with CGAL are also binary (to be precise: they are compressed archives containing an ASCII file).
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?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.
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?
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
- [cgal-discuss] Fwd: CGAL classification, Zhang Jinwei, 02/18/2020
- Re: [cgal-discuss] Fwd: CGAL classification, Simon Giraudot, 02/19/2020
- Re: [cgal-discuss] Fwd: CGAL classification, Zhang Jinwei, 02/21/2020
- Re: [cgal-discuss] Fwd: CGAL classification, Simon Giraudot, 02/24/2020
- Re: [cgal-discuss] Fwd: CGAL classification, Zhang Jinwei, 02/28/2020
- Re: [cgal-discuss] Fwd: CGAL classification, Zhang Jinwei, 02/28/2020
- Re: [cgal-discuss] Fwd: CGAL classification, Zhang Jinwei, 02/28/2020
- Re: [cgal-discuss] Fwd: CGAL classification, Simon Giraudot, 02/28/2020
- Re: [cgal-discuss] Fwd: CGAL classification, Zhang Jinwei, 02/29/2020
- Re: [cgal-discuss] Fwd: CGAL classification, Zhang Jinwei, 02/29/2020
- Re: [cgal-discuss] Fwd: CGAL classification, Zhang Jinwei, 02/29/2020
- Re: [cgal-discuss] Fwd: CGAL classification, Zhang Jinwei, 02/28/2020
- Re: [cgal-discuss] Fwd: CGAL classification, Simon Giraudot, 02/24/2020
- Re: [cgal-discuss] Fwd: CGAL classification, Zhang Jinwei, 02/21/2020
- Re: [cgal-discuss] Fwd: CGAL classification, Simon Giraudot, 02/19/2020
Archive powered by MHonArc 2.6.18.