# Unsupervised Anomaly Detection and Segmentation on Dirty Datasets
## 4 Experiment
### Construction of the Dirty Datasets  
In order to construct dirty datasets, we modified the three datasets. These datasets are MVTec, BTAD, and KolektorSDD2. The way to modify each dataset into a dirty dataset will be described below.  
* MVTec [35]: An industrial anomaly detection dataset containing 10 object categories and 5 texture categories. Each category has a test set with multiple real anomaly samples and a training set with only normal samples. To simulate the dirty dataset, we randomly selected a certain number of anomaly samples from the test set to be added to the training set and removed an equal number of normal samples from the training set. The test set remained unchanged. The number of randomly selected anomaly samples occupy 5%, 10%, 15%, 20%, 25%, and 30% ratio of the training set. We use the data augmentation by rotation and flip if there are insufficient anomaly samples in the test set. The details of the composition of the dirty MVTec dataset are shown in Table 1.  
Figure 8: Flowchart of PaIRE.  
* BTAD [36]: BeanTech Anomaly Detection Dataset. The dataset contains a total of 2830 real-world images of three industrial products, which showcased body and surface defects with the size of 600 \(\times\) 600. The training set only contains normal samples. The same approach simulates the dirty dataset as MVTec was used. If the real anomaly samples are insufficient, the same rotation and flip data augmentation are used.
* KolektorSDD2 [37]: A surface-defect detection dataset with over 3000 images containing several types of defects obtained while addressing a real-world industrial problem. In the original KSDD2 dataset, the training set contains 10% of the anomaly samples. On the KSDD2 dataset, we use the same strategy as before to simulate the dirty dataset with noise ratios of 15%, 20%, 25%, and 30%.  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Category** & **5**\% & **10**\% & **15**\% & **20**\% & **25**\% & **30**\% \\ \hline \multirow{2}{*}{bottle} & 198 & 188 & 178 & 167 & 157 & 146 \\  & 11 & 21 & 31 & 42 & 52 & 63 \\ \hline \multirow{2}{*}{cable} & 213 & 201 & 190 & 179 & 168 & 157 \\  & 11 & 23 & 34 & 45 & 56 & 67 \\ \hline \multirow{2}{*}{capsule} & 208 & 197 & 186 & 175 & 164 & 153 \\  & 11 & 122 & 33 & 44 & 55 & 66 \\ \hline \multirow{2}{*}{carpet} & 266 & 252 & 238 & 224 & 210 & 196 \\  & 14 & 28 & 42 & 56 & 70 & 84 \\ \hline \multirow{2}{*}{grid} & 250 & 238 & 224 & 211 & 198 & 185 \\  & 14 & 26 & 40 & 53 & **66** & **79** \\ \hline \multirow{2}{*}{hazehnut} & 371 & 352 & 332 & 313 & 293 & 274 \\  & 20 & 39 & 59 & **78** & **98** & **117** \\ \hline \multirow{2}{*}{leather} & 233 & 221 & 208 & 196 & 184 & 172 \\  & 12 & 24 & 37 & 49 & 61 & 73 \\ \hline \multirow{2}{*}{metal nut} & 209 & 198 & 187 & 176 & 165 & 154 \\  & 11 & 22 & 33 & 44 & 55 & 66 \\ \hline \multirow{2}{*}{pill} & 254 & 240 & 227 & 214 & 200 & 187 \\  & 13 & 27 & 40 & 53 & 67 & 80 \\ \hline \multirow{2}{*}{screw} & 304 & 288 & 272 & 256 & 240 & 224 \\  & 16 & 32 & 48 & 64 & 80 & 96 \\ \hline \multirow{2}{*}{tile} & 219 & 207 & 196 & 184 & 173 & 161 \\  & 11 & 23 & 34 & 46 & 57 & 69 \\ \hline \multirow{2}{*}{toothbrush} & 57 & 54 & 51 & 48 & 45 & 42 \\  & 3 & 6 & 9 & 12 & 15 & 18 \\ \hline \multirow{2}{*}{transistor} & 202 & 192 & 181 & 170 & 160 & 149 \\  & 11 & 21 & 32 & **43** & **53** & **64** \\ \hline \multirow{2}{*}{wood} & 235 & 222 & 210 & 198 & 185 & 173 \\  & 12 & 25 & 37 & 49 & **62** & **74** \\ \hline \multirow{2}{*}{zipper} & 228 & 216 & 204 & 192 & 180 & 168 \\  & 12 & 24 & 36 & 48 & 60 & 72 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Components of the dirty MVTec dataset. The upper row is the number of normal samples and the lower row is the number of anomaly samples. The bolded font means that the number of the anomaly samples in the test set were insufficient and we used data augmentation for them.