imdb = lib.datasets.imdb.imdb(imdb_names, tmp.classes)
    else:
        imdb = get_imdb(imdb_names)
    return imdb, roidb


if __name__ == '__main__':
    args = parse_args()

    print('Called with args:')
    print(args)

    if args.cfg_file is not None:
        cfg_from_file(args.cfg_file)
    if args.set_cfgs is not None:
        cfg_from_list(args.set_cfgs)

    print('Using config:')
    pprint.pprint(cfg)

    np.random.seed(cfg.RNG_SEED)

    # train set
    imdb, roidb = combined_roidb(args.imdb_name)
    print('{:d} roidb entries'.format(len(roidb)))

    # output directory where the models are saved
    output_dir = get_output_dir(imdb, args.tag)
    print('Output will be saved to `{:s}`'.format(output_dir))

    # tensorboard directory where the summaries are saved during training
示例#2
0
    train_datset_name = args.train_dataset_name  # 测试数据集名称
    val_dataset_name = args.val_dataset_name  # 验证数据集名称
    set_cfgs = [
        'ANCHOR_SCALES',
        '[8,16,32]',
        'ANCHOR_RATIOS',
        '[0.5,1,2]',
        'TRAIN.STEPSIZE',
        '[50000]',
    ]
    project_path = os.path.abspath('.')
    pre_train_weight = project_path + "/data/pre_train_weight/" + arg_net + ".ckpt"

    cfg_from_file(project_path + "/experiments/cfgs/" + arg_net +
                  ".yml")  #载入参数配置
    cfg_from_list(set_cfgs)  #修改参数配置
    print('Using config:')
    pprint.pprint(cfg)

    # roidb:所有训练图片的gt_boxes
    # imdb:训练数据集的相关信息:包括类别列表,所有的图片名称的索引,数据集名称等等
    imdb, roidb = combined_roidb("gridsum_car_train")
    print(roidb[0]['boxes'])
    print(roidb[0])
    print('{:d} roidb entries'.format(len(roidb)))
    # output directory where the models are saved
    output_dir = get_output_dir(imdb, "")
    print('Output will be saved to `{:s}`'.format(output_dir))
    # tensorboard directory where the summaries are saved during training
    tb_dir = get_output_tb_dir(imdb, "")
    # 同样的方法载入val数据集