Deprecate `Silence` module in favor of `nn.Identity` (#13785)

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: Laughing-q <1185102784@qq.com>
pull/13477/head
Burhan 5 months ago committed by GitHub
parent c432a05acd
commit f151c8d686
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      ultralytics/nn/tasks.py

@ -279,6 +279,12 @@ class DetectionModel(BaseModel):
"""Initialize the YOLOv8 detection model with the given config and parameters."""
super().__init__()
self.yaml = cfg if isinstance(cfg, dict) else yaml_model_load(cfg) # cfg dict
if self.yaml["backbone"][0][2] == "Silence":
LOGGER.warning(
"WARNING ⚠ YOLOv9 `Silence` module is deprecated in favor of nn.Identity. "
"Please delete local *.pt file and re-download the latest model checkpoint."
)
self.yaml["backbone"][0][2] = "nn.Identity"
# Define model
ch = self.yaml["ch"] = self.yaml.get("ch", ch) # input channels

Loading…
Cancel
Save