Skip to content

Commit

Permalink
Segmentation ID Metadata
Browse files Browse the repository at this point in the history
I think this is a somewhat fix for the Segmentation ID.
Without line 50 in post_processing "Null" gets passed through to the metadata.

The addition in utils just checks if the item has the attribute segmentation_id and adds it to the metadata info dictionary
  • Loading branch information
MrXandbadas committed Jun 4, 2022
1 parent 8f3bf65 commit 72415ea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions kubric/post_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def adjust_segmentation_idxs(
new_segmentation[segmentation == i] = asset.segmentation_id
elif asset in new_assets_list:
new_segmentation[segmentation == i] = new_assets_list.index(asset) + 1
asset.segmentation_id = i
else:
new_segmentation[segmentation == i] = ignored_label
return new_segmentation
Expand Down
2 changes: 2 additions & 0 deletions kubric/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ def get_instance_info(scene, assets_subset=None):
info = copy.copy(instance.metadata)
if hasattr(instance, "asset_id"):
info["asset_id"] = instance.asset_id
if hasattr(instance, "segmentation_id"):
info["segmentation_id"] = instance.segmentation_id
info["positions"] = instance.get_values_over_time("position")
info["quaternions"] = instance.get_values_over_time("quaternion")
info["velocities"] = instance.get_values_over_time("velocity")
Expand Down

0 comments on commit 72415ea

Please sign in to comment.