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

Unit tests upgrade. #145

Merged
merged 7 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion depthai_nodes/ml/messages/creators/clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def create_cluster_message(clusters: List[List[List[Union[float, int]]]]) -> Clu
if not isinstance(cluster, list):
raise TypeError(f"All clusters must be of type List, got {type(cluster)}")
for point in cluster:
if isinstance(point, list):
if not isinstance(point, list):
raise TypeError(
f"All points in clusters must be of type List, got {type(point)}"
)
Expand Down
1 change: 0 additions & 1 deletion depthai_nodes/ml/messages/creators/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def create_detection_message(
@raise ValueError: If the keypoints are not a numpy array of shape (N, M, 2 or 3).
@raise ValueError: If the masks are not a 3D numpy array of shape (img_height,
img_width, N) or (N, img_height, img_width).
@raise ValueError: If the masks are not in the range [0, 1].
@raise ValueError: If the keypoints scores are not a numpy array.
@raise ValueError: If the keypoints scores are not of shape [n_detections,
n_keypoints, 1].
Expand Down
8 changes: 4 additions & 4 deletions depthai_nodes/ml/parsers/utils/keypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,23 @@ def transform_to_keypoints(
raise ValueError("Keypoints must be a numpy array.")
if len(keypoints.shape) != 2:
raise ValueError(
"Keypoints must be of shape (N, 2). Got shape {keypoints.shape}."
f"Keypoints must be of shape (N, 2). Got shape {keypoints.shape}."
)
if keypoints.shape[1] != 2 and keypoints.shape[1] != 3:
raise ValueError(
"Keypoints must be of shape (N, 2) or (N, 3). Got shape {keypoints.shape}."
f"Keypoints must be of shape (N, 2) or (N, 3). Got shape {keypoints.shape}."
)

if confidences is not None:
if not isinstance(confidences, np.ndarray):
raise ValueError("Confidences must be a numpy array.")
if len(confidences.shape) != 1:
raise ValueError(
"Confidences must be of shape (N,). Got shape {confidences.shape}."
f"Confidences must be of shape (N,). Got shape {confidences.shape}."
)
if len(confidences) != len(keypoints):
raise ValueError(
"Confidences should have same length as keypoints, got {len(confidences)} confidences and {len(keypoints)} keypoints."
f"Confidences should have same length as keypoints, got {len(confidences)} confidences and {len(keypoints)} keypoints."
)

dim = keypoints.shape[1]
Expand Down
155 changes: 0 additions & 155 deletions tests/unittests/test_creators/test_classification.py

This file was deleted.

Loading
Loading