habitat-sim icon indicating copy to clipboard operation
habitat-sim copied to clipboard

Bug when mapping object_id to semantic_id

Open pangxincheng opened this issue 2 years ago • 1 comments

Habitat-Sim version

v0.2.3

Docs and Tutorials

Did you read the docs? https://aihabitat.org/docs/habitat-sim/ yes Did you check out the tutorials? https://aihabitat.org/tutorial/2020/ yes Perhaps your question is answered there. If not, carry on!

❓ Questions and Help

I want to map object_id to semantic_id in the HM3D dataset. I use the method in #263 but there is a problem.

Code

...
scene = sim.semantic_scene
object_id_to_label_id = {int(obj.id.split("_")[-1]): obj.category.index() for obj in scene.objects}
mapping = np.vectorize(lambda x: object_id_to_label_id.get(x))
observation = reset_pos(sim, pos, rot)  # set the position of the agent, and get the observation
semantic_label = mapping (observation["label"])
...

Problem There is a TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType' when the program was executed to semantic_label = mapping (observation["label"]). I debugged the program, and I found that this is because there are some object id in the observation["label"] that are not in object_id_to_label_id

How can I avoid this problem? Or how should I map object_id to semantic_id?(In fact, I want to map object_id to 40 Matterport categories, how can i do this?)

pangxincheng avatar Jan 31 '23 13:01 pangxincheng

Hi, May I know if you resolved this problem now?

Jaraxxus-Me avatar Mar 23 '24 18:03 Jaraxxus-Me