(args)
| 129 | |
| 130 | |
| 131 | def main(args): |
| 132 | cfg = setup(args) |
| 133 | |
| 134 | if args.eval_only: |
| 135 | model = Trainer.build_model(cfg) |
| 136 | DetectionCheckpointer(model, save_dir=cfg.OUTPUT_DIR).resume_or_load( |
| 137 | cfg.MODEL.WEIGHTS, resume=args.resume |
| 138 | ) |
| 139 | res = Trainer.test(cfg, model) |
| 140 | if cfg.TEST.AUG.ENABLED: |
| 141 | res.update(Trainer.test_with_TTA(cfg, model)) |
| 142 | if comm.is_main_process(): |
| 143 | verify_results(cfg, res) |
| 144 | return res |
| 145 | |
| 146 | """ |
| 147 | If you'd like to do anything fancier than the standard training logic, |
| 148 | consider writing your own training loop (see plain_train_net.py) or |
| 149 | subclassing the trainer. |
| 150 | """ |
| 151 | trainer = Trainer(cfg) |
| 152 | trainer.resume_or_load(resume=args.resume) |
| 153 | if cfg.TEST.AUG.ENABLED: |
| 154 | trainer.register_hooks( |
| 155 | [hooks.EvalHook(0, lambda: trainer.test_with_TTA(cfg, trainer.model))] |
| 156 | ) |
| 157 | return trainer.train() |
| 158 | |
| 159 | |
| 160 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected