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>
This commit is contained in:
Burhan 2024-06-19 10:42:54 -04:00 committed by GitHub
parent c432a05acd
commit f151c8d686
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -279,6 +279,12 @@ class DetectionModel(BaseModel):
"""Initialize the YOLOv8 detection model with the given config and parameters.""" """Initialize the YOLOv8 detection model with the given config and parameters."""
super().__init__() super().__init__()
self.yaml = cfg if isinstance(cfg, dict) else yaml_model_load(cfg) # cfg dict 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 # Define model
ch = self.yaml["ch"] = self.yaml.get("ch", ch) # input channels ch = self.yaml["ch"] = self.yaml.get("ch", ch) # input channels