コード例 #1
0
    args.env_name = args.env_name + "_" + now.strftime("%Y-%m-%d%H:%M:%S")

    if args.use_wandb:
        wandb = initialize_wandb(args)
        writer = SummaryWriter(os.path.join(args.logdir, args.env_name))

    pprint.pprint(vars(args))
    sys.stdout.flush()
    print("Current date and time : ")
    print(now.strftime("%Y-%m-%d %H:%M:%S"))
    print(f"Holdout dir is {holdout_dir}")

    #############################################################################
    # Load data from all the models
    all_archs, models_filter, models_lst = get_data_info(args, meta_data)
    all_data = load_data(feature_dir, meta_data, models_lst)
    if holdout_dir is not None:
        _, models_filter_holdout, models_lst_holdout = get_data_info(
            args, holdout_metadata)
        holdout_data = load_data(holdout_dir, holdout_metadata,
                                 models_lst_holdout)

    print("Dataset: ", args.dataset)
    print("Running experiments on archs: ", all_archs)

    #############################################################################
    # Create splits
    partitions = []
    for _ in range(nfolds):
        partitions.append(
            get_splits_random(models_filter, all_archs, args.test_split,
コード例 #2
0
        "densenet169",
    ]
    # models_filter = meta_data[meta_data.model_architecture.isin(all_archs)]
    models_filter = meta_data[meta_data.trigger_type.isin(trigger_type)]
    models_lst = models_filter.model_name.to_list()
    print("Running experiments on", all_archs)

    partitions = []
    for _ in range(nfolds):
        partitions.append(
            get_spits(models_filter, all_archs, args.test_split, args.val_split)
        )

    #############################################################################
    # Load data from all the models
    all_data = load_data(feature_dir, meta_data, models_lst)

    #############################################################################
    # Setup Cross-validation and model
    np.random.seed(0)
    auc_all = []
    scores_all = {}

    # Trainer and model
    # specify loss function
    """
    device = check_for_cuda()
    model = TrojNet()
    model.to(device)
    criterion = nn.CrossEntropyLoss()
    # specify optimizer