dataeval 0.71.0__tar.gz → 0.71.1__tar.gz

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.
Files changed (84) hide show
  1. {dataeval-0.71.0 → dataeval-0.71.1}/PKG-INFO +4 -3
  2. {dataeval-0.71.0 → dataeval-0.71.1}/pyproject.toml +7 -5
  3. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/__init__.py +2 -1
  4. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/detectors/ood/ae.py +1 -1
  5. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/detectors/ood/aegmm.py +1 -1
  6. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/detectors/ood/base.py +1 -1
  7. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/detectors/ood/llr.py +3 -3
  8. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/detectors/ood/vae.py +1 -1
  9. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/detectors/ood/vaegmm.py +1 -1
  10. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/detectors/outliers.py +1 -1
  11. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/metrics/stats/datasetstats.py +4 -4
  12. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/metrics/stats/dimensionstats.py +6 -6
  13. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/metrics/stats/visualstats.py +13 -12
  14. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/models/tensorflow/autoencoder.py +2 -2
  15. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/models/tensorflow/losses.py +1 -1
  16. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/models/tensorflow/pixelcnn.py +1 -1
  17. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/models/tensorflow/trainer.py +1 -1
  18. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/models/tensorflow/utils.py +5 -5
  19. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/utils/tensorflow/__init__.py +7 -1
  20. dataeval-0.71.1/src/dataeval/utils/tensorflow/loss/__init__.py +7 -0
  21. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/utils/tensorflow/models/__init__.py +5 -1
  22. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/utils/torch/__init__.py +11 -2
  23. dataeval-0.71.1/src/dataeval/utils/torch/datasets/__init__.py +12 -0
  24. dataeval-0.71.1/src/dataeval/utils/torch/models/__init__.py +11 -0
  25. dataeval-0.71.1/src/dataeval/utils/torch/trainer/__init__.py +7 -0
  26. dataeval-0.71.0/src/dataeval/utils/tensorflow/loss/__init__.py +0 -3
  27. dataeval-0.71.0/src/dataeval/utils/torch/datasets/__init__.py +0 -7
  28. dataeval-0.71.0/src/dataeval/utils/torch/models/__init__.py +0 -7
  29. dataeval-0.71.0/src/dataeval/utils/torch/trainer/__init__.py +0 -3
  30. {dataeval-0.71.0 → dataeval-0.71.1}/LICENSE.txt +0 -0
  31. {dataeval-0.71.0 → dataeval-0.71.1}/README.md +0 -0
  32. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/datasets.py +0 -0
  33. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/detectors/__init__.py +0 -0
  34. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/detectors/clusterer.py +0 -0
  35. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/detectors/drift/__init__.py +0 -0
  36. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/detectors/drift/base.py +0 -0
  37. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/detectors/drift/cvm.py +0 -0
  38. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/detectors/drift/ks.py +0 -0
  39. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/detectors/drift/mmd.py +0 -0
  40. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/detectors/drift/torch.py +0 -0
  41. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/detectors/drift/uncertainty.py +0 -0
  42. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/detectors/duplicates.py +0 -0
  43. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/detectors/merged_stats.py +0 -0
  44. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/detectors/ood/__init__.py +0 -0
  45. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/interop.py +0 -0
  46. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/metrics/__init__.py +0 -0
  47. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/metrics/balance.py +0 -0
  48. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/metrics/ber.py +0 -0
  49. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/metrics/coverage.py +0 -0
  50. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/metrics/divergence.py +0 -0
  51. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/metrics/diversity.py +0 -0
  52. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/metrics/parity.py +0 -0
  53. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/metrics/stats/base.py +0 -0
  54. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/metrics/stats/boxratiostats.py +0 -0
  55. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/metrics/stats/hashstats.py +0 -0
  56. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/metrics/stats/labelstats.py +0 -0
  57. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/metrics/stats/pixelstats.py +0 -0
  58. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/metrics/uap.py +0 -0
  59. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/metrics/utils.py +0 -0
  60. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/models/__init__.py +0 -0
  61. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/models/pytorch/__init__.py +0 -0
  62. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/models/pytorch/autoencoder.py +0 -0
  63. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/models/pytorch/blocks.py +0 -0
  64. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/models/pytorch/utils.py +0 -0
  65. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/models/tensorflow/__init__.py +0 -0
  66. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/models/tensorflow/gmm.py +0 -0
  67. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/output.py +0 -0
  68. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/utils.py +0 -0
  69. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/workflows/__init__.py +0 -0
  70. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/_internal/workflows/sufficiency.py +0 -0
  71. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/detectors/__init__.py +0 -0
  72. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/detectors/drift/__init__.py +0 -0
  73. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/detectors/drift/kernels/__init__.py +0 -0
  74. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/detectors/drift/updates/__init__.py +0 -0
  75. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/detectors/linters/__init__.py +0 -0
  76. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/detectors/ood/__init__.py +0 -0
  77. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/metrics/__init__.py +0 -0
  78. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/metrics/bias/__init__.py +0 -0
  79. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/metrics/estimators/__init__.py +0 -0
  80. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/metrics/stats/__init__.py +0 -0
  81. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/py.typed +0 -0
  82. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/utils/__init__.py +0 -0
  83. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/utils/tensorflow/recon/__init__.py +0 -0
  84. {dataeval-0.71.0 → dataeval-0.71.1}/src/dataeval/workflows/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dataeval
