Skip to content

Commit 5c5b1cf

Browse files
committed
add get early stopping method
1 parent 382bfcf commit 5c5b1cf

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

yolox/core/trainer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def __init__(self, exp: Exp, args):
7676
# before_train methods.
7777
self.exp = exp
7878
self.args = args
79+
self.early_stopper = None
7980

8081
# training related attr
8182
self.max_epoch = exp.max_epoch

yolox/exp/yolox_base.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,11 @@ def get_trainer(self, args):
349349
# NOTE: trainer shouldn't be an attribute of exp object
350350
return trainer
351351

352+
def get_early_stopping(self, patience, min_delta, mode):
353+
from yolox.core import EarlyStopping
354+
355+
return EarlyStopping(patience=patience, min_delta=min_delta, mode=mode)
356+
352357
def eval(self, model, evaluator, is_distributed, half=False, return_outputs=False):
353358
return evaluator.evaluate(model, is_distributed, half, return_outputs=return_outputs)
354359

0 commit comments

Comments
 (0)