GithubHelp home page GithubHelp logo

facebookresearch / occupancyanticipation Goto Github PK

View Code? Open in Web Editor NEW
74.0 6.0 26.0 166 KB

This repository contains code for our publication "Occupancy Anticipation for Efficient Exploration and Navigation" in ECCV 2020.

License: MIT License

Python 100.00%

occupancyanticipation's Introduction

Occupancy Anticipation

This repository contains a PyTorch implementation of our ECCV-20 paper:

Occupancy Anticipation for Efficient Exploration and Navigation
Santhosh Kumar Ramakrishnan, Ziad Al-Halah, Kristen Grauman
The University of Texas at Austin, Facebook AI Research

Project website: http://vision.cs.utexas.edu/projects/occupancy_anticipation

This code implements our winning entry to the Habitat-20 PointNav challenge which is a well-tuned version with improved ground-truth generation, faster training, and better heuristics for planning.

Abstract

State-of-the-art navigation methods leverage a spatial memory to generalize to new environments, but their occupancy maps are limited to capturing the geometric structures directly observed by the agent. We propose occupancy anticipation, where the agent uses its egocentric RGB-D observations to infer the occupancy state beyond the visible regions. In doing so, the agent builds its spatial awareness more rapidly, which facilitates efficient exploration and navigation in 3D environments. By exploiting context in both the egocentric views and top-down maps our model successfully anticipates a broader map of the environment, with performance significantly better than strong baselines. Furthermore, when deployed for the sequential decision-making tasks of exploration and navigation, our model outperforms state-of-the-art methods on the Gibson and Matterport3D datasets. Our approach is the winning entry in the 2020 Habitat PointNav Challenge.

Installation

Clone the current repository and required submodules:

git clone https://github.com/facebookresearch/OccupancyAnticipation.git
cd OccupancyAnticipation
  
export OCCANT_ROOT_DIR=$PWD
    
git submodule init 
git submodule update

This project relies on specific commits of 3 different submodules (habitat-api, habitat-sim, astar_pycpp). Ensure that their dependencies are satisfied and then install them as follows:

# Install habitat-api
cd $OCCANT_ROOT_DIR/environments/habitat/habitat-api
python setup.py develop --all
	
# Install habitat-sim
cd $OCCANT_ROOT_DIR/environments/habitat/habitat-sim
python setup.py install --headless --with-cuda
	
# Install astar_pycpp
cd $OCCANT_ROOT_DIR/occant_utils/astar_pycpp
make

Install other requirements for this repository.

cd $OCCANT_ROOT_DIR
pip install -r requirements.txt

Add the OccupancyAnticipation directory to PYTHONPATH in .bashrc.

export PYTHONPATH=<path to OccupancyAnticipation>:$PYTHONPATH

Create a symlink to the habitat-api data directory.

cd $OCCANT_ROOT_DIR
ln -s <PATH TO habitat-api/data> data

Download the exploration dataset.

cd $OCCANT_ROOT_DIR/data/datasets
mkdir exploration
cd exploration

# Download gibson task dataset
wget https://dl.fbaipublicfiles.com/OccupancyAnticipation/gibson.zip
unzip gibson.zip && rm gibson.zip

# Download the matterport3d task dataset
wget https://dl.fbaipublicfiles.com/OccupancyAnticipation/mp3d.zip
unzip mp3d.zip && rm mp3d.zip

Generating environment layouts

We generate top-down occupancy maps for:

  1. computing the occupancy anticipation ground-truth for training
  2. measuring map quality during evaluation.

This is a one-time process and will not impact training or evaluation.

Maps for occupancy ground-truth generation

To compute the occupancy ground-truth, we cast rays from the agent's position till it reaches a wall. We take the ground-truth for all locations that the ray traversed, which may include obstacles within the room. This allows us to exclude regions outside the current room which may be hard to predict.

# Gibson splits

# Need to set this to train / val
SPLIT="train"
cd $OCCANT_ROOT_DIR
python occant_baselines/generate_topdown_maps/generate_occant_gt_maps.py \
    --config-path occant_baselines/generate_topdown_maps/configs/occant_gt/gibson_${SPLIT}.yaml \
    --save-dir data/datasets/exploration/gibson/v1/${SPLIT}/occant_gt_maps \
    --global-map-size 961


# Matterport3D splits

# Need to set this to train / val / test
SPLIT="train"
cd $OCCANT_ROOT_DIR
python occant_baselines/generate_topdown_maps/generate_occant_gt_maps.py \
    --config-path occant_baselines/generate_topdown_maps/configs/occant_gt/mp3d_${SPLIT}.yaml \
    --save-dir data/datasets/exploration/mp3d/v1/${SPLIT}/occant_gt_maps \
    --global-map-size 2001

