# YOLO Model-Based Eye Movement Detection During Closed-Eye State
## 2 Theory
### Evaluation Indicators  
In order to quantitatively measure and evaluate the performance of the algorithm model, a series of indicators were used in the paper, including precision (P), recall (R), F1 score, intersection over union (IoU), confidence score, and average precision (AP) [37].  
Figure 2: YOLOv11’s network architecture.  
IoU was used to determine the degree of overlap between the predicted bounding box and the ground truth bounding box. The formula for its calculation is shown in Equation (1):  
\[\text{IoU}=\frac{\text{S}_{\text{P}}\cap\text{S}_{\text{R}}}{\text{S}_{\text{P}} \cup\text{S}_{\text{R}}} \tag{1}\]  
where S\({}_{\text{P}}\) is the area of the predicted bounding box and S\({}_{\text{R}}\) is the area of the ground truth bounding box. \(\cap\) denotes intersection, and \(\cup\) denotes concatenation.  
In object detection, a predicted bounding box is considered a true positive (TP) if its IoU with a ground truth box exceeds a set threshold (commonly 0.5) and the class prediction matches the ground truth class. A predicted box is deemed a false positive (FP) if it does not achieve the required IoU with any ground truth box or does so with an incorrect class. Conversely, a ground truth box is classified as a false negative (FN) if no predicted boxes overlap sufficiently with it, indicating a missed detection.  
Precision (P) is the proportion of true positive samples in the bounding boxes that are predicted by the model as positive samples. The formula for its calculation is shown in Equation (2):  
\[\text{P}=\frac{\text{TP}}{\text{TP}+\text{FP}} \tag{2}\]  
Recall (R) is the ratio of the number of true positive predictions to the total number of actual samples, and the formula for its calculation is shown in Equation (3):  
\[\text{R}=\frac{\text{TP}}{\text{TP}+\text{FN}} \tag{3}\]  
The F1 score is the reconciled average of precision and recall, which is used for balancing the two, and is particularly applicable to the scenario of sample imbalance. Its calculation method is outlined in Equation (4):  
\[\text{F1 Score}=2\times\frac{\text{P}\times\text{R}}{\text{P}+\text{R}} \tag{4}\]  
The confidence score indicates the level of confidence that the model contains the target object in the predicted bounding box. It is used to filter the detection results with a low level of confidence in order to reduce the false detection rate.  
Average precision (AP) is the mean of precision values across different recall levels, obtained by averaging the precision at each recall level where the recall changes. The formula for its calculation is shown in Equation (5):  
\[\text{AP}=\int_{0}^{1}\text{P}(\text{R})\text{dR} \tag{5}\]  
The AP will change as the IoU threshold changes. AP0.5 refers to the AP of the detection model when the IOU threshold is set to 0.5.  
The mAP represents the weighted mean of the average precision (AP) values for each class. Its calculation method is outlined in Equation (6):  
\[\text{mAP}=\frac{1}{\text{N}}\sum_{i=1}^{\text{N}}\text{AP}_{i} \tag{6}\]  
where N stands for the total number of object classes. In our study, only one target was detected, which was the eye, N = 1, so mAP is equal to AP in our experiments.  
These indicators assess the performance of the model from different perspectives. In eye detection, the trained YOLO model can quickly and indirectly predict the location of the eyeball from the eyelid texture image and output the bounding box and confidence level.  
By choosing the appropriate confidence and IoU thresholds, we can determine a bounding box and then use the center of the bounding box as the eye position to draw the motion trajectory and complete the eye tracking. Based on the coordinates of the eye position in consecutive image frames, we can calculate three key parameters of eye movement: displacement, velocity vector, and trajectory direction. We adopted the resolution, frame rate, and mean displacement error for the tracking evaluation metrics.