"__author__": "MOCO" if k.startswith("encoder_q.") else "CLS", "matching_heuristics": True } with open(save_path, "wb") as f: pkl.dump(res, f) if __name__ == "__main__": args = train_argument_parser().parse_args() if args.num_gpus is None: args.num_gpus = torch.cuda.device_count() extra_sys_path = ".." if args.dir is None else args.dir sys.path.append(extra_sys_path) from config import config from net import build_model config.link_log() logger.info("Create soft link to {}".format(config.OUTPUT_DIR)) launch( main, args.num_gpus, num_machines=args.num_machines, machine_rank=args.machine_rank, dist_url=args.dist_url, args=(args, config, build_model), )
valid_files = get_valid_files(args, cfg, logger) # * means all if need specific format then *.csv for current_file in valid_files: cfg.MODEL.WEIGHTS = current_file model = build_model(cfg) DetectionCheckpointer(model, save_dir=cfg.OUTPUT_DIR).resume_or_load( cfg.MODEL.WEIGHTS, resume=args.resume) if cfg.TEST.AUG.ENABLED: res = Trainer.test_with_TTA(cfg, model) else: res = Trainer.test(cfg, model) if comm.is_main_process(): verify_results(cfg, res) # return res if __name__ == "__main__": args = test_argument_parser().parse_args() print("Command Line Args:", args) launch( main, args.num_gpus, num_machines=args.num_machines, machine_rank=args.machine_rank, dist_url=args.dist_url, args=(args, ), )
logger.info("{} iters in {} seconds.".format(max_iter, timer.seconds())) if __name__ == "__main__": parser = default_argument_parser() parser.add_argument("--task", choices=["train", "eval", "data"], required=True) args = parser.parse_args() assert not args.eval_only if args.task == "data": f = benchmark_data elif args.task == "train": """ Note: training speed may not be representative. The training cost of a R-CNN model varies with the content of the data and the quality of the model. """ f = benchmark_train elif args.task == "eval": f = benchmark_eval # only benchmark single-GPU inference. assert args.num_gpus == 1 and args.num_machines == 1 launch(f, args.num_gpus, args.num_machines, args.machine_rank, args.dist_url, args=(args, ))