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

'from_depthai' conversion function added #909

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

CodeRic28
Copy link

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.

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

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 convert depthai detections result to supervision 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

  • No docs update

@CLAassistant
Copy link

CLAassistant commented Feb 15, 2024

CLA assistant check
All committers have signed the CLA.

@SkalskiP SkalskiP self-assigned this Feb 29, 2024
@SkalskiP SkalskiP added enhancement New feature or request api:detection labels Feb 29, 2024
@SkalskiP
Copy link
Collaborator

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:
Copy link
Collaborator

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
Copy link
Collaborator

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:
Copy link
Collaborator

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:
Copy link
Collaborator

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.

@onuralpszr onuralpszr assigned onuralpszr and CodeRic28 and unassigned SkalskiP Mar 6, 2024
@onuralpszr onuralpszr added this to the version: 0.19.0 milestone Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api:detection enhancement New feature or request
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

4 participants