Code Monkey home page Code Monkey logo

aisafety's Introduction

  • 重明

    本项目为重明开源项目的算法内核,重明开源项目是一个用于对抗攻击全流程评测算法学习研究的 Python库,其主要研究内容为集成对抗攻击和噪声攻击相关的攻击算法、评测算法、加固防御算法。可灵活测试数据集质量、算法训练、评估和部署等算法全生命周期各项指标。

    • 集成大量攻击、评测、防御加固算法
    • 提供多种可解释性分析工具
    • 提供完备的扩展和使用接口

    文档

    教程:如果您正在寻找教程,请查看AISafety/test/路径下相关示例文件

    文档:我们提供了完备的API说明文档以及教程:说明文档链接

    下载及使用

    STEP 1. 获取项目

    Python环境要求

    Python 3.6.5及以上
    

    克隆本项目并安装依赖:

    git clone http://git.openi.org.cn/OpenI/AISafety.git
    cd AISafety/
    pip install requirements.txt
    

    STEP 2. 数据准备

    重明开源项目的Datasets/中提供了Cifar10和ILSVR2012-ImageNet数据集。用户可使用上述数据集,或按照完整API文档,进行数据集扩展。

    用户需要使用所选数据集的训练集,执行模型训练过程。由于空间所限,本项目中统一不提供数据集对应的训练集,仅给出测试集以供测试。

    STEP 3. 快速开始

    使用cd test进入test目录。重明开源项目提供了几个示例的算法文件。如测试在FGSM攻击算法下,Resnet20模型的鲁棒性结果:

    # 使用接口文件默认参数
    python testimport.py
    
    # 自定义参数调用
    python testimport.py --attack_method "FGSM" --evaluation_method "ALDp" --model_dir ""

    上述命令均将测试ResNet20模型,在FGSM算法攻击下,ALDp指标的评测结果变化。并将结果存在AISafety/test/temp

    有关更多示例和用法(例如,如何扩展模型或算法,如何传入参数),请浏览完备API接口文档

    仍有疑问?

    如果你有任何疑问或需要帮助,请随时联系我们。

    协议

    AISafety基于MIT协议, 关于协议的更多信息,请参看 LICENSE 文件。

aisafety's People

Contributors

a157801 avatar raykr avatar sharinka0715 avatar shunchang-liu avatar xiaoyisong avatar yzx835 avatar zaozhe6666 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

aisafety's Issues

运行出错

1.按照API接口文档8.1. 参考实例1(白盒攻击)参数设置时
--Scale_ImageSize
(375,500)
--Crop_ImageSize
(375,500)
报错
testimport.py: error: argument --Scale_ImageSize: invalid int value: '(375,500)'

2.按照示例进行自定义参数调用
python testimport.py --attack_method "FGSM" --evaluation_method "ALDp" --model_dir ""
出错提示
['FGSM', '', 'attack_param/FGSM/fgsm_01.xml'] ALDp
Traceback (most recent call last):
File "testimport.py", line 242, in
main(args=arguments)
File "testimport.py", line 91, in main
adv_xs_npy = r_a.gen_attack_Samples()
File "D:\Code\Robustness\venv\AISafety\test/..\EvalBox\Analysis\Rebust_Eval.py", line 283, in gen_attack_Samples
device, model, att, att_name = self.setting_device(model_dir, self.model_name)
File "D:\Code\Robustness\venv\AISafety\test/..\EvalBox\Analysis\evaluation_base.py", line 196, in setting_device
model = self.get_model(model_dir, model_name, device)
File "D:\Code\Robustness\venv\AISafety\test/..\EvalBox\Analysis\evaluation_base.py", line 167, in get_model
model = eval(model_name)(pretrained = True)
File "", line 1, in
NameError: name 'Models' is not defined

语音攻击ImperceptibleCW

请问语音攻击里Imperceptible_CW算法有没有原论文,没有看懂,但也没找到更多参考资料

关于ImageMagick

在运行test中的代码时,出现下面的错误:
Traceback (most recent call last):
File "D:\ProgramData\Anaconda3\envs\AIsafety\lib\site-packages\wand\api.py", line 137, in
libraries = load_library()
File "D:\ProgramData\Anaconda3\envs\AIsafety\lib\site-packages\wand\api.py", line 126, in load_library
raise IOError('cannot find library; tried paths: ' + repr(tried_paths))
OSError: cannot find library; tried paths: []

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "testimport.py", line 16, in
from EvalBox.Analysis.evaluation_base import Evaluation_Base
File "E:\pycode\pycharmCode\AISafety\test/..\EvalBox\Analysis\evaluation_base.py", line 25, in
from EvalBox.Attack.CorAttack.corrupt import CORRUPT
File "E:\pycode\pycharmCode\AISafety\test/..\EvalBox\Attack\CorAttack_init_.py", line 5, in
from .corruptions import *
File "E:\pycode\pycharmCode\AISafety\test/..\EvalBox\Attack\CorAttack\corruptions.py", line 17, in
import wand.color as WandColor
File "D:\ProgramData\Anaconda3\envs\AIsafety\lib\site-packages\wand\color.py", line 10, in
from .api import library
File "D:\ProgramData\Anaconda3\envs\AIsafety\lib\site-packages\wand\api.py", line 163, in
'Try to install:\n ' + msg)
ImportError: MagickWand shared library not found.
You probably had not installed ImageMagick library.
Try to install:
http://docs.wand-py.org/en/latest/guide/install.html#install-imagemagick-on-windows

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.