dataeval 0.86.8__py3-none-any.whl → 0.86.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
dataeval/_version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.86.8'
21
- __version_tuple__ = version_tuple = (0, 86, 8)
20
+ __version__ = version = '0.86.9'
21
+ __version_tuple__ = version_tuple = (0, 86, 9)
@@ -4,6 +4,7 @@ from dataeval.utils.datasets._antiuav import AntiUAVDetection
4
4
  from dataeval.utils.datasets._cifar10 import CIFAR10
5
5
  from dataeval.utils.datasets._milco import MILCO
6
6
  from dataeval.utils.datasets._mnist import MNIST
7
+ from dataeval.utils.datasets._seadrone import SeaDrone
7
8
  from dataeval.utils.datasets._ships import Ships
8
9
  from dataeval.utils.datasets._voc import VOCDetection, VOCDetectionTorch, VOCSegmentation
9
10
 
@@ -13,6 +14,7 @@ __all__ = [
13
14
  "CIFAR10",
14
15
  "AntiUAVDetection",
15
16
  "MILCO",
17
+ "SeaDrone",
16
18
  "VOCDetection",
17
19
  "VOCDetectionTorch",
18
20
  "VOCSegmentation",
@@ -15,7 +15,7 @@ if TYPE_CHECKING:
15
15
  from dataeval.typing import Transform
16
16
 
17
17
 
18
- class AntiUAVDetection(BaseODDataset[NDArray[Any]], BaseDatasetNumpyMixin):
18
+ class AntiUAVDetection(BaseODDataset[NDArray[Any], list[str], str], BaseDatasetNumpyMixin):
19
19
  """
20
20
  A UAV detection dataset focused on detecting UAVs in natural images against large variation in backgrounds.
21
21
 
@@ -4,7 +4,7 @@ __all__ = []
4
4
 
5
5
  from abc import abstractmethod
6
6
  from pathlib import Path
7
- from typing import TYPE_CHECKING, Any, Generic, Iterator, Literal, NamedTuple, Sequence, TypeVar
7
+ from typing import TYPE_CHECKING, Any, Generic, Iterator, Literal, NamedTuple, Sequence, TypeVar, cast
8
8
 
9
9
  import numpy as np
10
10
 
@@ -28,7 +28,8 @@ else:
28
28
  _TArray = TypeVar("_TArray")
29
29
 
30
30
  _TTarget = TypeVar("_TTarget")
31
- _TRawTarget = TypeVar("_TRawTarget", list[int], list[str])
31
+ _TRawTarget = TypeVar("_TRawTarget", Sequence[int], Sequence[str], Sequence[tuple[list[int], list[list[float]]]])
32
+ _TAnnotation = TypeVar("_TAnnotation", int, str, tuple[list[int], list[list[float]]])
32
33
 
33
34
 
34
35
  class DataLocation(NamedTuple):
@@ -38,7 +39,9 @@ class DataLocation(NamedTuple):
38
39
  checksum: str
39
40
 
40
41
 
41
- class BaseDataset(AnnotatedDataset[tuple[_TArray, _TTarget, dict[str, Any]]], Generic[_TArray, _TTarget, _TRawTarget]):
42
+ class BaseDataset(
43
+ AnnotatedDataset[tuple[_TArray, _TTarget, dict[str, Any]]], Generic[_TArray, _TTarget, _TRawTarget, _TAnnotation]
44
+ ):
42
45
  """
43
46
  Base class for internet downloaded datasets.
44
47
  """
@@ -144,7 +147,7 @@ class BaseDataset(AnnotatedDataset[tuple[_TArray, _TTarget, dict[str, Any]]], Ge
144
147
 
145
148
 
146
149
  class BaseICDataset(
147
- BaseDataset[_TArray, _TArray, list[int]],
150
+ BaseDataset[_TArray, _TArray, list[int], int],
148
151
  BaseDatasetMixin[_TArray],
149
152
  ImageClassificationDataset[_TArray],
150
153
  ):
@@ -177,7 +180,7 @@ class BaseICDataset(
177
180
 
178
181
 
179
182
  class BaseODDataset(
180
- BaseDataset[_TArray, ObjectDetectionTarget[_TArray], list[str]],
183
+ BaseDataset[_TArray, ObjectDetectionTarget[_TArray], _TRawTarget, _TAnnotation],
181
184
  BaseDatasetMixin[_TArray],
182
185
  ObjectDetectionDataset[_TArray],
183
186
  ):
@@ -200,7 +203,8 @@ class BaseODDataset(
200
203
  Image, target, datum_metadata - target.boxes returns boxes in x0, y0, x1, y1 format
201
204
  """
202
205
  # Grab the bounding boxes and labels from the annotations
203
- boxes, labels, additional_metadata = self._read_annotations(self._targets[index])
206
+ annotation = cast(_TAnnotation, self._targets[index])
207
+ boxes, labels, additional_metadata = self._read_annotations(annotation)
204
208
  # Get the image
205
209
  img = self._read_file(self._filepaths[index])
206
210
  img_size = img.shape
@@ -217,11 +221,11 @@ class BaseODDataset(
217
221
  return img, target, img_metadata
218
222
 
219
223
  @abstractmethod
220
- def _read_annotations(self, annotation: str) -> tuple[list[list[float]], list[int], dict[str, Any]]: ...
224
+ def _read_annotations(self, annotation: _TAnnotation) -> tuple[list[list[float]], list[int], dict[str, Any]]: ...
221
225
 
222
226
 
223
227
  class BaseSegDataset(
224
- BaseDataset[_TArray, SegmentationTarget[_TArray], list[str]],
228
+ BaseDataset[_TArray, SegmentationTarget[_TArray], list[str], str],
225
229
  BaseDatasetMixin[_TArray],
226
230
  SegmentationDataset[_TArray],
227
231
  ):
@@ -128,9 +128,9 @@ def _ensure_exists(
128
128
 
129
129
  elif not check_path.exists() and not download:
130
130
  raise FileNotFoundError(
131
- "Data could not be loaded with the provided root directory, ",
132
- f"the file path to the file {filename} does not exist, ",
133
- "and the download parameter is set to False.",
131
+ "Data could not be loaded with the provided root directory, "
132
+ f"the file path to the file {filename} does not exist, "
133
+ "and the download parameter is set to False."
134
134
  )
135
135
  else:
136
136
  if not _validate_file(check_path, checksum, md5):
@@ -14,7 +14,7 @@ if TYPE_CHECKING:
14
14
  from dataeval.typing import Transform
15
15
 
16
16
 
17
- class MILCO(BaseODDataset[NDArray[Any]], BaseDatasetNumpyMixin):
17
+ class MILCO(BaseODDataset[NDArray[Any], list[str], str], BaseDatasetNumpyMixin):
18
18
  """
19
19
  A side-scan sonar dataset focused on mine-like object detection.
20
20