argus-cv 1.4.0__py3-none-any.whl → 1.5.1__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.

Potentially problematic release.


This version of argus-cv might be problematic. Click here for more details.

argus/core/yolo.py CHANGED
@@ -1,5 +1,6 @@
1
1
  """YOLO dataset detection and handling."""
2
2
 
3
+ import json
3
4
  from dataclasses import dataclass, field
4
5
  from pathlib import Path
5
6
 
@@ -200,6 +201,12 @@ class YOLODataset(Dataset):
200
201
  if not class_dirs:
201
202
  return None
202
203
 
204
+ # Check if any directory contains COCO annotation files
205
+ # (Roboflow COCO datasets have train/valid/test dirs with JSON files)
206
+ for class_dir in class_dirs:
207
+ if cls._has_coco_annotation(class_dir):
208
+ return None # Not a classification dataset
209
+
203
210
  # Check if these are class directories (contain images directly)
204
211
  class_names_set = set()
205
212
  for class_dir in class_dirs:
@@ -225,6 +232,28 @@ class YOLODataset(Dataset):
225
232
  config_file=None,
226
233
  )
227
234
 
235
+ @staticmethod
236
+ def _has_coco_annotation(directory: Path) -> bool:
237
+ """Check if directory contains COCO annotation files.
238
+
239
+ Args:
240
+ directory: Directory to check.
241
+
242
+ Returns:
243
+ True if COCO annotation files are found, False otherwise.
244
+ """
245
+ for f in directory.glob("*.json"):
246
+ try:
247
+ with open(f, encoding="utf-8") as fp:
248
+ data = json.load(fp)
249
+ if isinstance(data, dict) and any(
250
+ k in data for k in ["images", "annotations", "categories"]
251
+ ):
252
+ return True
253
+ except (json.JSONDecodeError, OSError):
254
+ pass
255
+ return False
256
+
228
257
  def get_instance_counts(self) -> dict[str, dict[str, int]]:
229
258
  """Get the number of annotation instances per class, per split.
230
259
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: argus-cv
3
- Version: 1.4.0
3
+ Version: 1.5.1
4
4
  Summary: CLI tool for working with vision AI datasets
5
5
  Requires-Python: >=3.10
6
6
  Requires-Dist: numpy>=1.24.0
@@ -0,0 +1,16 @@
1
+ argus/__init__.py,sha256=Yo7UDKujDodxid1b2g022IqmD1bwc9POtFSl8iolq5c,64
2
+ argus/__main__.py,sha256=63ezHx8eL_lCMoZrCbKhmpao0fmdvYVw1chbknGg-oI,104
3
+ argus/cli.py,sha256=Xri1KFVOMS-YhbwkRE0eB5HOf49kfQuftu0IJU4gAjA,59605
4
+ argus/commands/__init__.py,sha256=i2oor9hpVpF-_1qZWCGDLwwi1pZGJfZnUKJZ_NMBG18,30
5
+ argus/core/__init__.py,sha256=L5Onny8UjJtok5hOBKftqwnOhPvgQS5MZT_kgLpes1o,928
6
+ argus/core/base.py,sha256=WBrB7XWz125YZ1UQfHQwsYAuIFY_XGEhG_0ybgPhn6s,3696
7
+ argus/core/coco.py,sha256=V3Ifh6KUbifBTLefUuMxQkejgkwsPZNfKLn0newDZJ4,17539
8
+ argus/core/convert.py,sha256=cHuw1E9B4vyozpikS2PJnFfiJ_eRMPIHblizyeZz1Ps,8471
9
+ argus/core/filter.py,sha256=7BRefzYcKIxU0GkFNHiJJAijc9UIhrvNKdYgXE_22ig,21945
10
+ argus/core/mask.py,sha256=m7Ztf4lAZx5ITpk3F3mETcvCC6hGydlxK0-2nCjeTfU,21835
11
+ argus/core/split.py,sha256=kEWtbdg6bH-WiNFf83HkqZD90EL4gsavw6JiefuAETs,10776
12
+ argus/core/yolo.py,sha256=Vtw2sga40VooaRE8bmjKtr_aYhfoV7ZcVijFjg1DVwo,29644
13
+ argus_cv-1.5.1.dist-info/METADATA,sha256=71pcUGzx6s0uCiJjZNUh-4p-z50xCL5xqQC8-JXhNaI,1353
14
+ argus_cv-1.5.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
15
+ argus_cv-1.5.1.dist-info/entry_points.txt,sha256=dvJFH7BkrOxJnifSjPhwq1YCafPaqdngWyBuFYE73yY,43
16
+ argus_cv-1.5.1.dist-info/RECORD,,
@@ -1,14 +0,0 @@
1
- argus/__init__.py,sha256=rRRcnsvIBvQofIEjwsDsXsT9TiGB9c6zVOmzqmqX4Qg,64
2
- argus/__main__.py,sha256=63ezHx8eL_lCMoZrCbKhmpao0fmdvYVw1chbknGg-oI,104
3
- argus/cli.py,sha256=CXnzBiD0ROjHOVac1Jd3Yre4jPeiqkb1F0TGjHyccwc,47879
4
- argus/commands/__init__.py,sha256=i2oor9hpVpF-_1qZWCGDLwwi1pZGJfZnUKJZ_NMBG18,30
5
- argus/core/__init__.py,sha256=II2wYJpGUUGGKOFZ5BCpMIBTfv0WP-F15U_xbpWGjk8,453
6
- argus/core/base.py,sha256=WBrB7XWz125YZ1UQfHQwsYAuIFY_XGEhG_0ybgPhn6s,3696
7
- argus/core/coco.py,sha256=atVurZV2T7cszydyD9GfDTWHGYDd-JNK5RD7nse5avc,15823
8
- argus/core/mask.py,sha256=m7Ztf4lAZx5ITpk3F3mETcvCC6hGydlxK0-2nCjeTfU,21835
9
- argus/core/split.py,sha256=kEWtbdg6bH-WiNFf83HkqZD90EL4gsavw6JiefuAETs,10776
10
- argus/core/yolo.py,sha256=tTc9jJzXcwa8LQ_s8nv-D_i2b9k_x-LT1O0eWr4sZ2k,28616
11
- argus_cv-1.4.0.dist-info/METADATA,sha256=Gdf_n7cxFqS2JoM2Z48CqFcFWMAYHT1y3X1iy9WAxTA,1353
12
- argus_cv-1.4.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
13
- argus_cv-1.4.0.dist-info/entry_points.txt,sha256=dvJFH7BkrOxJnifSjPhwq1YCafPaqdngWyBuFYE73yY,43
14
- argus_cv-1.4.0.dist-info/RECORD,,