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

how to get objectnav goal string label from "observations["objectgoal"][0]"

Open Benson722 opened this issue 10 months ago • 0 comments

Habitat-Sim version

v0.3.2 (stable)

Habitat is under active development, and we advise users to restrict themselves to stable releases. Are you using the latest release version of Habitat-Sim? Your question may already be addressed in the latest version. We may also not be able to help with problems in earlier versions because they sometimes lack the more verbose logging needed for debugging.

Main branch contains 'bleeding edge' code and should be used at your own risk.

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

def example():    
    config=habitat.get_config("benchmark/nav/objectnav/objectnav_hm3d.yaml")
    # config = habitat.get_config(config_path="benchmark/nav/pointnav/pointnav_habitat_test.yaml")
    
    with read_write(config):
        # config.habitat.dataset.split = "val"
        agent_config = get_agent_config(sim_config=config.habitat.simulator)
        agent_config.sim_sensors.update(
            {"semantic_sensor": HabitatSimSemanticSensorConfig(height=256, width=256)}
        )
        config.habitat.simulator.turn_angle = 30

    env = habitat.Env(
        config=config
    )

    print("Environment creation successful")
    observations = env.reset()
    print("Destination, distance: {:3f}, Goal(uuid): {:.d}".format(
        env.get_metrics()["distance_to_goal"],
        observations["objectgoal"][0])
    )
    # print("Destination, distance: {:3f}, theta(radians): {:.2f}".format(
    #     observations["pointgoal_with_gps_compass"][0],
    #     observations["pointgoal_with_gps_compass"][1])
    # )
...

I want to get string label about "observations["objectgoal"][0])", which is "sofa" in the code. I don't find it in "observations["objectgoal"]". By the way, the value of observations["objectgoal"][0]) is 5, and the string label in dataset is sofa:

(objectnav/hm3d/v1/train/train.json.gz)

{"episodes": [], "category_to_task_category_id": {"chair": 0, "bed": 1, "plant": 2, "toilet": 3, "tv_monitor": 4, "sofa": 5}, "category_to_scene_annotation_category_id": {"chair": 0, "bed": 1, "plant": 2, "toilet": 3, "tv_monitor": 4, "sofa": 5}}

Benson722 avatar Dec 30 '24 03:12 Benson722