# Improved Training of CAE-Based Defect Detectors Using Structural Noise
## 4 Experiments
### Experimental Settings
#### 4.1.1 Compositions of the Training/Test Datasets  
The sets of images we used were artificially generated with a drawing software. They are grayscale pictures of which dimensions are 256 \(\times\) 256 px with a resolution of 72 dpi. Originally, the values of the pixels ranged from 0 to 255, but they were normalized to range from 0 to 1. One triangle about 199 px wide and 75 px tall is drawn within each picture. Although detailed analysis were not performed, simple preliminary experiments were conducted on quadrilaterals and circles and resulted in observations similar to that of triangles. The breakdown of the dataset is shown in the Table 1, which shows the five categories and their variations.  
Two categories are considered \"regular\": spotless triangles (A)(1) and spotted triangles (A)(2). However, only one at a time can be used during the training phase of a model, the other is then considered \"defective\" during its testing phase. Additionally, some datasets ((B), (C), (D), (E)) are \"defective\", regardless of the data used to train the model and are always used for testing purposes. They are made of spotted triangles whose spots are generated depending on several parameters, such as: their size (B), position (C), color (D) and count (E), which result into 9 defect patterns. Only a few defects were simulated, as there are a lot of parameters to take into consideration, we had to narrow down our attention and decided to examine a limited number of flaws characterized by one abnormal parameter at a time, instead of combinations. Some examples are displayed in Figure 7.  
\begin{table}
\begin{tabular}{l l l} \hline \hline
**Category** & **Class** & **Parameter** \\ \hline \multirow{2}{*}{**(A)** Presence of a spot} & **(1)** Without a spot & - \\  & **(2)** With a spot & Spot radius r = 25 px \\ \hline \multirow{2}{*}{**(B)** Defective spot size} & **(1)** Small & Spot radius r = 12.5 px \\  & **(2)** Large & spot radius r = 37.5 px \\ \hline \multirow{3}{*}{**(C)** Defective spot position} & **(1)** Up & Spot position 25 px to the top \\  & **(2)** Down & Spot position 25 px to the bottom \\  & **(3)** Left & Spot position 25 px to the left \\  & **(4)** Right & Spot position 25 px to the right \\ \hline \multirow{2}{*}{**(D)** Defective spot color} & **(1)** Black & Spot color (r, g, b) = (0, 0, 0) \\ \hline \multirow{2}{*}{**(E)** Defective spot count} & **(1)** Two & 2 spots \\  & **(2)** Three & 3 spots \\ \hline \hline \end{tabular}
\end{table}
Table 1: Compositions of the training and test datasets.  
In real life conditions, during their inspection, the pieces are everywhere but rarely centred within the camera's field of vision. To simulate these misalignments, the triangles also underwent translations and rotations from time to time, as shown in Figure 8.  
For our experiments, two pairs of training/test datasets were formed:  
* a training dataset made of 800 regular spotless triangles (A)(1) and a test dataset mixing 2000 defective samples (200 of each other class in the Table 1, including (A)(2))
* a training dataset made of 800 regular spotted triangles (A)(2) and a test dataset mixing 2000 defective samples (200 of each other class in the Table 1, including (A)(1))