supervision
supervision copied to clipboard
[CropAnnotator] - mark objects with zoomed in crop
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.
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! 🙏🏻
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
. :)
@xaristeidou good luck and have fun :)
The master of annotators is back in business 🔥! As for IconAnnotator
, I copied part of the description from another issue. Sorry for that.
Hi @xaristeidou 👋🏻 Did you manage to get started with this task?
@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
:
- The cropped part will be placed exactly to the anchor position and the rest of the exceeding cropped part will not be displayed.
- 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:
Scenario 2:
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.
@SkalskiP Ok, when it is finished will get back with a PR.
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?
@SkalskiP Hello!! Sorry for the delay to submit!! Submitted #888 .
Hi @xaristeidou 👋🏻 ! No worries!
@SkalskiP Maybe we should close the issue due to PR #888 .
Fixed via https://github.com/roboflow/supervision/pull/888