3
- Version: 0.71.0
3
+ Version: 0.71.1
4
4
  Summary: DataEval provides a simple interface to characterize image data and its impact on model performance across classification and object-detection tasks
5
5
  Home-page: https://dataeval.ai/
6
6
  License: MIT
@@ -29,8 +29,9 @@ Requires-Dist: nvidia-cudnn-cu11 (>=8.6.0.163) ; extra == "tensorflow" or extra
29
29
  Requires-Dist: pillow (>=10.3.0)
30
30
  Requires-Dist: scikit-learn (>=1.5.0)
31
31
  Requires-Dist: scipy (>=1.10)
32
- Requires-Dist: tensorflow (>=2.14.1,<2.16) ; extra == "tensorflow" or extra == "all"
33
- Requires-Dist: tensorflow_probability (>=0.22.1,<0.24) ; extra == "tensorflow" or extra == "all"
32
+ Requires-Dist: tensorflow (>=2.16) ; extra == "tensorflow" or extra == "all"
33
+ Requires-Dist: tensorflow_probability (>=0.24) ; extra == "tensorflow" or extra == "all"
34
+ Requires-Dist: tf-keras (>2.16) ; extra == "tensorflow" or extra == "all"
34
35
  Requires-Dist: torch (>=2.2.0) ; extra == "torch" or extra == "all"
35
36
  Requires-Dist: torchvision (>=0.17.0) ; extra == "torch" or extra == "all"
36
37
  Requires-Dist: tqdm
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "dataeval"
3
- version = "0.71.0" # dynamic
3
+ version = "0.71.1" # dynamic
4
4
  description = "DataEval provides a simple interface to characterize image data and its impact on model performance across classification and object-detection tasks"
5
5
  license = "MIT"
6
6
  readme = "README.md"
@@ -52,15 +52,16 @@ xxhash = {version = ">=3.3"}
52
52
  # optional
53
53
  matplotlib = {version = "*", optional = true}
54
54
  nvidia-cudnn-cu11 = {version = ">=8.6.0.163", optional = true}
55
- tensorflow = {version = ">=2.14.1, <2.16", optional = true}
56
- tensorflow_probability = {version = ">=0.22.1, <0.24", optional = true}
55
+ tensorflow = {version = ">=2.16", optional = true}
56
+ tensorflow_probability = {version = ">=0.24", optional = true}
57
+ tf-keras = {version = ">2.16", optional = true}
57
58
  torch = {version = ">=2.2.0", source = "pytorch", optional = true}
58
59
  torchvision = {version = ">=0.17.0", source = "pytorch", optional = true}
59
60
 
60
61
  [tool.poetry.extras]
61
- tensorflow = ["tensorflow", "tensorflow_probability", "nvidia-cudnn-cu11"]
62
+ tensorflow = ["tensorflow", "tensorflow_probability", "tf-keras", "nvidia-cudnn-cu11"]
62
63
  torch = ["torch", "torchvision", "matplotlib", "nvidia-cudnn-cu11"]
