dgenerate-ultralytics-headless 8.3.222__py3-none-any.whl → 8.3.225__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.
- {dgenerate_ultralytics_headless-8.3.222.dist-info → dgenerate_ultralytics_headless-8.3.225.dist-info}/METADATA +2 -2
- dgenerate_ultralytics_headless-8.3.225.dist-info/RECORD +286 -0
- tests/conftest.py +5 -8
- tests/test_cli.py +1 -8
- tests/test_python.py +1 -2
- ultralytics/__init__.py +1 -1
- ultralytics/cfg/__init__.py +34 -49
- ultralytics/cfg/datasets/ImageNet.yaml +1 -1
- ultralytics/cfg/datasets/kitti.yaml +27 -0
- ultralytics/cfg/datasets/lvis.yaml +5 -5
- ultralytics/cfg/datasets/open-images-v7.yaml +1 -1
- ultralytics/data/annotator.py +3 -4
- ultralytics/data/augment.py +244 -323
- ultralytics/data/base.py +12 -22
- ultralytics/data/build.py +47 -40
- ultralytics/data/converter.py +32 -42
- ultralytics/data/dataset.py +43 -71
- ultralytics/data/loaders.py +22 -34
- ultralytics/data/split.py +5 -6
- ultralytics/data/split_dota.py +8 -15
- ultralytics/data/utils.py +27 -36
- ultralytics/engine/exporter.py +49 -116
- ultralytics/engine/model.py +144 -180
- ultralytics/engine/predictor.py +18 -29
- ultralytics/engine/results.py +165 -231
- ultralytics/engine/trainer.py +11 -19
- ultralytics/engine/tuner.py +13 -23
- ultralytics/engine/validator.py +6 -10
- ultralytics/hub/__init__.py +7 -12
- ultralytics/hub/auth.py +6 -12
- ultralytics/hub/google/__init__.py +7 -10
- ultralytics/hub/session.py +15 -25
- ultralytics/hub/utils.py +3 -6
- ultralytics/models/fastsam/model.py +6 -8
- ultralytics/models/fastsam/predict.py +5 -10
- ultralytics/models/fastsam/utils.py +1 -2
- ultralytics/models/fastsam/val.py +2 -4
- ultralytics/models/nas/model.py +5 -8
- ultralytics/models/nas/predict.py +7 -9
- ultralytics/models/nas/val.py +1 -2
- ultralytics/models/rtdetr/model.py +5 -8
- ultralytics/models/rtdetr/predict.py +15 -18
- ultralytics/models/rtdetr/train.py +10 -13
- ultralytics/models/rtdetr/val.py +13 -20
- ultralytics/models/sam/amg.py +12 -18
- ultralytics/models/sam/build.py +6 -9
- ultralytics/models/sam/model.py +16 -23
- ultralytics/models/sam/modules/blocks.py +62 -84
- ultralytics/models/sam/modules/decoders.py +17 -24
- ultralytics/models/sam/modules/encoders.py +40 -56
- ultralytics/models/sam/modules/memory_attention.py +10 -16
- ultralytics/models/sam/modules/sam.py +41 -47
- ultralytics/models/sam/modules/tiny_encoder.py +64 -83
- ultralytics/models/sam/modules/transformer.py +17 -27
- ultralytics/models/sam/modules/utils.py +31 -42
- ultralytics/models/sam/predict.py +172 -209
- ultralytics/models/utils/loss.py +14 -26
- ultralytics/models/utils/ops.py +13 -17
- ultralytics/models/yolo/classify/predict.py +8 -11
- ultralytics/models/yolo/classify/train.py +8 -16
- ultralytics/models/yolo/classify/val.py +13 -20
- ultralytics/models/yolo/detect/predict.py +4 -8
- ultralytics/models/yolo/detect/train.py +11 -20
- ultralytics/models/yolo/detect/val.py +38 -48
- ultralytics/models/yolo/model.py +35 -47
- ultralytics/models/yolo/obb/predict.py +5 -8
- ultralytics/models/yolo/obb/train.py +11 -14
- ultralytics/models/yolo/obb/val.py +20 -28
- ultralytics/models/yolo/pose/predict.py +5 -8
- ultralytics/models/yolo/pose/train.py +4 -8
- ultralytics/models/yolo/pose/val.py +31 -39
- ultralytics/models/yolo/segment/predict.py +9 -14
- ultralytics/models/yolo/segment/train.py +3 -6
- ultralytics/models/yolo/segment/val.py +16 -26
- ultralytics/models/yolo/world/train.py +8 -14
- ultralytics/models/yolo/world/train_world.py +11 -16
- ultralytics/models/yolo/yoloe/predict.py +16 -23
- ultralytics/models/yolo/yoloe/train.py +30 -43
- ultralytics/models/yolo/yoloe/train_seg.py +5 -10
- ultralytics/models/yolo/yoloe/val.py +15 -20
- ultralytics/nn/autobackend.py +10 -18
- ultralytics/nn/modules/activation.py +4 -6
- ultralytics/nn/modules/block.py +99 -185
- ultralytics/nn/modules/conv.py +45 -90
- ultralytics/nn/modules/head.py +44 -98
- ultralytics/nn/modules/transformer.py +44 -76
- ultralytics/nn/modules/utils.py +14 -19
- ultralytics/nn/tasks.py +86 -146
- ultralytics/nn/text_model.py +25 -40
- ultralytics/solutions/ai_gym.py +10 -16
- ultralytics/solutions/analytics.py +7 -10
- ultralytics/solutions/config.py +4 -5
- ultralytics/solutions/distance_calculation.py +9 -12
- ultralytics/solutions/heatmap.py +7 -13
- ultralytics/solutions/instance_segmentation.py +5 -8
- ultralytics/solutions/object_blurrer.py +7 -10
- ultralytics/solutions/object_counter.py +8 -12
- ultralytics/solutions/object_cropper.py +5 -8
- ultralytics/solutions/parking_management.py +12 -14
- ultralytics/solutions/queue_management.py +4 -6
- ultralytics/solutions/region_counter.py +7 -10
- ultralytics/solutions/security_alarm.py +14 -19
- ultralytics/solutions/similarity_search.py +7 -12
- ultralytics/solutions/solutions.py +31 -53
- ultralytics/solutions/speed_estimation.py +6 -9
- ultralytics/solutions/streamlit_inference.py +2 -4
- ultralytics/solutions/trackzone.py +7 -10
- ultralytics/solutions/vision_eye.py +5 -8
- ultralytics/trackers/basetrack.py +2 -4
- ultralytics/trackers/bot_sort.py +6 -11
- ultralytics/trackers/byte_tracker.py +10 -15
- ultralytics/trackers/track.py +3 -6
- ultralytics/trackers/utils/gmc.py +6 -12
- ultralytics/trackers/utils/kalman_filter.py +35 -43
- ultralytics/trackers/utils/matching.py +6 -10
- ultralytics/utils/__init__.py +61 -100
- ultralytics/utils/autobatch.py +2 -4
- ultralytics/utils/autodevice.py +11 -13
- ultralytics/utils/benchmarks.py +25 -35
- ultralytics/utils/callbacks/base.py +8 -10
- ultralytics/utils/callbacks/clearml.py +2 -4
- ultralytics/utils/callbacks/comet.py +30 -44
- ultralytics/utils/callbacks/dvc.py +13 -18
- ultralytics/utils/callbacks/mlflow.py +4 -5
- ultralytics/utils/callbacks/neptune.py +4 -6
- ultralytics/utils/callbacks/raytune.py +3 -4
- ultralytics/utils/callbacks/tensorboard.py +4 -6
- ultralytics/utils/callbacks/wb.py +10 -13
- ultralytics/utils/checks.py +29 -56
- ultralytics/utils/cpu.py +1 -2
- ultralytics/utils/dist.py +8 -12
- ultralytics/utils/downloads.py +17 -27
- ultralytics/utils/errors.py +6 -8
- ultralytics/utils/events.py +2 -4
- ultralytics/utils/export/__init__.py +4 -239
- ultralytics/utils/export/engine.py +237 -0
- ultralytics/utils/export/imx.py +11 -17
- ultralytics/utils/export/tensorflow.py +217 -0
- ultralytics/utils/files.py +10 -15
- ultralytics/utils/git.py +5 -7
- ultralytics/utils/instance.py +30 -51
- ultralytics/utils/logger.py +11 -15
- ultralytics/utils/loss.py +8 -14
- ultralytics/utils/metrics.py +98 -138
- ultralytics/utils/nms.py +13 -16
- ultralytics/utils/ops.py +47 -74
- ultralytics/utils/patches.py +11 -18
- ultralytics/utils/plotting.py +29 -42
- ultralytics/utils/tal.py +25 -39
- ultralytics/utils/torch_utils.py +45 -73
- ultralytics/utils/tqdm.py +6 -8
- ultralytics/utils/triton.py +9 -12
- ultralytics/utils/tuner.py +1 -2
- dgenerate_ultralytics_headless-8.3.222.dist-info/RECORD +0 -283
- {dgenerate_ultralytics_headless-8.3.222.dist-info → dgenerate_ultralytics_headless-8.3.225.dist-info}/WHEEL +0 -0
- {dgenerate_ultralytics_headless-8.3.222.dist-info → dgenerate_ultralytics_headless-8.3.225.dist-info}/entry_points.txt +0 -0
- {dgenerate_ultralytics_headless-8.3.222.dist-info → dgenerate_ultralytics_headless-8.3.225.dist-info}/licenses/LICENSE +0 -0
- {dgenerate_ultralytics_headless-8.3.222.dist-info → dgenerate_ultralytics_headless-8.3.225.dist-info}/top_level.txt +0 -0
ultralytics/engine/predictor.py
CHANGED
|
@@ -68,11 +68,10 @@ Example:
|
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
class BasePredictor:
|
|
71
|
-
"""
|
|
72
|
-
A base class for creating predictors.
|
|
71
|
+
"""A base class for creating predictors.
|
|
73
72
|
|
|
74
|
-
This class provides the foundation for prediction functionality, handling model setup, inference,
|
|
75
|
-
|
|
73
|
+
This class provides the foundation for prediction functionality, handling model setup, inference, and result
|
|
74
|
+
processing across various input sources.
|
|
76
75
|
|
|
77
76
|
Attributes:
|
|
78
77
|
args (SimpleNamespace): Configuration for the predictor.
|
|
@@ -115,8 +114,7 @@ class BasePredictor:
|
|
|
115
114
|
overrides: dict[str, Any] | None = None,
|
|
116
115
|
_callbacks: dict[str, list[callable]] | None = None,
|
|
117
116
|
):
|
|
118
|
-
"""
|
|
119
|
-
Initialize the BasePredictor class.
|
|
117
|
+
"""Initialize the BasePredictor class.
|
|
120
118
|
|
|
121
119
|
Args:
|
|
122
120
|
cfg (str | dict): Path to a configuration file or a configuration dictionary.
|
|
@@ -151,8 +149,7 @@ class BasePredictor:
|
|
|
151
149
|
callbacks.add_integration_callbacks(self)
|
|
152
150
|
|
|
153
151
|
def preprocess(self, im: torch.Tensor | list[np.ndarray]) -> torch.Tensor:
|
|
154
|
-
"""
|
|
155
|
-
Prepare input image before inference.
|
|
152
|
+
"""Prepare input image before inference.
|
|
156
153
|
|
|
157
154
|
Args:
|
|
158
155
|
im (torch.Tensor | list[np.ndarray]): Images of shape (N, 3, H, W) for tensor, [(H, W, 3) x N] for list.
|
|
@@ -185,8 +182,7 @@ class BasePredictor:
|
|
|
185
182
|
return self.model(im, augment=self.args.augment, visualize=visualize, embed=self.args.embed, *args, **kwargs)
|
|
186
183
|
|
|
187
184
|
def pre_transform(self, im: list[np.ndarray]) -> list[np.ndarray]:
|
|
188
|
-
"""
|
|
189
|
-
Pre-transform input image before inference.
|
|
185
|
+
"""Pre-transform input image before inference.
|
|
190
186
|
|
|
191
187
|
Args:
|
|
192
188
|
im (list[np.ndarray]): List of images with shape [(H, W, 3) x N].
|
|
@@ -209,8 +205,7 @@ class BasePredictor:
|
|
|
209
205
|
return preds
|
|
210
206
|
|
|
211
207
|
def __call__(self, source=None, model=None, stream: bool = False, *args, **kwargs):
|
|
212
|
-
"""
|
|
213
|
-
Perform inference on an image or stream.
|
|
208
|
+
"""Perform inference on an image or stream.
|
|
214
209
|
|
|
215
210
|
Args:
|
|
216
211
|
source (str | Path | list[str] | list[Path] | list[np.ndarray] | np.ndarray | torch.Tensor, optional):
|
|
@@ -230,11 +225,10 @@ class BasePredictor:
|
|
|
230
225
|
return list(self.stream_inference(source, model, *args, **kwargs)) # merge list of Result into one
|
|
231
226
|
|
|
232
227
|
def predict_cli(self, source=None, model=None):
|
|
233
|
-
"""
|
|
234
|
-
Method used for Command Line Interface (CLI) prediction.
|
|
228
|
+
"""Method used for Command Line Interface (CLI) prediction.
|
|
235
229
|
|
|
236
|
-
This function is designed to run predictions using the CLI. It sets up the source and model, then processes
|
|
237
|
-
|
|
230
|
+
This function is designed to run predictions using the CLI. It sets up the source and model, then processes the
|
|
231
|
+
inputs in a streaming manner. This method ensures that no outputs accumulate in memory by consuming the
|
|
238
232
|
generator without storing results.
|
|
239
233
|
|
|
240
234
|
Args:
|
|
@@ -242,7 +236,7 @@ class BasePredictor:
|
|
|
242
236
|
Source for inference.
|
|
243
237
|
model (str | Path | torch.nn.Module, optional): Model for inference.
|
|
244
238
|
|
|
245
|
-
|
|
239
|
+
Notes:
|
|
246
240
|
Do not modify this function or remove the generator. The generator ensures that no outputs are
|
|
247
241
|
accumulated in memory, which is critical for preventing memory issues during long-running predictions.
|
|
248
242
|
"""
|
|
@@ -251,12 +245,11 @@ class BasePredictor:
|
|
|
251
245
|
pass
|
|
252
246
|
|
|
253
247
|
def setup_source(self, source):
|
|
254
|
-
"""
|
|
255
|
-
Set up source and inference mode.
|
|
248
|
+
"""Set up source and inference mode.
|
|
256
249
|
|
|
257
250
|
Args:
|
|
258
|
-
source (str | Path | list[str] | list[Path] | list[np.ndarray] | np.ndarray | torch.Tensor):
|
|
259
|
-
|
|
251
|
+
source (str | Path | list[str] | list[Path] | list[np.ndarray] | np.ndarray | torch.Tensor): Source for
|
|
252
|
+
inference.
|
|
260
253
|
"""
|
|
261
254
|
self.imgsz = check_imgsz(self.args.imgsz, stride=self.model.stride, min_dim=2) # check image size
|
|
262
255
|
self.dataset = load_inference_source(
|
|
@@ -282,8 +275,7 @@ class BasePredictor:
|
|
|
282
275
|
|
|
283
276
|
@smart_inference_mode()
|
|
284
277
|
def stream_inference(self, source=None, model=None, *args, **kwargs):
|
|
285
|
-
"""
|
|
286
|
-
Stream real-time inference on camera feed and save results to file.
|
|
278
|
+
"""Stream real-time inference on camera feed and save results to file.
|
|
287
279
|
|
|
288
280
|
Args:
|
|
289
281
|
source (str | Path | list[str] | list[Path] | list[np.ndarray] | np.ndarray | torch.Tensor, optional):
|
|
@@ -388,8 +380,7 @@ class BasePredictor:
|
|
|
388
380
|
self.run_callbacks("on_predict_end")
|
|
389
381
|
|
|
390
382
|
def setup_model(self, model, verbose: bool = True):
|
|
391
|
-
"""
|
|
392
|
-
Initialize YOLO model with given parameters and set it to evaluation mode.
|
|
383
|
+
"""Initialize YOLO model with given parameters and set it to evaluation mode.
|
|
393
384
|
|
|
394
385
|
Args:
|
|
395
386
|
model (str | Path | torch.nn.Module, optional): Model to load or use.
|
|
@@ -413,8 +404,7 @@ class BasePredictor:
|
|
|
413
404
|
self.model = attempt_compile(self.model, device=self.device, mode=self.args.compile)
|
|
414
405
|
|
|
415
406
|
def write_results(self, i: int, p: Path, im: torch.Tensor, s: list[str]) -> str:
|
|
416
|
-
"""
|
|
417
|
-
Write inference results to a file or directory.
|
|
407
|
+
"""Write inference results to a file or directory.
|
|
418
408
|
|
|
419
409
|
Args:
|
|
420
410
|
i (int): Index of the current image in the batch.
|
|
@@ -464,8 +454,7 @@ class BasePredictor:
|
|
|
464
454
|
return string
|
|
465
455
|
|
|
466
456
|
def save_predicted_images(self, save_path: Path, frame: int = 0):
|
|
467
|
-
"""
|
|
468
|
-
Save video predictions as mp4 or images as jpg at specified path.
|
|
457
|
+
"""Save video predictions as mp4 or images as jpg at specified path.
|
|
469
458
|
|
|
470
459
|
Args:
|
|
471
460
|
save_path (Path): Path to save the results.
|