You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

dp_ada_sgd_graph_config.py 2.1 kB

4 years ago
4 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # Copyright 2020 Huawei Technologies Co., Ltd
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # ============================================================================
  15. """
  16. network config setting, will be used in train.py
  17. """
  18. from easydict import EasyDict as edict
  19. mnist_cfg = edict({
  20. 'num_classes': 10, # the number of classes of model's output
  21. 'lr': 0.001, # the learning rate of model's optimizer
  22. 'momentum': 0.9, # the momentum value of model's optimizer
  23. 'epoch_size': 20, # training epochs
  24. 'batch_size': 256, # batch size for training
  25. 'image_height': 32, # the height of training samples
  26. 'image_width': 32, # the width of training samples
  27. 'save_checkpoint_steps': 234, # the interval steps for saving checkpoint file of the model
  28. 'keep_checkpoint_max': 10, # the maximum number of checkpoint files would be saved
  29. 'device_target': 'Ascend', # device used
  30. 'data_path': '../../common/dataset/MNIST', # the path of training and testing data set
  31. 'dataset_sink_mode': False, # whether deliver all training data to device one time
  32. 'micro_batches': 16, # the number of small batches split from an original batch
  33. 'norm_bound': 1.0, # the clip bound of the gradients of model's training parameters
  34. 'initial_noise_multiplier': 0.05, # the initial multiplication coefficient of the noise added to training
  35. # parameters' gradients
  36. 'decay_policy': 'Step',
  37. 'noise_mechanisms': 'AdaGaussian', # the method of adding noise in gradients while training
  38. 'optimizer': 'SGD' # the base optimizer used for Differential privacy training
  39. })

MindArmour关注AI的安全和隐私问题。致力于增强模型的安全可信、保护用户的数据隐私。主要包含3个模块:对抗样本鲁棒性模块、Fuzz Testing模块、隐私保护与评估模块。 对抗样本鲁棒性模块 对抗样本鲁棒性模块用于评估模型对于对抗样本的鲁棒性,并提供模型增强方法用于增强模型抗对抗样本攻击的能力,提升模型鲁棒性。对抗样本鲁棒性模块包含了4个子模块:对抗样本的生成、对抗样本的检测、模型防御、攻防评估。