コード例 #1
0
    loop_config, exp_identifier, save_path = load_config(args.config, args.exp_dir)

    # Load all  networks configs
    oracle_config = get_config_from_xp(os.path.join(args.networks_dir, "oracle"), args.oracle_identifier)
    guesser_config = get_config_from_xp(os.path.join(args.networks_dir, "guesser"), args.guesser_identifier)
    qgen_config = get_config_from_xp(os.path.join(args.networks_dir, "qgen"), args.qgen_identifier)

    logger = logging.getLogger()

    ###############################
    #  LOAD DATA
    #############################

    # Load image
    logger.info('Loading images..')
    image_loader = get_img_loader(qgen_config['model']['image'], args.image_dir)
    crop_loader = None  # get_img_loader(guesser_config['model']['crop'], args.image_dir)

    # Load data
    logger.info('Loading data..')
    trainset = Dataset(args.data_dir, "train", image_loader, crop_loader)
    validset = Dataset(args.data_dir, "valid", image_loader, crop_loader)
    testset = Dataset(args.data_dir, "test", image_loader, crop_loader)

    # Load dictionary
    logger.info('Loading dictionary..')
    tokenizer = GWTokenizer(os.path.join(args.data_dir, args.dict_file))

    ###############################
    #  LOAD NETWORKS
    #############################
コード例 #2
0
                        help="No thread to load batch")

    args = parser.parse_args()

    config, exp_identifier, save_path = load_config(args.config, args.exp_dir)
    logger = logging.getLogger()

    ###############################
    #  LOAD DATA
    #############################

    # Load image
    logger.info('Loading images..')
    image_loader, crop_loader = None, None
    if config['inputs'].get('image', False):
        image_loader = get_img_loader(config['image'], args.image_dir)
    if config['inputs'].get('crop', False):
        crop_loader = get_img_loader(config['crop'],
                                     args.crop_dir,
                                     is_crop=True)

    # Load data
    logger.info('Loading data..')
    trainset = OracleDataset.load(args.data_dir, "train", image_loader,
                                  crop_loader)
    validset = OracleDataset.load(args.data_dir, "valid", image_loader,
                                  crop_loader)
    testset = OracleDataset.load(args.data_dir, "test", image_loader,
                                 crop_loader)

    # Load dictionary