Blenderproc: using_new_version issue

Created on 12 May 2021  Â·  8Comments  Â·  Source: DLR-RM/BlenderProc

Hey guys.
Previously, the version with Boploader was used to generate data. Everything was ok.

 Today, we downloaded your new version from github, using ObjectLoaderModule to generate data. Ply files are downloaded from bop_challenge website. I got the error:

Thanks a lot.

Traceback (most recent call last):
File "/home/jw/Downloads/BlenderProc-main/src/run.py", line 40, in
pipeline.run()
File "./src/main/Pipeline.py", line 88, in run
module.run()
File "./src/camera/CameraSampler.py", line 186, in run
self.cam_pose_collection.add_item(source_spec)
File "./src/utility/ItemCollection.py", line 59, in add_item
self.add_item_func(config)
File "./src/camera/CameraSampler.py", line 245, in _sample_cam_poses
if self.sample_and_validate_cam_pose(cam, cam_ob, config):
File "./src/camera/CameraSampler.py", line 269, in sample_and_validate_cam_pose
cam2world_matrix = self._cam2world_matrix_from_cam_extrinsics(config)
File "./src/camera/CameraInterface.py", line 222, in _cam2world_matrix_from_cam_extrinsics
value = config.get_vector3d("rotation/value", [0, 0, 0])
File "./src/utility/Config.py", line 251, in get_vector3d
return self.get_vector(name, fallback, 3)
File "./src/utility/Config.py", line 219, in get_vector
value = self.get_list(name, fallback)
File "./src/utility/Config.py", line 199, in get_list
value = self._get_value_with_fallback(name, fallback, True)
File "./src/utility/Config.py", line 97, in _get_value_with_fallback
print("try: self._get_value(name, None, allow_invoke_provider): ", self._get_value(name, None, allow_invoke_provider))
File "./src/utility/Config.py", line 58, in _get_value
return self._get_value(name[delimiter_pos + 1:], block[block_name], allow_invoke_provider)
File "./src/utility/Config.py", line 72, in _get_value
return block[name].run()
File "./src/provider/getter/POI.py", line 65, in run
raise Exception("No objects were selected!")
Exception: No objects were selected!

