Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VLN Task & Dataset with shortest path example and tests. #233

Merged
merged 23 commits into from
Dec 5, 2019

Conversation

koshyanand
Copy link
Contributor

@koshyanand koshyanand commented Oct 22, 2019

Motivation and Context

  • Add VLN Task

  • Add reading of Room-to-Room Dataset

  • Add VLN Instruction Sensor

  • Added shortest path follower

  • Added benchmark for Random, ForwardOnly, RandomForward & GoalFollower agent

  • Represent instructions as list of tokens

  • Added vocabulary API to R2R dataset

How Has This Been Tested

  • Config test

  • Dataset size and serialization test

  • Instruction Sensor test & test to see if the sensor instruction matches the current instruction

Types of changes

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have completed my CLA (see CONTRIBUTING)
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Oct 22, 2019
@erikwijmans erikwijmans requested review from mathfac, abhiskk and erikwijmans and removed request for mathfac October 22, 2019 15:17
Copy link
Contributor

@erikwijmans erikwijmans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial comments. Will dive in more later.

habitat/tasks/vln/vln.py Outdated Show resolved Hide resolved
habitat/tasks/utils.py Outdated Show resolved Hide resolved
configs/tasks/vln_r2r.yaml Outdated Show resolved Hide resolved
Copy link
Contributor

@mathfac mathfac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome progress! VLN task is a one of the most anticipated tasks in Habitat. Left a part of the comments.

DATASET:
TYPE: R2RVLN-v1
SPLIT: train
DATA_PATH: data/R2R/habitat_R2R_{split}.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To follow naming dataset files naming convention I would advice next naming:

Suggested change
DATA_PATH: data/R2R/habitat_R2R_{split}.json
DATA_PATH: data/datasets/r2r/{split}/{split}.json.gz

HABITAT_SIM_V0:
GPU_DEVICE_ID: 0
RGB_SENSOR:
WIDTH: 512
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that expected that RGB resolution is different from Depth resolution?

TYPE: R2RVLN-v1
SPLIT: train
DATA_PATH: data/R2R/habitat_R2R_{split}.json
SCENES_DIR: data/mp3d/scenes/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default path is expected to be:

Suggested change
SCENES_DIR: data/mp3d/scenes/
SCENES_DIR: "data/scene_datasets/"

TYPE: R2RVLN-v1
SPLIT: train
DATA_PATH: data/datasets/R2R/hb_R2R_{split}.json
SCENES_DIR: data/scene_datasets/mp3d/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment regarding dataset paths.

configs/tasks/vln_r2r.yaml Show resolved Hide resolved
HEIGHT: 256
TASK:
TYPE: VLN-v0
SUCCESS_DISTANCE: 2.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 meters are acceptable success distance? Can be pretty large threshold.

configs/tasks/vln_r2r.yaml Show resolved Hide resolved
DATASET:
TYPE: R2RVLN-v1
SPLIT: val_seen
DATA_PATH: data/datasets/R2R/hb_R2R_{split}.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dataset files paths and naming.

HEIGHT: 256
TASK:
TYPE: VLN-v0
SUCCESS_DISTANCE: 3.0
Copy link
Contributor

@jacobkrantz jacobkrantz Oct 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The success distance is set to 3m here which is the distance defined in the original VLN paper and is used by most papers in this space.

Copy link
Contributor

@mathfac mathfac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are really close, left some final comments. Is it possible to add link to data download into README? Thank you!

TYPE: VLN-v0
SUCCESS_DISTANCE: 3.0
SENSORS: ['INSTRUCTION_SENSOR']
POSSIBLE_ACTIONS: ['MOVE_FORWARD', 'TURN_LEFT', 'TURN_RIGHT', 'STOP']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth to make 'STOP' 0 action, as list of other actions can expand.

