File size: 7,181 Bytes
97745a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
---
license: cc-by-4.0
language:
  - en
tags:
  - automotive
  - adversarial-robustness
  - can-bus
  - perception
  - planning
---

# Multi-domain DataSet

This repository provides data from two vehicle models, Vehicle_A and Vehicle_B, across three domains: CAN, perception, and planning. The data support comparisons of system inputs and outputs under normal and attack conditions.

## Data Files

| Domain | Vehicle_A | Vehicle_B |
| --- | --- | --- |
| CAN | [Dataset_CAN_Vehicle_A.zip](Dataset_CAN_Vehicle_A.zip) | [Dataset_CAN_Vehicle_B.zip](Dataset_CAN_Vehicle_B.zip) |
| Perception | [Perception_Vehicle_A.zip](Perception_Vehicle_A.zip) | [Perception_Vehicle_B.zip](Perception_Vehicle_B.zip) |
| Planning | [Planning_Vehicle_A.zip](Planning_Vehicle_A.zip) | [Planning_Vehicle_B.zip](Planning_Vehicle_B.zip) |

## Code Availability

Custom attack-generation and batch-processing code was used to construct the dataset.

| File | Purpose | File Type |
| --- | --- | --- |
| `attack_api_det.py` | Implements perception-domain adversarial image generation, including FGSM and PGD | Python source code |
| `run_det_attacks.py` | Generates adversarial images in batches and invokes the detector to produce results | Python source code |
| `best.pt` | Model weights used for attack generation | Model checkpoint |
| `main` | Perception detector provided by the company | Closed-source executable |

The underlying source code of `main` is not publicly available because of the company's intellectual property restrictions. Code for desensitisation and for constructing the CAN and planning datasets is not included in these four files.

## Usage Notes

### Downloading and Reading the Files

Download the required ZIP archives and extract each into a separate directory to avoid mixing vehicle directories with identical names across domains. For example:

```python
from huggingface_hub import hf_hub_download
from zipfile import ZipFile

archive = hf_hub_download(
    repo_id="MacroIC/Multi-domain-DataSet",
    repo_type="dataset",
    filename="Perception_Vehicle_A.zip",
)
with ZipFile(archive) as z:
    z.extractall("data/perception")
```

| Domain | How to Read the Files | Location of Normal and Attack Data |
| --- | --- | --- |
| CAN | ASC files are text-based message logs. Read timestamps, CAN IDs, payloads, and any available labels line by line. File headers and end markers are not messages. | `Normal` contains normal recordings. `Attack` is organised into DoS, Fuzzy, Replay, and Spoofing conditions. An attack directory identifies the recording's experimental condition; it does not mean that every message in the file is an injected attack message. |
| Perception | Load input images from `images` using an image library and parse the whitespace-separated detection results in `result/txt`. Files in `result/images` are visualisations. | `ori` denotes Clean. `FGSM` and `PGD` denote the corresponding attack conditions. Remove the `_adv_FGSM` or `_adv_PGD` suffix from an image's filename stem to match its Clean counterpart within the same run. |
| Planning | `.log` files contain text records. Read planning requests and available results by their field names. | `requests/clean` contains normal requests. `requests/attack` is organised by attack type, and attack logs contain an `ATTACK_TYPE` marker. Corresponding results are stored under `results`. |

Multiple ASC files may be consecutive segments of a single CAN recording. File counts should therefore not be treated as counts of independent recordings. To identify attack messages or exact attack start and end times, use acquisition records and per-message labels rather than directory names alone.

### Perception TXT Format and Class Identifiers

The image resolution is 448×416 pixels (width×height). Each non-empty TXT line contains one predicted box:

```text
x1 y1 x2 y2 x3 y3 x4 y4 class_id confidence
```

The first eight fields specify the coordinates of four vertices at the original image scale. The final two fields are the class identifier and confidence score. Each TXT file shares its filename stem with the corresponding input image. An empty TXT file indicates that no detection boxes were output for that frame.

### Generating Perception Attacks

Generate FGSM images:

```bash
python run_det_attacks.py \
  --weights ./best.pt \
  --source data/Vehicle_A/Double_Occlusion_16/ori/images \
  --out generated/Vehicle_A/Double_Occlusion_16 \
  --methods FGSM --eps 0.031372549 --batch 4 --img-size 640 \
  --device 0 --n-samples 999 \
  --method-config '{"FGSM":{"eps":0.031372549}}' \
  --main_exec ./main
```

Generate PGD images:

```bash
python run_det_attacks.py \
  --weights ./best.pt \
  --source data/Vehicle_A/Double_Occlusion_16/ori/images \
  --out generated/Vehicle_A/Double_Occlusion_16 \
  --methods PGD --eps 0.031372549 --batch 4 --img-size 640 \
  --device 0 --n-samples 999 \
  --method-config '{"PGD":{"eps":0.031372549,"alpha":0.01,"iters":40}}' \
  --main_exec ./main
```

For other runs, replace the vehicle and run directories in both `--source` and `--out`. The `--n-samples` option processes only the first N existing images sorted by filename; it does not create an `ori` directory. If fewer than N images are available, all available images are processed. The current runner does not pass `--eps` directly to the attack interface, so these examples explicitly set the effective epsilon through `--method-config`. PGD uses the step size and iteration count shown above, with the interface's default random initial perturbation.

Generated input images are saved to `<out>/FGSM/images` or `<out>/PGD/images`. The runner then executes `./main images/` in the method directory, where the company's detector generates `result/images` and `result/txt`. These commands do not automatically apply the coordinate clipping used for the released TXT files and do not guarantee byte-for-byte reproduction of the existing adversarial images.

### Dataset Construction Files

| File | Role |
| --- | --- |
| `run_det_attacks.py` | Main entry point: parses arguments, loads weights, reads input images, invokes the attacker, saves adversarial images, and runs the detector |
| `function/attack/attack_api_det.py` | Implements FGSM/PGD for detection tasks, letterbox preprocessing, the proxy objective, gradient updates, perturbation constraints, and image saving |
| `best.pt` | YOLOv7 checkpoint containing a model instance and weights; it still requires matching YOLOv7 source code, PyTorch, and related dependencies |
| `main` | Compiled detector provided by the company; generates result images and TXT files. Its underlying source code is not distributed with the data. |
| `<yolov7>/data/fisheye8k.yaml` | Class configuration file from the original training project. It is not included among the four files intended for upload, and its class names cannot be used directly to interpret the company's detector TXT identifiers. |

## License

The dataset retains the repository's existing **CC BY 4.0** declaration. This declaration does not automatically grant permission to publicly distribute unpublished company executables, model weights, or third-party code.