fix(pre_commit): 🎨 auto format pre-commit hooks
This commit is contained in:
1 parent
ea6439b8fd
commit
b2d98fe457
3 files changed
+9
-26
No files matched your search
@@ -61,8 +61,7 @@ def _validate_tracker_id(tracker_id: Any, n: int) -> None:
|
||||
|
||||
|
||||
def _data_payload_equal(
|
||||
data_a: Dict[str, np.ndarray],
|
||||
data_b: Dict[str, np.ndarray]
|
||||
data_a: Dict[str, np.ndarray], data_b: Dict[str, np.ndarray]
|
||||
) -> bool:
|
||||
"""
|
||||
Compares the data payloads of two Detections instances.
|
||||
@@ -73,9 +72,8 @@ def _data_payload_equal(
|
||||
Returns:
|
||||
True if the data payloads are equal, False otherwise.
|
||||
"""
|
||||
return (
|
||||
set(data_a.keys()) == set(data_b.keys()) and
|
||||
all(np.array_equal(data_a[key], data_b[key]) for key in data_a)
|
||||
return set(data_a.keys()) == set(data_b.keys()) and all(
|
||||
np.array_equal(data_a[key], data_b[key]) for key in data_a
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from contextlib import ExitStack as DoesNotRaise
|
||||
from test.test_utils import mock_detections
|
||||
from typing import List, Optional
|
||||
|
||||
import defusedxml.ElementTree as ET
|
||||
@@ -7,7 +6,6 @@ import numpy as np
|
||||
import pytest
|
||||
|
||||
from supervision.dataset.formats.pascal_voc import (
|
||||
detections_from_xml_obj,
|
||||
object_to_pascal_voc,
|
||||
parse_polygon_points,
|
||||
)
|
||||
|
||||
+6
-19
@@ -1,4 +1,4 @@
|
||||
from typing import List, Optional, Dict, Any
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
import numpy as np
|
||||
|
||||
@@ -13,33 +13,20 @@ def mock_detections(
|
||||
tracker_id: Optional[List[int]] = None,
|
||||
data: Optional[Dict[str, List[Any]]] = None,
|
||||
) -> Detections:
|
||||
|
||||
def convert_data(data: Dict[str, List[Any]]):
|
||||
return {k: np.array(v) for k, v in data.items()}
|
||||
|
||||
return Detections(
|
||||
xyxy=np.array(xyxy, dtype=np.float32),
|
||||
mask=(
|
||||
mask
|
||||
if mask is None
|
||||
else np.array(mask, dtype=bool)
|
||||
),
|
||||
mask=(mask if mask is None else np.array(mask, dtype=bool)),
|
||||
confidence=(
|
||||
confidence
|
||||
if confidence is None
|
||||
else np.array(confidence, dtype=np.float32)
|
||||
),
|
||||
class_id=(
|
||||
class_id
|
||||
if class_id is None
|
||||
else np.array(class_id, dtype=int)
|
||||
confidence if confidence is None else np.array(confidence, dtype=np.float32)
|
||||
),
|
||||
class_id=(class_id if class_id is None else np.array(class_id, dtype=int)),
|
||||
tracker_id=(
|
||||
tracker_id
|
||||
if tracker_id is None
|
||||
else np.array(tracker_id, dtype=int)
|
||||
tracker_id if tracker_id is None else np.array(tracker_id, dtype=int)
|
||||
),
|
||||
data=convert_data(data) if data else {}
|
||||
data=convert_data(data) if data else {},
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user