dataset_config
):
pytest.skip(
"Please download Matterport3D R2R dataset to " "data folder."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Please download Matterport3D R2R dataset to " "data folder."
"Please download Matterport3D R2R dataset to data folder."

test/test_r2r_vln.py Outdated Show resolved Hide resolved
follower = ShortestPathFollower(
env.habitat_env.sim, goal_radius=0.5, return_one_hot=False
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

@@ -0,0 +1,120 @@
#!/usr/bin/env python3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding relevant tests.

start_rotation: numpy ndarray with 4 entries for (x, y, z, w)
elements of unit quaternion (versor) representing agent 3D
orientation.
instruction: single instruction guide to goal.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
instruction: single instruction guide to goal.
instruction: single natural language instruction guide to goal.



@registry.register_task(name="VLN-v0")
class VLNTask(NavigationTask):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extensive doc string should be added with concise description of the task.

CONTENT_SCENES_PATH_FIELD = "content_scenes_path"
DEFAULT_SCENE_PATH_PREFIX = "data/scene_datasets/mp3d/"

R2R_TRAIN_EPISODES = 10837
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This constants are never used.

output_im, observations["instruction"]["text"]
)
images.append(output_im)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are all functions above required? Can we import and reuse functions from other examples or util functions?

return avg_metrics


def main():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, we would like to have same launcher for different task benchmarks. It should be possible to incorporate task config into examples/benchmark.py and make it support VLN as well. But most probably one more registry needed for supported agents/baselines. Let's create follow up issue with merging benchmark.py and vln_benchmark.py.

Copy link
Contributor

@mathfac mathfac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job @koshyanand and @jacobkrantz, really like how you figured out a lot details from existing code. Some minor comments otherwise ready to merge.

os.makedirs(IMAGE_DIR)


def append_text_to_image(orig_img, text):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move to habitat.utils.visualizations.utils.


deserialized = json.loads(json_str)

# Done for the serialization test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason that we need this if? Why we don't have deserialized["instruction_vocab"]["word_list"] in released version of dataset?

trajectory_id: id of ground truth trajectory path.
goals: relevant goal object/room.
"""
path: List[List[float]] = attr.ib(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make the rotation in ShortestPathPoint optional sounds good. You can re-use visualization we have for shortest path already.

@@ -0,0 +1,92 @@
#!/usr/bin/env python3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can include your names as owners/maintainers of the VLN task here as well as reflect your contribution in README section.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added our names in this file. For the README section, we can wait until we have a paper (as per discussion).

RGB_SENSOR:
WIDTH: 256
HEIGHT: 256
HFOV: 45
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 45 degrees? That seems incredibly narrow

DATASET:
TYPE: R2RVLN-v1
SPLIT: train
DATA_PATH: "data/datasets/vln/r2r/v1/{split}/{split}.json.gz"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be consistent with our dataset paths let change path to everywhere:

Suggested change
DATA_PATH: "data/datasets/vln/r2r/v1/{split}/{split}.json.gz"
DATA_PATH: "data/datasets/vln/mp3d/r2r/v1/{split}/{split}.json.gz"

R2R_VAL_SEEN_EPISODES = 781


@registry.register_dataset(name="R2RVLN-v1")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should register it MP3DR2RVLN-v1 or change doc string not attach it to MP3D only. From my experience this class can be scene dataset agnostic.

Suggested change
@registry.register_dataset(name="R2RVLN-v1")
@registry.register_dataset(name="R2RVLN-v1")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the doc string as the class is not tied to MP3D.

@jacobkrantz
Copy link
Contributor

@erikwijmans @mathfac back to you!

@mathfac mathfac merged commit 8726f0d into facebookresearch:master Dec 5, 2019
@mathfac
Copy link
Contributor

mathfac commented Dec 5, 2019

@jacobkrantz and @koshyanand thank you for the contribution of such popular Embodied AI task and following all the comments.

dhruvbatra pushed a commit that referenced this pull request May 10, 2020
This test is randomly failing (#233). Try to make it deterministic
so that it always fails or always passes.
dannymcy pushed a commit to dannymcy/habitat-lab that referenced this pull request Jul 8, 2024
…earch#233)

 * Add VLN Task

 * Add reading of Room-to-Room Dataset

 * Add VLN Instruction Sensor

 * Added shortest path follower

 * Added benchmark for Random, ForwardOnly, RandomForward & GoalFollower agent

*  Represent instructions as list of tokens

*  Added vocabulary API to R2R dataset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants