habitat-sim
habitat-sim copied to clipboard
Bug when mapping object_id to semantic_id
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?)
Hi, May I know if you resolved this problem now?