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

Add transform method to Detections class and documentation for the transform method #1779

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

nahcol10
Copy link

Add transform method to Detections class and documentation for the transform method

  • Added the transform method to the Detections class to support remapping class names, filtering predictions, and remapping class IDs to match a dataset's classes.
  • Added comprehensive documentation for the transform method in docs/detections.md, including a description, parameters, returns, raises, and an example usage.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@SkalskiP
Copy link
Collaborator

Hi @nahcol10 👋🏻 Thank you very much for your interest in supervision. Could you please clarify when the user would like to use the transform method?

@nahcol10
Copy link
Author

nahcol10 commented Feb 19, 2025

Hi @nahcol10 👋🏻 Thank you very much for your interest in supervision. Could you please clarify when the user would like to use the transform method?

Hi @SkalskiP 👋🏻, thanks for your question!

The transform method is particularly useful when you need to remap detection class names and update class IDs to align with a specific dataset. This can be helpful in scenarios such as:

Standardizing class names: When integrating detections from multiple sources, you can ensure consistency by mapping different class names to a unified set.

Renaming classes: For example, mapping "dog" → "animal" or "eagle" → "bird" based on a predefined mapping.

Filtering detections: Ensuring only valid detections (those with class names present in the dataset) are retained, improving consistency and reducing noise.

@patel-zeel
Copy link
Contributor

patel-zeel commented Feb 19, 2025

@nahcol10, are you trying to address #1778?

@SkalskiP Such a method may ease the process of benchmarking VLMs on Roboflow datasets because:

  1. VLMs by design can not predict class_id so we need to assign appropriate class_id to predictions to enable evaluation API and compute metrics such as mAP, Precision or Recall.
  2. By default, we can remove all predicted classes which are not present in the dataset. Optionally, we can have an argument in transform method to keep them if desired.
  3. In cases where we want to apply small modifications to predicted classes, class_mapping would come handy.

@nahcol10
Copy link
Author

@nahcol10, are you trying to address #1778?

@SkalskiP Such a method may ease the process of benchmarking VLMs on Roboflow datasets because:

1. VLMs by design can not predict `class_id` so we need to assign appropriate `class_id` to predictions to enable evaluation API and compute metrics such as mAP, Precision or Recall.

2. By default, we can remove all predicted classes which are not present in the dataset. Optionally, we can have an argument in `transform` method to keep them if desired.

3. In cases where we want to apply small modifications to predicted classes, `class_mapping` would come handy.

Yes, this method is intended to address #1778 by ensuring VLM predictions have appropriate class_id assignments, filtering out irrelevant predictions, and allowing for class modifications using class_mapping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants