Install
Python>=3.6.0 is required with all requirements.txt installed including PyTorch>=1.7:
$ git clone https://github.com/shighghyujie/infrared_patch_attack.git
$ cd infrared_patch_attack
$ pip install -r requirements.txt
Preparation Before Attack
You can obtain infrared pedestrian data through the following dataset:The Opening Database FLIR ADAS to simulate the physical attacks. The Opening Database CVC-14 CVC-14
Here, we provide the our trained weights of YOLOv3 model (based on yolov3.pt) at yolov3\weights\best.pt and some images to conduct attacks in datasets\pedestrian.
Firstly, you should put the folder "weights" in "yolov3".
The weight can be downloaded from: https://pan.baidu.com/s/1cvG_FDyjMedQfixnVvHAkA, code:q1w2 or from https://drive.google.com/file/d/1qvcQGhs20eU6DGgQqtGctVXgfJspKa2V/view?usp=sharing
Attack
Running this command for attacks:
$ cd infrared_patch_attack
$ python shaped_patch_attack.py
If you want to use your own data, you can pass the dataset path to the "victim_imgs" parameter.
For more attack settings, you can change the values of parameters at config/config.py:
width, height: the width and height of optimized object(infrared mask). If the value is too large, it may prevent the mask from aggregating properly.
emp_iterations: the steps of optimization.
cover_rate: the coverage rate of infrared patches on the target.
content: the gray value of infared patch in the thermal image.