Note that generating the maps for train and test splits may take several hours.

Maps for evaluating map quality

The top-down layout of objects, walls and free-space needs to be generated for each episode in the evaluation data.

# Gibson validation
cd $OCCANT_ROOT_DIR
python occant_baselines/generate_topdown_maps/generate_environment_layouts.py \
    --config-path occant_baselines/generate_topdown_maps/configs/environment_layouts/gibson_val.yaml \
    --save-dir data/datasets/exploration/gibson/v1/val/environment_layouts \
    --global-map-size 961
    
# Matterport3D test
cd $OCCANT_ROOT_DIR
python occant_baselines/generate_topdown_maps/generate_environment_layouts.py \
    --config-path occant_baselines/generate_topdown_maps/configs/environment_layouts/mp3d_test.yaml \
    --save-dir data/datasets/exploration/mp3d/v1/test/environment_layouts \
    --global-map-size 2001

Note that the Matterport3D test set generation may take ~ 3 hours.

Training models

We provide the training code for the following baselines and variants of our models:

Model Config directory
ANS(rgb) configs/model_configs/ans_rgb
ANS(depth) configs/model_configs/ans_depth
OccAnt(rgb) configs/model_configs/occant_rgb
OccAnt(depth) configs/model_configs/occant_depth
OccAnt(rgbd) configs/model_configs/occant_rgbd
OccAnt(GT) configs/model_configs/occant_ground_truth

To train a model, run the following:

cd $OCCANT_ROOT_DIR

python -u run.py --exp-config <CONFIG-DIRECTORY>/ppo_exploration.yaml --run-type train

Evaluating models

