Giter VIP home page Giter VIP logo

full-coverage-camouflage-adversarial-attack's Introduction

[AAAI 2022] FCA: Learning a 3D Full-coverage Vehicle Camouflage for Multi-view Physical Adversarial Attack

三维多视角车辆反识别对抗迷彩生成框架

fork目的

  1. 原来项目的主要问题:1)环境安装困难,尤其是渲染器的安装;2)没有使用指导;3)没有数据集制作指导;4)基本无人维护;
  2. 因此,这个fork主要解决这几个问题;问题1)和问题3)是非常困难的,然而,我这里基本打通了,所以,我尽量将整个过程清晰地分享给大家;有问题大家再互相交流。

环境安装

pip install -r requirements.txt

3D Renderer安装指导: https://winterwindwang.github.io/2021/07/22/nerual_rendered_build.html

下载数据集,从百度网盘或google drive上下载: 百度网盘:(提取码:dual) https://pan.baidu.com/s/1m2dACufqcRb-uL2JYGZxkA#list/path=%2F Google Drive: https://drive.google.com/drive/folders/1vspvRxnZ3shOV4kM5ELcO9-xztapBThS

代码使用指导

训练前,要注意参数设置

  1. 要设置车辆模型存在位置: parser.add_argument('--obj_file', type=str, default='carassets/audi_et_te.obj', help='3d car model obj') parser.add_argument('--faces', type=str, default='carassets/exterior_face.txt', help='exterior_face file (exterior_face, all_faces)')
  2. 设置训练数据集的位置: parser.add_argument('--datapath', type=str, default='F:/PythonPro/DualAttentionAttack/data/', help='data path')

执行训练:python train_camouflage_yolov3.py

训练过程中,注意查看loss是否正常显示。训练过程中的中介结果存放在logs/epoch-x-。。。。。/文件夹下面,里面会有texture.png和test_total.png

texture.png是当前的车辆渲染结果,test_total.png是渲染车辆叠加环境的结果,可以查看这两张图片,查看生成结果是否存在异常。

训练结束后,生成的结果是:logs/epoch-x-。。。。。/texture.npy

将此npy文件复制: cp logs/epoch-x-。。。。。/texture.npy textures/texture_camouflage.npy 用于下面步骤中,生成纹理

使用训练结果测试和生成纹理:python generated_and_test.py

生成的结果,保存在savedImage/文件夹下

实际效果测试

将生成的纹理图片打印出来,粘贴到车体上; 使用yolo系列模型对车进行检测,查看纹理是否欺骗yolo,使其不能检测到车辆。

数据集制作指导

前置条件:

  1. 编译安装carlaUE4,以便能够启动carlaUE4 Editor;这一步需要在windows上完成,因为carlaUE4 Editor启动后有图形界面。
  2. 制作车辆模型,模型的格式是fbx,这个车辆既是被用来进行纹理生成的,生成的纹理将能够将车辆对于OD检测系统隐身;
  3. 编辑此fbx模型,以便能够导入carlaUE4;包括设置车辆模型中,对车轮的旋转方向和移动等进行约束等;
  4. 重新导出fbx模型,然后导入到carlaUE4中;包括创建车辆蓝图、修改车轮尺寸等等。
  5. 通过camera_test.py,调试和配置车辆上放置的摄像头。
  6. 在carla中制作vehicle_manual_control_with_customized_camera.py, 用于驱动车辆在carla中运行。

创建数据集

  1. 采用自己导入的车辆模型,使其在carlaUE4中运行起来,并采集图片,生成携带相机和车辆全局位置(transform)的npy文件和图片文件。
  2. 制作每张图片的mask.png,既:将图片中的车辆的RGB使用白色(255,255,255)替代,其他部分采用黑色(0,0,0)替代
  3. 制作每张图片的label,yolo格式。
  4. 将数据集分割成train, train_new, masks, label, test等

将车辆模型和数据集加入FCA代码中;

  1. 将fbx格式车辆模型转换为obj模型,并导入到FCA中,执行训练可能报显存不足,那么就需要通过blender压缩obj文件。

  2. 将数据集导入FCA代码中。

  3. 修改代码配置,执行训练 注意,在使用自建数据集时,需要把nmr_test.py文件中get_param()函数进行修改,改为:

    for i in range(0, 3):

     eye[i] = (carlaTcam[0][i] - carlaTveh[0][i]) * scale
    
     if i == 2:
    
         eye[i] = (carlaTcam[0][i] - (carlaTveh[0][i]+0.93)) * scale
    

注意,这个0.93是对车辆位置的调整,车辆位置一般是车辆的几何中心,我们拍摄点一般在车顶中心。 当采用下载的数据集时,需要将这部分代码恢复为原代码。

Overview

This is the official implementation and case study of the Full-coverage Vehicle Camouflage(FCA) method proposed in our AAAI 2022 paper FCA: Learning a 3D Full-coverage Vehicle Camouflage for Multi-view Physical Adversarial Attack.

Abstract

Physical adversarial attacks in object detection have attracted increasing attention. However, most previous works focus on hiding the objects from the detector by generating an individual adversarial patch, which only covers the planar part of the vehicle’s surface and fails to attack the detector in physical scenarios for multi-view, long-distance and partially occluded objects. To bridge the gap between digital attacks and physical attacks, we exploit the full 3D vehicle surface to propose a robust Full-coverage Camouflage Attack (FCA) to fool detectors. Specifically, we first try rendering the nonplanar camouflage texture over the full vehicle surface. To mimic the real-world environment conditions, we then introduce a transformation function to transfer the rendered camouflaged vehicle into a photo realistic scenario. Finally, we design an efficient loss function to optimize the camouflage texture. Experiments show that the full-coverage camouflage attack can not only outperform state-of-the-art methods under various test cases but also generalize to different environments, vehicles, and object detectors.

Framework

image-20211209204327675

Cases of Digital Attack

Multi-view Attack: Carmear distance is 3

Elevation 0 Elevation 30 Elevation 50
Original
FCA

Multi-view Attack: Carmear distance is 5

Elevation 20 Elevation 40 Elevation 50
Original
FCA

Multi-view Attack: Carmear distance is 10

Elevation 30 Elevation 40 Elevation 50
Original
FCA

Multi-view Attack: different distance, elevation and azimuth

Original
FCA

Partial occlusion

Original
FCA

Cases of Phyical Attack

Case in the simulator environment

<iframe src="//player.bilibili.com/player.html?aid=937368019&bvid=BV1dT4y1U75b&cid=550826852&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>

Case in the real world

<iframe src="//player.bilibili.com/player.html?aid=852356546&bvid=BV1RL4y1T723&cid=550828041&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>

full-coverage-camouflage-adversarial-attack's People

Contributors

francisapzii avatar tingsongpku avatar winterwindwang avatar

Stargazers

 avatar

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.