Exemplo n.º 1
0
def main():
    print('begin program\n')
    args = parse_args()

    # load the configuration
    # import on-the-fly to avoid overwriting cfg
    from partnet.config.ins_seg_3d import cfg
    cfg.merge_from_file(args.config_file)
    cfg.merge_from_list(args.opts)
    purge_cfg(cfg)
    cfg.freeze()

    output_dir = cfg.OUTPUT_DIR
    # replace '@' with config path
    if output_dir:
        config_path = osp.splitext(args.config_file)[0]
        config_path = config_path.replace('configs', 'outputs')
        output_dir_merge = output_dir.replace('@', config_path)+'_merge'
        os.makedirs(output_dir_merge, exist_ok=True)
        output_dir = osp.join('outputs/stage1/', cfg.DATASET.PartNetInsSeg.TRAIN.stage1)
        os.makedirs(output_dir, exist_ok=True)

    logger = setup_logger('shaper', output_dir_merge, prefix='train')
    logger.info('Using {} GPUs'.format(torch.cuda.device_count()))
    logger.info(args)


    logger.info('Loaded configuration file {}'.format(args.config_file))
    logger.info('Running with config:\n{}'.format(cfg))

    assert cfg.TASK == 'ins_seg_3d'
    train(cfg, output_dir, output_dir_merge)
Exemplo n.º 2
0
def main():
    args = parse_args()

    from partnet.config.ins_seg_3d import cfg
    cfg.merge_from_file(args.config_file)
    cfg.merge_from_list(args.opts)
    purge_cfg(cfg)
    cfg.freeze()

    output_dir = cfg.OUTPUT_DIR
    # Replace '@' with config path
    if output_dir:
        config_path = osp.splitext(args.config_file)[0]
        config_path = config_path.replace('configs', 'outputs')
        output_dir_merge = 'outputs/pn_stage2_fusion_l%d_merge' % cfg.TEST.LEVEL
        os.makedirs(output_dir_merge, exist_ok=True)
        output_dir = osp.join('outputs/stage1/',
                              cfg.DATASET.PartNetInsSeg.TRAIN.stage1)
        output_dir_save = './results/' + cfg.DATASET.PartNetInsSeg.TEST.shape
        os.makedirs(output_dir_save, exist_ok=True)
        output_dir_save = osp.join(output_dir_save,
                                   'Level_%d' % cfg.TEST.LEVEL)
        os.makedirs(output_dir_save, exist_ok=True)
        os.makedirs(output_dir, exist_ok=True)

    logger = setup_logger('shaper', output_dir_save, prefix='test')
    logger.info('Using {} GPUs'.format(torch.cuda.device_count()))
    logger.info(args)
    logger.info('Loaded configuration file {}'.format(args.config_file))
    logger.info('Running with config:\n{}'.format(cfg))

    assert cfg.TASK == 'ins_seg_3d'
    test(cfg, output_dir, output_dir_merge, output_dir_save)
Exemplo n.º 3
0
def main():
    args = parse_args()

    # load the configuration
    # import on-the-fly to avoid overwriting cfg
    from shaper.config.classification import cfg
    cfg.merge_from_file(args.config_file)
    cfg.merge_from_list(args.opts)
    purge_cfg(cfg)
    cfg.freeze()

    output_dir = cfg.OUTPUT_DIR
    # replace '@' with config path
    if output_dir:
        config_path = osp.splitext(args.config_file)[0]
        config_path = config_path.replace('configs', 'outputs')
        output_dir = output_dir.replace('@', config_path)
        os.makedirs(output_dir, exist_ok=True)

    logger = setup_logger('shaper', output_dir, prefix='train')
    logger.info('Using {} GPUs'.format(torch.cuda.device_count()))
    logger.info(args)

    from core.utils.torch_util import collect_env_info
    logger.info('Collecting env info (might take some time)\n' +
                collect_env_info())

    logger.info('Loaded configuration file {}'.format(args.config_file))
    logger.info('Running with config:\n{}'.format(cfg))

    assert cfg.TASK == 'classification'
    train(cfg, output_dir)