# Args: <path_to_bop_data> <bop_datset_name> <bop_toolkit_path> <path_to_cc_textures> <output_dir>
{
  "version": 3,
  "setup": {
    "blender_install_path": "/home_local/<env:USER>/blender/",
    "pip": [
      "h5py",
      "scikit-image",
      "pypng==0.0.20",
      "scipy==1.2.2",
      "matplotlib==2.2.4"
    ]
  },
  "modules": [
    {
      "module": "main.Initializer",
      "config": {
        "global": {
          "output_dir": "<args:4>",
          "sys_paths": ["<args:2>"]
        }
      }
    },


    {
      "module": "loader.ObjectLoaderModule",
      "config": {
        "paths": "<args:0>/<args:1>",
        "model_type": "",
        "mm2m": True,
        "sample_objects": True,
        "num_of_objs_to_sample": 21,
        "obj_instances_limit": 1,
        "add_properties": {
          "cp_physics": True
        },
        "cf_set_shading": "SMOOTH"
      }
    },
    {
      "module": "manipulators.MaterialManipulator",
      "config": {
        "selector": {
          "provider": "getter.Material",
          "conditions": [
          {
            "name": "bop_ycbv_vertex_col_material.*"     ### "name": "bop_tless_vertex_col_material.*"
          }
          ]
        },
        "cf_set_base_color": {
          "provider": "sampler.Color",
          "grey": True,
          "min": [0.1, 0.1, 0.1, 1.0],
          "max": [0.9, 0.9, 0.9, 1.0]
        }
      }
    },
    {
      "module": "manipulators.MaterialManipulator",
      "config": {
        "selector": {
          "provider": "getter.Material",
          "conditions": [
          {
            "name": "bop_ycbv_vertex_col_material.*"   ### "name": "bop_tless_vertex_col_material.*"
          },
          {
            "name": "bop_hb_vertex_col_material.*"
          },
          {
            "name": "bop_tyol_vertex_col_material.*"
          },
          {
            "name": "bop_<args:1>_vertex_col_material.*"
          }
          ]
        },
        "cf_set_specular": {
          "provider": "sampler.Value",
          "type": "float",
          "min": 0.0,
          "max": 1.0
        },
        "cf_set_roughness": {
          "provider": "sampler.Value",
          "type": "float",
          "min": 0.0,
          "max": 1.0
        }
      }
    },
    {
      "module": "constructor.BasicMeshInitializer",
      "config": {
        "meshes_to_add": [
        {
          "type": "plane",
          "name": "ground_plane0",
          "scale": [2, 2, 1]
        },
        {
          "type": "plane",
          "name": "ground_plane1",
          "scale": [2, 2, 1],
          "location": [0, -2, 2],
          "rotation": [-1.570796, 0, 0] # switch the sign to turn the normals to the outside
        },
        {
          "type": "plane",
          "name": "ground_plane2",
          "scale": [2, 2, 1],
          "location": [0, 2, 2],
          "rotation": [1.570796, 0, 0]
        },
        {
          "type": "plane",
          "name": "ground_plane4",
          "scale": [2, 2, 1],
          "location": [2, 0, 2],
          "rotation": [0, -1.570796, 0]
        },
        {
          "type": "plane",
          "name": "ground_plane5",
          "scale": [2, 2, 1],
          "location": [-2, 0, 2],
          "rotation": [0, 1.570796, 0]
        },
        {
          "type": "plane",
          "name": "light_plane",
          "location": [0, 0, 10],
          "scale": [3, 3, 1]
        }
        ]
      }
    },
    {
      "module": "manipulators.EntityManipulator",
      "config": {
        "selector": {
          "provider": "getter.Entity",
          "conditions": {
            "name": '.*plane.*'
          }
        },
        "cp_physics": False,
        "cp_category_id": 333
      }
    },
    {
      "module": "manipulators.MaterialManipulator",
      "config": {
        "selector": {
          "provider": "getter.Material",
          "conditions": {
            "name": "light_plane_material"
          }
        },
        "cf_switch_to_emission_shader": {
          "color": {
            "provider": "sampler.Color",
            "min": [0.5, 0.5, 0.5, 1.0],
            "max": [1.0, 1.0, 1.0, 1.0]
          },
          "strength": {
            "provider": "sampler.Value",
            "type": "float",
            "min": 3,
            "max": 6
          }
        }
      }
    },
    {
      "module": "loader.CCMaterialLoader",
      "config": {
        "folder_path": "<args:3>"
      }
    },
    {
      "module": "manipulators.EntityManipulator",
      "config": {
        "selector": {
          "provider": "getter.Entity",
          "conditions": {
            "name": "ground_plane.*"
          }
        },
        "mode": "once_for_all",
        "cf_randomize_materials": {
          "randomization_level": 1,
          "materials_to_replace_with": {
            "provider": "getter.Material",
            "random_samples": 1,
            "conditions": {
              "cp_is_cc_texture": True
            }
          }
        }
      }
    },
    {
      "module": "object.ObjectPoseSampler",
      "config": {
        "objects_to_sample": {
          "provider": "getter.Entity",
          "conditions": {
            "cp_physics": True
          }
        },
        "pos_sampler": {
          "provider":"sampler.Uniform3d",
          "min": {
            "provider": "sampler.Uniform3d",
            "min": [-0.3, -0.3, 0.0],
            "max": [-0.2, -0.2, 0.0]
          },
          "max": {
            "provider": "sampler.Uniform3d",
            "min": [0.2, 0.2, 0.4],
            "max": [0.3, 0.3, 0.6]
          }
        },
        "rot_sampler":{
          "provider":"sampler.UniformSO3"
        }
      }
    },
    {
      "module": "object.PhysicsPositioning",
      "config": {
        "min_simulation_time": 3,
        "max_simulation_time": 10,
        "check_object_interval": 1,
        "solver_iters": 25,
        "substeps_per_frame": 20,
        "friction": 100.0,
        "linear_damping": 0.99,
        "angular_damping": 0.99,
        "objs_with_box_collision_shape": {
          "provider": "getter.Entity",
          "conditions": {
            "name": "ground_plane.*"
          }
        }
      }
    },
    {
      "module": "lighting.LightSampler",
      "config": {
        "lights": [
        {
          "location": {
            "provider": "sampler.Shell",
            "center": [0, 0, 0],
            "radius_min": 1, # now depends on the bottom area of the box
            "radius_max": 1.5, # this one too
            "elevation_min": 5,
            "elevation_max": 89,
            "uniform_elevation": True
          },
          "color": {
            "provider": "sampler.Color",
            "min": [0.5, 0.5, 0.5, 1.0],
            "max": [1.0, 1.0, 1.0, 1.0]
          },
          "type": "POINT",
          "energy": 200
        }
        ]
      }
    },
    {
      "module": "camera.CameraSampler",
      "config": {
        "cam_poses": [
        {
          "proximity_checks": {
            "min": 0.3
          },
          "excluded_objs_in_proximity_check":  {
            "provider": "getter.Entity",
            "conditions": {
              "name": "ground_plane.*",
              "type": "MESH"
            }
          },
          "number_of_samples": 1,     #### original 25
          "location": {
            "provider": "sampler.Shell",
            "center": [0, 0, 0],
            "radius_min": 0.61,
            "radius_max": 1.24,
            "elevation_min": 5,
            "elevation_max": 89,
            "uniform_elevation": True
          },
          "rotation": {
            "format": "look_at",
            "value": {
              "provider": "getter.POI",
              "selector": {
                "provider": "getter.Entity",
                "conditions": {
                  "type": "MESH",
                  "cp_bop_dataset_name": "<args:1>",
                },
                "random_samples": 15
              }
            },
            "inplane_rot": {
              "provider": "sampler.Value",
              "type": "float",
              "min": -3.14159,
              "max": 3.14159
            }
          }
        }
        ]
      }
    },
    {
      "module": "renderer.RgbRenderer",
      "config": {
        "samples": 50,
        "render_distance": True,
        "image_type": "JPEG"                                     #### JPEG ---- png
      }
    },
    {
      "module": "writer.BopWriter",
      "config": {
        "dataset": "<args:1>",
        "append_to_existing_output": True,
        "postprocessing_modules": {
          "distance": [
            {"module": "postprocessing.Dist2Depth"}
          ]
        }
      }
    }
  ]
}

