ultralytics 8.3.182__py3-none-any.whl → 8.3.183__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.
tests/test_cuda.py CHANGED
@@ -67,7 +67,7 @@ def test_export_onnx_matrix(task, dynamic, int8, half, batch, simplify, nms):
67
67
  half=half,
68
68
  batch=batch,
69
69
  simplify=simplify,
70
- nms=nms,
70
+ nms=nms and task != "obb", # disable NMS for OBB task for now on T4 instance
71
71
  device=DEVICES[0],
72
72
  )
73
73
  YOLO(file)([SOURCE] * batch, imgsz=64 if dynamic else 32, device=DEVICES[0]) # exported model inference
@@ -163,7 +163,7 @@ def test_autobatch():
163
163
 
164
164
 
165
165
  @pytest.mark.slow
166
- @pytest.mark.skipif(not DEVICES, reason="No CUDA devices available")
166
+ @pytest.mark.skipif(True, reason="Skip for now since T4 instance does not support TensorRT > 10.0")
167
167
  def test_utils_benchmarks():
168
168
  """Profile YOLO models for performance benchmarks."""
169
169
  from ultralytics.utils.benchmarks import ProfileModels
tests/test_python.py CHANGED
@@ -228,6 +228,15 @@ def test_train_scratch():
228
228
  model(SOURCE)
229
229
 
230
230
 
231
+ @pytest.mark.skipif(not ONLINE, reason="environment is offline")
232
+ def test_train_ndjson():
233
+ """Test training the YOLO model using NDJSON format dataset."""
234
+ model = YOLO(WEIGHTS_DIR / "yolo11n.pt")
235
+ model.train(
236
+ data="https://github.com/ultralytics/assets/releases/download/v0.0.0/coco8-ndjson.ndjson", epochs=1, imgsz=32
237
+ )
238
+
239
+
231
240
  @pytest.mark.parametrize("scls", [False, True])
232
241
  def test_train_pretrained(scls):
233
242
  """Test training of the YOLO model starting from a pre-trained checkpoint."""
ultralytics/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
- __version__ = "8.3.182"
3
+ __version__ = "8.3.183"
4
4
 
5
5
  import os
6
6
 
@@ -1,5 +1,6 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
+ import asyncio
3
4
  import json
4
5
  import random
5
6
  import shutil
@@ -12,7 +13,8 @@ import cv2
12
13
  import numpy as np
13
14
  from PIL import Image
14
15
 
15
- from ultralytics.utils import DATASETS_DIR, LOGGER, NUM_THREADS, TQDM
16
+ from ultralytics.utils import DATASETS_DIR, LOGGER, NUM_THREADS, TQDM, YAML
17
+ from ultralytics.utils.checks import check_file, check_requirements
16
18
  from ultralytics.utils.downloads import download, zip_directory
17
19
  from ultralytics.utils.files import increment_path
18
20
 