63
- all = ["matplotlib", "nvidia-cudnn-cu11", "tensorflow", "tensorflow_probability", "torch", "torchvision"]
64
+ all = ["matplotlib", "nvidia-cudnn-cu11", "tensorflow", "tensorflow_probability", "tf-keras", "torch", "torchvision"]
64
65
 
65
66
  [tool.poetry.group.dev]
66
67
  optional = true
@@ -131,6 +132,7 @@ reportMissingImports = false
131
132
 
132
133
  [tool.pytest.ini_options]
133
134
  norecursedirs = ["prototype"]
135
+ testpaths = ["tests"]
134
136
  addopts = ["--pythonwarnings=ignore::DeprecationWarning", "--verbose", "--durations=20", "--durations-min=1.0"]
135
137
 
136
138
  [tool.coverage.run]
@@ -1,8 +1,9 @@
1
- __version__ = "0.71.0"
1
+ __version__ = "0.71.1"
2
2
 
3
3
  from importlib.util import find_spec
4
4
 
5
5
  _IS_TORCH_AVAILABLE = find_spec("torch") is not None
6
+ _IS_TORCHVISION_AVAILABLE = find_spec("torchvision") is not None
6
7
  _IS_TENSORFLOW_AVAILABLE = find_spec("tensorflow") is not None and find_spec("tensorflow_probability") is not None
7
8
 
8
9
  del find_spec
@@ -10,9 +10,9 @@ from __future__ import annotations
10
10
 
11
11
  from typing import Callable
12
12
 
13
- import keras
14
13
  import numpy as np
15
14
  import tensorflow as tf
15
+ import tf_keras as keras
16
16
  from numpy.typing import ArrayLike
17
17
 
18
18
  from dataeval._internal.detectors.ood.base import OODBase, OODScoreOutput
@@ -10,8 +10,8 @@ from __future__ import annotations
10
10
 
11
11
  from typing import Callable
12
12
 
13
- import keras
14
13
  import tensorflow as tf
14
+ import tf_keras as keras
15
15
  from numpy.typing import ArrayLike
16
16
 
17
17
  from dataeval._internal.detectors.ood.base import OODGMMBase, OODScoreOutput
@@ -12,9 +12,9 @@ from abc import ABC, abstractmethod
12
12
  from dataclasses import dataclass
13
13
  from typing import Callable, Literal, cast
14
14
 
15
- import keras
16
15
  import numpy as np
17
16
  import tensorflow as tf
17
+ import tf_keras as keras
18
18
  from numpy.typing import ArrayLike, NDArray
19
19
 
20
20
  from dataeval._internal.interop import to_numpy
@@ -11,12 +11,12 @@ from __future__ import annotations
11
11
  from functools import partial
12
12
  from typing import Callable
13
13
 
14
- import keras
15
14
  import numpy as np
16
15
  import tensorflow as tf
17
- from keras.layers import Input
18
- from keras.models import Model
16
+ import tf_keras as keras
19
17
  from numpy.typing import ArrayLike, NDArray
18
+ from tf_keras.layers import Input
19
+ from tf_keras.models import Model
20
20
 
21
21
  from dataeval._internal.detectors.ood.base import OODBase, OODScoreOutput
22
22
  from dataeval._internal.interop import to_numpy
@@ -10,9 +10,9 @@ from __future__ import annotations
10
10
 
11
11
  from typing import Callable
12
12
 
13
- import keras
14
13
  import numpy as np
15
14
  import tensorflow as tf
15
+ import tf_keras as keras
16
16
  from numpy.typing import ArrayLike
17
17
 
18
18
  from dataeval._internal.detectors.ood.base import OODBase, OODScoreOutput
@@ -10,9 +10,9 @@ from __future__ import annotations
10
10
 
11
11
  from typing import Callable
12
12
 
13
- import keras
14
13
  import numpy as np
15
14
  import tensorflow as tf
15
+ import tf_keras as keras
16
16
  from numpy.typing import ArrayLike
17
17
 
