# Comparison of Manual and Automated Capillary Morphometry Measurements in Oral Mucosa: A Pilot Study
## 2 Materials and Methods
### Automated Method  
The automated method for capillary analysis was based on a neural network trained at the University of Palermo. The neural network was designed to identify and measure capillary structures in the videocapillaroscopy images, with a focus on three key parameters: capillary caliber, length, and density. The software used for the automated analysis was developed using a deep learning framework and was trained on a dataset of manually annotated capillary images to ensure accuracy. The neural network was optimized to handle variations in image quality and capillary morphology, making it suitable for use in clinical and research settings.  
Starting with the videos acquired by the medical specialists involved in this work, our dataset was generated from 10 frames drawn randomly from each video and at least one second apart to ensure adequate differences. The processing pipeline was created by the co-authored group of computer scientists and is based mostly on consolidated public domain techniques.  
Avoiding capillaries close to the edges of each frame, the software elaborated all remaining vessels. Apart from choosing the above features useful for pathology detection and comparing automatic and manual results, we conveniently avoided further collaboration between these two groups of researchers so as not to influence the development and validation of the proposed methodology.  
Labeling was performed manually using the LabelMe 5.8.1 software developed by MIT [17]. In particular, each vessel was associated with a sequence of dots starting at one end of the vessel and ending at the other. These dots were located to follow the perceived path of blood within the vessel itself and then joined together by interpolation.  
Subsequent segmentation, formatted in the Common Objects in COntext developed by Microsoft ([PERSON], WA, USA) [18], was achieved through the deep learning framework Detectron2 developed by Meta AI Research (Figure 3) [19]. The choice of Detectron2 is due to its high scalability across a wide range of CPUs and GPUs. This approach makes use of a backbone network to extract image features and a region proposal network module to generate a set of regions of interest within each frame. The components inside the regions of interest are then classified through a SoftMax function in PyTorch 2.7.0 developed by the Linux Foundation [20]. Mathematical morphology by means of OpenCV 4.11.0 [21] is used on just identified single capillaries to smooth their contours, removing any small protuberances. The ellipse that best approximates the appearance of each capillary is useful for calculating the elongation and direction. Finally, the maximum value of the transformed distance orthogonal to the direction of the capillary provides the caliber measurement.  
Considering that the dataset is well balanced in its classes and the great diversity in the available videos that show various real pathologies, we did not find it necessary to implement data augmentation. The dataset was divided into 70% for training and the remaining 30% for validation.