Enable model.eval() usage for `YOLO` class (#17754)

pull/17748/head^2
Laughing 4 months ago committed by GitHub
parent 65c797a898
commit 6a762564c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 17
      ultralytics/engine/model.py

@ -1126,3 +1126,20 @@ class Model(nn.Module):
description of the expected behavior and structure.
"""
raise NotImplementedError("Please provide task map for your model!")
def eval(self):
"""
Sets the model to evaluation mode.
This method changes the model's mode to evaluation, which affects layers like dropout and batch normalization
that behave differently during training and evaluation.
Returns:
(Model): The model instance with evaluation mode set.
Examples:
>> model = YOLO("yolo11n.pt")
>> model.eval()
"""
self.model.eval()
return self

Loading…
Cancel
Save