-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
'from_depthai' conversion function added #909
base: develop
Are you sure you want to change the base?
'from_depthai' conversion function added #909
Conversation
Hi @CodeRic28 👋🏻 ! I'm very sorry for the late response. I was a bit overwhelmed with responsibilities not related to supervision. I like the idea of adding Luxonis support. I left a few comments under your PR. |
@@ -710,6 +710,57 @@ def from_paddledet(cls, paddledet_result) -> Detections: | |||
class_id=paddledet_result["bbox"][:, 0].astype(int), | |||
) | |||
|
|||
@classmethod | |||
def from_depthai(cls, depthai_results) -> Detections: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we rename it from from_depthai
to from_luxonis
? I think the Luxonis brand is much more recognizable than DepthAI. To be honest, I did not know what DepthAI is, but I'm absolutely familiar with Luxonis.
|
||
Args: | ||
depthai_results (depthai/resources/nn): | ||
The output Detections instance from DepthAI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add .
at the end of the sentence.
results = sv.Detections.from_depthai(detection) | ||
tracks = tracker.update_with_detections(results) | ||
``` | ||
# For device and nn setup, refer: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd move this to the very top of the docstring.
Returns: | ||
Detections: A new Detections object. | ||
|
||
Example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we make this example a bit simpler? Maybe show how it works for a single frame. For sure, drop tracker.
Description
Added 'from_depthai()' function to convert depthai detection class to supervision detection class. Returns a new detections object. This can now be used in any of the supervision functions for detections or tracking.
Dependencies
depthai
Type of change
Please delete options that are not relevant.
How has this change been tested, please provide a testcase or example of how you tested the change?
Initially I added this function to
venv/lib/python3.11/site-packages/supervision/detection/core.py
and used the example code to convertdepthai
detections result tosupervision
format. I then used the result to apply supervision's ByteTracker. I created a PPE detection application that used Oak-1 device for real-time detection and deployment.Any specific deployment considerations
No
Docs