Commit 3aab66f1 authored by Yuxin Wu's avatar Yuxin Wu

[MaskRCNN] fix evaluation period

parent e943200b
......@@ -114,7 +114,7 @@ _C.TRAIN.STEPS_PER_EPOCH = 500
# Therefore, there is *no need* to modify the config if you only change the number of GPUs.
# LR_SCHEDULE = [120000, 160000, 180000] # "1x" schedule in detectron
_C.TRAIN.LR_SCHEDULE = [240000, 320000, 360000] # "2x" schedule in detectron
_C.TRAIN.NUM_EVALS = 20 # number of evaluations to run during training
_C.TRAIN.EVAL_PERIOD = 25 # period (epochs) to run eva
# preprocessing --------------------
# Alternative old (worse & faster) setting: 600, 1024
......
......@@ -430,14 +430,14 @@ class EvalCallback(Callback):
return lambda img: detect_one_image(img, graph_func)
def _before_train(self):
num_eval = cfg.TRAIN.NUM_EVALS
interval = max(self.trainer.max_epoch // (num_eval + 1), 1)
self.epochs_to_eval = set([interval * k for k in range(1, num_eval + 1)])
eval_period = cfg.TRAIN.EVAL_PERIOD
self.epochs_to_eval = set()
for k in itertools.count(1):
if k * eval_period > self.trainer.max_epoch:
break
self.epochs_to_eval.add(k * eval_period)
self.epochs_to_eval.add(self.trainer.max_epoch)
if len(self.epochs_to_eval) < 15:
logger.info("[EvalCallback] Will evaluate at epoch " + str(sorted(self.epochs_to_eval)))
else:
logger.info("[EvalCallback] Will evaluate every {} epochs".format(interval))
logger.info("[EvalCallback] Will evaluate every {} epochs".format(eval_period))
def _eval(self):
logdir = args.logdir
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment