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

43 panoptic quality metrics #89

Merged
merged 24 commits into from
Oct 8, 2021
Merged

Conversation

Johansmm
Copy link
Contributor

Development of PQmetric and PQMetricsCallback modules, to measure Panoptic Quality metric.

Important changes:

  • Update CocoPanopticDataset to read and handled multiples labels: ['category','isthing','supercategory']
  • Implement ApMetricsCallbacks and PQMetricsCallbacks base on BaseMetricsCallbacks, in order to use any metric with add_sample function.
  • Update LitPanopticDetr and create PanopticApMetricsCallbacks, that transform (if the procedure required it) the labels in aloscene.Labels object (keep only 'category' label)', to handled the same pipeline that Detr model.
  • Update in aloscene.Mask.masks2id function (called aloscene.Mask.masks2panoptic before) to return annotations (use just in get_view function) if desired and fix silence problem in wrong changes of ids.

Some problems fixed:

  • aloscene.Mask.getview: Render aloscene.BoundingBoxes2d and aloscene.Mask from multiples labels. Tested cases:
# boxes with multiples labels (using append_labels function and name parameter)
boxes2d.get_view(labels_set="category").render() # Render category-boxes without background image
boxes2d.get_view().render() # Render boxes without background image and boxes with the same color

# masks with multiples labels
masks.get_view(labels_set="category").render() # Render category-masks without background image
masks.get_view().render() # Render masks without background image and different color for each object with the same color (regardless of whether they are in the same category or not)

# Frame with boxes and segmentation attributes (not None value)
# Render specific views, each with category as labels
views = [fr.boxes2d.get_view(fr, labels_set="category") for fr in frames]
views += [fr.segmentation.get_view(fr, labels_set="category") for fr in frames]
frames.get_view(views).render()

# Render all in frame (4 views per frame in batch: boxes, segmentation, mask and frame)
frames.get_view(labels_set="category").render() # Render a specific label set
frames.get_view().render() # Render all boxes with same color and diff color for each object-masks 

Important note:
This feature requires first approve and merge #73. The changes present in the new update not mentioned are part of #73

Closes #43

@Johansmm Johansmm added enhancement New feature or request alonet labels Sep 28, 2021
@Johansmm Johansmm self-assigned this Sep 28, 2021
@Johansmm Johansmm changed the base branch from 42-development-panoptic-module to master September 28, 2021 15:23
@Johansmm Johansmm mentioned this pull request Sep 30, 2021
@Johansmm Johansmm linked an issue Sep 30, 2021 that may be closed by this pull request
Copy link
Contributor

@thibo73800 thibo73800 left a comment

Choose a reason for hiding this comment

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

When this pull request should be merged ? It look there is a lot of overlap with an other pull request I just reviewed

@staticmethod
def __new__(cls, x, labels: Union[dict, Labels] = None, *args, **kwargs):
# Load frame from path
if isinstance(x, str):
x = load_mask(x)
kwargs["names"] = ("N", "H", "W")
tensor = super().__new__(cls, x, *args, **kwargs)
tensor.add_label("labels", labels, align_dim=["N"], mergeable=False)
tensor.add_label("labels", labels, align_dim=["N"], mergeable=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, what is the reason for using mergeable True for the labels ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@thibo73800 , actually I see BoundingBoxes2d have the labels as mergeable. so i used the same logic

@Johansmm
Copy link
Contributor Author

Johansmm commented Oct 6, 2021

@thibo73800 I updated PQmetric, fixing a problem in calculus. Now is ready to merge

@thibo73800 thibo73800 merged commit 007e149 into master Oct 8, 2021
@Johansmm Johansmm deleted the 43-panoptic-quality-metrics branch October 20, 2021 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alonet enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Development panoptic metrics
2 participants