-
Notifications
You must be signed in to change notification settings - Fork 2
Replace dai-nodes messages with DAI native messages #317
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
Draft
klemen1999
wants to merge
1
commit into
feat/dai_beta_parsers
Choose a base branch
from
feat/dai_beta_messages
base: feat/dai_beta_parsers
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,146 +1,30 @@ | ||
| # Message Types | ||
|
|
||
| Here are the custom message types that we introduce in this package. They are used as output types of the parsers. | ||
| Parser creators return native DepthAI messages. The parser-specific message types | ||
| are available under `dai.beta`: | ||
|
|
||
| **Table of Contents** | ||
| - `dai.beta.Classifications` | ||
| - `dai.beta.Clusters` and `dai.beta.Cluster` | ||
| - `dai.beta.Keypoints` | ||
| - `dai.beta.Lines` and `dai.beta.Line` | ||
| - `dai.beta.Map2D` | ||
| - `dai.beta.Predictions` and `dai.beta.Prediction` | ||
|
|
||
| - [Message Types](#message-types) | ||
| - [Classifications](#classifications) | ||
| - [Attributes](#attributes) | ||
| - [Cluster](#cluster) | ||
| - [Attributes](#attributes-1) | ||
| - [Clusters](#clusters) | ||
| - [Attributes](#attributes-2) | ||
| - [Collection](#collection) | ||
| - [Attributes](#attributes-3) | ||
| - [GatheredData](#gathereddata) | ||
| - [Attributes](#attributes-4) | ||
| - [Keypoints](#keypoints) | ||
| - [Attributes](#attributes-5) | ||
| - [Line](#line) | ||
| - [Attributes](#attributes-6) | ||
| - [Lines](#lines) | ||
| - [Attributes](#attributes-7) | ||
| - [Map2D](#map2d) | ||
| - [Attributes](#attributes-8) | ||
| - [Prediction](#prediction) | ||
| - [Attributes](#attributes-9) | ||
| - [Predictions](#predictions) | ||
| - [Attributes](#attributes-10) | ||
| - [SnapData](#snapdata) | ||
| - [Attributes](#attributes-12) | ||
|
|
||
| ## Classifications | ||
|
|
||
| Classification class for storing the classes and their respective scores. | ||
|
|
||
| ### Attributes | ||
|
|
||
| - **classes** (list\[str\]): A list of classes. | ||
| - **scores** (NDArray\[np.float32\]): Corresponding probability scores. | ||
|
|
||
| ## Cluster | ||
|
|
||
| Cluster class for storing a cluster. | ||
|
|
||
| ### Attributes | ||
|
|
||
| - **label** (int): Label of the cluster. | ||
| - **points** (List\[dai.Point2f\]): List of points in the cluster. | ||
|
|
||
| ## Clusters | ||
|
|
||
| Clusters class for storing clusters. | ||
|
|
||
| ### Attributes | ||
|
|
||
| - **clusters** (List\[[Cluster](#cluster)\]): List of clusters. | ||
| depthai-nodes retains only the package-specific messages below because DepthAI has | ||
| no native equivalent for them. | ||
|
|
||
| ## Collection | ||
|
|
||
| Collection class for storing a list of messages or other items of the same type. | ||
|
|
||
| ### Attributes | ||
|
|
||
| - **items** (List\[T\]): List of collected items. | ||
| - **item_cls** (Optional\[Type\[T\]\]): Runtime item type inferred from the first item once the collection is non-empty. | ||
|
|
||
| Items can be added with `append(...)` or `extend(...)`. The collection enforces that all items have the same inferred type. | ||
| `Collection` stores a list of messages or other items of the same runtime type. | ||
| Items can be added with `append(...)` or `extend(...)`. | ||
|
|
||
| ## GatheredData | ||
|
|
||
| GatheredData class for storing a reference message and the messages gathered for that reference. | ||
|
|
||
| ### Attributes | ||
|
|
||
| - **reference_data** (TReference): Reference message used to determine how many items to gather. | ||
| - **items** (List\[TGathered\]): List of gathered messages. | ||
| - **item_cls** (Optional\[Type\[TGathered\]\]): Runtime gathered-item type inferred from the first item once the collection is non-empty. | ||
|
|
||
| GatheredData inherits [Collection](#collection) behavior, so all gathered items must have the same inferred type. Setting `reference_data` copies the reference message sequence number, timestamp, and device timestamp to the GatheredData message. | ||
|
|
||
| ## Keypoints | ||
|
|
||
| Keypoints class for storing keypoints and optional skeleton edges. | ||
|
|
||
| ### Attributes | ||
|
|
||
| - **keypoints_list** (dai.KeypointsList): Native DepthAI keypoints list containing keypoints and edges. | ||
| - **transformation** (Optional\[dai.ImgTransformation\]): Optional image transformation associated with the keypoints. | ||
|
|
||
| The keypoints can be accessed with `getKeypoints()` and set with `setKeypoints(...)`. Each keypoint is a `dai.Keypoint` with image coordinates, confidence, and optional label name. Edges can be accessed with `getEdges()` and set with `setEdges(...)`. | ||
|
|
||
| ## Line | ||
|
|
||
| Line class for storing a line. | ||
|
|
||
| ### Attributes | ||
|
|
||
| - **start_point** (dai.Point2f): Start point of the line with x and y coordinates. | ||
| - **end_point** (dai.Point2f): End point of the line with x and y coordinates. | ||
| - **confidence** (float): Confidence of the line. | ||
|
|
||
| ## Lines | ||
|
|
||
| Lines class for storing lines. | ||
|
|
||
| ### Attributes | ||
|
|
||
| - **lines** (List\[[Line](#line)\]): List of detected lines. | ||
|
|
||
| ## Map2D | ||
|
|
||
| Map2D class for storing a 2D map of floats. | ||
|
|
||
| ### Attributes | ||
|
|
||
| - **map** (NDArray\[np.float32\]): 2D map. | ||
| - **width** (int): 2D Map width. | ||
| - **height** (int): 2D Map height. | ||
|
|
||
| ## Prediction | ||
|
|
||
| Prediction class for storing a prediction. | ||
|
|
||
| ### Attributes | ||
|
|
||
| - **prediction** (float): The predicted value. | ||
|
|
||
| ## Predictions | ||
|
|
||
| Predictions class for storing predictions. | ||
|
|
||
| ### Attributes | ||
|
|
||
| - **predictions** (List\[[Prediction](#prediction)\]): List of predictions. | ||
| `GatheredData` stores a reference message and the messages gathered for that | ||
| reference. It inherits `Collection` and copies timestamp and sequence metadata from | ||
| the reference message. | ||
|
|
||
| ## SnapData | ||
|
|
||
| SnapData class for representing a single snap event to be uploaded to DepthAI Hub. | ||
|
|
||
| ### Attributes | ||
|
|
||
| - **snap_name** (str): Logical name of the snap. | ||
| - **file_group** (dai.FileGroup): Object containing the snap image and associated data (e.g., images, detections). | ||
| - **tags** (List\[str\]): Optional list of tags for categorizing the snap. | ||
| - **extras** (Dict\[str, str\]): Additional metadata as key-value pairs. | ||
| `SnapData` represents a snap event uploaded to DepthAI Hub. It contains the snap | ||
| name, a `dai.FileGroup`, optional tags, and string metadata. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,9 @@ | ||
| from .classification import Classifications | ||
| from .clusters import Cluster, Clusters | ||
| from .collection import Collection | ||
| from .gathered_data import GatheredData | ||
| from .keypoints import Keypoints | ||
| from .lines import Line, Lines | ||
| from .map import Map2D | ||
| from .prediction import Prediction, Predictions | ||
| from .snap_data import SnapData | ||
|
|
||
| __all__ = [ | ||
| "Line", | ||
| "Lines", | ||
| "Classifications", | ||
| "Map2D", | ||
| "Clusters", | ||
| "Cluster", | ||
| "Prediction", | ||
| "Predictions", | ||
| "GatheredData", | ||
| "Keypoints", | ||
| "SnapData", | ||
| "Collection", | ||
| ] |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Document the minimum DepthAI version.
This migration requires DepthAI 3.9 or newer. State that requirement before listing
dai.betatypes. This prevents import failures for users on earlier versions.🤖 Prompt for AI Agents