コード例 #1
0
DEFAULT_RESULTS_FOLDER_ARGUMENT = "Not Valid"
DEFAULT_RESULTS_FOLDER = "./results_test/"
FILES_TO_BE_SAVED = ["./", "./Torture", "./Torture/Models", "./Utils", "MI"]
KEY_ARGUMENTS = ["batch_size", "model", "data"]
config = {
    "DEFAULT_RESULTS_FOLDER": DEFAULT_RESULTS_FOLDER,
    "FILES_TO_BE_SAVED": FILES_TO_BE_SAVED,
    "KEY_ARGUMENTS": KEY_ARGUMENTS
}

flags.DEFINE_argument("-gpu", "--gpu", default="-1")
flags.DEFINE_argument("--results-folder",
                      default=DEFAULT_RESULTS_FOLDER_ARGUMENT)
flags.DEFINE_argument("-k", "-key", "--key", default="")
flags.DEFINE_argument("-data", "--data", default="cifar10")
flags.DEFINE_boolean("-o", "--overwrite-results", default=False)
flags.DEFINE_argument("-bs",
                      "-batch_size",
                      "--batch_size",
                      type=int,
                      default=50)
flags.DEFINE_argument("-nw",
                      "-num_workers",
                      "--num_workers",
                      type=int,
                      default=4)
flags.DEFINE_argument("-oldmodel", "--oldmodel", default=None)
flags.DEFINE_argument("-model", "--model", default="resnet34")
flags.DEFINE_argument("-attack", "--attack", default="cleverhans_pgd")
flags.DEFINE_boolean("-adaptive", "--adaptive", default=False)
コード例 #2
0
DEFAULT_RESULTS_FOLDER_ARGUMENT = "Not Valid"
DEFAULT_RESULTS_FOLDER = "./results/"
FILES_TO_BE_SAVED = ["./", "./Torture", "./Torture/Models", "./Utils"]
KEY_ARGUMENTS = ["batch_size", "model", "data", "adv_ratio"]
config = {
    "DEFAULT_RESULTS_FOLDER": DEFAULT_RESULTS_FOLDER,
    "FILES_TO_BE_SAVED": FILES_TO_BE_SAVED,
    "KEY_ARGUMENTS": KEY_ARGUMENTS
}

flags.DEFINE_argument("-gpu", "--gpu", default="-1")
flags.DEFINE_argument("--results-folder",
                      default=DEFAULT_RESULTS_FOLDER_ARGUMENT)
flags.DEFINE_argument("-k", "-key", "--key", default="")
flags.DEFINE_argument("-data", "--data", default="Caltech101")
flags.DEFINE_boolean("-o", "--overwrite-results", default=False)
flags.DEFINE_argument("-bs",
                      "-batch_size",
                      "--batch_size",
                      type=int,
                      default=50)
flags.DEFINE_argument("-nw",
                      "-num_workers",
                      "--num_workers",
                      type=int,
                      default=64)
flags.DEFINE_argument("-ar",
                      "-adv_ratio",
                      "--adv_ratio",
                      type=float,
                      default=0.)
コード例 #3
0
DEFAULT_RESULTS_FOLDER_ARGUMENT = "Not Valid"
DEFAULT_RESULTS_FOLDER = "~/results/"
FILES_TO_BE_SAVED = ["./", "./Torture", "./Torture/Models", "./Utils", "MI"]
KEY_ARGUMENTS = ["batch_size", "model", "data"]
config = {
    "DEFAULT_RESULTS_FOLDER": DEFAULT_RESULTS_FOLDER,
    "FILES_TO_BE_SAVED": FILES_TO_BE_SAVED,
    "KEY_ARGUMENTS": KEY_ARGUMENTS
}

flags.DEFINE_argument("-gpu", "--gpu", default="-1")
flags.DEFINE_argument("--results-folder",
                      default=DEFAULT_RESULTS_FOLDER_ARGUMENT)
flags.DEFINE_argument("-k", "-key", "--key", default="")
flags.DEFINE_argument("-data", "--data", default="cifar10")
flags.DEFINE_boolean("-o", "--overwrite-results", default=False)
flags.DEFINE_argument("-bs",
                      "-batch_size",
                      "--batch_size",
                      type=int,
                      default=50)
flags.DEFINE_argument("-nw",
                      "-num_workers",
                      "--num_workers",
                      type=int,
                      default=4)
flags.DEFINE_argument("-oldmodel", "--oldmodel", default=None)
flags.DEFINE_argument("-model", "--model", default="resnet34")
flags.DEFINE_boolean("-adaptive", "--adaptive", default=False)

flags.DEFINE_boolean("-targeted", "--targeted", default=False)
コード例 #4
0
    "gpu": "-1",
    "key": "None",
    "dataset": notValid,
    "results_folder": notValid,
    "subfolder": notValid,
}

existed_args = list(default_arguments.keys())
flags.DEFINE_argument(
    "config_file", type=str, help="Path to config file.",
)
for k in default_arguments:
    if k != "config_file":
        flags.DEFINE_argument("-" + k, "--" + k, type=str, default=default_arguments[k])

others_yml = glob.glob("./configs/*.yml") + glob.glob("./configs/*.yaml")
for yml in others_yml:
    with open(yml, "r") as f:
        newdict = yaml.load(f, Loader=yaml.FullLoader)
    for k in newdict:
        if k in existed_args:
            continue
        existed_args.append(k)
        v = newdict[k]
        if type(v) == bool:
            flags.DEFINE_boolean("-" + k, "--" + k, default=argparse.SUPPRESS)
        else:
            flags.DEFINE_argument(
                "-" + k, "--" + k, default=argparse.SUPPRESS, type=type(v)
            )