# YOLO-OHFD: A YOLO-Based Oriented Hair Follicle Detection Method for Robotic Hair Transplantation
## 3 Experiments
### Experimental Setup
#### 3.1.3 Performance Evaluation  
To quantitatively assess the algorithm's effectiveness, we employ specific performance metrics such as AP, mAP, and FPS, which are pivotal for evaluating both accuracy and efficiency [36; 37].  
In order to comprehensively evaluate the performance of YOLO-OHFD, we set up evaluation indicators in terms of the detection accuracy and detection efficiency of the algorithm.  
First, AP and mAP are used to quantitatively evaluate the detection accuracy of our proposed algorithm. AP measures the detection accuracy of the algorithm for each type of hair follicle, mAP measures the overall detection performance of the algorithm by calculating the average of the APs of all categories of hair follicles, and FPS measures the detection efficiency of the algorithm. The formulae for AP and mAP are shown in Equations (10)-(13).  
\[precision=\frac{TP}{TP+FP} \tag{10}\]  
\[recall=\frac{TP}{TP+FN} \tag{11}\]  
\[AP=\int_{0}^{1}P(R)dR \tag{12}\]  
\[mAP=\frac{1}{m}\sum_{i=1}^{m}AP_{i} \tag{13}\]  
where TP, FP and FN represent True Positive, False Negative, and False Negative, respectively. P represents precision and R represents recall. m is the number of hair follicle classifications.  
However, in order to efficiently characterize hair follicles with large aspect ratios, we use OBB instead of HBB. In the HBB detection, TP and FP are determined only by EIoU. When Equation (14) is satisfied, the sample is defined as TP, otherwise it is defined as FP. However, in the oriented hair follicle detection, the rotation angle also affects the accuracy of hair follicle localization. Therefore, we add an angle constraint on the basis of EIoU, as shown in Equation (15). When both Equations (14) and (15) are satisfied, the sample is defined as TP; otherwise, it is defined as FP.  
\[\frac{\left|g\cap g^{gt}\right|}{\left|g\cup g^{gt}\right|}>EIoU_{Thr} \tag{14}\]  
\[g_{\theta}-g_{\theta}^{gt}\leq\theta_{Thr} \tag{15}\]  
where g and ggt are the predicted box and ground truth box. g\({}_{\theta}\) and ggt are the angle of the predicted box and ground truth box. EIoU\({}_{Thr}\) and \(\theta_{Thr}\) are the threshold of EIoU and angle.  
In addition, the AP in the experiments of this paper is [EMAIL_ADDRESS]:0.95, which indicates the average of the corresponding APs for different EIoU\({}_{Thr}\) (0.5 to 0.95 in steps of 0.05). mAP is also [EMAIL_ADDRESS]:0.95.  
As shown in Figure 9, boxes with different aspect ratios have different sensitivities to the rotation angle. The aspect ratios are larger for follicles with fewer hairs, and the angular error has a significant impact on IoU, so the \(\theta_{Thr}\) should be set smaller. Conversely, for follicles with more hairs, which have a relatively smaller aspect ratio, it is advisable to increase the value of \(\theta_{Thr}\) appropriately. So \(\theta_{Thr}\) is set according to the aspect ratio of different types of hair follicles.  
Then, frames per second (PFS), floating point operation per second (FLOPs), parameters (Paras), and mean inference time (MIT) are used to quantitatively evaluate the detection efficiency of our proposed algorithm. FPS measures the model's ability to process images in real time, reflecting its practical applicability in time-sensitive scenarios. FLOPs provides an estimate of the computational complexity of the model, indicating the amount of processing power required. Paras represents the size of the model, which directly impacts memory usage and deployment feasibility. Lastly, MIT assesses the average time the model takes to process a single image, offering insights into the model's overall speed and responsiveness. In experiments, FPS is utilized to identify the optimal balance between accuracy and computational cost for each module in the ablation experiment. Finally, by combining FLOPs, parameters, and MIT, the proposed model is compared with other object detection methods in terms of time complexity, space complexity, and real-time processing ability.