18
18
  from dataeval._internal.detectors.ood.base import OODGMMBase, OODScoreOutput
@@ -147,7 +147,7 @@ class Outliers:
147
147
  mask = _get_outlier_mask(values.astype(np.float64), self.outlier_method, self.outlier_threshold)
148
148
  indices = np.flatnonzero(mask)
149
149
  for i, value in zip(indices, values[mask]):
150
- flagged_images.setdefault(i, {}).update({stat: value})
150
+ flagged_images.setdefault(int(i), {}).update({stat: value})
151
151
 
152
152
  return dict(sorted(flagged_images.items()))
153
153
 
@@ -162,10 +162,10 @@ def channelstats(
162
162
 
163
163
  >>> stats = channelstats(images)
164
164
  >>> print(stats.visualstats.darkness)
165
- [0.02124 0.1213 0.2212 0.1013 0.1076 0.11383 0.2013 0.2076 0.2139
166
- 0.3013 0.3076 0.3137 0.4014 0.4075 0.4138 0.5015 0.508 0.5137
167
- 0.6016 0.6074 0.614 0.701 0.7075 0.714 0.8013 0.8076 0.814
168
- 0.9014 0.9077 0.914 ]
165
+ [0.07495 0.1748 0.275 0.1047 0.11096 0.1172 0.2047 0.2109 0.2172
166
+ 0.3047 0.311 0.3171 0.4048 0.411 0.4172 0.505 0.5107 0.517
167
+ 0.6045 0.611 0.617 0.7046 0.711 0.7173 0.8047 0.811 0.8174
168
+ 0.905 0.911 0.917 ]
169
169
  """
170
170
  outputs = run_stats(images, bboxes, True, [PixelStatsProcessor, VisualStatsProcessor])
171
171
  return ChannelStatsOutput(*outputs) # type: ignore
@@ -57,16 +57,16 @@ class DimensionStatsProcessor(StatsProcessor[DimensionStatsOutput]):
57
57
  image_function_map = {
58
58
  "left": lambda x: x.box[0],
59
59
  "top": lambda x: x.box[1],
60
- "width": lambda x: x.shape[-1],
61
- "height": lambda x: x.shape[-2],
60
+ "width": lambda x: x.box[2] - x.box[0],
61
+ "height": lambda x: x.box[3] - x.box[1],
62
62
  "channels": lambda x: x.shape[-3],
63
- "size": lambda x: np.prod(x.shape[-2:]),
64
- "aspect_ratio": lambda x: x.shape[-1] / x.shape[-2],
63
+ "size": lambda x: (x.box[2] - x.box[0]) * (x.box[3] - x.box[1]),
64
+ "aspect_ratio": lambda x: (x.box[2] - x.box[0]) / (x.box[3] - x.box[1]),
65
65
  "depth": lambda x: get_bitdepth(x.image).depth,
66
66
  "center": lambda x: np.asarray([(x.box[0] + x.box[2]) / 2, (x.box[1] + x.box[3]) / 2]),
67
67
  "distance": lambda x: np.sqrt(
68
- np.square(((x.box[0] + x.box[2]) / 2) - (x.width / 2))
69
- + np.square(((x.box[1] + x.box[3]) / 2) - (x.height / 2))
68
+ np.square(((x.box[0] + x.box[2]) / 2) - (x.shape[-1] / 2))
69
+ + np.square(((x.box[1] + x.box[3]) / 2) - (x.shape[-2] / 2))
70
70
  ),
71
71
  }
72
72
 
@@ -22,14 +22,14 @@ class VisualStatsOutput(BaseStatsOutput):
22
22
  ----------
23
23
  brightness : NDArray[np.float16]
24
24
  Brightness of the images
25
- sharpness : NDArray[np.float16]
26
- Blurriness of the images
27
25
  contrast : NDArray[np.float16]
28
26
  Image contrast ratio
29
27
  darkness : NDArray[np.float16]
30
28
  Darkness of the images
31
29
  missing : NDArray[np.float16]
32
30
  Percentage of the images with missing pixels
31
+ sharpness : NDArray[np.float16]
32
+ Sharpness of the images
33
33
  zeros : NDArray[np.float16]
34
34
  Percentage of the images with zero value pixels
35
35
  percentiles : NDArray[np.float16]
@@ -37,10 +37,10 @@ class VisualStatsOutput(BaseStatsOutput):
37
37
  """
38
38
 
39
39
  brightness: NDArray[np.float16]
40
- sharpness: NDArray[np.float16]
41
40
  contrast: NDArray[np.float16]
42
41
  darkness: NDArray[np.float16]
43
42
  missing: NDArray[np.float16]
43
+ sharpness: NDArray[np.float16]
44
44
  zeros: NDArray[np.float16]
45
45
  percentiles: NDArray[np.float16]
46
46
 
@@ -49,25 +49,25 @@ class VisualStatsProcessor(StatsProcessor[VisualStatsOutput]):
49
49
  output_class = VisualStatsOutput
50
50
  cache_keys = ["percentiles"]
51
51
  image_function_map = {
52
- "brightness": lambda x: x.get("percentiles")[-2],
53
- "sharpness": lambda x: np.std(edge_filter(np.mean(x.image, axis=0))),
52
+ "brightness": lambda x: x.get("percentiles")[1],
54
53
  "contrast": lambda x: np.nan_to_num(
55
54
  (np.max(x.get("percentiles")) - np.min(x.get("percentiles"))) / np.mean(x.get("percentiles"))
56
55
  ),
57
- "darkness": lambda x: x.get("percentiles")[1],
56
+ "darkness": lambda x: x.get("percentiles")[-2],
58
57
  "missing": lambda x: np.count_nonzero(np.isnan(np.sum(x.image, axis=0))) / np.prod(x.shape[-2:]),
58
+ "sharpness": lambda x: np.std(edge_filter(np.mean(x.image, axis=0))),
59
59
  "zeros": lambda x: np.count_nonzero(np.sum(x.image, axis=0) == 0) / np.prod(x.shape[-2:]),
60
60
  "percentiles": lambda x: np.nanpercentile(x.scaled, q=QUARTILES),
61
61
  }
62
62
  channel_function_map = {
63
- "brightness": lambda x: x.get("percentiles")[:, -2],
64
- "sharpness": lambda x: np.std(np.vectorize(edge_filter, signature="(m,n)->(m,n)")(x.image), axis=(1, 2)),
63
+ "brightness": lambda x: x.get("percentiles")[:, 1],
65
64
  "contrast": lambda x: np.nan_to_num(
66
65
  (np.max(x.get("percentiles"), axis=1) - np.min(x.get("percentiles"), axis=1))
67
66
  / np.mean(x.get("percentiles"), axis=1)
68
67
  ),
69
- "darkness": lambda x: x.get("percentiles")[:, 1],
68
+ "darkness": lambda x: x.get("percentiles")[:, -2],
70
69
  "missing": lambda x: np.count_nonzero(np.isnan(x.image), axis=(1, 2)) / np.prod(x.shape[-2:]),
70
+ "sharpness": lambda x: np.std(np.vectorize(edge_filter, signature="(m,n)->(m,n)")(x.image), axis=(1, 2)),
71
71
  "zeros": lambda x: np.count_nonzero(x.image == 0, axis=(1, 2)) / np.prod(x.shape[-2:]),
72
72
  "percentiles": lambda x: np.nanpercentile(x.scaled, q=QUARTILES, axis=1).T,
73
73
  }
@@ -113,9 +113,10 @@ def visualstats(
113
113
 
114
114
  >>> results = visualstats(images)
115
115
  >>> print(results.brightness)
116
- [0.0737 0.607 0.0713 0.1046 0.138 0.1713 0.2046 0.2379 0.2712 0.3047
117
- 0.338 0.3713 0.4045 0.438 0.4712 0.5044 0.538 0.5713 0.6045 0.638
118
- 0.6714 0.7046 0.738 0.7715 0.8047 0.838 0.871 0.905 0.938 0.971 ]
116
+ [0.02246 0.5557 0.06805 0.1014 0.1348 0.1681 0.2014 0.2347 0.268
117
+ 0.3015 0.3347 0.3682 0.4014 0.4348 0.468 0.5015 0.5347 0.568
118
+ 0.6016 0.635 0.668 0.701 0.735 0.768 0.8013 0.835 0.868
119
+ 0.9014 0.9346 0.9683 ]
119
120
  >>> print(results.contrast)
120
121
  [2.041 1.332 1.293 1.279 1.272 1.268 1.265 1.263 1.261 1.26 1.259 1.258
121
122
  1.258 1.257 1.257 1.256 1.256 1.255 1.255 1.255 1.255 1.254 1.254 1.254
@@ -12,9 +12,9 @@ from __future__ import annotations
12
12
 
13
13
  from typing import Callable, cast
14
14
 
15
- import keras
16
15
  import tensorflow as tf
17
- from keras.layers import (
16
+ import tf_keras as keras
17
+ from tf_keras.layers import (
18
18
  Dense,
19
19
  Flatten,
20
20
  Layer,
@@ -11,11 +11,11 @@ from __future__ import annotations
11
11
  from typing import Literal, cast
12
12
 
13
13
  import tensorflow as tf
14
- from keras.layers import Flatten
15
14
  from numpy.typing import NDArray
16
15
  from tensorflow_probability.python.distributions.mvn_diag import MultivariateNormalDiag
17
16
  from tensorflow_probability.python.distributions.mvn_tril import MultivariateNormalTriL
18
17
  from tensorflow_probability.python.stats import covariance
18
+ from tf_keras.layers import Flatten
19
19
 
20
20
  from dataeval._internal.models.tensorflow.gmm import gmm_energy, gmm_params
21
21
 
@@ -13,9 +13,9 @@ from __future__ import annotations
13
13
  import functools
14
14
  import warnings
15
15
 
16
- import keras
17
16
  import numpy as np
18
17
  import tensorflow as tf
18
+ import tf_keras as keras
19
19
  from tensorflow_probability.python.bijectors import bijector
20
20
  from tensorflow_probability.python.distributions import (
21
21
  categorical,
@@ -10,9 +10,9 @@ from __future__ import annotations
10
10
 
11
11
  from typing import Callable, Iterable, cast
12
12
 
13
- import keras
14
13
  import numpy as np
15
14
  import tensorflow as tf
15
+ import tf_keras as keras
16
16
  from numpy.typing import NDArray
17
17
 
18
18
 
@@ -11,11 +11,13 @@ from __future__ import annotations
11
11
  import math
12
12
  from typing import Callable, Union, cast
13
13
 
14
- import keras as keras
15
14
  import numpy as np
16
15
  import tensorflow as tf
17
- from keras import Sequential
18
- from keras.layers import (
16
+ import tf_keras as keras
17
+ from numpy.typing import NDArray
18
+ from tensorflow._api.v2.nn import relu, softmax, tanh
19
+ from tf_keras import Sequential
20
+ from tf_keras.layers import (
19
21
  Conv2D,
20
22
  Conv2DTranspose,
21
23
  Dense,
@@ -23,8 +25,6 @@ from keras.layers import (
23
25
  InputLayer,
24
26
  Reshape,
25
27
  )
26
- from numpy.typing import NDArray
27
- from tensorflow._api.v2.nn import relu, softmax, tanh
28
28
 
29
29
  from dataeval._internal.models.tensorflow.autoencoder import AE, AEGMM, VAE, VAEGMM
30
30
  from dataeval._internal.models.tensorflow.pixelcnn import PixelCNN
@@ -6,6 +6,12 @@ as well as constructors which allow for customization of the encoder, decoder an
6
6
  layers used by the model.
7
7
  """
8
8
 
9
+ from dataeval import _IS_TENSORFLOW_AVAILABLE
10
+
9
11
  from . import loss, models, recon
10
12
 
11
- __all__ = ["loss", "models", "recon"]
13
+ __all__ = []
14
+
15
+
16
+ if _IS_TENSORFLOW_AVAILABLE:
17
+ __all__ = ["loss", "models", "recon"]
@@ -0,0 +1,7 @@
1
+ from dataeval import _IS_TENSORFLOW_AVAILABLE
2
+ from dataeval._internal.models.tensorflow.losses import Elbo, LossGMM
3
+
4
+ __all__ = []
5
+
6
+ if _IS_TENSORFLOW_AVAILABLE:
7
+ __all__ += ["Elbo", "LossGMM"]
@@ -1,5 +1,9 @@
1
+ from dataeval import _IS_TENSORFLOW_AVAILABLE
1
2
  from dataeval._internal.models.tensorflow.autoencoder import AE, AEGMM, VAE, VAEGMM
2
3
  from dataeval._internal.models.tensorflow.pixelcnn import PixelCNN
3
4
  from dataeval._internal.models.tensorflow.utils import create_model
4
5
 
5
- __all__ = ["create_model", "AE", "AEGMM", "PixelCNN", "VAE", "VAEGMM"]
6
+ __all__ = []
7
+
8
+ if _IS_TENSORFLOW_AVAILABLE:
9
+ __all__ += ["create_model", "AE", "AEGMM", "PixelCNN", "VAE", "VAEGMM"]
@@ -5,8 +5,17 @@ While these metrics can take in custom models, DataEval provides utility classes
5
5
  to create a seamless integration between custom models and DataEval's metrics.
6
6
  """
7
7
 
8
+ from dataeval import _IS_TORCH_AVAILABLE, _IS_TORCHVISION_AVAILABLE
8
9
  from dataeval._internal.utils import read_dataset
9
10
 
10
- from . import models, trainer
11
+ __all__ = []
11
12
 
12
- __all__ = ["read_dataset", "models", "trainer"]
13
+ if _IS_TORCH_AVAILABLE:
14
+ from . import models, trainer
15
+
16
+ __all__ += ["read_dataset", "models", "trainer"]
17
+
18
+ if _IS_TORCHVISION_AVAILABLE:
19
+ from . import datasets
20
+
21
+ __all__ += ["datasets"]
@@ -0,0 +1,12 @@
1
+ """
2
+ Provide access to common Torch datasets used for computer vision
3
+ """
4
+
5
+ from dataeval import _IS_TORCHVISION_AVAILABLE
6
+
7
+ __all__ = []
8
+
9
+ if _IS_TORCHVISION_AVAILABLE:
10
+ from dataeval._internal.datasets import CIFAR10, MNIST, VOCDetection
11
+
12
+ __all__ += ["CIFAR10", "MNIST", "VOCDetection"]
@@ -0,0 +1,11 @@
1
+ from dataeval import _IS_TORCH_AVAILABLE
2
+ from dataeval._internal.models.pytorch.autoencoder import (
3
+ AriaAutoencoder,
4
+ Decoder,
5
+ Encoder,
6
+ )
7
+
8
+ __all__ = []
9
+
10
+ if _IS_TORCH_AVAILABLE:
11
+ __all__ += ["AriaAutoencoder", "Decoder", "Encoder"]
@@ -0,0 +1,7 @@
1
+ from dataeval import _IS_TORCH_AVAILABLE
2
+ from dataeval._internal.models.pytorch.autoencoder import AETrainer
3
+
4
+ __all__ = []
5
+
6
+ if _IS_TORCH_AVAILABLE:
7
+ __all__ += ["AETrainer"]
@@ -1,3 +0,0 @@
1
- from dataeval._internal.models.tensorflow.losses import Elbo, LossGMM
2
-
3
- __all__ = ["Elbo", "LossGMM"]
@@ -1,7 +0,0 @@
1
- """
2
- Provide access to common Torch datasets used for computer vision
3
- """
4
-
5
- from dataeval._internal.datasets import CIFAR10, MNIST, VOCDetection
6
-
7
- __all__ = ["CIFAR10", "MNIST", "VOCDetection"]
@@ -1,7 +0,0 @@
1
- from dataeval._internal.models.pytorch.autoencoder import (
2
- AriaAutoencoder,
3
- Decoder,
4
- Encoder,
5
- )
6
-
7
- __all__ = ["AriaAutoencoder", "Decoder", "Encoder"]
@@ -1,3 +0,0 @@
1
- from dataeval._internal.models.pytorch.autoencoder import AETrainer
2
-
3
- __all__ = ["AETrainer"]
File without changes
File without changes