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

[esp/scene] initial support for Gibson semantic scene #393

Merged
merged 10 commits into from
Dec 20, 2019
Merged

Conversation

msbaines
Copy link
Contributor

This change include a Gibson semantic scene generator and parser.

Motivation and Context

Required to support Gibson semantic mesh data.

How Has This Been Tested

Wrote a simple test.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

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.

This change include a Gibson semantic scene generator and parser.
@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Dec 18, 2019
@msbaines msbaines requested a review from mosra December 18, 2019 22:12
@codecov-io
Copy link

codecov-io commented Dec 19, 2019

Codecov Report

Merging #393 into master will decrease coverage by 1.33%.
The diff coverage is 77.15%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #393      +/-   ##
==========================================
- Coverage   57.16%   55.82%   -1.34%     
==========================================
  Files         156      170      +14     
  Lines        7122     7918     +796     
  Branches        0       82      +82     
==========================================
+ Hits         4071     4420     +349     
- Misses       3051     3498     +447
Flag Coverage Δ
#CPP 52.35% <72.5%> (?)
#JavaScript 5.53% <ø> (?)
#Python 77.42% <100%> (?)
Impacted Files Coverage Δ
src/esp/assets/MeshData.h 100% <ø> (ø)
src/esp/scene/SemanticScene.h 14.28% <ø> (ø) ⬆️
src/esp/gfx/Simulator.h 100% <ø> (ø) ⬆️
src/esp/assets/MeshMetaData.h 81.81% <ø> (-4.39%) ⬇️
habitat_sim/nav/__init__.py 100% <ø> (ø) ⬆️
src/esp/assets/GenericInstanceMeshData.h 0% <ø> (ø) ⬆️
src/esp/geo/geo.cpp 34.28% <0%> (+4.28%) ⬆️
src/esp/gfx/PTexMeshShader.cpp 0% <0%> (ø) ⬆️
src/esp/nav/PathFinder.h 26.66% <0%> (-46.07%) ⬇️
src/esp/gfx/Simulator.cpp 63.46% <0%> (-2.99%) ⬇️
... and 38 more

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 d3523aa...4a9e94a. Read the comment docs.

const std::string& houseFilename,
SemanticScene& scene,
const quatf& worldRotation /* = quatf::Identity() */) {
if (!io::exists(houseFilename)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Cr::Utility::Directory::exists()? IIRC the io:: APIs are obsolete and should be gradually replaced with corrade's functionality.

#include <map>
#include <string>

#include <Corrade/Utility/String.h>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unused include?

@msbaines
Copy link
Contributor Author

ping

All feedback addressed.

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, some minor comments. Can we add example of command line how to run the tool.

src/esp/gfx/Simulator.cpp Show resolved Hide resolved
bool SemanticScene::loadGibsonHouse(
const std::string& houseFilename,
SemanticScene& scene,
const quatf& worldRotation /* = quatf::Identity() */) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to uncomment default value? Looks reasonable.

Copy link
Contributor

Choose a reason for hiding this comment

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

The default arguments are only provided in the function declaration, not in the function definition.

scene.categories_.push_back(category);
object->category_ = std::move(category);
}
// TODO(msb) object->obb = ;
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 more extended comment about adding bounding boxes.

def fixCoords(entry):
size = entry["size"].tolist()
size[1], size[2] = size[2], size[1]
entry["size"] = size
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like entry["size"] wasn't list, but now it is. Is that expected?

tools/npz2scn.py Outdated

# Convert ndarrays to python lists so that we can serialize.
# Tranform coordinates by rotating Y-axis to Z-axis
def fixCoords(entry):
Copy link
Contributor

@mathfac mathfac Dec 20, 2019

Choose a reason for hiding this comment

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

If we know entry type we can add typing to the func, for example:
from typing import Any, Dict
def fix_coords(entry: Dict[str, Any]) -> None

tools/npz2scn.py Outdated


# Convert ndarrays to python lists so that we can serialize.
# Tranform coordinates by rotating Y-axis to Z-axis
Copy link
Contributor

@mathfac mathfac Dec 20, 2019

Choose a reason for hiding this comment

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

Suggested change
# Tranform coordinates by rotating Y-axis to Z-axis
# Transform coordinates by rotating Y-axis to Z-axis

Maybe, the comment should be:
# Transform coordinates by rotating Y-axis to -Z-axis

tools/npz2scn.py Outdated

# Convert ndarrays to python lists so that we can serialize.
# Tranform coordinates by rotating Y-axis to Z-axis
def fixCoords(entry):
Copy link
Contributor

Choose a reason for hiding this comment

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

Based on naming convention:

Suggested change
def fixCoords(entry):
def fix_coords(entry):

tools/npz2scn.py Outdated


def main():
parser = argparse.ArgumentParser(description="Extract object IDs from npz.")
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
parser = argparse.ArgumentParser(description="Extract object IDs from npz.")
parser = argparse.ArgumentParser(description="Extracts object IDs from npz. Used for loading 3dscenegraph.stanford.edu semantic data.")

tools/npz2scn.py Outdated
Comment on lines 33 to 34
for object in objects.values():
fixCoords(object)
Copy link
Contributor

Choose a reason for hiding this comment

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

Use of keyword object, rename to obj maybe.

} else {
int nextCategoryIndex = scene.categories_.size();
categories[categoryName] = nextCategoryIndex++;
auto category = std::make_shared<GibsonObjectCategory>(nextCategoryIndex,
Copy link
Contributor

Choose a reason for hiding this comment

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

nextCategoryIndex has been increased by 1.
It is NOT equal to categories[categoryName] now. Make sure if this is really what you want?

@msbaines
Copy link
Contributor Author

I've now addressed all feedback.

@msbaines msbaines merged commit 998f3f7 into master Dec 20, 2019
@msbaines msbaines deleted the gibson-scene branch December 20, 2019 23:36
mathfac added a commit that referenced this pull request Jan 2, 2020
…is missing (#406)

With current code state 3dscenegraph semantic annotation files (*.scn) won't load, as our semantic loading pipeline triggers only on *.house files. To enable functionality implemented in #393 and #374 added loading of Gibson Semantics scene if MP3D semantic is missing. To test semantic loading e2e added integration test that will run only when *.scn test data is available.
eundersander pushed a commit to eundersander/habitat-sim that referenced this pull request Aug 6, 2020
Ram81 pushed a commit to Ram81/habitat-web-sim that referenced this pull request Dec 10, 2020
Ram81 pushed a commit to Ram81/habitat-web-sim that referenced this pull request Dec 10, 2020
…is missing (facebookresearch#406)

With current code state 3dscenegraph semantic annotation files (*.scn) won't load, as our semantic loading pipeline triggers only on *.house files. To enable functionality implemented in facebookresearch#393 and facebookresearch#374 added loading of Gibson Semantics scene if MP3D semantic is missing. To test semantic loading e2e added integration test that will run only when *.scn test data is available.
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.

7 participants