## 2 Materials and Methods  
Seventy hands with no clinical signs of CTS and normal NCS results (control group) and 70 hands affected by CTS who underwent surgery for CTS (CTS group) were included. Out of a total of 140 hands, 100 hands (50 hands in each group) were used to build the machine learning model. The videos of the remaining 40 hands (20 hands in each group) were used to analyze the MN's dynamics. Patients with a history of traumatic injury or wrist surgery to the affected wrist, rheumatoid arthritis, or osteoarthritis of the wrist were excluded. The sample size of MN dynamics analysis was determined based on a careful power analysis using the results of the overall standardized mean difference (SMD) of MN transverse displacement from a pilot study [31] using G*Power 3.1. Preliminary sample size calculations indicated that a sample of 28 participants (14 in each group) was sufficient to detect differences in MN displacement between the two groups using a \(t\)-test (effect size = 1.612, \(\alpha\) = 0.01, power = 0.95). The diagnosis of CTS was based on a physical examination and NCS. The severity of CTS was graded according to the NCS report [35], resulting in five distinct stages. Stage 1 denotes the normal sensory nerve conduction velocity (SNCV) and distal motor latency (DML). Stage 2 is characterized by a normal SNCV along with a DML greater than 4.5 ms. Stage 3 includes conditions in which the SNCV is less than 40 m/s; the DML exceeds 4.5 ms. Stage 4 is identified by the absence of a sensory response accompanied by a DML greater than 4.5 ms. Finally, stage 5 represents the complete absence of both SNCV and DML responses. The CTS group included only patients classified as stage 2 or higher. Healthy volunteers were included in the control group, along with patients with stage 1 NCS results. The identification of the MN on short-axis US images was performed just proximal to the carpal tunnel at the wrist crease using an 18 MHz linear probe (Canon APLIO300, Canon Medical Systems, Tochigi, Japan) (Figure 1). The participants actively moved their five fingers from full extension to full flexion (until the fingertips touched the palm) at a metronomic rhythm of 60 cycles per minute in a dorsiflexion neutral position. The recordings, taken at a rate of 30 frames per second, were then cropped to produce a 4 s video. An experienced hand surgeon performed both CTS diagnosis and US imaging. We constructed a model to detect normal MN or CTS using YOLOv5, an object detection algorithm model originally developed by [PERSON] [32]. We used 5000 US images containing MN data extracted from 50 hands without CTS and 50 hands with CTS as our basic input data, which were different from the 40 hands used for MN analysis. The amount of data used for training was increased by adding noise to the existing images to compensate for the lack of sample size. This is a common practice in machine learning [36; 37]. The CTS detection model was meticulously trained to anticipate and delineate bounding boxes around the MN while simultaneously determining the precise coordinates of the MN (Figure 2). The following software and hardware orchestration was used during the training phase: Ultralytics/YOLOv5, Python-3.7.0, PyTorch-1.7 GPU, and NVIDIA GeForce RTX 3050 laptop GPU. In particular, a stochastic allocation method allocated 80% of the US images to serve as our training dataset, with the remaining 20% reserved for testing purposes. For the object detection task, the YOLOv5 model (parameter size 1.8 M) was used. The hyperparameters were Ir0: 0.01, Irf: 0.01, momentum: 0.937, weight_decay: 0.0005, warmup_epochs: 3.0, warmup_momentum: 0.8, warmup_bias_lr: 0.1, box: 0.05, cls: 0.5, cls_pw: 1.0, obj: 1.0, obj_pw: 1.0, anchor_t: 4.0. Transfer learning was performed using the pre-trained weights from YOLOv5 with the US images and the label information of the bounding boxes as the input data. An MN detection task was performed.