Hello,
I can generate objects with the following ObjectPoseSampler
~
{
"module": "object.ObjectPoseSampler",
"config": {
"objects_to_sample": {
"provider": "getter.Entity",
"conditions": {
"cp_physics": True,
}
},
"pos_sampler": {
"provider":"sampler.Uniform3d",
"min": [-0.2, -0.2, 0.0],
"max": [0.2, 0.2, 1.0]
},
"rot_sampler":{
"provider":"sampler.UniformSO3",
}
}
}
~
However, I want to specify each object's pose in the config file instead of sampling position and rotation from uniform disribution. Is there a way to do this?
Hey,
However, I want to specify each object's pose in the config file instead of sampling position and rotation from uniform disribution. Is there a way to do this?
So, you want for example to set the object apple to the position: [0.0, 1.0, 5.0]?
You can do this by using the EntityManipulator:
But, now instead of the sampler you set the position directly:
"location": [0.0, 1.0, 5.0],
"rotation_euler": [1, 1, 0],
If you struggle to use the selector please see the documentation.
I hope this helps.
Best,
Max
@themasterlink , so this way BlenderProc generates objects whose name is 'Suzanne' on that given location with that rotation values, and it continues to generate objects with names other than 'Suzanne' by using ObjectPoseSampler. Am I correct?
Moreover, lets say I have two objects namely obj1.ply and obj2.ply. If I create two instances from obj1.ply and one instance from obj2.ply, how can I set, for example, only the first instance of obj1.ply object? I do not know what should be the value of "name" parameter in this case.
so this way BlenderProc generates objects whose name is 'Suzanne' on that given location with that rotation values, and it continues to generate objects with names other than 'Suzanne' by using ObjectPoseSampler. Am I correct?
BlenderProc does not generate objects, you have to load some 3D models and then you can put them at certain positions with the EntityManipulator. This was just an example, of course you would have to adjust this to your example, depending on the names of your objects.
Moreover, lets say I have two objects namely obj1.ply and obj2.ply. If I create two instances from obj1.ply and one instance from obj2.ply, how can I set, for example, only the first instance of obj1.ply object? I do not know what should be the value of "name" parameter in this case.
You can use custom properties, which are set while loading them.
Here you can add any kind of custom property, which always start with cp_ then you can later use them in the selector.
Does this help?
Best,
Max
The way that I load my objects are as follows
{
"module": "loader.BopLoader",
"config": {
"bop_dataset_path": "<args:0>",
"mm2m": True,
"sample_objects": True,
"num_of_objs_to_sample": 2,
"obj_instances_limit": 1,
"add_properties": {
"cp_physics": True
},
"obj_ids": [1,2]
}
},
What I want to do is write an EntityManipulator in which I select a specific object in "conditions" key. For example,
{
"module": "manipulators.EntityManipulator",
"config": {
"selector": {
"provider": "getter.Entity",
"check_empty": True,
"conditions": {
"cp_MY_CUSTOM_PROPERTY": 'NAME_OF_A_SPECIFIC_OBJECT_INSTANCE',
"type": "MESH"
}
},
"location": [5,5,0.5],
"rotation_euler": [1, 1, 0],
"cp_physics": True
}
},
However, I still cannot define a specific name for each object instance by adding a custom property in "add_properties" to BopLoader. If I add something like "name" : "BOP_OBJECTS", all objects (objects with id 1 and 2 in this case) have this same property. How can I select the objects in the EntityManipulator in the following manner?
{
"module": "manipulators.EntityManipulator",
"config": {
"selector": {
"provider": "getter.Entity",
"check_empty": True,
"conditions": {
"cp_obj_name": '1.2', # select the 2. instance of objects with id 1
"type": "MESH"
}
},
"location": [5,5,0.5],
"rotation_euler": [1, 1, 0],
"cp_physics": True
}
},
Hey,
now I get it.
That is possible, not exactly as you imagined but really close and you need to add one line of code:
Between those two lines you need to add:
cur_obj.set_cp("instances_id", loaded_ids[random_id])
That way each object will have an instances id as well, which you can then use to select objects.
{
"module": "manipulators.EntityManipulator",
"config": {
"selector": {
"provider": "getter.Entity",
"check_empty": True,
"conditions": {
"cp_category_id": 1,
"cp_instance_id": 0
"type": "MESH"
}
},
"location": [5,5,0.5],
"rotation_euler": [1, 1, 0],
"cp_physics": True
}
},
I hope this helps.
Best,
Max
I'll give it a try, thanks.
I will close this, if the problem persists, you can reopen this issue. If there is a different issue, please open a new issue.
I had an issue at first since I've used both EntityManipulator and ObjectPoseSampler, but I've achieved what I wanted just 20 minutes ago. Thanks again.
Great :) No worries, if you ever publish something with BlenderProc don't forget to cite us :D