コード例 #1
0
ファイル: main.py プロジェクト: mmalk03/RAVEN
def main():
    main_arg_parser = argparse.ArgumentParser(description="parser for RAVEN")
    main_arg_parser.add_argument(
        "--num-samples",
        type=int,
        default=20000,
        help="number of samples for each component configuration")
    main_arg_parser.add_argument(
        "--save-dir",
        type=str,
        default="~/Datasets/",
        help="path to folder where the generated dataset will be saved.")
    main_arg_parser.add_argument("--seed",
                                 type=int,
                                 default=1234,
                                 help="random seed for dataset generation")
    main_arg_parser.add_argument(
        "--fuse",
        type=int,
        default=0,
        help="whether to fuse different configurations")
    main_arg_parser.add_argument(
        "--val",
        type=float,
        default=2,
        help="the proportion of the size of validation set")
    main_arg_parser.add_argument("--test",
                                 type=float,
                                 default=2,
                                 help="the proportion of the size of test set")
    args = main_arg_parser.parse_args()

    all_configs = {
        "center_single":
        build_center_single(),
        "distribute_four":
        build_distribute_four(),
        "distribute_nine":
        build_distribute_nine(),
        "left_center_single_right_center_single":
        build_left_center_single_right_center_single(),
        "up_center_single_down_center_single":
        build_up_center_single_down_center_single(),
        "in_center_single_out_center_single":
        build_in_center_single_out_center_single(),
        "in_distribute_four_out_center_single":
        build_in_distribute_four_out_center_single()
    }

    if not os.path.exists(args.save_dir):
        os.mkdir(args.save_dir)
    if args.fuse:
        if not os.path.exists(os.path.join(args.save_dir, "fuse")):
            os.mkdir(os.path.join(args.save_dir, "fuse"))
        fuse(args, all_configs)
    else:
        for key in all_configs.keys():
            if not os.path.exists(os.path.join(args.save_dir, key)):
                os.mkdir(os.path.join(args.save_dir, key))
        separate(args, all_configs)
コード例 #2
0
def main():
    main_arg_parser = argparse.ArgumentParser(description="parser for RAVEN")
    main_arg_parser.add_argument("--num-samples", type=int, default=10000,
                                 help="number of samples for each component configuration")
    main_arg_parser.add_argument("--save-dir", type=str, default="./Datasets",
                                 help="path to folder where the generated dataset will be saved.")
    main_arg_parser.add_argument("--seed", type=int, default=1234,
                                 help="random seed for dataset generation")
    main_arg_parser.add_argument("--fair", type=int, default=0,
                                 help="whether to create FAIR or ORIG dataset")
    main_arg_parser.add_argument("--val", type=float, default=2,
                                 help="the proportion of the size of validation set")
    main_arg_parser.add_argument("--test", type=float, default=2,
                                 help="the proportion of the size of test set")
    main_arg_parser.add_argument("--save", type=int, default=1,
                                 help="save the dataset")
    args = main_arg_parser.parse_args()

    args.save_dir = os.path.join(args.save_dir, 'RAVEN' + ('-F' if args.fair else ''))

    all_configs = {"center_single": build_center_single(),
                   "distribute_four": build_distribute_four(),
                   "distribute_nine": build_distribute_nine(),
                   "left_center_single_right_center_single": build_left_center_single_right_center_single(),
                   "up_center_single_down_center_single": build_up_center_single_down_center_single(),
                   "in_center_single_out_center_single": build_in_center_single_out_center_single(),
                   "in_distribute_four_out_center_single": build_in_distribute_four_out_center_single()}

    separate(args, all_configs)