Coder Social home page Coder Social logo

zson's Introduction

ZSON: Zero-Shot Object-Goal Navigation using Multimodal Goal Embeddings

This is a PyTorch implementation of the NeurIPS-22 paper: https://arxiv.org/abs/2206.12403

Arjun Majumdar*, Gunjan Aggarwal*, Bhavika Devnani, Judy Hoffman and Dhruv Batra

Georgia Institute of Technology, Meta AI

Details

We present a scalable approach for learning open-world object-goal navigation (ObjectNav) – the task of asking a virtual robot (agent) to find any instance of an object in an unexplored environment (e.g., “find a sink”). Our approach is entirely zero-shot – i.e., it does not require ObjectNav rewards or demonstrations of any kind.

Model Architecture for ZSON.

Installation

All the required data can be downloaded from here.

  1. Create a conda environment:

    conda create -n zson python=3.7 cmake=3.14.0
    
    conda activate zson
    
  2. Install pytorch version 1.10.2:

    conda install pytorch==1.10.2 torchvision==0.11.3 cudatoolkit=11.3 -c pytorch -c conda-forge
    
  3. Install habitat-sim:

    conda install habitat-sim-challenge-2022 headless -c conda-forge -c aihabitat
    
  4. Install habitat-lab:

    git clone --branch challenge-2022 https://github.com/facebookresearch/habitat-lab.git habitat-lab-challenge-2022
    
    cd habitat-lab-challenge-2022
    
    pip install -r requirements.txt
    
    python setup.py develop --all # install habitat and habitat_baselines
    
    cd ..
    

Download and Install zson:

  1. Setup steps

    git clone [email protected]:gunagg/zson.git
    
    cd zson
    
    pip install -r requirements.txt
    
    python setup.py develop
    
  2. Follow the instructions here to set up the data/scene_datasets/ directory. gibson scenes can be found here.

  3. Download the HM3D ImageNav training dataset:

    wget https://huggingface.co/gunjan050/ZSON/resolve/main/imagenav_hm3d.zip
    
    unzip imagenav_hm3d.zip
    
    rm imagenav_hm3d.zip  # clean-up
    
  4. Download the MP3D objectnav dataset.

    wget https://dl.fbaipublicfiles.com/habitat/data/datasets/objectnav/m3d/v1/objectnav_mp3d_v1.zip
    
    mkdir -p data/datasets/objectnav/mp3d/v1
    
    unzip objectnav_mp3d_v1.zip -d data/datasets/objectnav/mp3d/v1
    
    rm objectnav_mp3d_v1.zip  # clean-up
    
  5. Download the HM3D objectnav dataset.

    wget https://dl.fbaipublicfiles.com/habitat/data/datasets/objectnav/hm3d/v1/objectnav_hm3d_v1.zip
    
    unzip objectnav_hm3d_v1.zip -d data/datasets/objectnav/
    
    rm objectnav_hm3d_v1.zip  # clean-up
    
  6. Download the trained checkpoints zson_conf_A.pth and zson_conf_B.pth, and move to data/checkpoints.

  7. To train policies using OVRL pretrained RGB encoder, download the model weights from here and move to data/models/. More details on the encoder can be found here.

  8. Setup data/goal_datasets using the script tools/extract-goal-features.py. This caches CLIP goal embeddings for faster training.

    Your directory structure should now look like this:

    .
    +-- habitat-lab-v0.2.1/
    |   ...
    +-- zson/
    |   +-- data/
    |   |   +-- datasets/
    |   |   |   +-- objectnav/
    |   |   |   +-- imagenav/
    |   |   +-- scene_datasets/
    |   |   |   +-- hm3d/
    |   |   |   +-- mp3d/
    |   |   +-- goal_datasets/
    |   |   |   +-- imagenav/
    |   |   |   |   +-- hm3d/
    |   |   +-- models/
    |   |   +-- checkpoints/
    |   +-- zson/
    |   ...
    

