Skip to content

'from_depthai' conversion function added#909

Open
CodeRic28 wants to merge 2 commits intoroboflow:developfrom
CodeRic28:depthai-bytetrack-integration
Open

'from_depthai' conversion function added#909
CodeRic28 wants to merge 2 commits intoroboflow:developfrom
CodeRic28:depthai-bytetrack-integration

Conversation

@CodeRic28
Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown
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.

)

@classmethod
def from_depthai(cls, depthai_results) -> Detections:
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 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
Copy Markdown
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
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 move this to the very top of the docstring.

Returns:
Detections: A new Detections object.

Example:
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 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

Projects

No open projects
Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants