def main():
    args = parse_args()
    cfg = Config.fromfile(args.config)
    if cfg.get('cudnn_benchmark', False):
        torch.backends.cudnn.benchmark = True
    if (args.work_dir is not None):
        cfg.work_dir = args.work_dir
    if (args.resume_from is not None):
        cfg.resume_from = args.resume_from
    cfg.gpus = args.gpus
    if args.autoscale_lr:
        cfg.optimizer['lr'] = ((cfg.optimizer['lr'] * cfg.gpus) / 8)
    if (args.launcher == 'none'):
        distributed = False
    else:
        distributed = True
        init_dist(args.launcher, **cfg.dist_params)
    logger = get_root_logger(cfg.log_level)
    logger.info('Distributed training: {}'.format(distributed))
    if (args.seed is not None):
        logger.info('Set random seed to {}'.format(args.seed))
        set_random_seed(args.seed)
    model = build_detector(cfg.model, train_cfg=cfg.train_cfg, test_cfg=cfg.test_cfg)
    train_dataset = build_dataset(cfg.data.train)
    if (cfg.checkpoint_config is not None):
        cfg.checkpoint_config.meta = dict(mmdet_version=__version__, config=cfg.text, CLASSES=train_dataset.CLASSES)
    model.CLASSES = train_dataset.CLASSES
    train_detector(model, train_dataset, cfg, distributed=distributed, validate=args.validate, logger=logger)
def main():
    args = parse_args()
    cfg = Config.fromfile(args.config)
    if cfg.get('cudnn_benchmark', False):
        torch.backends.cudnn.benchmark = True
    if (args.work_dir is not None):
        cfg.work_dir = args.work_dir
    if (args.resume_from is not None):
        cfg.resume_from = args.resume_from
    cfg.gpus = args.gpus
    if args.autoscale_lr:
        cfg.optimizer['lr'] = ((cfg.optimizer['lr'] * cfg.gpus) / 8)
    if (args.launcher == 'none'):
        distributed = False
    else:
        distributed = True
        init_dist(args.launcher, **cfg.dist_params)
    logger = get_root_logger(cfg.log_level)
    logger.info('Distributed training: {}'.format(distributed))
    if (args.seed is not None):
        logger.info('Set random seed to {}'.format(args.seed))
        set_random_seed(args.seed)
    model = build_detector(cfg.model, train_cfg=cfg.train_cfg, test_cfg=cfg.test_cfg)
    train_dataset = build_dataset(cfg.data.train)
    if (cfg.checkpoint_config is not None):
        cfg.checkpoint_config.meta = dict(mmdet_version=__version__, config=cfg.text, CLASSES=train_dataset.CLASSES)
    model.CLASSES = train_dataset.CLASSES
    train_detector(model, train_dataset, cfg, distributed=distributed, validate=args.validate, logger=logger)