Usage

ZSON configuration A ImageNav Training

sbatch scripts/imagenav-v1-hm3d-ovrl-rn50.sh

ZSON configuration B ImageNav Training

sbatch scripts/imagenav-v2-hm3d-ovrl-rn50.sh

ObjectNav Evaluation

To evaluate a checkpoint trained using ZSON checkpoint use the following command:

sbatch scripts/objnav-eval-$DESIRED-CONFIGURATION$-$DATASET$.sh

Citation

If you use this code in your research, please consider citing:

@inproceedings{majumdar2022zson,
  title={ZSON: Zero-Shot Object-Goal Navigation using Multimodal Goal Embeddings},
  author={Majumdar, Arjun and Aggarwal, Gunjan and Devnani, Bhavika and Hoffman, Judy and Batra, Dhruv},
  booktitle={Neural Information Processing Systems (NeurIPS)},
  year={2022}
}

zson's People

Contributors

gunagg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

zson's Issues

retrain

I am an undergraduate student from the School of Software at Dalian University of Technology. I am very interested in your team's project. Could you please provide a brief explanation on how to retrain a model? Thank you very much.

Environment Setup and Import Errors with `habitat-sim`

Issue Summary:

When attempting to install habitat-sim-challenge-2022 using Conda, I encountered a PackagesNotFoundError. Additionally, switching to the latest version of habitat-sim (0.3.0) results in an ImportError.

Steps to Reproduce:

  1. Attempted installation of habitat-sim-challenge-2022 with the following command:
    conda install habitat-sim-challenge-2022 headless -c conda-forge -c aihabitat
    
  2. Received PackagesNotFoundError.
  3. Tried installing the latest version of habitat-sim (0.3.0).
  4. Encountered an ImportError while importing _C from habitat.config.default.

Error Messages:

  1. PackagesNotFoundError:

    PackagesNotFoundError: The following packages are not available from current channels:
    - habitat-sim-challenge-2022
    
  2. ImportError:

    ImportError: cannot import name '_C' from 'habitat.config.default'
    

what are the versions of habitat-lab and habitat-sim of zson uses?

Whether the data path is forgotten to write?

Thanks for your great working . When I reprodue this work , I can not find the content of DATA_PATH In the scripts/objnav-eval-v2-mp3d.sh file?. " TASK_CONFIG.DATASET.DATA_PATH $DATA_PATH " So where is the content of DATA_PATH In the scripts/objnav-eval-v2-mp3d.sh file? Whether the DATA_PATH is forgotten to write?
#!/bin/bash
#SBATCH --job-name eval
#SBATCH --output log.out
#SBATCH --error log.err
#SBATCH --gres gpu:1
#SBATCH --nodes 1
#SBATCH --cpus-per-task 7
#SBATCH --ntasks-per-node 1
#SBATCH --partition short
#SBATCH --constraint "a40"

export GLOG_minloglevel=2
export MAGNUM_LOG=quiet

MASTER_ADDR=$(srun --ntasks=1 hostname 2>&1 | tail -n1)
export MASTER_ADDR

source activate zson

CKPT_DIR="data/checkpoints/zson_conf_B.pth"

set -x
srun python -u run.py
--exp-config configs/experiments/objectnav_mp3d.yaml
--run-type eval
TASK_CONFIG.TASK.SENSORS '["OBJECTGOAL_PROMPT_SENSOR"]'
TASK_CONFIG.TASK.MEASUREMENTS '["DISTANCE_TO_GOAL", "SUCCESS", "SPL", "SOFT_SPL", "AGENT_ROTATION", "AGENT_POSITION"]'
EVAL_CKPT_PATH_DIR $CKPT_DIR
EVAL.SPLIT "val"
NUM_ENVIRONMENTS 11
TASK_CONFIG.DATASET.DATA_PATH $DATA_PATH
RL.POLICY.pretrained_encoder 'data/models/omnidata_DINO_02.pth'
RL.REWARD_MEASURE "distance_to_goal"
RL.POLICY.CLIP_MODEL "RN50"
EVAL.episodes_eval_data True \

How to use the extract-goal-features.py ?

Thanks for your great work ,I want to reproduce the work and re-train the model.but I do not know what does the 'chunk_index' mean in the extract-goal-features.py? what value should I give to the 'chunk_index' when run the extract-goal-features.py file.
As follows:
parser.add_argument(
"--chunk_index",
required=True,
type=int,
help="the chunk index",
)

Error about slurm

sbatch: error: s_p_parse_file: unable to status file /etc/slurm-llnl/slurm.conf: No such file or directory, retrying in 1sec up to 60sec

Object navigation (config A)

Hi! Thanks for releasing the code.

I tried to train an imagenav model using the script (imagenav-v1-hm3d-ovrl-rn50.sh) in the codebase, but I failed to re-implement the success rate (20.1% vs. 31.3% reported in the paper) when transferred to objectnav. I am wondering if you can provide the training log of config A if convenient. Thanks a lot!

Questions for gibson-objectnav

  1. As the Paper says that ZSON use the config A for gibson objectnav dataset. But in “(https://github.com/gunagg/zson/tree/main/scripts)/objnav-eval-v1-gibson.sh” , it uses the config-B model. I am very confuse about this. Can you please inform me some details?
  2. As I run the (https://github.com/gunagg/zson/tree/main/scripts)/objnav-eval-v1-gibson.sh, I just get the result success rate much lower than the scores in paper both for config A and B without modifing anything with the setting of SUCCESS DISTANCE 0.1 . Is the success distance for gibson-objectnav 0.1m or 1m likes Zer?

Thank you so much for your answers!

Error at loading pretrain weights

Thank you for your excellent work. I encountered an error regarding a missing configuration file when evaluating the hm3d dataset with your pretrained model using script objnav-eval-v2-hm3d.sh

Traceback (most recent call last):
File "/home/mdisk1/heqisheng/embody/navigation/zson/zson/run.py", line 90, in
main()
File "/home/mdisk1/heqisheng/embody/navigation/zson/zson/run.py", line 38, in main
run_exp(**vars(args))
File "/home/mdisk1/heqisheng/embody/navigation/zson/zson/run.py", line 85, in run_exp
config = get_config(exp_config, opts)
File "/home/mdisk1/heqisheng/embody/navigation/zson/zson/zson/config.py", line 259, in get_config
config.TASK_CONFIG = get_task_config(config.BASE_TASK_CONFIG_PATH)
File "/home/mdisk1/heqisheng/embody/navigation/zson/zson/zson/config.py", line 155, in get_task_config
config.merge_from_file(config_path)
File "/home/zhangzhiyuan/miniconda3/envs/zson/lib/python3.7/site-packages/yacs/config.py", line 211, in merge_from_file
with open(cfg_filename, "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'configs/tasks/pointnav.yaml'

After modifying the configuration file path as configs/tasks/objectnav_v1.yaml, the model reported an error that the checkpoints’ weights and the model’s weights are inconsistent.

Traceback (most recent call last):
File "/home/mdisk1/heqisheng/embody/navigation/zson/zson/run.py", line 90, in
main()
File "/home/mdisk1/heqisheng/embody/navigation/zson/zson/run.py", line 38, in main
run_exp(**vars(args))
File "/home/mdisk1/heqisheng/embody/navigation/zson/zson/run.py", line 86, in run_exp
execute_exp(config, run_type)
File "/home/mdisk1/heqisheng/embody/navigation/zson/zson/run.py", line 71, in execute_exp
trainer.eval()
File "/home/mdisk1/heqisheng/embody/navigation/zson/habitat-lab-challenge-2022/habitat_baselines/common/base_trainer.py", line 112, in eval
checkpoint_index=ckpt_idx,
File "/home/mdisk1/heqisheng/embody/navigation/zson/zson/zson/trainer.py", line 179, in _eval_checkpoint
msg = self.agent.load_state_dict(ckpt_dict["state_dict"], strict=False)
File "/home/zhangzhiyuan/miniconda3/envs/zson/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1672, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for ZSON_PPO:
size mismatch for actor_critic.net.state_encoder.rnn.weight_ih_l0: copying a param with shape torch.Size([2048, 1568]) from checkpoint, the shape in current model is torch.Size([1536, 1568]).
size mismatch for actor_critic.net.state_encoder.rnn.weight_hh_l0: copying a param with shape torch.Size([2048, 512]) from checkpoint, the shape in current model is torch.Size([1536, 512]).
size mismatch for actor_critic.net.state_encoder.rnn.bias_ih_l0: copying a param with shape torch.Size([2048]) from checkpoint, the shape in current model is torch.Size([1536]).
size mismatch for actor_critic.net.state_encoder.rnn.bias_hh_l0: copying a param with shape torch.Size([2048]) from checkpoint, the shape in current model is torch.Size([1536]).
size mismatch for actor_critic.net.state_encoder.rnn.weight_ih_l1: copying a param with shape torch.Size([2048, 512]) from checkpoint, the shape in current model is torch.Size([1536, 512]).
size mismatch for actor_critic.net.state_encoder.rnn.weight_hh_l1: copying a param with shape torch.Size([2048, 512]) from checkpoint, the shape in current model is torch.Size([1536, 512]).
size mismatch for actor_critic.net.state_encoder.rnn.bias_ih_l1: copying a param with shape torch.Size([2048]) from checkpoint, the shape in current model is torch.Size([1536]).
size mismatch for actor_critic.net.state_encoder.rnn.bias_hh_l1: copying a param with shape torch.Size([2048]) from checkpoint, the shape in current model is torch.Size([1536]).
Exception ignored in: <function VectorEnv.del at 0x7fa9f2275050>
Traceback (most recent call last):
File "/home/mdisk1/heqisheng/embody/navigation/zson/habitat-lab-challenge-2022/habitat/core/vector_env.py", line 592, in del
self.close()
File "/home/mdisk1/heqisheng/embody/navigation/zson/habitat-lab-challenge-2022/habitat/core/vector_env.py", line 463, in close
write_fn((CLOSE_COMMAND, None))
File "/home/mdisk1/heqisheng/embody/navigation/zson/habitat-lab-challenge-2022/habitat/core/vector_env.py", line 118, in call
self.write_fn(data)
File "/home/mdisk1/heqisheng/embody/navigation/zson/habitat-lab-challenge-2022/habitat/utils/pickle5_multiprocessing.py", line 62, in send
self.send_bytes(buf.getvalue())
File "/home/zhangzhiyuan/miniconda3/envs/zson/lib/python3.7/multiprocessing/connection.py", line 200, in send_bytes
self._send_bytes(m[offset:offset + size])
File "/home/zhangzhiyuan/miniconda3/envs/zson/lib/python3.7/multiprocessing/connection.py", line 404, in _send_bytes
self._send(header + buf)
File "/home/zhangzhiyuan/miniconda3/envs/zson/lib/python3.7/multiprocessing/connection.py", line 368, in _send
n = write(self._handle, buf)
BrokenPipeError: [Errno 32] Broken pipe

Could it be that I have made a mistake in some settings? Could you give me some advice? Thank you.

environment setup

Could you plz give more specific command about this :
Setup data/goal_datasets using the script tools/extract-goal-features.py.

Which dataset I should download and put in?
Follow the instructions here to set up the data/scene_datasets/ directory. gibson scenes can be found here.

How to train objnav task? what is the difference between sbatch scripts/imagenav-v1-hm3d-ovrl-rn50.sh and v2?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.