class TrainingConfig(TrainingConfigBase): abs_current_path = os.path.realpath('./') root_path = os.path.join('/', *abs_current_path.split(os.path.sep)[:-3]) lib_dir = os.path.join(root_path, 'lib') num_epochs = 105 eval_interval = 15 weight_decay = 5e-4 inner_iters = 3 K = 5 sigma = 2 / 255.0 eps = 8 / 255.0 create_optimizer = SGDOptimizerMaker(lr=1e-1 * 2 / K, momentum=0.9, weight_decay=5e-4) create_lr_scheduler = PieceWiseConstantLrSchedulerMaker( milestones=[55, 75, 95], gamma=0.1) create_loss_function = torch.nn.CrossEntropyLoss create_attack_method = None create_evaluation_attack_method = \ IPGDAttackMethodMaker(eps=8 / 255.0, sigma=2 / 255.0, nb_iters=20, norm=np.inf, mean=torch.tensor( np.array([0]).astype(np.float32)[np.newaxis, :, np.newaxis, np.newaxis]), std=torch.tensor(np.array([1]).astype(np.float32)[np.newaxis, :, np.newaxis, np.newaxis]))
class TrainingConfing(TrainingConfigBase): lib_dir = lib_dir num_epochs = 40 val_interval = 0 weight_decay = 5e-4 inner_iters = 10 K = 5 sigma = 0.01 eps = 0.3 create_optimizer = SGDOptimizerMaker(lr =1e-2 / K, momentum = 0.9, weight_decay = weight_decay) create_lr_scheduler = PieceWiseConstantLrSchedulerMaker(milestones = [30, 35, 39], gamma = 0.1) create_loss_function = None create_attack_method = None create_evaluation_attack_method = \ IPGDAttackMethodMaker(eps = 0.3, sigma = 0.01, nb_iters = 40, norm = np.inf, mean=torch.tensor( np.array([0]).astype(np.float32)[np.newaxis, :, np.newaxis, np.newaxis]), std=torch.tensor(np.array([1]).astype(np.float32)[np.newaxis, :, np.newaxis, np.newaxis]))
class TrainingConfing(TrainingConfigBase): lib_dir = lib_dir num_epochs = 36 val_interval = 0 weight_decay = 5e-4 inner_iters = 3 K = 5 sigma = 2 / 255.0 eps = 8 / 255.0 create_optimizer = SGDOptimizerMaker(lr=1e-1 * 4 / K, momentum=0.9, weight_decay=5e-4) create_lr_scheduler = PieceWiseConstantLrSchedulerMaker( milestones=[30, 34, 36], gamma=0.1) create_loss_function = torch.nn.CrossEntropyLoss #create_attack_method = \ # IPGDAttackMethodMaker(eps = 8/255.0, sigma = 2/255.0, nb_iters = 10, norm = np.inf, # mean = torch.tensor(np.array([0]).astype(np.float32)[np.newaxis, :, np.newaxis, np.newaxis]), # std = torch.tensor(np.array([1]).astype(np.float32)[np.newaxis, :, np.newaxis, np.newaxis])) create_attack_method = None create_evaluation_attack_method = \ IPGDAttackMethodMaker(eps = 8/255.0, sigma = 2/255.0, nb_iters = 20, norm = np.inf, mean=torch.tensor( np.array([0]).astype(np.float32)[np.newaxis, :, np.newaxis, np.newaxis]), std=torch.tensor(np.array([1]).astype(np.float32)[np.newaxis, :, np.newaxis, np.newaxis]))