Ejemplo n.º 1
0
    def bt(self, loader='test_loader'):
        print("Benign training")
        self.args['robust_training'] = False

        ac = AdversarialCompression(self.args)
        model = ac.get_full_model()
        ac.print_metrics(model, loader=loader, unmask_metrics=True)
Ejemplo n.º 2
0
    def gtc(self, loader='test_loader'):
        # no adversarial robustness
        self.args['robust_training'] = False
        self.args['orthogonality'] = False
        self.args['spectral_normalization'] = False
        self.args['ortho_lambda'] = 0

        # some noise corruption
        self.args['gaussian_training'] = True
        assert self.args['train_corruption_strength'] in [1, 2, 3, 4, 5]

        # assert some compression
        assert self.args['gamma_lambda'] != 0

        # no noise removal
        self.args['noise_removal'] = False

        ac = AdversarialCompression(self.args)
        model = ac.get_small_model()
        ac.print_metrics(model, type='small', loader=loader)
Ejemplo n.º 3
0
    def atc(self):
        # only adversarial robustness
        self.args['robust_training'] = True
        self.args['orthogonality'] = False
        self.args['spectral_normalization'] = False
        self.args['ortho_lambda'] = 0

        # no noise corruption
        self.args['gaussian_training'] = False
        self.args['train_corruption_strength'] = 1
        self.args['test_corruption'] = 'none'
        self.args['test_corruption_strength'] = 1

        # assert some compression
        assert self.args['gamma_lambda'] != 0

        # no noise removal
        self.args['noise_removal'] = False

        ac = AdversarialCompression(self.args)
        model = ac.get_small_model()
        ac.print_metrics(model, type='small')
Ejemplo n.º 4
0
    def at(self, loader='test_loader'):
        # no adversarial robustness
        self.args['robust_training'] = True
        self.args['orthogonality'] = False
        self.args['spectral_normalization'] = False
        self.args['ortho_lambda'] = 0

        # no noise corruption
        self.args['gaussian_training'] = False
        self.args['train_corruption_strength'] = 1
        self.args['test_corruption'] = 'none'
        self.args['test_corruption_strength'] = 1

        # no compression
        self.args['gamma_lambda'] = 0

        # no noise removal
        self.args['noise_removal'] = False

        ac = AdversarialCompression(self.args)
        model = ac.get_full_model()
        ac.print_metrics(model,loader=loader)
Ejemplo n.º 5
0
 def train(self, loader='test_loader'):
     ac = AdversarialCompression(self.args)
     model = ac.get_full_model()
     ac.print_metrics(model, loader=loader, unmask_metrics=False)