@@ -754,3 +756,112 @@ def convert_to_multispectral(path: Union[str, Path], n_channels: int = 10, repla
754
756
  multispectral = f(target_wavelengths)
755
757
  cv2.imwritemulti(str(output_path), np.clip(multispectral, 0, 255).astype(np.uint8).transpose(2, 0, 1))
756
758
  LOGGER.info(f"Converted {output_path}")
759
+
760
+
761
+ async def convert_ndjson_to_yolo(ndjson_path: Union[str, Path], output_path: Optional[Union[str, Path]] = None) -> Path:
762
+ """
763
+ Convert NDJSON dataset format to Ultralytics YOLO11 dataset structure.
764
+
765
+ This function converts datasets stored in NDJSON (Newline Delimited JSON) format to the standard YOLO
766
+ format with separate directories for images and labels. It supports parallel processing for efficient
767
+ conversion of large datasets and can download images from URLs if they don't exist locally.
768
+
769
+ The NDJSON format consists of:
770
+ - First line: Dataset metadata with class names and configuration
771
+ - Subsequent lines: Individual image records with annotations and optional URLs
772
+
773
+ Args:
774
+ ndjson_path (Union[str, Path]): Path to the input NDJSON file containing dataset information.
775
+ output_path (Optional[Union[str, Path]], optional): Directory where the converted YOLO dataset
776
+ will be saved. If None, uses the parent directory of the NDJSON file. Defaults to None.
777
+
778
+ Returns:
779
+ (Path): Path to the generated data.yaml file that can be used for YOLO training.
780
+
781
+ Examples:
782
+ Convert a local NDJSON file:
783
+ >>> yaml_path = convert_ndjson_to_yolo("dataset.ndjson")
784
+ >>> print(f"Dataset converted to: {yaml_path}")
785
+
786
+ Convert with custom output directory:
787
+ >>> yaml_path = convert_ndjson_to_yolo("dataset.ndjson", output_path="./converted_datasets")
788
+
789
+ # Use with YOLO training
790
+ >>> from ultralytics import YOLO
791
+ >>> model = YOLO("yolo11n.pt")
792
+ >>> model.train(data="https://github.com/ultralytics/assets/releases/download/v0.0.0/coco8-ndjson.ndjson")
793
+ """
794
+ check_requirements("aiohttp")
795
+ import aiohttp
796
+
797
+ ndjson_path = Path(check_file(ndjson_path))
798
+ output_path = Path(output_path or DATASETS_DIR)
799
+ with open(ndjson_path) as f:
800
+ lines = [json.loads(line.strip()) for line in f if line.strip()]
801
+
802
+ dataset_record, image_records = lines[0], lines[1:]
803
+ dataset_dir = output_path / ndjson_path.stem
804
+ splits = {record["split"] for record in image_records}
805
+
806
+ # Create directories and prepare YAML structure
807
+ dataset_dir.mkdir(parents=True, exist_ok=True)
808
+ data_yaml = dict(dataset_record)
809
+ data_yaml["names"] = {int(k): v for k, v in dataset_record.get("class_names", {}).items()}
810
+
811
+ for split in sorted(splits):
812
+ (dataset_dir / "images" / split).mkdir(parents=True, exist_ok=True)
813
+ (dataset_dir / "labels" / split).mkdir(parents=True, exist_ok=True)
814
+ data_yaml[split] = f"images/{split}"
815
+
816
+ async def process_record(session, semaphore, record):
817
+ """Process single image record with async session."""
818
+ async with semaphore:
819
+ split, original_name = record["split"], record["file"]
820
+ label_path = dataset_dir / "labels" / split / f"{Path(original_name).stem}.txt"
821
+ image_path = dataset_dir / "images" / split / original_name
822
+
823
+ annotations = record.get("annotations", {})
824
+ lines_to_write = []
825
+ for key in annotations.keys():
826
+ lines_to_write = [" ".join(map(str, item)) for item in annotations[key]]
827
+ break
828
+ if "classification" in annotations:
829
+ lines_to_write = [str(cls) for cls in annotations["classification"]]
830
+
831
+ label_path.write_text("\n".join(lines_to_write) + "\n" if lines_to_write else "")
832
+
833
+ if http_url := record.get("url"):
834
+ if not image_path.exists():
835
+ try:
836
+ async with session.get(http_url, timeout=aiohttp.ClientTimeout(total=30)) as response:
837
+ response.raise_for_status()
838
+ with open(image_path, "wb") as f:
839
+ async for chunk in response.content.iter_chunked(8192):
840
+ f.write(chunk)
841
+ return True
842
+ except Exception as e:
843
+ LOGGER.warning(f"Failed to download {http_url}: {e}")
844
+ return False
845
+ return True
846
+
847
+ # Process all images with async downloads
848
+ semaphore = asyncio.Semaphore(64)
849
+ async with aiohttp.ClientSession() as session:
850
+ pbar = TQDM(
851
+ total=len(image_records),
852
+ desc=f"Converting {ndjson_path.name} → {dataset_dir} ({len(image_records)} images)",
853
+ )
854
+
855
+ async def tracked_process(record):
856
+ result = await process_record(session, semaphore, record)
857
+ pbar.update(1)
858
+ return result
859
+
860
+ await asyncio.gather(*[tracked_process(record) for record in image_records])
861
+ pbar.close()
862
+
863
+ # Write data.yaml
864
+ yaml_path = dataset_dir / "data.yaml"
865
+ YAML.save(yaml_path, data_yaml)
866
+
867
+ return yaml_path
@@ -598,6 +598,15 @@ class BaseTrainer:
598
598
  try:
599
599
  if self.args.task == "classify":
600
600
  data = check_cls_dataset(self.args.data)
601
+ elif self.args.data.rsplit(".", 1)[-1] == "ndjson":
602
+ # Convert NDJSON to YOLO format
603
+ import asyncio
604
+
605
+ from ultralytics.data.converter import convert_ndjson_to_yolo
606
+
607
+ yaml_path = asyncio.run(convert_ndjson_to_yolo(self.args.data))
608
+ self.args.data = str(yaml_path)
609
+ data = check_det_dataset(self.args.data)
601
610
  elif self.args.data.rsplit(".", 1)[-1] in {"yaml", "yml"} or self.args.task in {
602
611
  "detect",
603
612
  "segment",
@@ -181,7 +181,7 @@ class YOLOEDetectValidator(DetectionValidator):
181
181
  else:
182
182
  if refer_data is not None:
183
183
  assert load_vp, "Refer data is only used for visual prompt validation."
184
- self.device = select_device(self.args.device)
184
+ self.device = select_device(self.args.device, verbose=False)
185
185
 
186
186
  if isinstance(model, (str, Path)):
187
187
  from ultralytics.nn.tasks import attempt_load_weights
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ultralytics
3
- Version: 8.3.182
3
+ Version: 8.3.183
4
4
  Summary: Ultralytics YOLO 🚀 for SOTA object detection, multi-object tracking, instance segmentation, pose estimation and image classification.
5
5
  Author-email: Glenn Jocher <glenn.jocher@ultralytics.com>, Jing Qiu <jing.qiu@ultralytics.com>
6
6
  Maintainer-email: Ultralytics <hello@ultralytics.com>
@@ -1,13 +1,13 @@
1
1
  tests/__init__.py,sha256=b4KP5_q-2IO8Br8YHOSLYnn7IwZS81l_vfEF2YPa2lM,894
2
2
  tests/conftest.py,sha256=LXtQJcFNWPGuzauTGkiXgsvVC3llJKfg22WcmhRzuQc,2593
3
3
  tests/test_cli.py,sha256=EMf5gTAopOnIz8VvzaM-Qb044o7D0flnUHYQ-2ffOM4,5670
4
- tests/test_cuda.py,sha256=-nQsfF3lGfqLm6cIeu_BCiXqLj7HzpL7R1GzPEc6z2I,8128
4
+ tests/test_cuda.py,sha256=7RAMC1DoXpsRvH0Jfyo9cqHkaJZWcWeqniCW5BW87hY,8228
5
5
  tests/test_engine.py,sha256=Jpt2KVrltrEgh2-3Ykouz-2Z_2fza0eymL5ectRXadM,4922
6
6
  tests/test_exports.py,sha256=CY-4xVZlVM16vdyIC0mSR3Ix59aiZm1qjFGIhSNmB20,11007
7
7
  tests/test_integrations.py,sha256=kl_AKmE_Qs1GB0_91iVwbzNxofm_hFTt0zzU6JF-pg4,6323
8
- tests/test_python.py,sha256=-qvdeg-hEcKU5mWSDEU24iFZ-i8FAwQRznSXpkp6WQ4,27928
8
+ tests/test_python.py,sha256=JbOB6pbTkoQtPCjkl_idagV0_W2QLWGbsh2IvGmru0M,28274
9
9
  tests/test_solutions.py,sha256=tuf6n_fsI8KvSdJrnc-cqP2qYdiYqCWuVrx0z9dOz3Q,13213
10
- ultralytics/__init__.py,sha256=NmFp8Z3Rk0s1QZu4IuBv2wLLf-Pc5DLFdycD5Y49Keg,730
10
+ ultralytics/__init__.py,sha256=hpM4gHWSSIAjKjCF3tuvHLzoZadJLeOZVINd-nMfpm8,730
11
11
  ultralytics/py.typed,sha256=la67KBlbjXN-_-DfGNcdOcjYumVpKG_Tkw-8n5dnGB4,8
12
12
  ultralytics/assets/bus.jpg,sha256=wCAZxJecGR63Od3ZRERe9Aja1Weayrb9Ug751DS_vGM,137419
13
13
  ultralytics/assets/zidane.jpg,sha256=Ftc4aeMmen1O0A3o6GCDO9FlfBslLpTAw0gnetx7bts,50427
@@ -109,7 +109,7 @@ ultralytics/data/annotator.py,sha256=uAgd7K-yudxiwdNqHz0ubfFg5JsfNlae4cgxdvCMyuY
109
109
  ultralytics/data/augment.py,sha256=Ps1s-ug_oXdyAz4Jyur6OmxzRlyzwP3VP-3hDalSxj8,132959
110
110
  ultralytics/data/base.py,sha256=mRcuehK1thNuuzQGL6D1AaZkod71oHRdYTod_zdQZQg,19688
111
111
  ultralytics/data/build.py,sha256=TfMLSPMbE2hGZVMLl178NTFrihC1-50jNOt1ex9elxw,11480
112
- ultralytics/data/converter.py,sha256=dExElV0vWd4EmDtZaFMC0clEmLdjRDIdFiXf01PUvQA,27134
112
+ ultralytics/data/converter.py,sha256=1YJNJcOyzdnc-LmJw4oFbeJemHOWwx9z8m0V2QA_lzc,32053
113
113
  ultralytics/data/dataset.py,sha256=GhoFzBiuGvTr_5-3pzgWu6D_3aQVwW-hcS7kCo8XscM,36752
114
114
  ultralytics/data/loaders.py,sha256=u9sExTGPy1iiqVd_p29zVoEkQ3C36g2rE0FEbYPET0A,31767
115
115
  ultralytics/data/split.py,sha256=F6O73bAbESj70FQZzqkydXQeXgPXGHGiC06b5MkLHjQ,5109
@@ -124,7 +124,7 @@ ultralytics/engine/exporter.py,sha256=Vr7K8Yf3wyf91ZvDpRosAohwa_W0oe4qW-JvqigCPf
124
124
  ultralytics/engine/model.py,sha256=877u2n0ISz2COOYtEMUqQe0E-HHB4Atb2DuH1XCE98k,53530
125
125
  ultralytics/engine/predictor.py,sha256=iXnUB-tvBHtVpKbB-5EKs1wSREBIerdUxWx39MaFYuk,22485
126
126
  ultralytics/engine/results.py,sha256=QcHcbPVlLBiy_APwABr-T5K65HR8Bl1rRzxawjjP76E,71873
127
- ultralytics/engine/trainer.py,sha256=28FeqASvQRxCaK96SXDM-BfPJjqy5KNiWhf8v6GXTug,39785
127
+ ultralytics/engine/trainer.py,sha256=rOzMFt7b5PzVJZ3cOl80wxQAKUTP7XhnMHfXSaVRbOE,40193
128
128
  ultralytics/engine/tuner.py,sha256=sfQ8_yzgLNcGlKyz9b2vAzyggGZXiQzdZ5tKstyqjHM,12825
129
129
  ultralytics/engine/validator.py,sha256=g0StH6WOn95zBN-hULDAR5Uug1pU2YkaeNH3zzq3SVg,16573
130
130
  ultralytics/hub/__init__.py,sha256=ulPtceI3hqud03mvqoXccBaa1e4nveYwC9cddyuBUlo,6599
@@ -193,7 +193,7 @@ ultralytics/models/yolo/yoloe/__init__.py,sha256=6SLytdJtwu37qewf7CobG7C7Wl1m-xt
193
193
  ultralytics/models/yolo/yoloe/predict.py,sha256=GmQxCQe7sLomAujde53jQzquzryNn6fEjS4Oalf3mPs,7124
194
194
  ultralytics/models/yolo/yoloe/train.py,sha256=XYpQYSnSD8vi_9VSj_S5oIsNUEqm3e66vPT8rNFI_HY,14086
195
195
  ultralytics/models/yolo/yoloe/train_seg.py,sha256=aCV7M8oQOvODFnU4piZdJh3tIrBJYAzZfRVRx1vRgxo,4956
196
- ultralytics/models/yolo/yoloe/val.py,sha256=yebPkxwKKt__cY05Zbh1YXg4_BKzzpcDc3Cv3FJ5SAA,9769
196
+ ultralytics/models/yolo/yoloe/val.py,sha256=2NuERI3B3WeED658Cat1xL2SVpORUHlCHCWI3L8pJJc,9784
197
197
  ultralytics/nn/__init__.py,sha256=rjociYD9lo_K-d-1s6TbdWklPLjTcEHk7OIlRDJstIE,615
198
198
  ultralytics/nn/autobackend.py,sha256=UM9ObXeLB0lgak1Q5oSi2IA-R_Owr6NdJNBAsA3mSbo,41790
199
199
  ultralytics/nn/tasks.py,sha256=vw_TNacAv-RN24rusFzKuYL6qRBD7cve8EpB7gOlU_8,72505
@@ -266,9 +266,9 @@ ultralytics/utils/callbacks/neptune.py,sha256=j8pecmlcsM8FGzLKWoBw5xUsi5t8E5HuxY
266
266
  ultralytics/utils/callbacks/raytune.py,sha256=S6Bq16oQDQ8BQgnZzA0zJHGN_BBr8iAM_WtGoLiEcwg,1283
267
267
  ultralytics/utils/callbacks/tensorboard.py,sha256=MDPBW7aDes-66OE6YqKXXvqA_EocjzEMHWGM-8z9vUQ,5281
268
268
  ultralytics/utils/callbacks/wb.py,sha256=Tm_-aRr2CN32MJkY9tylpMBJkb007-MSRNSQ7rDJ5QU,7521
269
- ultralytics-8.3.182.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
270
- ultralytics-8.3.182.dist-info/METADATA,sha256=6J19Tk3kc50OtxsKa2FTq2NrpG7hB3nrYzLCvHbkxes,37631
271
- ultralytics-8.3.182.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
272
- ultralytics-8.3.182.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
273
- ultralytics-8.3.182.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
274
- ultralytics-8.3.182.dist-info/RECORD,,
269
+ ultralytics-8.3.183.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
270
+ ultralytics-8.3.183.dist-info/METADATA,sha256=odde802Zna981J9saZqkJ_7de5OJkGqq_4yNWHzOZJs,37631
271
+ ultralytics-8.3.183.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
272
+ ultralytics-8.3.183.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
273
+ ultralytics-8.3.183.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
274
+ ultralytics-8.3.183.dist-info/RECORD,,