The evaluation configurations for both exploration and navigation under noise_free and noisy conditions are provided for OccAnt(depth) in `configs/. Similar configs can be generated for other models.

To continuously evaluate a series of checkpoints while training, just run the following after setting the right paths:

cd $OCCANT_ROOT_DIR

python -u run.py --exp-config <CONFIG-DIRECTORY>/ppo_<TASK>_evaluate_<NOISE_CONDITION>.yaml --run-type eval

To evaluate a single checkpoint, change EVAL_CKPT_PATH_DIR in the evaluation yaml files to the model path and run the same command.

Pretrained models

We provide sample pretrained models for all methods and the corresponding configurations. These are trained with the latest version of the code for ~24 hours each. We also provide the benchmarked navigation results on Gibson under noise-free and noisy (N) conditions.

Model name Training data Val SPL Val SPL (N) Checkpoint URL Train config URL
ANS(rgb) Gibson 4+ 0.825 0.385 ckpt.12.pth ppo_exploration.yaml
ANS(depth) Gibson 4+ 0.894 0.466 ckpt.14.pth ppo_exploration.yaml
OccAnt(rgb) Gibson 4+ 0.825 0.432 ckpt.11.pth ppo_exploration.yaml
OccAnt(depth) Gibson 4+ 0.912 0.492 ckpt.11.pth ppo_exploration.yaml
OccAnt(rgbd) Gibson 4+ 0.911 0.510 ckpt.10.pth ppo_exploration.yaml

We also provide a habitat challenge version of our model with the navigation results on Gibson under challenge conditions.

Model name Training data Val SPL Test Std. SPL Checkpoint URL Eval config URL
OccAnt(depth) Gibson 2+ 0.463 0.190 ckpt.13.pth ppo_navigation_evaluate.yaml

Replicating ECCV results

Since this version of code is a well-tuned version, it results is much higher performance than those reported in our paper. To replicate results from the paper, we provide the models used to generate the ECCV results and the corresponding evaluation scripts. Checkout the eccv_2020_eval branch for the evaluation code. The pretrained models are provided below along with the benchmarked navigation results on Gibson under noise-free conditions:

Model name Training data Val SPL Checkpoint URL Eval config URL
ANS(rgb) Gibson 4+ 0.586 ckpt.16.pth ppo_navigation_evaluate.yaml
ANS(depth) Gibson 4+ 0.749 ckpt.16.pth ppo_navigation_evaluate.yaml
OccAnt(rgb) Gibson 4+ 0.707 ckpt.8.pth ppo_navigation_evaluate.yaml
OccAnt(depth) Gibson 4+ 0.784 ckpt.6.pth ppo_navigation_evaluate.yaml
OccAnt(rgbd) Gibson 4+ 0.782 ckpt.7.pth ppo_navigation_evaluate.yaml

Acknowledgements

This repository uses parts of Habitat Lab and extends it. We also used Neural SLAM as a reference for the planning heuristics. We thank Devendra Singh Chaplot for helping replicate the Active Neural SLAM results during the early stages of the project.

Citation

@inproceedings{ramakrishnan2020occant,
  title={Occupancy Anticipation for Efficient Exploration and Navigation},
  author={Santhosh Kumar Ramakrishnan, Ziad Al-Halah and Kristen Grauman},
  booktitle={Proceedings of the European Conference on Computer Vision (ECCV)},
  year={2020}
}

License

This project is released under the MIT license, as found in the LICENSE file.

occupancyanticipation's People

Contributors

rpartsey avatar srama2512 avatar yeachan-heo 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

occupancyanticipation's Issues

What if train the modules individually?

It seems that the method consists of three modules, a mapper/occupancy anticipator, a Global policy and a Local policy. The three modules are trained simultaneously. Would you mind letting me know if it is possible to train the three modules individually?

Taking training the Global policy for example, replace the outputs of the mapper with the ground truth, the local policy with a heuristic method, and train the global policy. Next freeze parameters of Global policy and train the mapper. At last freeze both the mapper and the Global policy and train the Local Policy. Will it cause any problem if trained in this way? What are advantages of training simultaneously comparing with training individually?

Your response would be highly appreciated.

Question about path planning.

Hi, I visualize the "wall" in collision map (plot in orange), and the planning path (plot in purple), finding that the path can sometimes still across the "wall". I don't know why. Can you provide some reasons for that? Much appreciate!
image

A question about computing the area of environments

Hello. The paper says

"we divide the validation environments into small (area less than 36m^2) and large (area greater than 36m^2) to observe the influence of environment size on results".

Would you mind giving me any hint on computing the area/size of the enviroment? How do you compute and obtain it? Which lines of code in the project are responsible for computing the area of the environment?

Your response would be highly appreciated.

data preparation

my train.json.gz file is empty,is this supposed to be right?

Bugs in pose sensors Y computation

There is bug in the Y estimates for the pose sensors. It needs to be

delta_y_gt = current_agent_position[1] - past_agent_position[1]

here and here. Note that this bug does not affect the rest of the pipeline since Y is usually left unused.

Run OccupancyAnticipation in Colab

Dear Team,

I would like to use and test the OccupancyAnticipation project for a university course however I don't have access to a local machine with CUDA and I would like to run your repo in Colab. I've tried to follow your instructions directly in Colab without success. Do you have an idea if it is possible to run it in Colab?

Thanks!
Francisco

Train models config directory path

Shouldn't the model config path in the configs table in the README.md Training models section contain model_configs directory as shown below?

Model Config directory
ANS(rgb) configs/model_configs/ans_rgb
ANS(depth) configs/model_configs/ans_depth
OccAnt(rgb) configs/model_configs/occant_rgb
OccAnt(depth) configs/model_configs/occant_depth
OccAnt(rgbd) configs/model_configs/occant_rgbd
OccAnt(GT) configs/model_configs/occant_ground_truth

Question about local masks

Hello, I have some questions about the local masks of the local policy (line 670 in ans.py). It seems that if the previous local goal has been reached or occupied, the hidden state will be masked. I don't understand it. Could you provide some reasons? Thank you so much!

What's does height_thresh means when generating map?

In habitat_extensions.config.default.py, the following parameters are used. What do they mean?

_C.TASK.GT_EGO_MAP.HEIGHT_THRESH = [0.2, 1.5]
_C.TASK.GT_EGO_WALL_MAP.HEIGHT_THRESH = [0.2, 1.5]
_C.TASK.GT_EGO_MAP_ANTICIPATED.HEIGHT_THRESH = [0.2, 1.5]

Normalization of image in Mapper

In Mapper (Line 276 in policy.py ), the input image is processed by "process_image" function, which tries to normalize image. However, the img_mean and img_std are not computed from the distribution of image but set as fixed value from config. I do not understand the reason why to do like this? Hope some explanations could be provided.

No module named 'habitat_baselines.common.env_utils'

When I at # Gibson splits and insert the command
"python occant_baselines/generate_topdown_maps/generate_occant_gt_maps.py", it occured
ModuleNotFoundError: No module named 'habitat_baselines.common.env_utils'

Could anyone help me?

Custom Dataset Evaluation

Hey!

I'm trying to run the OccAnt model on my dataset, with the aim of generating the top-view maps - not concerned with the RL pipeline or pose estimation at the moment. How can I go about loading a pretrained model and run just the mapper module. It seems that the RL pipeline is tightly coupled with this, so I'm facing some trouble using my dataset.

Here's what I've tried so far:

config = get_config("ppo_navigation_evaluate.yaml", None)
trainer_init = OccAntExpTrainer(config)

ans_cfg = config['RL']['ANS']
ppo_cfg = config['RL']['PPO']
occ_cfg = ans_cfg.OCCUPANCY_ANTICIPATOR
mapper_cfg = ans_cfg.MAPPER

# Create occupancy anticipation model
occupancy_model = OccupancyAnticipator(occ_cfg)
occupancy_model = OccupancyAnticipationWrapper(
    occupancy_model, mapper_cfg.map_size, (128, 128)
)

# Create ANS model
ans_net = ActiveNeuralSLAMExplorer(ans_cfg, occupancy_model)
mapper = ans_net.mapper

train_dict = trainer_init.load_checkpoint("models/eccv/ckpt.6.pth")
new_dict = {}
for key in train_dict['mapper_state_dict'].keys():
    if 'projection_unit' in key:
        new_dict['.'.join(key.split('.')[2:])] = train_dict['mapper_state_dict'][key]

mapper.projection_unit.load_state_dict(new_dict)

However, the mapper module seems to require inputs that come from the Habitat Sensors used. My dataset is just a collection of RGB+D images.

Ideally, I can just isolate the OccAntRGBD module, use the pretrained weights, and do a simple forward pass with RGB+D input.

Would appreciate any help on this front.

Thanks!

Mapper training during policy training

Hi there,

I have been working on a variation to the projection unit to add a different type of "fog of war" approach for the sensors. However I do not fully understand the code implementation because the mapper training and policy training seem to happen simultaneously. Wouldn't that lead to sorted, correlated data/label pairs in the supervised part? Is there some shuffling happening that I am missing?
Would really appreciate an answer to how this was approached.

Replicating Habitat Challenge results

Hi dear @srama2512
I followed your README.md instructions and were able to run OccupancyAnticipation evaluation using specified configs without any issues.

The only thing I'd like to ask you is to share the Dockerfile and the agent.py you used for evalai evaluation.

I tried to create my own Dockerfile (and agent.py) but all my attempts to set up the python environment and install OccupancyAnticipation dependencies inside the docker failed.

torch version

When we follow the habitat-api installation instructions https://github.com/facebookresearch/habitat-lab/blob/27483d017210cf710a50ba8061948eab58777202/.circleci/config.yml#L110
then the torch==1.4.0 will be installed.

But the OccupancyAnticipation has the torch==1.2.0 as it's requirement.

When I use torch==1.2.0 and try to generate maps I get following error

ImportError: .virtualenvs/occupancy_anticipation-env/lib/python3.6/site-packages/torch_scatter/scatter_cpu.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe28TypeMeta21_typeMetaDataInstanceIN3c108BFloat16EEEPKNS_6detail12TypeMetaDataEv

When I use torch==1.4.0, then the error doesn't occur, but the warning

Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify to align_corners=True if the old behavior is desired.

is displayed. And I should add align_corners=False to all grid_sample and affine_grid behavior function calls.

I wonder which torch version should be used.

Habitat Challenge evaluation config URL

It looks like the Habitat Challenge evaluation config URL should be called ppo_navigation_evaluate.yaml instead of ppo_exploration.yaml.

See the second table in the Pretrained models section of the README.md.

Why is the MAX_EPISODE_STEPS set to 1001 instead of 1000?

Hi, I noticed that MAX_EPISODE_STEPS is set to 1001 instead of 1000 in the config file during training, but T_EXP is set to 1000, which is not consistent. However, in the test, MAX_EPISODE_STEPS and T_EXP are the same, both are 500. Could you tell me the reason? Thanks!

Not able to load trained models

Hi,
I am trying to load the OccAnt(depth) models but to no luck. Getting the following errors :

Unexpected key(s) in state_dict: "mapper_state_dict", "local_state_dict", "global_state_dict", "config", "extra_state".

I am not doing evaluations through your code base but rather trying to replicate the test_occant.py file.

TASK_CONFIG = "OccupancyAnticipation/occant_baselines/config/ppo_exploration.yaml"
        cfg = get_config(TASK_CONFIG)
        occ_cfg = cfg.RL.ANS.OCCUPANCY_ANTICIPATOR
        OccNet = OccAntDepth(occ_cfg)
        OccNet.load_state_dict(torch.load("OccupancyAnticipation/ckpt.11.pth",map_location='cuda:0'))
        OccNet.eval()

I tried using the specific state dics like mapper_state_dict, but that also does not match with the model's state dict.

Question in updating collision maps in ans.py.

The t2 is equal to "global_pose[i, 2].item() - math.pi / 2", and then I visualize the collision map, finding that the collision you set is in front of the "global_pose[i, 2].item() - math.pi / 2" instead of the direction of agent's pose, which is "global_pose[i, 2].item()". Can you explain that? Much appreciate!!

How to ensure that when using the same experimental setup, the model results after two runs are consistent?

Hi, I noticed that you have used these following codes to generate a random number of a specific seed so that the result is deterministic,
random.seed(config.TASK_CONFIG.SEED)
np.random.seed(config.TASK_CONFIG.SEED)
torch.manual_seed(config.TASK_CONFIG.SEED)
But the truth is , when I use the same experimental setup to run for two times, the results of the same model (eg. ckpt.22.pth )are not the same or even very different. Could you tell me how to ensure that when using the same experimental setup, the model results after two runs are consistent?
Thanks a lot!

Questions about local policy

Q1. It seems that local policy is trained using Imitation Learning/Behavior cloning. Would you mind letting me know where the training data and labels are from for imitation learning?

Q2. I'm not quite clear about the role that local policy plays. Is it possible for the agent to go to long-term goal directed by A* without using local policy?

RuntimeError when running run.py for training

When I tried to train a model for ans_depth via the command "python -u run.py --exp-config configs/model_configs/ans_depth/ppo_exploration.yaml --run-type train", the following error occurs ("RuntimeError: inverse_cuda: For batch 0: U(360710144,360710144) is zero, singular U."). I have no idea on how the error is generated. Is it caused by incorrect installed environments, or other things? I followed the installation guidance, and checked that habitat_sim and habitat did work well. Hope someone to help me figure out the reason or provide solution.

2021-08-16 11:24:35,760 local_agent number of parameters: 489697
2021-08-16 11:24:35,761 global_agent number of parameters: 60739
=================== Mapper rollouts ======================
key: action_at_t_1 , memory: 0.0000 GB
key: depth_at_t , memory: 0.0655 GB
key: depth_at_t_1 , memory: 0.0655 GB
key: ego_map_gt_anticipated_at_t , memory: 0.0338 GB
key: ego_map_gt_at_t , memory: 0.0338 GB
key: ego_map_gt_at_t_1 , memory: 0.0338 GB
key: pose_at_t , memory: 0.0000 GB
key: pose_at_t_1 , memory: 0.0000 GB
key: pose_gt_at_t , memory: 0.0000 GB
key: pose_gt_at_t_1 , memory: 0.0000 GB
key: pose_hat_at_t_1 , memory: 0.0000 GB
key: rgb_at_t , memory: 0.1966 GB
key: rgb_at_t_1 , memory: 0.1966 GB
Total memory: 0.6258 GB
================== Local policy rollouts =====================
key: goal_at_t , memory: 0.0000 GB
key: rgb_at_t , memory: 0.0613 GB
key: t , memory: 0.0000 GB
Total memory: 0.0613 GB
================== Global policy rollouts ====================
key: map_at_t , memory: 3.7236 GB
key: pose_in_map_at_t , memory: 0.0000 GB
Total memory: 3.7236 GB
Traceback (most recent call last):
File "run.py", line 70, in
main()
File "run.py", line 39, in main
run_exp(**vars(args))
File "run.py", line 64, in run_exp
trainer.train()
File "OccupancyAnticipation/occant_baselines/rl/occant_exp_trainer.py", line 1079, in train
batch["pose_gt"],
File "OccupancyAnticipation/occant_baselines/rl/policy.py", line 481, in ext_register_map
return self._register_map(m, p, x)
File "OccupancyAnticipation/occant_baselines/rl/policy.py", line 423, in _register_map
p_reg = self._spatial_transform(p_pad, x)
File "OccupancyAnticipation/occant_baselines/rl/policy.py", line 394, in _spatial_transform
p_trans = spatial_transform_map(p, dx_map, invert=invert)
File "OccupancyAnticipation/occant_utils/common.py", line 60, in spatial_transform_map
Ainv = torch.inverse(A)
RuntimeError: inverse_cuda: For batch 0: U(360710144,360710144) is zero, singular U.
Exception ignored in: <function VectorEnv.del at 0x7f0836dde680>
Traceback (most recent call last):
File "OccupancyAnticipation/environments/habitat/habitat-api/habitat/core/vector_env.py", line 534, in del
self.close()
File "OccupancyAnticipation/environments/habitat/habitat-api/habitat/core/vector_env.py", line 416, in close
write_fn((CLOSE_COMMAND, None))
File "/home/agent/anaconda3/envs/ocan/lib/python3.7/multiprocessing/connection.py", line 206, in send
self._send_bytes(_ForkingPickler.dumps(obj))
File "/home/agent/anaconda3/envs/ocan/lib/python3.7/multiprocessing/connection.py", line 404, in _send_bytes
self._send(header + buf)
File "/home/agent/anaconda3/envs/ocan/lib/python3.7/multiprocessing/connection.py", line 368, in _send
n = write(self._handle, buf)
BrokenPipeError: [Errno 32] Broken pipe

CUDA out of memory

"CUDA out of memory" error occurs during training. Would you mind letting me know the minimum GPU capacity requirement for running the code? Or what capacity of GPU do you suggest to run this code?

Questions about mp3d datasets

Thank you for your work.
Whether mp3d dataset tests in the paper all use the starting point of each scenario provided by the official mp3d dataset test set?

Checkpoints size

@srama2512 Could you, please, also give some insights on why the size of the checkpoints of the same model type vary a lot

For example, let's consider OccAnt(depth):

README.md Model name Training data Val SPL Checkpoint URL Config URL Checkpoint size
Pretrained models OccAnt(depth) Gibson 4+ 0.912 ckpt.11.pth ppo_exploration.yaml 125 MB
Habitat Challenge OccAnt(depth) Gibson 2+ 0.463 ckpt.13.pth ppo_exploration.yaml 94.6 MB
ECCV OccAnt(depth) Gibson 4+ 0.784 ckpt.6.pth ppo_navigation_evaluate.yaml 6.6 MB

Especially, I'm curious about the last row with the checkpoint size of 6.6 MB.

What does map_size mean?

Hello. Please tell me about map_size.
I guessed that map_size in configs/model_configs/*/ppo_exploration.yaml meant the local map size (V) in the paper.
In the paper, even though the local map size (V) is 101, map_size in configs/model_configs/occant_rgb/ppo_exploration.yaml and configs/model_configs/occant_depth/ppo_exploration.yaml is 65. But that of configs/model_configs/occant_rgbd/ppo_exploration.yaml is 101.

I also found the description _C.RL.ANS.MAPPER.map_size = 101 # V in occant_baselines/config/default.py.

mp3d configs

I was wondering if it is possible to release mp3d exploration eval config files/models as well (those mentioned in the paper)?
Thanks!

Unresolved reference 'eval_ckpt_idx'

Unresolved reference 'eval_ckpt_idx' in occant_nav_trainer.py.
See

f"{self.config.TENSORBOARD_DIR}/navigation_results_ckpt_final_{eval_ckpt_idx}.txt"

I guess it should be handled the same way as in the occant_exp_trainer.py.
See

eval_ckpt_idx = self.config.EVAL_CKPT_PATH_DIR.split("/")[-1].split(

@srama2512 if you agree that it should be handled in the same fashion as in occant_exp_trainer.py I can send you a PR to fix this.

How to set appropriate values in .yaml file to avoid low GPU-uti but high GPU Memory-usage?

I used torch==1.9.0 and cuda=11.1, with two A40 GPUs. The code could work if "fill_value" is removed from the inputs to scatter_max function in Line 78 in mapnet.py .
The fps is nearly 30.

What confuses me is that the "GPU-util" is extremely low (<10%) and the "GPU Memory-usage" is high (nearly 50%) when training a model (e.g., the "ans-depth" model). The GPU-util of the GPU for SIMULATOR and MAPPER is nearly 0. Is this normal or is there something wrong due to the change of installation environments?

What should I do to improve the GPU-util? Is it possible to improve the GPU-util by setting the config values in .yaml file? What's the relationship between RL.ANS.MAPPER.replay_size and map_batch_size and NUM_PROCESSES? I have no idea on how to setting appropriate values for "replay_size" and "map_batch_size". It will be of great help is some explanations could be provided.

AttributeError: 'NoneType' object has no attribute 'dim'

I tried to reproduce the OccAnt(GT) results by running
python -u run.py --exp-config configs/model_configs/occant_ground_truth/ppo_exploration.yaml --run-type train.

But got the following error

Process ForkServerProcess-3:
Traceback (most recent call last):
  File "/opt/conda/envs/habitat/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/opt/conda/envs/habitat/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/project/occant_baselines/supervised/map_update.py", line 272, in map_update_worker
    losses = map_update_fn(ps_args)
  File "/opt/project/occant_baselines/supervised/map_update.py", line 174, in map_update_fn
    mapper_outputs = mapper(mapper_inputs, method_name="predict_deltas")
  File "/opt/conda/envs/habitat/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in __call__
    result = self.forward(*input, **kwargs)
  File "/opt/conda/envs/habitat/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 150, in forward
    return self.module(*inputs[0], **kwargs[0])
  File "/opt/conda/envs/habitat/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in __call__
    result = self.forward(*input, **kwargs)
  File "/opt/project/occant_baselines/rl/policy.py", line 603, in forward
    outputs = self.predict_deltas(*args, **kwargs)
  File "/opt/project/occant_baselines/rl/policy.py", line 304, in predict_deltas
    pu_outputs = self.projection_unit(pu_inputs)
  File "/opt/conda/envs/habitat/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in __call__
    result = self.forward(*input, **kwargs)
  File "/opt/project/occant_baselines/rl/policy_utils.py", line 57, in forward
    x_full[k], size=(self.V, self.V), mode="bilinear"
  File "/opt/conda/envs/habitat/lib/python3.6/site-packages/torch/nn/functional.py", line 2482, in interpolate
    if input.dim() == 3 and mode == 'nearest':
AttributeError: 'NoneType' object has no attribute 'dim'

I traced the error. It comes from the following lines
x_full[k] = F.interpolate(x_full[k], size=(self.V, self.V), mode="bilinear")

I further print out x_full[k] that caused the error, finding that
x_full['occ_estimate']=None

It seems when k='occ_estimate', x_full['occ_estimate'], which is None, is passed to F.interpolate(), causing the error.

Would you please help give any suggestion on why the error occurs and how to solve it?
Many thanks!

RuntimeError: inverse_cuda: For batch 0: U(163642880,163642880) is zero, singular U

Hi everyone!

I am running a docker image on google.cloud instance with nvidia K80. Trying it with three different base images:

nvidia/cudagl:10.0-devel-ubuntu18.04
nvidia/cudagl:10.1-devel-ubuntu18.04
nvidia/cudagl:10.2-devel-ubuntu18.04

Dockerfile follows the steps from the README + additional steps for downloading the gibson dataset and additional configs.

nvidia-smi and nvcc work as expected, I am also setting CUDA_VISIBLE_DEVICES=0

Trying different combinations of torch/torch-scatter with python==3.7.11
After running:

/root/miniconda3/envs/env/bin/python -u run.py --exp-config $OCCANT_ROOT_DIR/configs/model_configs/occant_rgb/ppo_navigation_evaluate.yaml --run-type eval

I am either getting:

  1. undefined symbol: _ZN6caffe26detail37_typeMetaDataInstance
    _preallocated_32E

or

  1. RuntimeError: inverse_cuda: For batch 0: U(163642880,163642880) is zero, singular U. Exception ignored in: <function VectorEnv.del at 0x7f1fb3805560> Traceback (most recent call last): File "/OccupancyAnticipation/environments/habitat/habitat-api/habitat/core/vector_env.py", line 534, in del File "/OccupancyAnticipation/environments/habitat/habitat-api/habitat/core/vector_env.py", line 416, in close File "/root/miniconda3/envs/env/lib/python3.7/multiprocessing/connection.py", line 206, in send

I saw issues #34 and #3, so I understand that this might be an incompatibility issue between torch/torch-scatter/cuda
Can someone please suggest a working combination of torch/torch-scatter versions for cuda10.2?

Regarding creating symlink

Hi. I'm trying to run the code. I followed your instructions given by the readme. Everything is fine until creating the symlink using the commond

ln -s <PATH TO habitat-api/data> data

But I didn't find a "data" directory under the "habitat-api" directory. Did I miss anything? Any suggestion is grateful.

How is "done" variable being defined in exploration task?

Hello, I observe the following code in habitat_extensions/exploration_demo.py. And I am confused how is the value of "done" being computed.

while True:
obs, reward, done, info = env.step(action)
if done:
obs = env.reset()

Apart from the maximum number of steps per episode, is there any other condition for an agent to finish one episode? For example, if the agent has fully explored all spaces in the house before the number of experienced steps reaches the allowed maximum number of steps per episode. Will the agent finish this episode and perform env.reset()?

Occupancy estimate

There are some bugs. I found that when calculate xyz position of pixels on the ground. The y were very different. But since pixels are on the ground, the y should be same, right? Another question is about the depth images used in your work. The values of pixels in depth images is the distance between real points and camera of agent. What does the distance define? Is it horizontal distance?

ModuleNotFoundError: No module named 'habitat_extensions'

Hi dear @srama2512
Thanks for open-sourcing your work!

Code snippets from Maps for occupancy ground-truth generation and Maps for evaluating map quality sections in the README.md result in ModuleNotFoundError: No module named 'habitat_extensions' error.

This happens because OccupancyAnticipation directory is missing in the PATH (check sys.path) during the runtime.

I've overcome that by adding

import sys
sys.path.insert(0, os.getcwd())

both to occant_baselines/generate_topdown_maps/generate_occant_gt_maps.py and occant_baselines/generate_topdown_maps/generate_environment_layouts.py.

My python version is Python 3.6.9.

Problem of hyper-parameter

Thanks for your great work. I have a problem with the settting of hyper-parameters. In supplementary materials of the paper, part S8 gives some implementation of hyper-parameters. I am in doubt that the setting is for which kind of experiment? Is it corresponding to the occant_rgbd exploration on Gibson? But it is different with the default setting in ‘configs/model_configs/occant_rgbd/ppo_exploration.yaml’ in the code. Which one is the setting of the result of the paper. Specifically, I don't find 'Mapper update interval' parameter in the code. Is it same with the paper?
Detials of difference is shown as follows

image

Is there any mistake in above table. If there is, please tell me.

By the way, the default value of parameter 'MAX_EPISODE_STEPS' is 1001 in gibson_train.yaml. Should it be 1000?

RuntimeError: Error(s) in loading state_dict for Mapper:

Hi,
I'm trying to evaluate OccAnt(depth) checkpoint ([ckpt.11.pth]) using the yaml file ppo_navigation_evaluate_noisy.yaml provided https://github.com/facebookresearch/OccupancyAnticipation/blob/main/configs/model_configs/occant_depth/ppo_navigation_evaluate_noisy.yaml.
The problem is that it outputs:
I0215 15:12:23.423159 3373 simulator.py:170] Loaded navmesh data/scene_datasets/gibson/Cantwell.navmesh 2022-02-15 15:12:23,426 Initializing task Nav-v0 Traceback (most recent call last): File "run.py", line 70, in <module> main() File "run.py", line 39, in main run_exp(**vars(args)) File "run.py", line 66, in run_exp trainer.eval() File "/OccupancyAnticipation/environments/habitat/habitat-api/habitat_baselines/common/base_trainer.py", line 109, in eval checkpoint_index=prev_ckpt_ind, File "/OccupancyAnticipation/occant_baselines/rl/occant_nav_trainer.py", line 302, in _eval_checkpoint self.mapper.load_state_dict(mapper_dict, strict=False) File "/custom/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 845, in load_state_dict self.__class__.__name__, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for Mapper: size mismatch for projection_unit.main.main.gp_depth_proj_encoder.inc.conv.conv.0.weight: copying a param with shape torch.Size([64, 2, 3, 3]) from checkpoint, the shape in current model is torch.Size([16, 2, 3, 3]). size mismatch for projection_unit.main.main.gp_depth_proj_encoder.inc.conv.conv.0.bias: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([16]). size mismatch for projection_unit.main.main.gp_depth_proj_encoder.inc.conv.conv.1.weight: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([16]). size mismatch for projection_unit.main.main.gp_depth_proj_encoder.inc.conv.conv.1.bias: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([16]). size mismatch for projection_unit.main.main.gp_depth_proj_encoder.inc.conv.conv.1.running_mean: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([16]).
`
and so on.
If I use the same checkpoints for exploration with ppo_exploration_evaluate_noisy.yaml everything is perfect!
What can be the problem?

Unexpected results for pre-trained model

Hi,

Thanks for your work~

I evaluate three different pre-trained models (ANS(rgb), OccAnt(depth) and OccAnt(depth) with challenge vision) with the noise-free setting. However, the SPL and Success seem almost zero. I guess there may be some mistakes in my own evaluation config. Is that possible to provide the corresponding evaluation script?

By the way, the model that I trained from scratch performs badly, either. If you have any suggestion, please tell me. Thank you very much~

actuation noise

Hi, I was wondering where can I find the noisy task action registry? I only found "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT" in the config files and assume they are noisy-free. Thank you.

What's the behind meaning of "GT_TYPE: wall_occupancy" in the configuration .yaml file?

In the configuration file, the following is described for the GT_EGO_MAP_ANTICIPATED. What will happen if the GT_TYPE is selected as "wall_occupancy". Are there other types, and what are the meaning of the other types?

GT_EGO_MAP_ANTICIPATED:
MAP_SIZE: 101
MAP_SCALE: 0.05
HEIGHT_THRESH: [0.2, 1.5]
MAX_SENSOR_RANGE: 5.05
NUM_TOPDOWN_MAP_SAMPLE_POINTS: 20000
GT_TYPE: 'wall_occupancy'
ALL_MAPS_INFO_PATH: 'data/datasets/exploration/gibson/v1/train/occant_gt_maps/all_maps_info.json'

Why is the rl used for training the local policy and heuristics used for testing?

Hi, I notice that there is no config file for testing in configs/model_configs/occant_rgbd, but in configs/model_configs/occant_depth, I found ppo_exploration.yaml and ppo_exploration_evaluate_noise_free.yaml, which are respectively for training and testing. I compared the two files and found that the local policy for training is rl, and the heuristic is used for testing. Does this mean that the local policy I trained during training was not used during testing? Can you explain it! Thanks for your time!!

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.