fix(pre_commit): 🎨 auto format pre-commit hooks
This commit is contained in:
1 parent
9ad850af46
commit
61cca76acc
2 files changed
+8
-1
No files matched your search
@@ -296,7 +296,10 @@ class Detections:
|
||||
class_id=np.arange(len(ultralytics_results)),
|
||||
)
|
||||
|
||||
if hasattr(ultralytics_results, "boxes") and ultralytics_results.boxes is not None:
|
||||
if (
|
||||
hasattr(ultralytics_results, "boxes")
|
||||
and ultralytics_results.boxes is not None
|
||||
):
|
||||
class_id = ultralytics_results.boxes.cls.cpu().numpy().astype(int)
|
||||
class_names = np.array([ultralytics_results.names[i] for i in class_id])
|
||||
return cls(
|
||||
|
||||
@@ -816,6 +816,7 @@ def test_merge_inner_detection_object_pair(
|
||||
result = merge_inner_detection_object_pair(detection_1, detection_2)
|
||||
assert result == expected_result
|
||||
|
||||
|
||||
class TestFromUltralytics:
|
||||
"""Test suite for Detections.from_ultralytics method."""
|
||||
|
||||
@@ -824,6 +825,7 @@ class TestFromUltralytics:
|
||||
|
||||
Regression test for issue #2000.
|
||||
"""
|
||||
|
||||
# Create a mock ultralytics result without boxes attribute
|
||||
class MockUltralyticsResult:
|
||||
def __init__(self):
|
||||
@@ -839,6 +841,7 @@ class TestFromUltralytics:
|
||||
|
||||
def test_from_ultralytics_with_boxes_none(self):
|
||||
"""Test that from_ultralytics handles boxes=None (segmentation-only models)."""
|
||||
|
||||
# Create a mock ultralytics result with boxes=None
|
||||
class MockUltralyticsResult:
|
||||
def __init__(self):
|
||||
@@ -859,6 +862,7 @@ class TestFromUltralytics:
|
||||
|
||||
def test_from_ultralytics_with_valid_boxes(self):
|
||||
"""Test that from_ultralytics works correctly with valid boxes."""
|
||||
|
||||
# Create a mock ultralytics result with valid boxes
|
||||
class MockBoxes:
|
||||
def __init__(self):
|
||||
|
||||
Reference in new issue
Block a user