From f151c8d6867d618ecd3ebc36d47f6df645a8cc24 Mon Sep 17 00:00:00 2001 From: Burhan <62214284+Burhan-Q@users.noreply.github.com> Date: Wed, 19 Jun 2024 10:42:54 -0400 Subject: [PATCH] Deprecate `Silence` module in favor of `nn.Identity` (#13785) Co-authored-by: UltralyticsAssistant Co-authored-by: Glenn Jocher Co-authored-by: Laughing-q <1185102784@qq.com> --- ultralytics/nn/tasks.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ultralytics/nn/tasks.py b/ultralytics/nn/tasks.py index cd4c790d..cdd0b007 100644 --- a/ultralytics/nn/tasks.py +++ b/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