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

[CropAnnotator] - mark objects with zoomed in crop #786

Closed
SkalskiP opened this issue Jan 26, 2024 · 12 comments
Closed

[CropAnnotator] - mark objects with zoomed in crop #786

SkalskiP opened this issue Jan 26, 2024 · 12 comments
Assignees
Labels
api:annotator Annotators enhancement New feature or request good first issue Good for newcomers Q1.2024 Tasks planned for execution in Q1 2024.

Comments

@SkalskiP
Copy link
Collaborator

SkalskiP commented Jan 26, 2024

Description

Create CropAnnotator - whose task is to mark objects related to sv.Detections with zoomed-in crops.

Below is an example found on the internet. Of course, as part of this task, we would only add the part responsible for the crop.

Screenshot 2024-01-26 at 10 14 45

The API should also allow for the selection of the location of the enlarged crop using sv.Position (above, below, ...), as well as the choice of the zoom_factor.

API

class CropAnnotator(BaseAnnotator):

    def __init__(
        self,
        position: Position = Position.TOP_CENTER,
        zoom_factor: int = 2
    ):
        pass

    def annotate(
        self,
        scene: np.ndarray,
        detections: Detections,
    ) -> np.ndarray:
        pass

Additional

  • Note: Please share a Google Colab with minimal code to test the new feature. We know it's additional work, but it will definitely speed up the review process. Each change must be tested by the reviewer. Setting up a local environment to do this is time-consuming. Please ensure that Google Colab can be accessed without any issues (make it public). Thank you! 🙏🏻
@SkalskiP SkalskiP added enhancement New feature or request api:annotator Annotators Q1.2024 Tasks planned for execution in Q1 2024. good first issue Good for newcomers labels Jan 26, 2024
@xaristeidou
Copy link
Contributor

xaristeidou commented Jan 29, 2024

Hello there! I would love to be assigned and implement that!

A small correction at the description of the issue, the name of the annotator to be changed in CropAnnotator instead of IconAnnotator. :)

@onuralpszr
Copy link
Collaborator

@xaristeidou good luck and have fun :)

@SkalskiP
Copy link
Collaborator Author

The master of annotators is back in business 🔥! As for IconAnnotator, I copied part of the description from another issue. Sorry for that.

@SkalskiP
Copy link
Collaborator Author

SkalskiP commented Feb 5, 2024

Hi @xaristeidou 👋🏻 Did you manage to get started with this task?

@xaristeidou
Copy link
Contributor

@SkalskiP In fact yes! I dealt with some bugs in the meanwhile, and now are fixed. I have a question to get some different opinions on implementation.

I have 2 different scenarios in mind. In cases where the cropped part of the image is going to exceed the scene dimensions based on the selected anchor Position:

  1. The cropped part will be placed exactly to the anchor position and the rest of the exceeding cropped part will not be displayed.
  2. The cropped part will be clipped to the edge of the scene, so the anchor position will be dynamically variable.

I would like to hear thoughts on that to continue further with a concept. Below I attach two examples for better representation. In both examples the anchor Position is assumed to be TOP_RIGHT

Scenario 1:

Screenshot 2024-02-05 175000

Scenario 2:

Screenshot 2024-02-05 175015

@SkalskiP
Copy link
Collaborator Author

SkalskiP commented Feb 5, 2024

Hi @xaristeidou 👋🏻 ! It's awesome to see the progress.

Let's go with scenario 1. It will be consistent with the behavior of other annotators.

@xaristeidou
Copy link
Contributor

@SkalskiP Ok, when it is finished will get back with a PR.

@SkalskiP
Copy link
Collaborator Author

Hi @xaristeidou, 👋 supervision-0.19.0 release is getting closer and closer. I would love to include this feature in an upcoming release. Have you been able to move the work on this feature forward? Alternatively, could you open the PR in your current state so we can finish it for you?

@xaristeidou
Copy link
Contributor

xaristeidou commented Feb 12, 2024

@SkalskiP Hello!! Sorry for the delay to submit!! Submitted #888 .

@SkalskiP
Copy link
Collaborator Author

Hi @xaristeidou 👋🏻 ! No worries!

@xaristeidou
Copy link
Contributor

@SkalskiP Maybe we should close the issue due to PR #888 .

@onuralpszr
Copy link
Collaborator

Fixed via #888

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api:annotator Annotators enhancement New feature or request good first issue Good for newcomers Q1.2024 Tasks planned for execution in Q1 2024.
Projects
Development

No branches or pull requests

3 participants