[AAAI 2022] FCA: Learning a 3D Full-coverage Vehicle Camouflage for Multi-view Physical Adversarial Attack
- 原来项目的主要问题:1)环境安装困难,尤其是渲染器的安装;2)没有使用指导;3)没有数据集制作指导;4)基本无人维护;
- 因此,这个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
- 要设置车辆模型存在位置: 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)')
- 设置训练数据集的位置: parser.add_argument('--datapath', type=str, default='F:/PythonPro/DualAttentionAttack/data/', help='data path')
texture.png是当前的车辆渲染结果,test_total.png是渲染车辆叠加环境的结果,可以查看这两张图片,查看生成结果是否存在异常。
将此npy文件复制: cp logs/epoch-x-。。。。。/texture.npy textures/texture_camouflage.npy 用于下面步骤中,生成纹理
生成的结果,保存在savedImage/文件夹下
将生成的纹理图片打印出来,粘贴到车体上; 使用yolo系列模型对车进行检测,查看纹理是否欺骗yolo,使其不能检测到车辆。
- 编译安装carlaUE4,以便能够启动carlaUE4 Editor;这一步需要在windows上完成,因为carlaUE4 Editor启动后有图形界面。
- 制作车辆模型,模型的格式是fbx,这个车辆既是被用来进行纹理生成的,生成的纹理将能够将车辆对于OD检测系统隐身;
- 编辑此fbx模型,以便能够导入carlaUE4;包括设置车辆模型中,对车轮的旋转方向和移动等进行约束等;
- 重新导出fbx模型,然后导入到carlaUE4中;包括创建车辆蓝图、修改车轮尺寸等等。
- 通过camera_test.py,调试和配置车辆上放置的摄像头。
- 在carla中制作vehicle_manual_control_with_customized_camera.py, 用于驱动车辆在carla中运行。
- 采用自己导入的车辆模型,使其在carlaUE4中运行起来,并采集图片,生成携带相机和车辆全局位置(transform)的npy文件和图片文件。
- 制作每张图片的mask.png,既:将图片中的车辆的RGB使用白色(255,255,255)替代,其他部分采用黑色(0,0,0)替代
- 制作每张图片的label,yolo格式。
- 将数据集分割成train, train_new, masks, label, test等
-
将fbx格式车辆模型转换为obj模型,并导入到FCA中,执行训练可能报显存不足,那么就需要通过blender压缩obj文件。
-
将数据集导入FCA代码中。
-
修改代码配置,执行训练 注意,在使用自建数据集时,需要把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是对车辆位置的调整,车辆位置一般是车辆的几何中心,我们拍摄点一般在车顶中心。 当采用下载的数据集时,需要将这部分代码恢复为原代码。
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.
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.
Elevation 0 | Elevation 30 | Elevation 50 | |
Original | ![]() |
![]() |
![]() |
FCA | ![]() |
![]() |
![]() |
Elevation 20 | Elevation 40 | Elevation 50 | |
Original | ![]() |
![]() |
![]() |
FCA | ![]() |
![]() |
![]() |
Elevation 30 | Elevation 40 | Elevation 50 | |
Original | ![]() |
![]() |
![]() |
FCA | ![]() |
![]() |
![]() |
Original | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
FCA | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Original | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
FCA | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |