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 sv.RoundBoxAnnotator which annotates bounding box with round edges #702

Merged
merged 14 commits into from
Jan 10, 2024
Merged

Add sv.RoundBoxAnnotator which annotates bounding box with round edges #702

merged 14 commits into from
Jan 10, 2024

Conversation

xaristeidou
Copy link
Contributor

@xaristeidou xaristeidou commented Dec 29, 2023

Description

This annotator will draw a bounding box which has round edges based on roundness attribute which accepts float values < roundness <= 1.0.

By default, roundness attribute percentage value is calculated based on the smaller size dimension (width or height). For example if height < width, and roundness is 1.0, the height dimension will be rounded completely.

This PR implements issue #693. (Fix #693)

Execution time of annotation process (tested on Ryzen 7 5800H):

  • Exec time for 35 objects: 0.0018765926361083984
  • Mean exec time for each object: 5.361693246023995e-05

No new dependencies required for this change.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

I tested annotation results on walking people demo video. I used YOLOv8 to get the detection results. Screenshot of demo, using roundness = 0.5, is presented below:
roundness_05

Any specific deployment considerations

  • Add new annotator class in Documentation.
  • Add image example link reference in class Description in annotators/core.py

Docs

Docs not updated. Need to be updated with new annotator.

@xaristeidou xaristeidou changed the title Add RoundBoundingBoxAnnotator which annotates bounding box with round edges Add 'sv.RoundBoundingBoxAnnotator' which annotates bounding box with round edges Dec 29, 2023
@xaristeidou xaristeidou changed the title Add 'sv.RoundBoundingBoxAnnotator' which annotates bounding box with round edges Add sv.RoundBoundingBoxAnnotator which annotates bounding box with round edges Dec 29, 2023
@onuralpszr onuralpszr self-requested a review January 5, 2024 17:41
@onuralpszr onuralpszr added the api:annotator Annotators label Jan 5, 2024
@onuralpszr
Copy link
Collaborator

@xaristeidou hello, first of it looks amazing. 🚀 I am taking the review.

@onuralpszr
Copy link
Collaborator

onuralpszr commented Jan 5, 2024

Simple Test Collab Link and python code

Google Collab link here

#!pip install git+https://github.com/xaristeidou/supervision.git@develop
#!pip install requests tqdm ultralytics

import supervision as sv
from supervision.assets import download_assets, VideoAssets
from ultralytics import YOLO

download_assets(VideoAssets.PEOPLE_WALKING)
model = YOLO('yolov8x-seg.pt')

frames_generator = sv.get_video_frames_generator(source_path='people-walking.mp4')
frames_iterator = iter(frames_generator)
frame = next(frames_iterator)

result = model.track(frame)[0]
detections = sv.Detections.from_ultralytics(result)

round_box_annotator = sv.RoundBoxAnnotator()
annotated_frame = round_box_annotator.annotate(scene=frame.copy(), detections=detections)
sv.plot_image(image=annotated_frame, size=(12, 12))

@onuralpszr onuralpszr added documentation Improvements or additions to documentation enhancement New feature or request labels Jan 6, 2024
Signed-off-by: Onuralp SEZER <thunderbirdtr@gmail.com>
@onuralpszr
Copy link
Collaborator

cc @SkalskiP I did checks and write docs parts and also made collab part for testing so can you also check and upload the image to server so it can show up as well.

@SkalskiP
Copy link
Collaborator

SkalskiP commented Jan 9, 2024

@onuralpszr, can we make the name a bit shorter? I was thinking about RoundBoxAnnotator.

@onuralpszr
Copy link
Collaborator

@onuralpszr, can we make the name a bit shorter? I was thinking about RoundBoxAnnotator.

Okay let me handle it but you also please handle image for me (upload for docs collab already ready)

@onuralpszr
Copy link
Collaborator

@SkalskiP rename done. And test code and collab also changed as well.

@onuralpszr onuralpszr changed the title Add sv.RoundBoundingBoxAnnotator which annotates bounding box with round edges Add sv.RoundBoxAnnotator which annotates bounding box with round edges Jan 9, 2024
Signed-off-by: Onuralp SEZER <thunderbirdtr@gmail.com>
@onuralpszr
Copy link
Collaborator

Thanks to @capjamesg's help he uploaded the pictures for docs so I am merging. Thank you all !

@onuralpszr onuralpszr merged commit 97d9472 into roboflow:develop Jan 10, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api:annotator Annotators documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add annotator RoundBoundingBoxAnnotator which has rectangle with round edges
3 participants