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.

lenet5_config.py 2.6 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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.01, # the learning rate of model's optimizer
  22. 'momentum': 0.9, # the momentum value of model's optimizer
  23. 'epoch_size': 10, # 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': 32, # 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.4, # the initial multiplication coefficient of the noise added to training
  35. # parameters' gradients
  36. 'noise_mechanisms': 'Gaussian', # the method of adding noise in gradients while training
  37. 'clip_mechanisms': 'Gaussian', # the method of adaptive clipping gradients while training
  38. 'clip_decay_policy': 'Linear', # Decay policy of adaptive clipping, decay_policy must be in ['Linear', 'Geometric'].
  39. 'clip_learning_rate': 0.001, # Learning rate of update norm clip.
  40. 'target_unclipped_quantile': 0.9, # Target quantile of norm clip.
  41. 'fraction_stddev': 0.01, # The stddev of Gaussian normal which used in empirical_fraction.
  42. 'optimizer': 'Momentum', # the base optimizer used for Differential privacy training
  43. 'target_delta': 1e-5 # the target delta budget for DP training
  44. })

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