diff --git a/docs/en/macros/train-args.md b/docs/en/macros/train-args.md index 0bc48f8117..924bd31345 100644 --- a/docs/en/macros/train-args.md +++ b/docs/en/macros/train-args.md @@ -40,7 +40,6 @@ | `dfl` | `1.5` | Weight of the distribution focal loss, used in certain YOLO versions for fine-grained classification. | | `pose` | `12.0` | Weight of the pose loss in models trained for pose estimation, influencing the emphasis on accurately predicting pose keypoints. | | `kobj` | `2.0` | Weight of the keypoint objectness loss in pose estimation models, balancing detection confidence with pose accuracy. | -| `label_smoothing` | `0.0` | Applies label smoothing, softening hard labels to a mix of the target label and a uniform distribution over labels, can improve generalization. | | `nbs` | `64` | Nominal batch size for normalization of loss. | | `overlap_mask` | `True` | Determines whether object masks should be merged into a single mask for training, or kept separate for each object. In case of overlap, the smaller mask is overlayed on top of the larger mask during merge. | | `mask_ratio` | `4` | Downsample ratio for segmentation masks, affecting the resolution of masks used during training. | diff --git a/ultralytics/cfg/__init__.py b/ultralytics/cfg/__init__.py index 40cf16a5ee..9bfd6a6000 100644 --- a/ultralytics/cfg/__init__.py +++ b/ultralytics/cfg/__init__.py @@ -160,7 +160,6 @@ CFG_FRACTION_KEYS = { # fractional float arguments with 0.0<=values<=1.0 "weight_decay", "warmup_momentum", "warmup_bias_lr", - "label_smoothing", "hsv_h", "hsv_s", "hsv_v", @@ -436,6 +435,9 @@ def _handle_deprecation(custom): if key == "line_thickness": deprecation_warn(key, "line_width") custom["line_width"] = custom.pop("line_thickness") + if key == "label_smoothing": + deprecation_warn(key) + custom.pop("label_smoothing") return custom diff --git a/ultralytics/cfg/default.yaml b/ultralytics/cfg/default.yaml index 9f6eb51a42..0423366f77 100644 --- a/ultralytics/cfg/default.yaml +++ b/ultralytics/cfg/default.yaml @@ -99,7 +99,6 @@ cls: 0.5 # (float) cls loss gain (scale with pixels) dfl: 1.5 # (float) dfl loss gain pose: 12.0 # (float) pose loss gain kobj: 1.0 # (float) keypoint obj loss gain -label_smoothing: 0.0 # (float) label smoothing (fraction) nbs: 64 # (int) nominal batch size hsv_h: 0.015 # (float) image HSV-Hue augmentation (fraction) hsv_s: 0.7 # (float) image HSV-Saturation augmentation (fraction) diff --git a/ultralytics/utils/__init__.py b/ultralytics/utils/__init__.py index a2540c6b85..b6d620fdb4 100644 --- a/ultralytics/utils/__init__.py +++ b/ultralytics/utils/__init__.py @@ -1255,9 +1255,12 @@ class SettingsManager(JSONDict): self.update(self.defaults) -def deprecation_warn(arg, new_arg): +def deprecation_warn(arg, new_arg=None): """Issue a deprecation warning when a deprecated argument is used, suggesting an updated argument.""" - LOGGER.warning(f"WARNING ⚠️ '{arg}' is deprecated and will be removed in in the future. Use '{new_arg}' instead.") + msg = f"WARNING ⚠️ '{arg}' is deprecated and will be removed in in the future." + if new_arg is not None: + msg += f" Use '{new_arg}' instead." + LOGGER.warning(msg) def clean_url(url):