thodan / bop_toolkit

A Python toolkit of the BOP benchmark for 6D object pose estimation.
http://bop.felk.cvut.cz
MIT License
376 stars 135 forks source link

Symmetry information in model_info.json ? #50

Closed maedhril closed 3 years ago

maedhril commented 3 years ago

I am trying to use my own models and I used 'calc_model_info.json' script. However, The script does not generate some property called "symmetry_discrete" that I do not know what it means. Do you know what it is or how can I generate this information for my own model?

48

bertid commented 3 years ago

This field contains a list of 3D poses (each represented as 4x4 matrix) under which your model is symmetric. The identity pose is omitted. In other words, if the model is transformed by one of the listed poses, it does not change (too much).

For example, a cereal box would have three poses in that list, if texture is ignored (flip over the long side, flip over the short side, flip over long and short side).

maedhril commented 3 years ago

@bertid First of all, thanks for the answer!

How about more complex objects that have symmetry transformation beyond simple axis flips. For example; in YCB-V dataset there are some objects that have symmetry transformation as following;

    "symmetries_discrete": [
      [0.00179515,
      -0.999956,
      -0.00918835,
      -0.451143,
      0.99999,
      0.00175811,
      0.00403816,
      -0.140551,
      -0.00402183,
      -0.00919551,
      0.99995,
      -0.00311599,
      0,
      0,
      0,
      1],

I mean this matrix must be calculated from a script or library but I did not have any luck finding any library or method to calculate these values.

bertid commented 3 years ago

@maedhril Right, there is a script but it is unfortunately not released. It is a semi-manual process, where you first define the symmetry class of the object (there aren't that many, usually boxes, n-fold rotations around an axis which is usually the z-axis etc.), and then ICP is used to further improve those initial poses.

If your models are manually created CAD models and the coordinate frame is nicely aligned (center in the object center, axis aligned with whatever symmetry you have), you can also often come up with the poses yourself. If the models are the result of some scanning this is more difficult.

The scripts are not really a secret and I can send them to you, but they are undocumented and require a license for the HALCON library. Free licenses are available for universities, but there is a steep initial learning curve. Alternatively, if you just have a few objects you can send them to me and I can annotate them and send you back the symmetries. Be advised that you might have to filter those symmetries to account for texture. The script only takes geometry into account, and depending on what you want to measure you might want to remove some symmetries for which the texture changes drastically. That is highly domain dependent, though,

maedhril commented 3 years ago

@bertid If you can send me the scripts that would be fantastic because besides the objects currently I have, I will probably try new objects in the future. Besides, I think looking at the script will be helpful whether I will try to create my own script or I will try to integrate HALCON. So if you can send me the script to my mail account cptmaa@gmail.com; I would be very thankful.

bertid commented 3 years ago

@maedhril Sure - I'll clean up the scripts a bit and send them to you in the next days.

HamilkarBrq commented 3 years ago

Hey @bertid, I am facing similar problems like @maedhril described at the moment as well. Could you send me the script to my university mail account j.schons@wzl.rwth-aachen.de ? Thanks in advance.

bertid commented 3 years ago

@maedhril @HamilkarBrq The mail is on its way - let me know if you have any issues with the scripts (which is quite likely, they really are spaghetti code, no need to comment because I will run this one time only scripts).

YyYyYong0331 commented 3 years ago

Hey @bertid, I am facing similar problems, too. Could you send me the script? The mail account: wyong233@gmail.com Thanks

bertid commented 3 years ago

@YyYyYong0331 The mail is on its way.

baichuan05 commented 2 years ago

Hey @bertid, I am facing similar problems, too. Could you send me the script? We are trying to extend ycbv to a larger one with other ycb objects. The mail account: baichuan.huang@rutgers.edu Thanks

bertid commented 2 years ago

Hi @baichuan05 - apologies for the delay.

Attached are the HALCON scripts that were used to build the symmetries for the BOP objects.

Please note again that they are not very polished. The idea is to first run script #1, where you can use sort of a GUI to set the object symmetries. Different types are available (box, n-fold symmetry etc.). They usually work out of the box if (1) the model’s symmetry axis is the z-axis and (2) the center of the coordinate frame is also the center of symmetry. If that is not the case, you will have to manually adjust those values in the code for your object.

Script #2 will take all the symmetries and produce the json file.

I’m quite sure that they will not run out of the box for you, so please just let me know if you run into any issues or need a quick walkthrough. In any case, you can produce the symmetries with any program of your choice, or even manually in some cases if the model is well behaved.

bop_symmetries.zip

baichuan05 commented 2 years ago

Hi @baichuan05 - apologies for the delay.

Attached are the HALCON scripts that were used to build the symmetries for the BOP objects.

Please note again that they are not very polished. The idea is to first run script #1, where you can use sort of a GUI to set the object symmetries. Different types are available (box, n-fold symmetry etc.). They usually work out of the box if (1) the model’s symmetry axis is the z-axis and (2) the center of the coordinate frame is also the center of symmetry. If that is not the case, you will have to manually adjust those values in the code for your object.

Script #2 will take all the symmetries and produce the json file.

I’m quite sure that they will not run out of the box for you, so please just let me know if you run into any issues or need a quick walkthrough. In any case, you can produce the symmetries with any program of your choice, or even manually in some cases if the model is well behaved.

bop_symmetries.zip

Thank you for the code! I really appreciate it! I see the original YCB objects are not aligned to the center of symmetry, I have used meshlab to relocate the center.