Skip to content

Commit

Permalink
validate api transfer to hook
Browse files Browse the repository at this point in the history
  • Loading branch information
OceanPang committed Oct 1, 2018
1 parent c20c2c8 commit 2d34ceb
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions tools/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,6 @@ def main():
runner = Runner(model, batch_processor, cfg.optimizer, cfg.work_dir,
cfg.log_level)

if args.validate:
val_dataset = obj_from_dict(cfg.data.test, datasets)
data_loaders.append(
build_dataloader(val_dataset, cfg.data.imgs_per_gpu,
cfg.data.workers_per_gpu, cfg.gpus, dist))

# register hooks
optimizer_config = DistOptimizerHook(
**cfg.optimizer_config) if dist else cfg.optimizer_config
Expand All @@ -148,10 +142,11 @@ def main():
if dist:
runner.register_hook(DistSamplerSeedHook())
# register eval hooks
if isinstance(model.module, RPN):
runner.register_hook(CocoDistEvalRecallHook(cfg.data.val))
elif cfg.data.val.type == 'CocoDataset':
runner.register_hook(CocoDistEvalmAPHook(cfg.data.val))
if args.validate:
if isinstance(model.module, RPN):
runner.register_hook(CocoDistEvalRecallHook(cfg.data.val))
elif cfg.data.val.type == 'CocoDataset':
runner.register_hook(CocoDistEvalmAPHook(cfg.data.val))

if cfg.resume_from:
runner.resume(cfg.resume_from)
Expand Down

0 comments on commit 2d34ceb

Please sign in to comment.