diff --git a/ultralytics/nn/tasks.py b/ultralytics/nn/tasks.py index 68d4ee65..a30094c9 100644 --- a/ultralytics/nn/tasks.py +++ b/ultralytics/nn/tasks.py @@ -379,7 +379,7 @@ class DetectionModel(BaseModel): def init_criterion(self): """Initialize the loss criterion for the DetectionModel.""" - return E2EDetectLoss(self) if self.end2end else v8DetectionLoss(self) + return E2EDetectLoss(self) if getattr(self, "end2end", False) else v8DetectionLoss(self) class OBBModel(DetectionModel):