@@ -0,0 +1,2 @@ | |||
https://mindspore.cn/mindarmour/*/r1.8/* | |||
https://www.mindspore.cn/*/r1.8/* |
@@ -75,7 +75,7 @@ The architecture is shown as follow: | |||
- The hardware platform should be Ascend, GPU or CPU. | |||
- See our [MindSpore Installation Guide](https://www.mindspore.cn/install) to install MindSpore. | |||
The versions of MindArmour and MindSpore must be consistent. | |||
- All other dependencies are included in [setup.py](https://gitee.com/mindspore/mindarmour/blob/master/setup.py). | |||
- All other dependencies are included in [setup.py](https://gitee.com/mindspore/mindarmour/blob/r1.8/setup.py). | |||
### Installation | |||
@@ -100,7 +100,7 @@ The architecture is shown as follow: | |||
pip install https://ms-release.obs.cn-north-4.myhuaweicloud.com/{version}/MindArmour/{arch}/mindarmour-{version}-cp37-cp37m-linux_{arch}.whl --trusted-host ms-release.obs.cn-north-4.myhuaweicloud.com -i https://pypi.tuna.tsinghua.edu.cn/simple | |||
``` | |||
> - When the network is connected, dependency items are automatically downloaded during .whl package installation. (For details about other dependency items, see [setup.py](https://gitee.com/mindspore/mindarmour/blob/master/setup.py)). In other cases, you need to manually install dependency items. | |||
> - When the network is connected, dependency items are automatically downloaded during .whl package installation. (For details about other dependency items, see [setup.py](https://gitee.com/mindspore/mindarmour/blob/r1.8/setup.py)). In other cases, you need to manually install dependency items. | |||
> - `{version}` denotes the version of MindArmour. For example, when you are downloading MindArmour 1.0.1, `{version}` should be 1.0.1. | |||
> - `{arch}` denotes the system architecture. For example, the Linux system you are using is x86 architecture 64-bit, `{arch}` should be `x86_64`. If the system is ARM architecture 64-bit, then it should be `aarch64`. | |||
@@ -72,7 +72,7 @@ Fuzz Testing模块的架构图如下: | |||
- 硬件平台为Ascend、GPU或CPU。 | |||
- 参考[MindSpore安装指南](https://www.mindspore.cn/install),完成MindSpore的安装。 | |||
MindArmour与MindSpore的版本需保持一致。 | |||
- 其余依赖请参见[setup.py](https://gitee.com/mindspore/mindarmour/blob/master/setup.py)。 | |||
- 其余依赖请参见[setup.py](https://gitee.com/mindspore/mindarmour/blob/r1.8/setup.py)。 | |||
### 安装 | |||
@@ -97,7 +97,7 @@ Fuzz Testing模块的架构图如下: | |||
pip install https://ms-release.obs.cn-north-4.myhuaweicloud.com/{version}/MindArmour/{arch}/mindarmour-{version}-cp37-cp37m-linux_{arch}.whl --trusted-host ms-release.obs.cn-north-4.myhuaweicloud.com -i https://pypi.tuna.tsinghua.edu.cn/simple | |||
``` | |||
> - 在联网状态下,安装whl包时会自动下载MindArmour安装包的依赖项(依赖项详情参见[setup.py](https://gitee.com/mindspore/mindarmour/blob/master/setup.py)),其余情况需自行安装。 | |||
> - 在联网状态下,安装whl包时会自动下载MindArmour安装包的依赖项(依赖项详情参见[setup.py](https://gitee.com/mindspore/mindarmour/blob/r1.8/setup.py)),其余情况需自行安装。 | |||
> - `{version}`表示MindArmour版本号,例如下载1.0.1版本MindArmour时,`{version}`应写为1.0.1。 | |||
> - `{arch}`表示系统架构,例如使用的Linux系统是x86架构64位时,`{arch}`应写为`x86_64`。如果系统是ARM架构64位,则写为`aarch64`。 | |||
@@ -88,7 +88,7 @@ mindarmour.privacy.diff_privacy | |||
噪声产生机制的工厂类。它目前支持高斯随机噪声(Gaussian Random Noise)和自适应高斯随机噪声(Adaptive Gaussian Random Noise)。 | |||
详情请查看: `教程 <https://mindspore.cn/mindarmour/docs/zh-CN/master/protect_user_privacy_with_differential_privacy.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_。 | |||
详情请查看: `教程 <https://mindspore.cn/mindarmour/docs/zh-CN/r1.8/protect_user_privacy_with_differential_privacy.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_。 | |||
.. py:method:: create(mech_name, norm_bound=1.0, initial_noise_multiplier=1.0, seed=0, noise_decay_rate=6e-6, decay_policy=None) | |||
@@ -113,7 +113,7 @@ mindarmour.privacy.diff_privacy | |||
梯度剪裁机制的工厂类。它目前支持高斯随机噪声(Gaussian Random Noise)的自适应剪裁(Adaptive Clipping)。 | |||
详情请查看: `教程 <https://mindspore.cn/mindarmour/docs/zh-CN/master/protect_user_privacy_with_differential_privacy.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_。 | |||
详情请查看: `教程 <https://mindspore.cn/mindarmour/docs/zh-CN/r1.8/protect_user_privacy_with_differential_privacy.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_。 | |||
.. py:method:: create(mech_name, decay_policy='Linear', learning_rate=0.001, target_unclipped_quantile=0.9, fraction_stddev=0.01, seed=0) | |||
@@ -138,7 +138,7 @@ mindarmour.privacy.diff_privacy | |||
DP训练隐私监视器的工厂类。 | |||
详情请查看: `教程 <https://mindspore.cn/mindarmour/docs/zh-CN/master/protect_user_privacy_with_differential_privacy.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_。 | |||
详情请查看: `教程 <https://mindspore.cn/mindarmour/docs/zh-CN/r1.8/protect_user_privacy_with_differential_privacy.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_。 | |||
.. py:method:: create(policy, *args, **kwargs) | |||
@@ -163,7 +163,7 @@ mindarmour.privacy.diff_privacy | |||
.. math:: | |||
(ε'+\frac{log(1/δ)}{α-1}, δ) | |||
详情请查看: `教程 <https://mindspore.cn/mindarmour/docs/zh-CN/master/protect_user_privacy_with_differential_privacy.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_。 | |||
详情请查看: `教程 <https://mindspore.cn/mindarmour/docs/zh-CN/r1.8/protect_user_privacy_with_differential_privacy.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_。 | |||
参考文献: `Rényi Differential Privacy of the Sampled Gaussian Mechanism <https://arxiv.org/abs/1908.10530>`_。 | |||
@@ -207,7 +207,7 @@ mindarmour.privacy.diff_privacy | |||
注意,ZCDPMonitor不适合子采样噪声机制(如NoiseAdaGaussianRandom和NoiseGaussianRandom)。未来将开发zCDP的匹配噪声机制。 | |||
详情请查看: `教程 <https://mindspore.cn/mindarmour/docs/zh-CN/master/protect_user_privacy_with_differential_privacy.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_。 | |||
详情请查看: `教程 <https://mindspore.cn/mindarmour/docs/zh-CN/r1.8/protect_user_privacy_with_differential_privacy.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_。 | |||
参考文献:`Concentrated Differentially Private Gradient Descent with Adaptive per-Iteration Privacy Budget <https://arxiv.org/abs/1808.09501>`_。 | |||
@@ -277,7 +277,7 @@ mindarmour.privacy.diff_privacy | |||
这个类重载自Mindpore.train.model.Model。 | |||
详情请查看: `教程 <https://mindspore.cn/mindarmour/docs/zh-CN/master/protect_user_privacy_with_differential_privacy.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_。 | |||
详情请查看: `教程 <https://mindspore.cn/mindarmour/docs/zh-CN/r1.8/protect_user_privacy_with_differential_privacy.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_。 | |||
**参数:** | |||
@@ -8,7 +8,7 @@ mindarmour.privacy.evaluation | |||
成员推理是由Shokri、Stronati、Song和Shmatikov提出的一种用于推断用户隐私数据的灰盒攻击。它需要训练样本的loss或logits结果。 | |||
(隐私是指单个用户的一些敏感属性)。 | |||
有关详细信息,请参见: `教程 <https://mindspore.cn/mindarmour/docs/en/master/test_model_security_membership_inference.html>`_。 | |||
有关详细信息,请参见: `教程 <https://mindspore.cn/mindarmour/docs/en/r1.8/test_model_security_membership_inference.html>`_。 | |||
参考文献:`Reza Shokri, Marco Stronati, Congzheng Song, Vitaly Shmatikov. Membership Inference Attacks against Machine Learning Models. 2017. <https://arxiv.org/abs/1610.05820v2>`_。 | |||
@@ -8,7 +8,7 @@ mindarmour.privacy.sup_privacy | |||
周期性检查抑制隐私功能状态和切换(启动/关闭)抑制操作。 | |||
详情请查看: `应用抑制隐私机制保护用户隐私 | |||
<https://mindspore.cn/mindarmour/docs/zh-CN/master/protect_user_privacy_with_suppress_privacy.html#%E5%BC%95%E5%85%A5%E6%8A%91%E5%88%B6%E9%9A%90%E7%A7%81%E8%AE%AD%E7%BB%83>`_。 | |||
<https://mindspore.cn/mindarmour/docs/zh-CN/r1.8/protect_user_privacy_with_suppress_privacy.html#%E5%BC%95%E5%85%A5%E6%8A%91%E5%88%B6%E9%9A%90%E7%A7%81%E8%AE%AD%E7%BB%83>`_。 | |||
**参数:** | |||
@@ -27,7 +27,7 @@ mindarmour.privacy.sup_privacy | |||
完整的模型训练功能。抑制隐私函数嵌入到重载的mindspore.train.model.Model中。 | |||
有关详细信息,请查看: `应用抑制隐私机制保护用户隐私 <https://mindspore.cn/mindarmour/docs/zh-CN/master/protect_user_privacy_with_suppress_privacy.html>`_。 | |||
有关详细信息,请查看: `应用抑制隐私机制保护用户隐私 <https://mindspore.cn/mindarmour/docs/zh-CN/r1.8/protect_user_privacy_with_suppress_privacy.html>`_。 | |||
**参数:** | |||
@@ -48,7 +48,7 @@ mindarmour.privacy.sup_privacy | |||
SuppressCtrl机制的工厂类。 | |||
详情请查看: `应用抑制隐私机制保护用户隐私 <https://mindspore.cn/mindarmour/docs/zh-CN/master/protect_user_privacy_with_suppress_privacy.html#%E5%BC%95%E5%85%A5%E6%8A%91%E5%88%B6%E9%9A%90%E7%A7%81%E8%AE%AD%E7%BB%83>`_。 | |||
详情请查看: `应用抑制隐私机制保护用户隐私 <https://mindspore.cn/mindarmour/docs/zh-CN/r1.8/protect_user_privacy_with_suppress_privacy.html#%E5%BC%95%E5%85%A5%E6%8A%91%E5%88%B6%E9%9A%90%E7%A7%81%E8%AE%AD%E7%BB%83>`_。 | |||
.. py:method:: create(networks, mask_layers, policy='local_train', end_epoch=10, batch_num=20, start_epoch=3, mask_times=1000, lr=0.05, sparse_end=0.90, sparse_start=0.0) | |||
@@ -73,7 +73,7 @@ mindarmour.privacy.sup_privacy | |||
完成抑制隐私操作,包括计算抑制比例,找到应该抑制的参数,并永久抑制这些参数。 | |||
详情请查看: `应用抑制隐私机制保护用户隐私 <https://mindspore.cn/mindarmour/docs/zh-CN/master/protect_user_privacy_with_suppress_privacy.html#%E5%BC%95%E5%85%A5%E6%8A%91%E5%88%B6%E9%9A%90%E7%A7%81%E8%AE%AD%E7%BB%83>`_。 | |||
详情请查看: `应用抑制隐私机制保护用户隐私 <https://mindspore.cn/mindarmour/docs/zh-CN/r1.8/protect_user_privacy_with_suppress_privacy.html#%E5%BC%95%E5%85%A5%E6%8A%91%E5%88%B6%E9%9A%90%E7%A7%81%E8%AE%AD%E7%BB%83>`_。 | |||
**参数:** | |||
@@ -7,7 +7,7 @@ MindArmour的可靠性方法。 | |||
故障注入模块模拟深度神经网络的各种故障场景,并评估模型的性能和可靠性。 | |||
详情请查看 `实现模型故障注入评估模型容错性 <https://mindspore.cn/mindarmour/docs/zh-CN/master/fault_injection.html>`_。 | |||
详情请查看 `实现模型故障注入评估模型容错性 <https://mindspore.cn/mindarmour/docs/zh-CN/r1.8/fault_injection.html>`_。 | |||
**参数:** | |||
@@ -42,7 +42,7 @@ MindArmour的可靠性方法。 | |||
概念漂移检查时间序列(ConceptDriftCheckTimeSeries)用于样本序列分布变化检测。 | |||
有关详细信息,请查看 `实现时序数据概念漂移检测应用 | |||
<https://mindspore.cn/mindarmour/docs/zh-CN/master/concept_drift_time_series.html>`_。 | |||
<https://mindspore.cn/mindarmour/docs/zh-CN/r1.8/concept_drift_time_series.html>`_。 | |||
**参数:** | |||
@@ -107,7 +107,7 @@ MindArmour的可靠性方法。 | |||
训练OOD检测器。提取训练数据特征,得到聚类中心。测试数据特征与聚类中心之间的距离确定图像是否为分布外(OOD)图像。 | |||
有关详细信息,请查看 `实现图像数据概念漂移检测应用 <https://mindspore.cn/mindarmour/docs/zh-CN/master/concept_drift_images.html>`_。 | |||
有关详细信息,请查看 `实现图像数据概念漂移检测应用 <https://mindspore.cn/mindarmour/docs/zh-CN/r1.8/concept_drift_images.html>`_。 | |||
**参数:** | |||
@@ -196,7 +196,7 @@ MindArmour是MindSpore的工具箱,用于增强模型可信,实现隐私保 | |||
- 首先,自然鲁棒性方法包括:'Translate', 'Scale'、'Shear'、'Rotate'、'Perspective'、'Curve'、'GaussianBlur'、'MotionBlur'、'GradientBlur'、'Contrast'、'GradientLuminance'、'UniformNoise'、'GaussianNoise'、'SaltAndPepperNoise'、'NaturalNoise'。 | |||
- 其次,对抗样本攻击方式包括:'FGSM'、'PGD'和'MDIM'。'FGSM'、'PGD'和'MDIM'分别是 FastGradientSignMethod、ProjectedGradientDent和MomentumDiverseInputIterativeMethod的缩写。 `mutate_config` 必须包含在['Contrast', 'GradientLuminance', 'GaussianBlur', 'MotionBlur', 'GradientBlur', 'UniformNoise', 'GaussianNoise', 'SaltAndPepperNoise', 'NaturalNoise']中的方法。 | |||
- 第一类方法的参数设置方式可以在 `mindarmour/natural_robustness/transform/image <https://gitee.com/mindspore/mindarmour/tree/master/mindarmour/natural_robustness/transform/image>`_ 中看到。第二类方法参数配置参考 `self._attack_param_checklists` 。 | |||
- 第一类方法的参数设置方式可以在 `mindarmour/natural_robustness/transform/image <https://gitee.com/mindspore/mindarmour/tree/r1.8/mindarmour/natural_robustness/transform/image>`_ 中看到。第二类方法参数配置参考 `self._attack_param_checklists` 。 | |||
- **initial_seeds** (list[list]) - 用于生成变异样本的初始种子队列。初始种子队列的格式为[[image_data, label], [...], ...],且标签必须为one-hot。 | |||
- **coverage** (CoverageMetrics) - 神经元覆盖率指标类。 | |||
- **evaluate** (bool) - 是否返回评估报告。默认值:True。 | |||
@@ -223,7 +223,7 @@ MindArmour是MindSpore的工具箱,用于增强模型可信,实现隐私保 | |||
这个类就是重载Mindpore.train.model.Model。 | |||
详情请查看: `应用差分隐私机制保护用户隐私 <https://mindspore.cn/mindarmour/docs/zh-CN/master/protect_user_privacy_with_differential_privacy.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_。 | |||
详情请查看: `应用差分隐私机制保护用户隐私 <https://mindspore.cn/mindarmour/docs/zh-CN/r1.8/protect_user_privacy_with_differential_privacy.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_。 | |||
**参数:** | |||
@@ -241,7 +241,7 @@ MindArmour是MindSpore的工具箱,用于增强模型可信,实现隐私保 | |||
成员推理是由Shokri、Stronati、Song和Shmatikov提出的一种用于推测用户隐私数据的灰盒攻击。它需要训练样本的loss或logits结果。(隐私是指单个用户的一些敏感属性)。 | |||
有关详细信息,请参见:`使用成员推理测试模型安全性 <https://mindspore.cn/mindarmour/docs/zh-CN/master/test_model_security_membership_inference.html>`_。 | |||
有关详细信息,请参见:`使用成员推理测试模型安全性 <https://mindspore.cn/mindarmour/docs/zh-CN/r1.8/test_model_security_membership_inference.html>`_。 | |||
参考文献:`Reza Shokri, Marco Stronati, Congzheng Song, Vitaly Shmatikov. Membership Inference Attacks against Machine Learning Models. 2017. <https://arxiv.org/abs/1610.05820v2>`_。 | |||
@@ -357,7 +357,7 @@ MindArmour是MindSpore的工具箱,用于增强模型可信,实现隐私保 | |||
概念漂移检查时间序列(ConceptDriftCheckTimeSeries)用于样本序列分布变化检测。 | |||
有关详细信息,请查看: `实现时序数据概念漂移检测应用 <https://mindspore.cn/mindarmour/docs/zh-CN/master/concept_drift_time_series.html>`_。 | |||
有关详细信息,请查看: `实现时序数据概念漂移检测应用 <https://mindspore.cn/mindarmour/docs/zh-CN/r1.8/concept_drift_time_series.html>`_。 | |||
**参数:** | |||
@@ -94,7 +94,7 @@ This takes around 75 minutes. | |||
## Mixed Precision | |||
The [mixed precision](https://www.mindspore.cn/tutorials/experts/en/master/others/mixed_precision.html) training method accelerates the deep learning neural network training process by using both the single-precision and half-precision data formats, and maintains the network precision achieved by the single-precision training at the same time. Mixed precision training can accelerate the computation process, reduce memory usage, and enable a larger model or batch size to be trained on specific hardware. | |||
The [mixed precision](https://www.mindspore.cn/tutorials/experts/en/r1.8/others/mixed_precision.html) training method accelerates the deep learning neural network training process by using both the single-precision and half-precision data formats, and maintains the network precision achieved by the single-precision training at the same time. Mixed precision training can accelerate the computation process, reduce memory usage, and enable a larger model or batch size to be trained on specific hardware. | |||
For FP16 operators, if the input data type is FP32, the backend of MindSpore will automatically handle it with reduced precision. Users could check the reduced-precision operators by enabling INFO log and then searching ‘reduce precision’. | |||
# [Environment Requirements](#contents) | |||
@@ -106,9 +106,9 @@ For FP16 operators, if the input data type is FP32, the backend of MindSpore wil | |||
- [MindSpore](https://www.mindspore.cn/install/en) | |||
- For more information, please check the resources below: | |||
- [MindSpore tutorials](https://www.mindspore.cn/tutorials/en/master/index.html) | |||
- [MindSpore tutorials](https://www.mindspore.cn/tutorials/en/r1.8/index.html) | |||
- [MindSpore Python API](https://www.mindspore.cn/docs/en/master/index.html) | |||
- [MindSpore Python API](https://www.mindspore.cn/docs/en/r1.8/index.html) | |||
# [Quick Start](#contents) | |||
@@ -517,7 +517,7 @@ accuracy: 0.8533 | |||
### Inference | |||
If you need to use the trained model to perform inference on multiple hardware platforms, such as GPU, Ascend 910 or Ascend 310, you can refer to this [Link](https://www.mindspore.cn/tutorials/experts/en/master/infer/inference.html). Following the steps below, this is a simple example: | |||
If you need to use the trained model to perform inference on multiple hardware platforms, such as GPU, Ascend 910 or Ascend 310, you can refer to this [Link](https://www.mindspore.cn/tutorials/experts/en/r1.8/infer/inference.html). Following the steps below, this is a simple example: | |||
- Running on Ascend | |||
@@ -95,7 +95,7 @@ python src/preprocess_dataset.py | |||
## 混合精度 | |||
采用[混合精度](https://www.mindspore.cn/tutorials/experts/zh-CN/master/others/mixed_precision.html)的训练方法使用支持单精度和半精度数据来提高深度学习神经网络的训练速度,同时保持单精度训练所能达到的网络精度。混合精度训练提高计算速度、减少内存使用的同时,支持在特定硬件上训练更大的模型或实现更大批次的训练。 | |||
采用[混合精度](https://www.mindspore.cn/tutorials/experts/zh-CN/r1.8/others/mixed_precision.html)的训练方法使用支持单精度和半精度数据来提高深度学习神经网络的训练速度,同时保持单精度训练所能达到的网络精度。混合精度训练提高计算速度、减少内存使用的同时,支持在特定硬件上训练更大的模型或实现更大批次的训练。 | |||
以FP16算子为例,如果输入数据类型为FP32,MindSpore后台会自动降低精度来处理数据。用户可打开INFO日志,搜索“reduce precision”查看精度降低的算子。 | |||
# 环境要求 | |||
@@ -109,9 +109,9 @@ python src/preprocess_dataset.py | |||
- [MindSpore](https://www.mindspore.cn/install) | |||
- 如需查看详情,请参见如下资源: | |||
- [MindSpore教程](https://www.mindspore.cn/tutorials/zh-CN/master/index.html) | |||
- [MindSpore教程](https://www.mindspore.cn/tutorials/zh-CN/r1.8/index.html) | |||
- [MindSpore Python API](https://www.mindspore.cn/docs/zh-CN/master/index.html) | |||
- [MindSpore Python API](https://www.mindspore.cn/docs/zh-CN/r1.8/index.html) | |||
# 快速入门 | |||
@@ -250,7 +250,7 @@ bash scripts/run_distribute_train_ascend.sh [RANK_TABLE_FILE] [PRETRAINED_CKPT(o | |||
> 注意: | |||
RANK_TABLE_FILE相关参考资料见[链接](https://www.mindspore.cn/tutorials/experts/zh-CN/master/parallel/train_ascend.html), 获取device_ip方法详见[链接](https://gitee.com/mindspore/models/tree/master/utils/hccl_tools). | |||
RANK_TABLE_FILE相关参考资料见[链接](https://www.mindspore.cn/tutorials/experts/zh-CN/r1.8/parallel/train_ascend.html), 获取device_ip方法详见[链接](https://gitee.com/mindspore/models/tree/master/utils/hccl_tools). | |||
### 训练结果 | |||
@@ -449,7 +449,7 @@ bash run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [DVPP] [DEVICE_ID] | |||
### 推理 | |||
如果您需要在GPU、Ascend 910、Ascend 310等多个硬件平台上使用训练好的模型进行推理,请参考此[链接](https://www.mindspore.cn/tutorials/experts/zh-CN/master/infer/inference.html)。以下为简单示例: | |||
如果您需要在GPU、Ascend 910、Ascend 310等多个硬件平台上使用训练好的模型进行推理,请参考此[链接](https://www.mindspore.cn/tutorials/experts/zh-CN/r1.8/infer/inference.html)。以下为简单示例: | |||
- Ascend处理器环境运行 | |||
@@ -126,7 +126,7 @@ | |||
### 基于自然扰动serving生成评测数据集 | |||
1. 启动自然扰动serving服务。具体说明参考:[ 自然扰动样本生成serving服务](https://gitee.com/mindspore/mindarmour/blob/master/examples/natural_robustness/serving/README.md) | |||
1. 启动自然扰动serving服务。具体说明参考:[ 自然扰动样本生成serving服务](https://gitee.com/mindspore/mindarmour/blob/r1.8/examples/natural_robustness/serving/README.md) | |||
```bash | |||
cd serving/server/ | |||
@@ -144,7 +144,7 @@ | |||
2. 核心代码说明: | |||
1. 配置扰动方法,目前可选的扰动方法及参数配置参考[image transform methods](https://gitee.com/mindspore/mindarmour/tree/master/mindarmour/natural_robustness/transform/image)。下面是一个配置例子。 | |||
1. 配置扰动方法,目前可选的扰动方法及参数配置参考[image transform methods](https://gitee.com/mindspore/mindarmour/tree/r1.8/mindarmour/natural_robustness/transform/image)。下面是一个配置例子。 | |||
```python | |||
PerturbConfig = [ | |||
@@ -39,7 +39,9 @@ class ClipMechanismsFactory: | |||
Wrapper of clip noise generating mechanisms. It supports Adaptive Clipping with | |||
Gaussian Random Noise for now. | |||
For details, please check `Tutorial <https://mindspore.cn/mindarmour/docs/zh-CN/master/protect_user_privacy_with_differential_privacy.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_. | |||
For details, please check `Tutorial | |||
<https://mindspore.cn/mindarmour/docs/zh-CN/r1.8/protect_user_privacy_with_differential_privacy | |||
.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_. | |||
""" | |||
@@ -100,7 +102,9 @@ class NoiseMechanismsFactory: | |||
Wrapper of noise generating mechanisms. It supports Gaussian Random Noise and | |||
Adaptive Gaussian Random Noise for now. | |||
For details, please check `Tutorial <https://mindspore.cn/mindarmour/docs/zh-CN/master/protect_user_privacy_with_differential_privacy.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_. | |||
For details, please check `Tutorial | |||
<https://mindspore.cn/mindarmour/docs/zh-CN/r1.8/protect_user_privacy_with_differential_privacy | |||
.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_. | |||
""" | |||
def __init__(self): | |||
@@ -28,7 +28,9 @@ TAG = 'DP monitor' | |||
class PrivacyMonitorFactory: | |||
""" | |||
Factory class of DP training's privacy monitor. | |||
For details, please check `Tutorial <https://mindspore.cn/mindarmour/docs/zh-CN/master/protect_user_privacy_with_differential_privacy.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_. | |||
For details, please check `Tutorial | |||
<https://mindspore.cn/mindarmour/docs/zh-CN/r1.8/protect_user_privacy_with_differential_privacy | |||
.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_. | |||
""" | |||
@@ -77,7 +79,9 @@ class RDPMonitor(Callback): | |||
.. math:: | |||
(ε'+\frac{log(1/δ)}{α-1}, δ) | |||
For details, please check `Tutorial <https://mindspore.cn/mindarmour/docs/zh-CN/master/protect_user_privacy_with_differential_privacy.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_. | |||
For details, please check `Tutorial | |||
<https://mindspore.cn/mindarmour/docs/zh-CN/r1.8/protect_user_privacy_with_differential_privacy | |||
.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_. | |||
Reference: `Rényi Differential Privacy of the Sampled Gaussian Mechanism | |||
<https://arxiv.org/abs/1908.10530>`_ | |||
@@ -370,7 +374,9 @@ class ZCDPMonitor(Callback): | |||
noise mechanisms(such as NoiseAdaGaussianRandom and NoiseGaussianRandom). | |||
The matching noise mechanism of ZCDP will be developed in the future. | |||
For details, please check `Tutorial <https://mindspore.cn/mindarmour/docs/zh-CN/master/protect_user_privacy_with_differential_privacy.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_. | |||
For details, please check `Tutorial | |||
<https://mindspore.cn/mindarmour/docs/zh-CN/r1.8/protect_user_privacy_with_differential_privacy | |||
.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_. | |||
Reference: `Concentrated Differentially Private Gradient Descent with | |||
Adaptive per-Iteration Privacy Budget <https://arxiv.org/abs/1808.09501>`_ | |||
@@ -71,7 +71,7 @@ class DPModel(Model): | |||
This class is overload mindspore.train.model.Model. | |||
For details, please check `Protecting User Privacy with Differential Privacy Mechanism | |||
<https://mindspore.cn/mindarmour/docs/en/master/protect_user_privacy_with_differential_privacy.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_. | |||
<https://mindspore.cn/mindarmour/docs/en/r1.8/protect_user_privacy_with_differential_privacy.html#%E5%B7%AE%E5%88%86%E9%9A%90%E7%A7%81>`_. | |||
Args: | |||
micro_batches (int): The number of small batches split from an original | |||
@@ -99,7 +99,7 @@ class MembershipInference: | |||
(Privacy refers to some sensitive attributes of a single user). | |||
For details, please refer to the `Using Membership Inference to Test Model Security | |||
<https://mindspore.cn/mindarmour/docs/en/master/test_model_security_membership_inference.html>`_. | |||
<https://mindspore.cn/mindarmour/docs/en/r1.8/test_model_security_membership_inference.html>`_. | |||
References: `Reza Shokri, Marco Stronati, Congzheng Song, Vitaly Shmatikov. | |||
Membership Inference Attacks against Machine Learning Models. 2017. | |||
@@ -28,7 +28,7 @@ class SuppressMasker(Callback): | |||
""" | |||
Periodicity check suppress privacy function status and toggle suppress operation. | |||
For details, please check `Protecting User Privacy with Suppression Privacy | |||
<https://mindspore.cn/mindarmour/docs/en/master/protect_user_privacy_with_suppress_privacy.html>`_. | |||
<https://mindspore.cn/mindarmour/docs/en/r1.8/protect_user_privacy_with_suppress_privacy.html>`_. | |||
Args: | |||
model (SuppressModel): SuppressModel instance. | |||
@@ -36,7 +36,7 @@ class SuppressPrivacyFactory: | |||
Factory class of SuppressCtrl mechanisms. | |||
For details, please check `Protecting User Privacy with Suppress Privacy | |||
<https://mindspore.cn/mindarmour/docs/en/master/protect_user_privacy_with_suppress_privacy.html>`_. | |||
<https://mindspore.cn/mindarmour/docs/en/r1.8/protect_user_privacy_with_suppress_privacy.html>`_. | |||
""" | |||
def __init__(self): | |||
@@ -120,7 +120,7 @@ class SuppressCtrl(Cell): | |||
parameters permanently. | |||
For details, please check `Protecting User Privacy with Suppress Privacy | |||
<https://mindspore.cn/mindarmour/docs/en/master/protect_user_privacy_with_suppress_privacy.html>`_. | |||
<https://mindspore.cn/mindarmour/docs/en/r1.8/protect_user_privacy_with_suppress_privacy.html>`_. | |||
Args: | |||
networks (Cell): The training network. | |||
@@ -60,7 +60,7 @@ class SuppressModel(Model): | |||
mindspore.train.model.Model. | |||
For details, please check `Protecting User Privacy with Suppress Privacy | |||
<https://mindspore.cn/mindarmour/docs/en/master/protect_user_privacy_with_suppress_privacy.html>`_. | |||
<https://mindspore.cn/mindarmour/docs/en/r1.8/protect_user_privacy_with_suppress_privacy.html>`_. | |||
Args: | |||
network (Cell): The training network. | |||
@@ -90,7 +90,7 @@ class OodDetectorFeatureCluster(OodDetector): | |||
image or not. | |||
For details, please check `Implementing the Concept Drift Detection Application of Image Data | |||
<https://mindspore.cn/mindarmour/docs/en/master/concept_drift_images.html>`_. | |||
<https://mindspore.cn/mindarmour/docs/en/r1.8/concept_drift_images.html>`_. | |||
Args: | |||
model (Model):The training model. | |||
@@ -24,7 +24,7 @@ class ConceptDriftCheckTimeSeries: | |||
r""" | |||
ConceptDriftCheckTimeSeries is used for example series distribution change detection. | |||
For details, please check `Implementing the Concept Drift Detection Application of Time Series Data | |||
<https://mindspore.cn/mindarmour/docs/en/master/concept_drift_time_series.html>`_. | |||
<https://mindspore.cn/mindarmour/docs/en/r1.8/concept_drift_time_series.html>`_. | |||
Args: | |||
window_size(int): Size of a concept window, no less than 10. If given the input data, | |||
@@ -32,7 +32,7 @@ class FaultInjector: | |||
performance and reliability of the model. | |||
For details, please check `Implementing the Model Fault Injection and Evaluation | |||
<https://mindspore.cn/mindarmour/docs/en/master/fault_injection.html>`_. | |||
<https://mindspore.cn/mindarmour/docs/en/r1.8/fault_injection.html>`_. | |||
Args: | |||
model (Model): The model need to be evaluated. | |||