## 6 OOD-Mask Detection Framework
### Experiments & Results
#### 6.4.3 Experiment on OOD-Mask Detection Framework  
The third experiment was based on the framework combining the YOLOX detection head and OOD-Mask, which used the energy function to score the results without reducing the performance of wearing mask and without mask. It separated the OOD data from the ID to a greater extent, so the distinction effect of the OOD could be improved. We used both energy score and sigmoid score in OOD-Mask and changed the range of the energy score by adjusting the value of T in the energy function, as shown in Figure 8. A comparable classification performance could be achieved at a low cost. When T equaled 30, the energy score range was between 14 and 22. When we observed the energy score distributions of three classes, setting the threshold to 18.3 provided a greater degree of discrimination between abnormal and normal classes. Therefore, after many experiments, we selected an energy score of between 18.3 and 22 as the OOD, and the rest were divided into the ID. The wearing mask and without mask classes in ID were still classified using the sigmoid function. Figure 8: Class distributions corresponding to different T values: (**a**). When T equals 1, the overlap of three distributions makes it challenging to extract the incorrect mask-wearing class. (**b**). When T is set to 10, the peak of incorrect mask-wearing distribution can be clearly distinguished from other classes (wearing mask and without mask). (**c**). When T is set to 30, the distinction effect is further improved. (**d**). When the value of T is greater than or equal to 30, the distribution of the three classes changes little. The energy scores increase with the value of T, but the range of score still remains within 10. It was shown that the results of this method's F1-score improved by 24.51% over the results of the second experiment. Compared with the previous experiment, the values of precision and recall improved by 13% and 28%, respectively, as shown in the third row of Table 5. Besides, the performance of both wearing mask and without mask was comparable. Under the same condition as in the second experiment that only two classes (wearing mask and without mask) of data were input into the training process, without any data support for the third class of incorrect mask-wearing, the improvement in the detection performance of the third class was considerable. However, since there was no training data for the third class, the performance still had room for further improvement. Therefore, new OOD-related variants remain to be discovered. Furthermore, to assess the performance of experiments 2 and 3 more thoroughly, we classified wearing mask and without mask as in-distribution (positive class) and incorrect mask-wearing as out-of-distribution (negative class). The receiver operating characteristic (_ROC_) curve is a performance measure for classification problems under various threshold settings, where the \(y\)-axis is \(TPR\) and the \(x\)-axis is \(FPR\), and area under curve (_AUC_) is the area under the _ROC_ curve, indicating the degree or measure of separability. Since some targets were not recognized by the network due to being too small or inconspicuous features, the \(TPR\) and \(FPR\) values could not reach 1.0. For the _AUC_ value, 53.43% in experiment 3 was higher than 45.80% in experiment 2. By observing the _ROC_ of the two experiments in Figure 9, it was shown that the classification performance of using the energy score was more excellent and obvious than only using the sigmoid score. When we took the same \(FPR\) value of between 0.2 and 1.0, the value of \(TPR\) in the energy score was consistently higher than in the sigmoid score. In order to test the speed performance, we divided all images in the testing set by the whole processing time and used the frame per second (FPS) as the evaluation metric. The test dataset contained a total of 235 images. As shown in Table 6, the frame rate of the three experiments reached 76.18, 65.68 and 64.51 FPS, respectively.