question first answer provided

All 8 comments

Hey @jingweirobot,

I don not fully understand, why you have switched from Boploader to ObjectLoader?

In your camera sampler you make use of the bop_dataset_name custom property:

{
    "provider": "getter.Entity",
    "conditions": {
      "type": "MESH",
      "cp_bop_dataset_name": "<args:1>",
    },
    "random_samples": 15
  }

This custom property is only set automatically when using the BopLoader, so it fails when using the ObjectLoader instead.

@jingweirobot Hi,

I would advise exploring the documentation of the respective modules. It seems like you are confused regarding the operations carried out by the modules in your config file: what parameters are set and what they are doing exactly. BOP-related examples would be a good start.

Please, make sure you are familiar with the operation details of configuration file you are using, it will save you a great deal of time in the future.

Hi, thanks a lot for your information.

You know, yesterday, we used the modified ply files.

We wanted to try to use objectloadermodule to generate dataset by inputting the original ply files

If everything is ok, we will try to import obj files or modified ply files. 

---Original---
From: "Dominik @.>
Date: Wed, May 12, 2021 17:28 PM
To: *
@.>;
Cc:
@.@.*>;
Subject: Re: [DLR-RM/BlenderProc] using_new_version issue (#207)

Hey @jingweirobot,

I don not fully understand, why you have switched from Boploader to ObjectLoader?

In your camera sampler you make use of the bop_dataset_name custom property:
{ "provider": "getter.Entity", "conditions": { "type": "MESH", "cp_bop_dataset_name": "<args:1>", }, "random_samples": 15 }
This custom property is only set automatically when using the BopLoader, so it fails when using the ObjectLoader instead.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

@jingweirobot Just make sure that in your config you refer to the custom properties that you actually set by some modules prior.

Hey
Thanks.

Actually, i read your codes previously, i was able to use this repo to generate dataset successfully. I think i am familar with your code almost.

---Original---
From: @.>
Date: Wed, May 12, 2021 17:35 PM
To: *
@.>;
Cc:
@.@.*>;
Subject: Re: [DLR-RM/BlenderProc] using_new_version issue (#207)

@jingweirobot Hi,

I would advise exploring the documentation of the respective modules. It seems like you are confused regarding the operations carried out by the modules in your config file: what parameters are set and what they are doing exactly. BOP-related examples would be a good start.

Please, make sure you are familiar with the operation details of configuration file you are using, it will save you a great deal of time in the future.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

Camerasampler issue.
Yesterday, according to your suggestion, we are trying to use objectloadermodule.

---Original---
From: @.>
Date: Wed, May 12, 2021 17:38 PM
To: *
@.>;
Cc:
@.@.*>;
Subject: Re: [DLR-RM/BlenderProc] using_new_version issue (#207)

@jingweirobot Just make sure that in your config you refer to the custom properties that you actually set by some modules prior.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

Hey @jingweirobot ,

sorry I did not get the link to the other issue, I thought you were talking about the new BlenderProc version.
So, interchanging the BopLoader with the ObjectLoaderModule is ok, but it is wrong to expect everything to work without any changes to the rest of your config.
As the ObjectLoaderModule does not have anything to do with BOP, it of course does not set the bop_dataset_name custom property.
To fix that specfic issue, you could set this custom propery in you ObjectLoaderModule manually:

    {
      "module": "loader.ObjectLoaderModule",
      "config": {
        "paths": "<args:0>/<args:1>",
        "model_type": "",
        "mm2m": True,
        "sample_objects": True,
        "num_of_objs_to_sample": 21,
        "obj_instances_limit": 1,
        "add_properties": {
          "cp_physics": True,
          "cp_bop_dataset_name": "<args:1>" # <-- here
        },
        "cf_set_shading": "SMOOTH"
      }
    },

@ideas-man @cornerfarmer thanks a lot.

Was this page helpful?
0 / 5 - 0 ratings