Skip to content

Add custom text for the in & out tags - #44

Merged
SkalskiP merged 1 commit into
roboflow:mainfrom
iPoe:feature/custom_msg_for_line_zone
May 10, 2023
Merged

Add custom text for the in & out tags#44
SkalskiP merged 1 commit into
roboflow:mainfrom
iPoe:feature/custom_msg_for_line_zone

Conversation

@iPoe

@iPoe iPoe commented Mar 13, 2023

Copy link
Copy Markdown
Contributor

Description

This PR adds 2 new parameters for the class LineZoneAnnotator in order to add a custom label instead of only using in/out labels. This idea occurred to us on a project where we needed to show the real time obj detection with a context of what in & out means for example: in means numbers of runs completed for a machine.

Type of change

  • New feature (non-breaking change which adds functionality)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hello there, thank you for opening an PR ! 馃檹馃徎 The team was notified and they will get back to you asap.

@SkalskiP SkalskiP self-assigned this Mar 13, 2023
Comment thread supervision/detection/line_counter.py Outdated
text_scale: float = 0.5,
text_offset: float = 1.5,
text_padding: int = 10,
custom_in_text: str = '',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could we make those arguments Optional[str] = None?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure! It's great to learn that python allows this type of value 馃. Today I learned something new about python

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I love to hear that

Comment thread supervision/detection/line_counter.py Outdated

in_text = f"in: {line_counter.in_count}"
out_text = f"out: {line_counter.out_count}"
in_text = f"in: {line_counter.in_count}" if len(self.custom_in_text) == 0 else f"{self.custom_in_text}: {line_counter.in_count}"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Then here we would have if self.custom_in_text is not None. Same for other text.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I like the idea. I left two comments. ;)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I applied your comments, lmk if you see something that can be improved too. 馃憢馃徑

@iPoe
iPoe force-pushed the feature/custom_msg_for_line_zone branch from 540c314 to 7dfdd2f Compare March 13, 2023 23:32
@iPoe
iPoe requested a review from SkalskiP March 13, 2023 23:34
Comment thread supervision/detection/line_counter.py Outdated
from supervision.detection.core import Detections
from supervision.draw.color import Color
from supervision.geometry.core import Point, Rect, Vector
from dataclasses import dataclass

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd drop dataclass here. But add Optional to from typing import Dict

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure! thanks @SkalskiP

@SkalskiP

Copy link
Copy Markdown
Collaborator

Hi @iPoe 馃憢馃徎! I just left one more comment. All in all:

  • I'd drop the dataclass
  • I'd add Optional to imports at the very top of the file

@iPoe
iPoe force-pushed the feature/custom_msg_for_line_zone branch from 7dfdd2f to a8c335d Compare March 14, 2023 15:37
@iPoe

iPoe commented Mar 14, 2023

Copy link
Copy Markdown
Contributor Author

Changes added @SkalskiP! 馃憣

@iPoe
iPoe requested a review from SkalskiP March 14, 2023 15:38
@iPoe

iPoe commented Mar 16, 2023

Copy link
Copy Markdown
Contributor Author

@SkalskiP I'm gonna search why the build is failing with my coworkers, I'll let you know if I find something

@SkalskiP

Copy link
Copy Markdown
Collaborator

@iPoe I am going on a short vacation - I will return on Tuesday. If you can't find anything by then, I will try to help you when I return.

@iPoe
iPoe force-pushed the feature/custom_msg_for_line_zone branch 2 times, most recently from 630a777 to dea8761 Compare March 17, 2023 01:32
@iPoe

iPoe commented Mar 17, 2023

Copy link
Copy Markdown
Contributor Author

@SkalskiP Just needed to update this branch with your main branch. let me know if you see something else 馃

@iPoe
iPoe force-pushed the feature/custom_msg_for_line_zone branch from dea8761 to ac61598 Compare March 29, 2023 19:01
@iPoe

iPoe commented Mar 29, 2023

Copy link
Copy Markdown
Contributor Author

Hey @SkalskiP I just rebased with main but the jobs failed so I'm gonna hold the merge for the moment and try to find out why is not building successfully 馃.
Also if you can give me a hand to find out why is not working let me know.

Regards,
Leo. 馃

@iPoe
iPoe requested a review from SkalskiP May 10, 2023 15:30
@SkalskiP
SkalskiP merged commit a911cbd into roboflow:main May 10, 2023
@SkalskiP

Copy link
Copy Markdown
Collaborator

Merged :) It will be released along with version 0.7.0 probably tomorrow.

@danigarciaoca danigarciaoca mentioned this pull request Jun 14, 2023
1 task
@FoxieK

FoxieK commented Dec 15, 2023

Copy link
Copy Markdown

Hello guys, i'm currently using the supervision library version 0.17.0 and i was wondering if it's possible to hide entirely the "in text" as shown in the picture
image
my code looks like this:
line_zone_annotator = sv.LineZoneAnnotator(thickness=3, text_thickness=1, text_scale=1, custom_in_text=None, custom_out_text='counter_out') as you can see i've already set custom_in_text to None and even tried with an empty string '', but still it doesn't work. Any suggestions? Thank you in advance!

@SkalskiP

Copy link
Copy Markdown
Collaborator

Hi @FoxieK 馃憢馃徎, unfortunately, not yet. But I'd love to add this feature in upcoming releases. Would you be interested in contributing?

@FoxieK

FoxieK commented Dec 19, 2023

Copy link
Copy Markdown

Hello @SkalskiP, i'd love to! But for time being i'm focusing on my project and writing my thesis which both have a deadline馃槗. After that why not, let's keep in touch. Have a good day!

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.

3 participants