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

Higher mesh coverage pose extraction for ImageExtractor #516

Merged
merged 57 commits into from
Mar 23, 2020

Conversation

mpiseno
Copy link

@mpiseno mpiseno commented Mar 3, 2020

Motivation and Context

The data extraction in habitat sim is currently limited because it extracts 1 camera pose per camera position. In this PR I created another method for pose extraction, named panorama, in which for each camera position, we can extract multiple different poses by doing a simple 360 degree turn at each point. The purpose is to obtain a more complete mesh coverage and have more image data per scene to train models with.

How Has This Been Tested

Added a simple test that uses the "panorama" method of pose extraction and asserts that the extractor extracted some poses using this method.

Types of changes

  • New feature (non-breaking change which adds functionality)

Example Output

Below are a series of image that were taken from the same camera position within Replica Apartment 1. With the other method of pose extraction, this camera position would only produce one image.

pan1
pan2
pan3
pan4
pan5
pan6
pan7

Michael Piseno and others added 30 commits January 28, 2020 17:08
… pytorch model and tests for that as well as the topdown view
@mpiseno mpiseno changed the title initial commit for panorama pose extraction Improved mesh coverage for ImageExtractor Mar 3, 2020
@dhruvbatra
Copy link
Contributor

Can you please post pictures of the kinds of frames you are able to extract?

Also (just curious, don't know the right answer) -- would this be better captured as a new camera model in habitat-sim RGB sensor?

@mpiseno
Copy link
Author

mpiseno commented Mar 3, 2020

Can you please post pictures of the kinds of frames you are able to extract?

Also (just curious, don't know the right answer) -- would this be better captured as a new camera model in habitat-sim RGB sensor?

Sure no problem! As for the new camera model, that's something I can bring up, but the way I have it implemented currently is simple and works. Perhaps we could get a more complete coverage of the mesh with a new camera model. This will become more clear when I implement a metric to track how much of the mesh has actually been covered.

@codecov
Copy link

codecov bot commented Mar 3, 2020

Codecov Report

Merging #516 into master will not change coverage by %.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #516   +/-   ##
=======================================
  Coverage   62.16%   62.16%           
=======================================
  Files         167      167           
  Lines        7860     7860           
  Branches       84       84           
=======================================
  Hits         4886     4886           
  Misses       2974     2974           
Flag Coverage Δ
#CPP 57.45% <0.00%> (ø)
#JavaScript 10.00% <0.00%> (ø)
#Python 80.48% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9a0bcc6...9a0bcc6. Read the comment docs.

@mpiseno
Copy link
Author

mpiseno commented Mar 4, 2020

Can you please post pictures of the kinds of frames you are able to extract?

Also (just curious, don't know the right answer) -- would this be better captured as a new camera model in habitat-sim RGB sensor?

Updated the PR with some example output.

@mpiseno mpiseno changed the title Improved mesh coverage for ImageExtractor Higher mesh coverage pose extraction for ImageExtractor Mar 12, 2020
@mpiseno mpiseno changed the base branch from maskrcnn-training to master March 18, 2020 04:29
@mpiseno mpiseno changed the base branch from master to maskrcnn-training March 18, 2020 04:30
@mpiseno mpiseno changed the base branch from maskrcnn-training to master March 18, 2020 04:36
def extract_poses(self, labels, extraction_method):
r"""Returns a numpy array of camera poses. If extraction method is "closest", this method will
use bfs to find the closest point of interest to each camera position. If the extraction method
is "panorama", it will extract a full panorama of camera poses for each camera position
Copy link
Contributor

Choose a reason for hiding this comment

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

When you mention panorama here, does that mean one image or a number of images taking turns? Let's make it explicit what to expect.

@@ -28,8 +29,10 @@ def __init__(self, topdown_views, sim, pixels_per_meter=0.1):
self.sim = sim
self.pixels_per_meter = pixels_per_meter

def extract_poses(self, labels):
r"""Returns a numpy array of camera poses.
def extract_poses(self, labels, extraction_method):
Copy link
Contributor

@mathfac mathfac Mar 18, 2020

Choose a reason for hiding this comment

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

This is part of public API, let's add typing to the signature, especially result type.

in_bounds_of_tdv = lambda row, col: 0 <= row < len(view) and 0 <= col < len(
view[0]
)
cpi_label_pairs = []
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 tdv, cpi here? Let's make it verbose.

import os


def search_dir_tree_for_ext(mydir, ext):
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add typing to the function signature.

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.

Overall, looks great, left several comments.

@mpiseno mpiseno requested a review from mathfac March 19, 2020 01:56
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.

Looks great, thank you for addressing the comments and making code more easy readable and easier to support.

@mathfac
Copy link
Contributor

mathfac commented Mar 19, 2020

If you have related unit test that would be great to add panorama options to testing.

@mpiseno mpiseno merged commit 4332d78 into master Mar 23, 2020
Ram81 pushed a commit to Ram81/habitat-web-sim that referenced this pull request Dec 10, 2020
…arch#516)

* created infrastructure for data extraction API

* mend

* added functionality for data extractor to be ran end-to-end through a pytorch model and tests for that as well as the topdown view

* fixed incorrect rotations in camera poses

* Added more user options for image extraction and added heuristics to BFS

* formatting and added pytorch as dependency

* dependencies

* modifed topdown test

* modified test

* added reconfig step if a sim is provided to the test (for image shapes)

* fixed error with end-to-end test

* Removed PyTorch dependecy except for in tests

* creating branch for maskrcnn experiments

* added close function to extractor to shut down sim

* created notebook for training maskrcnn with habitat - doesn't work on devfair yet

* added support for train/test split to ImageExtractor

* branch init

* added functionality for multiple scene files to extract images from

* created data extraction API for habitat-sim

* height passed in as arg to getTopdownView and removed examples/settings import

* added jupyter notebook example for Dataset Extraction API and changed getTopdownView to return Eigen Matrix

* formatting

* moved PoseExtractor to separate file and other formatting changes

* modified training pipeline

* removed torch dependency

* failing api tests fix

* full training pipeline with overfitting on small dataset

* fixed merge conflict in pyrproject.toml

* created caching for ImageExtractor so scene switches are less frequent

* changed file names to match format

* formatting

* removed jupyter notebook

* --ammend

* formatting

* removed pytorch vision/detection depednecies and updated comments

* --ammend

* --ammend

* --ammend

* fixed deps

* deps

* adding back a deleted file

* fixed bug in cache

* minor changes for testing

* minor test changes

* more test changes

* initial commit for panorama pose extraction

* --ammend

* formatting

* typing and updated comments

* added typing to ImageExtractor constructor and test for panorama

Co-authored-by: Michael Piseno <mpiseno@fb.com>
Co-authored-by: Michael Piseno <mpiseno@devfair0238.h2.fair>
luoj1 pushed a commit to luoj1/habitat-sim that referenced this pull request Aug 16, 2022
…nfig

--Refactor for removal of Habsim:SceneConfiguration
@jturner65 jturner65 deleted the better-pose-extraction branch November 29, 2023 16:33
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.

4 participants