Hair transplantation root number calculation method and system based on YOLOv8 and AprilTag

CN122714532BActive Publication Date: 2026-10-23HEFEI BANGCE MEDICAL TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611223160.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-08-13
Publication Date
2026-10-23
Estimated Expiration
2046-08-13

AI Technical Summary

Technical Problem

[0005]本发明的目的在于克服现有技术中人工测算植发种植区域面积及根数存在的操作繁琐、效率低下、误差较大、主观性强的缺陷,提供一种基于YOLOv8和AprilTag的植发根数测算方法及系统,实现种植区域面积及植发根数的自动化、精准化测算,简化操作流程,提升测算效率和准确性,为植发术前规划提供可靠的技术支持

Benefits of technology

(1)本发明利用AprilTag定位标签建立图像像素尺寸与实际物理尺寸之间的换算关系,再结合识别得到的植发划线区域轮廓计算实际面积,无需人工进行塑料膜拓印和格子计数,因此能够减少人工操作中因轮廓偏移、漏计或多计所带来的误差,提高面积测算精度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122714532B_ABST
    Figure CN122714532B_ABST
Patent Text Reader

Abstract

The application provides a hair transplantation root number calculation method and system based on YOLOv8 and AprilTag, and relates to the technical fields of image processing and artificial intelligence. The method comprises the following steps: acquiring an image containing a patient's forehead area to be planted and an AprilTag positioning label, and preprocessing the image; using a trained YOLOv8 instance segmentation model to identify the hair transplantation area contour and output a mask image, and detecting the AprilTag positioning label and obtaining the corner point coordinates; calculating the conversion ratio between pixels and actual size according to the AprilTag positioning label, and combining the mask image to calculate the actual area of the planting area; correcting the area by using a random forest machine learning model; calculating the number of hair follicle units according to the hair transplantation density parameter, and displaying and storing the result. The application realizes automatic and accurate calculation of the hair transplantation area and the number of hair roots.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of image processing and artificial intelligence technology, and in particular to a method and system for calculating the number of hair transplanted roots based on YOLOv8 and AprilTag. Background Technology

[0002] In the field of hair transplantation, accurate pre-operative calculation of the transplant area and the number of hair follicles required is crucial for developing a hair transplant plan, controlling surgical costs, and ensuring surgical results. Currently, hair transplant clinics generally use manual methods for calculation. The procedure is as follows: First, the outline of the area to be transplanted on the patient's forehead is drawn with a pen. Then, a plastic film is placed over the drawn area, and the shape of the transplant area is traced onto the plastic film along the outline. The traced plastic film is then laid flat on a 1mm×1mm grid board, and the number of grids contained in the transplant area on the plastic film is manually counted to estimate the area of ​​the transplant area. Finally, combined with empirical hair transplant density, the number of hair follicles required to be transplanted is calculated.

[0003] The above-mentioned manual measurement method has many drawbacks: First, it is cumbersome to operate, involving multiple steps such as drawing lines, imprinting, and counting, which is time-consuming, inefficient, and increases the workload of medical staff; second, it has a large error margin, as outline deviation is prone to occur during manual imprinting, and omissions or overcounts are likely to occur when counting grids, and different operators have different counting habits, which is highly subjective and makes it difficult to guarantee the accuracy of the measurement results; third, it has poor flexibility and cannot adapt to individual differences in the forehead contours and hair distribution of different patients, resulting in low universality and applicability of the measurement results.

[0004] With the development of computer vision technology, the YOLO series instance segmentation models have been widely applied in various target recognition scenarios, boasting advantages such as fast recognition speed and high accuracy. AprilTag, as a visual positioning tag, can quickly obtain physical dimensions through image recognition, achieving precise size calibration. Currently, there is no technical solution combining the YOLOv8 model with AprilTag tags for calculating the area and number of hair transplantation grafts, failing to address the pain points of existing manual calculation methods. Therefore, developing an automated and accurate hair transplantation graft calculation solution has become an urgent need in the current hair transplantation medical field. Summary of the Invention

[0005] The purpose of this invention is to overcome the shortcomings of existing technologies, such as cumbersome operation, low efficiency, large errors, and strong subjectivity in manually calculating the area and number of hair transplantation roots. This invention provides a method and system for calculating the number of hair transplantation roots based on YOLOv8 and AprilTag, which realizes automated and accurate calculation of the area and number of hair transplantation roots, simplifies the operation process, improves the calculation efficiency and accuracy, and provides reliable technical support for preoperative planning of hair transplantation.

[0006] To achieve the above objectives, this invention proposes a method for calculating the number of hair transplanted roots based on YOLOv8 and AprilTag, comprising the following steps:

[0007] As a preferred solution, a Gaussian filter is used to perform noise reduction processing on the image; The automatic white balance correction process includes: converting the image to the LAB color space and performing histogram equalization on the luminance channel.

[0008] As a preferred embodiment, the YOLOv8 instance segmentation model includes a backbone network, a feature pyramid network, and a head network; The YOLOv8 instance segmentation model is used to output the mask image and confidence level corresponding to the hair transplanted area, and the recognition results that meet the preset confidence level conditions are taken as valid recognition results.

[0009] As a preferred embodiment, a feature enhancement module is introduced into the backbone network. The feature enhancement module enhances the features of the hair transplant marking area by combining a spatial attention mechanism and a channel attention mechanism. The feature pyramid network is used to fuse the multi-scale features output by the backbone network. The head network is used to output bounding box information, category information and mask information corresponding to the hair transplant marking area based on the fused features, so as to generate the mask map and confidence level corresponding to the hair transplant marking area.

[0010] As a preferred embodiment, the AprilTag location tag in the preprocessed image is detected, specifically including: Identify AprilTag location tags; Parse the encoded information of the AprilTag location tag; Get the coordinates of the four corner points of the AprilTag location tag.

[0011] As a preferred embodiment, the calculation of the actual area of ​​the area to be planted specifically includes: The pixel side length of the AprilTag location tag is calculated based on the coordinates of its four corner points. Calculate the conversion ratio between pixels and actual size based on the actual side length of the AprilTag positioning tag and the pixel side length; The pixel region corresponding to the outline of the hair transplantation marking area is determined based on the mask image; The initial actual area of ​​the area to be planted is calculated based on the conversion ratio and the pixel area. The initial actual area is input into the trained random forest machine learning model to correct the initial actual area and output the final actual area of ​​the planting area.

[0012] As a preferred embodiment, the random forest machine learning model is trained using the initial actual area as input and the actual area of ​​the head planting region as output.

[0013] As a preferred embodiment, the calculation of the number of hair follicle units for hair transplantation specifically includes: Obtain preset hair transplant density parameters or user-input hair transplant density parameters; The number of hair follicle units to be transplanted is calculated based on the actual area of ​​the final planting area and the hair transplant density parameters.

[0014] As a preferred embodiment, the storage and display of the planting area and the corresponding calculation results specifically includes: The system displays the outline of the hair transplant area, the location of the AprilTag positioning tag, the actual area, the hair transplant density parameters, the number of hair follicle units transplanted, and the error range, and stores and exports the calculation results.

[0015] Furthermore, this invention also proposes a hair transplant root count calculation system, which can execute the aforementioned hair transplant root count calculation method based on YOLOv8 and AprilTag. This hair transplant root count calculation system includes: The image acquisition module is used to acquire images containing the outline of the area to be implanted on the patient's forehead and the AprilTag positioning label; The image preprocessing module is used to perform noise reduction and automatic white balance correction on the image to obtain a preprocessed image; The contour recognition module is used to identify the contour of the hair transplantation marking area from the preprocessed image based on the trained YOLOv8 instance segmentation model and output the corresponding mask image. The AprilTag detection and calibration module is used to detect AprilTag positioning tags from the preprocessed image and output corner coordinates, as well as calculate the conversion ratio between pixels and actual size. An area conversion module is used to calculate the actual area of ​​the area to be planted based on the mask image and the conversion ratio. The hair follicle count calculation module is used to calculate the number of hair follicle units to be transplanted based on the actual area and the preset hair transplant density parameters. The results display and export module stores and displays the planting area and the corresponding calculation results.

[0016] Compared with the prior art, the present invention has the following beneficial effects: (1) This invention uses AprilTag positioning tags to establish the conversion relationship between image pixel size and actual physical size, and then combines the identified hair transplant line area outline to calculate the actual area. There is no need for manual plastic film imprinting and grid counting, so it can reduce the error caused by outline offset, omission or over-counting in manual operation and improve the accuracy of area calculation.

[0017] (2) Since the head region is not a planar structure, the present invention further uses a random forest machine learning model to correct the initial actual area. By establishing a correspondence between the initial area and the actual area of ​​the head planting region, the measurement deviation caused by curvature factors is corrected, thereby improving the accuracy of the final planting area calculation result.

[0018] (3) The present invention calculates the number of hair follicle units based on the actual area of ​​the planting area and the hair density parameters. It also supports the use of preset hair density parameters or parameter settings according to the patient's condition. Therefore, it can adapt to the hair conditions of different patients and improve the applicability of the hair transplant number calculation results. Attached Figure Description

[0019] Figure 1 This is a flowchart illustrating the hair transplant root number calculation method of the present invention.

[0020] Figure 2 This is a schematic diagram of the YOLOv8 planting area detection module. Detailed Implementation

[0021] In the following description, numerous specific details are set forth in order to provide a more thorough understanding of the invention. However, it will be apparent to those skilled in the art that the invention can be practiced without one or more of these details. In other instances, certain technical features well-known in the art have not been described in order to avoid obscuring the invention.

[0022] Example 1 This embodiment discloses a hair transplant root count calculation system based on YOLOv8 and AprilTag. The system consists of an image acquisition module, an image preprocessing module, a contour recognition module, an AprilTag detection and calibration module, an area conversion module, a hair transplant root count calculation module, and a result display and export module. These modules work collaboratively to automate the calculation of the number of hair transplant roots. Specific functions are as follows: Image acquisition module: Used to receive images uploaded by users. These images must include the outline of the area to be implanted on the patient's forehead and an AprilTag location tag. It supports importing mainstream image formats such as JPG and PNG, and also has image storage capabilities for easy retrieval and reuse. Users can easily upload images by taking pictures with their mobile phones or cameras.

[0023] Image preprocessing module: Responsible for preprocessing uploaded images, eliminating external interference, improving image quality, and laying the foundation for subsequent target recognition and size conversion. Specifically, it includes three steps: First, Gaussian noise reduction, using a 3×3 Gaussian filter to smooth the image, eliminating noise generated during image capture and preventing noise from affecting target recognition accuracy; second, automatic white balance correction, converting the image to the LAB color space and performing histogram equalization on the brightness channel to solve the color cast problem caused by uneven shooting light, ensuring that skin texture, outlines, and AprilTag tags are clearly visible. Contour Recognition Module: Based on the YOLOv8 instance segmentation model, this is one of the core modules of this invention. The core function of this module is to recognize the outlines of drawn lines in images—specifically, the outlines of hair transplantation areas. To improve recognition accuracy, especially for subtle hair transplantation outlines, the YOLOv8 model was optimized by introducing a feature enhancement module into its backbone network. This module combines spatial and channel-wise attention mechanisms to enhance the model's sensitivity to key features of the outlines and reduce the influence of interference factors such as skin texture, hair, and lighting changes. After training on a large number of sample images labeled with hair transplantation areas, the model can quickly output the image mask and confidence level of the outlines. Recognition results with a confidence level of 0.7 are selected as valid data to ensure the reliability of the recognition results.

[0024] The AprilTag detection and calibration module uses the AprilTag visual calibration algorithm to detect calibration markers in images; it determines the pixel coordinates of the four corner points of the marker by parsing the AprilTag encoding information; and it calculates the pixel-to-actual-size conversion factor based on the correspondence between the actual physical size of the marker and the pixel size in the image. The specific calculation method is as follows: the conversion factor is equal to the actual side length of the AprilTag marker divided by the pixel distance between the detected corner points of the marker.

[0025] Area conversion module: This module converts image pixels to actual physical dimensions to calculate the actual area of ​​the planting region. Its core principle is to use the conversion ratio obtained from the AprilTag detection and calibration module, combined with the hair transplant area outline coordinates output by the target recognition module, to calculate the actual area of ​​the planting region (unit: cm²) through integral calculations or pixel statistics. This method requires no manual intervention, provides accurate size conversion, and effectively avoids errors caused by manual tracing and counting.

[0026] Hair Root Count Calculation Module: This module calculates the required number of hair roots to be transplanted based on the actual area and density of the transplantation area. It presets an industry-standard hair transplantation density range (50-60 roots / cm²) and allows users to customize density parameters according to the patient's hair condition and surgical needs. The calculation process is as follows: Hair Root Count = Actual Area of ​​Transplantation Area × Hair Transplantation Density. Simultaneously, a trained random forest machine learning model is used to predict the final area based on the curvature of the forehead. The final output includes the area of ​​the transplantation area, the density parameters used, the number of hair roots transplanted, and the error range.

[0027] The results display and export module visually displays the outline of the identified planting area and the location of the AprilTag tag, while also showing the calculated planting area, hair density, number of hair roots, and error range, making it easy for users to view intuitively. It also supports exporting the calculation results to document formats such as Word and Excel, which is convenient for hair transplant institutions to retain the calculation data and develop surgical plans.

[0028] Example 2 like Figure 1 As shown in the figure, this embodiment proposes a method for calculating the number of hair transplant roots based on YOLOv8 and AprilTag. The specific steps are as follows: Step S1: Image acquisition and upload.

[0029] Step S2, image preprocessing.

[0030] Step S3: Input the preprocessed image into the trained Yolov8 model to obtain the corresponding mask image. Then, use the AprilTag detector to obtain the coordinates of the four vertices of the AprilTag label.

[0031] Step S4: Calculate the actual length of a pixel based on the average pixel side length and the actual side length of AprilTag, and then calculate the actual planting area of ​​the drawn area based on the actual length of the pixel.

[0032] Step S5: Calculate the actual number of hair follicle units to be implanted based on the set hair follicle density parameters.

[0033] Step S6: Display and store the identified lined areas and the corresponding number of hair follicles to facilitate the creation of subsequent surgical plans.

[0034] In a further embodiment, step S1 is specifically performed as follows: Step S1.1: Medical staff use their mobile phones to take an image of the patient's forehead. The image must include the outline of the area to be implanted and the AprilTag positioning tag. (The AprilTag tag is placed near the outlined area on the forehead, ensuring that the marker and the implantation area are on the same focal plane to reduce measurement errors caused by changes in depth of field.) After taking the picture, the image is uploaded through the system's image acquisition module in JPG format. The image acquisition module stores the image in a local database for later retrieval.

[0035] In a further embodiment, step S2 is specifically performed as follows: Step S2.1, the image preprocessing module preprocesses the uploaded image: First, a 3×3 Gaussian filter is used for Gaussian noise reduction to eliminate noise in the image. The core formula of Gaussian filtering is shown in formula (1). The image pixels are smoothed by this formula to suppress noise interference. Then, the image is converted to LAB color space and the brightness channel (L channel), red-green difference channel (A channel) and blue-yellow difference channel (B channel) are separated. Histogram equalization is performed on the L channel to achieve automatic white balance correction and solve the problem of image color cast caused by uneven shooting light. The core formula of histogram equalization is shown in formula (2).

[0036]

[0037] in, Gaussian filter in coordinate The filter weights at the point, The standard deviation is Gaussian (1.0 in this example). These are the center coordinates of the Gaussian filter.

[0038]

[0039] in For the equalization of the first The cumulative probability corresponding to each gray level Let N be the number of pixels at gray level i, N be the total number of pixels in the image, and L be the gray level set (L=256 in this embodiment).

[0040] In a further embodiment, step S3 is specifically performed as follows: Step S3.1: Input the preprocessed image into the trained and optimized YOLOv8 instance segmentation model. The model identifies the contour of the hair transplanted area in the image and outputs the mask image and confidence score of the area. (See attached image.) Figure 2As shown, the Yolov8 model's network structure mainly consists of three parts: the Backbone, PAFPN (Panoptic Feature Pyramid Network), and the Head. When the input image is 1... 640 At 640, the trained Yolov8 network will have two outputs: (1, 38, 8400) and (1, 32, 160, 160), denoted as... and .in The first parameter represents BatchSize, which is the number of images. The second parameter represents the coordinates of 4 boxes, 2 categories, and 32 mask weights. This parameter represents the output mask image. The first parameter is `BatchSize`, which is the number of images. The second parameter is the prototype of the mask, and the third parameter is the actual size of the mask image. The actual mask image requires mask weights. The mask is obtained as shown in formula (3).

[0041]

[0042] in For the true mask image in coordinates Pixel value at that location, for The output of the i-th mask weight, for The output i-th mask prototype is at coordinates The pixel value at that location.

[0043] In this embodiment, the recognition confidence level of the hair transplant marking area is 95%, and all meet the screening condition of ≥70%, thus being considered valid recognition results. The colored closed curve in the recognition results represents the outline of the hair transplant marking area. Simultaneously, the AprilTag label is recognized using the AprilTag detector, and its four vertex coordinates are output. , , , This is used for subsequent dimension calculations.

[0044] In a further embodiment, step S4 is specifically performed as follows: Step S4.1, the area conversion module first obtains the preset actual side length of the AprilTag label. Then, using the coordinates of the four corners of the AprilTag tag, the pixel side lengths of its four sides are calculated based on the Euclidean distance formula (4), and the average pixel side length is obtained by taking the average value. (In this embodiment) (pixels); then calculate the conversion ratio k between pixels and actual physical size, as shown in formula (5); then, based on the contour coordinates of the hair transplant area, use the pixel statistics method to count the number of pixels in the mask image whose pixel value is greater than the threshold (the threshold is 0.5 in this embodiment). (In this embodiment) (pixels and 22690 pixels), combined with the conversion ratio to calculate the initial actual area of ​​the planting area. The formula is shown in (6).

[0045]

[0046] in, The pixel distance between the i-th and j-th vertices of the AprilTag tag (i, j = 1, 2, 3, 4, i ≠ j, and they are adjacent vertices).

[0047]

[0048] Where k is the pixel conversion ratio (unit: mm / pixel), calculated in this embodiment. .

[0049]

[0050] In this embodiment, the initial actual area is calculated as follows: ; .

[0051] Step S4.2: Because the head is not a flat plane, a curvature parameter is added to ensure the accuracy of the results. 2000 head images are divided into training, testing, and validation sets in an 8:1:1 ratio, using the initial area calculated in step S4.1. As input to the training set, the actual area of ​​the head implantation region obtained through high-precision 3D scanning is used. As output, a random forest machine learning model is trained, and the loss function of the model is the mean squared error (MSE), as shown in Equation (7):

[0052] Where M is the number of samples in the training set. This represents the predicted area of ​​the m-th sample in the model. This is the true area of ​​the m-th sample. In this embodiment, the initial area calculated in step S4.1 is used... , Input the trained random forest model to obtain the final corrected actual area of ​​the planting region. , .

[0053] In a further embodiment, step S5 is specifically performed as follows: Step S5.1: The hair follicle count calculation module calls the preset hair transplant density parameter (55 hairs / cm² in this embodiment) to calculate the number of hair follicle units transplanted. , .

[0054] In a further embodiment, step S6 is specifically performed as follows: Step S6.1, Result Display and Storage: Module 6 displays the calculation results in a visual manner, showing the outline of the planting area, the location of the AprilTag tag, and the actual area of ​​the planting area (11.52 cm²). 2 and 10.17cm 2 The hair transplant density used (55 FU / cm²) 2 The number of hair follicle units transplanted (634 and 559). This data is retained for developing a hair transplant surgery plan.

[0055] In this embodiment, the training process of the YOLOv8 model is as follows: 2000 sample images containing the hair transplant area on the forehead are collected, covering images of different ages (20-50 years old), different forehead contours (wide forehead, narrow forehead, round forehead), and different lighting conditions (natural light, indoor lighting); the sample images are labeled, and the outline of the hair transplant area is labeled as an area using the Labelme tool, and the training set is divided into 1400 images, the validation set is 400 images, and the test set is 200 images; the YOLOv8 model is initialized, with a learning rate of 0.001, a batch size of 16, and 150 training rounds; the training set is input into the model for training, and the model parameters are adjusted in real time through the validation set. A feature enhancement module (combining spatial attention mechanism and channel attention mechanism) is introduced to improve the recognition accuracy. The core formula of the spatial attention mechanism is shown in (8), and the core formula of the channel attention mechanism is shown in (9); after training, the model performance is verified through the test set, and the model's recognition accuracy for the hair transplant area is... To meet the needs of practical applications.

[0056]

[0057] in, coordinates Spatial attention weights at the location, These are the spatial feature weight values.

[0058]

[0059] in, Let c be the channel attention weight. These are the channel feature weight values.

[0060] The logical ideas behind the methods disclosed in the above embodiments can be implemented, in whole or in part, through software, hardware, firmware, or any other combination thereof. When implemented in software, the above embodiments can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions or computer programs.

[0061] When computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions according to the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. Computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more sets of available media. Available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media. Semiconductor media can be solid-state drives (SSDs).

[0062] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0063] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0064] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0065] The preferred embodiments of the present invention disclosed above are merely illustrative of the invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the invention to any specific implementation. Clearly, many modifications and variations can be made based on the content of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, thereby enabling those skilled in the art to better understand and utilize the invention. The invention is limited only by the claims and their full scope and equivalents.

Claims

1. A method for calculating the number of hair transplanted roots based on YOLOv8 and AprilTag, characterized in that, Includes the following steps: Acquire an image containing the outline of the area to be implanted on the patient's forehead and the AprilTag location tag; The image is subjected to noise reduction and automatic white balance correction to obtain a preprocessed image; The preprocessed image is input into the trained YOLOv8 instance segmentation model to identify the outline of the hair transplantation marking area and output the corresponding mask image. At the same time, the AprilTag positioning labels in the preprocessed image are detected and the corner coordinates of the AprilTag positioning labels are output. Based on the corner coordinates of the AprilTag positioning tag and the actual size information of the AprilTag positioning tag, the conversion ratio between pixels and actual size is calculated, and the actual area of ​​the planting area is calculated in combination with the mask image. The number of hair follicle units to be transplanted is calculated based on the actual area and the preset hair transplant density parameters. Store and display the planting area and the corresponding calculation results.

2. The method for calculating the number of hair transplanted roots based on YOLOv8 and AprilTag according to claim 1, characterized in that, The image is denoised using a Gaussian filter. The automatic white balance correction process includes: converting the image to the LAB color space and performing histogram equalization on the luminance channel.

3. The method for calculating the number of hair transplanted roots based on YOLOv8 and AprilTag according to claim 1, characterized in that, The YOLOv8 instance segmentation model includes a backbone network, a feature pyramid network, and a head network. The YOLOv8 instance segmentation model is used to output the mask image and confidence level corresponding to the hair transplanted area, and the recognition results that meet the preset confidence level conditions are taken as valid recognition results.

4. The method for calculating the number of hair transplanted roots based on YOLOv8 and AprilTag according to claim 3, characterized in that, A feature enhancement module is introduced into the backbone network. The feature enhancement module enhances the features of the hair transplant marking area by combining a spatial attention mechanism and a channel attention mechanism. The feature pyramid network is used to fuse the multi-scale features output by the backbone network. The head network is used to output bounding box information, category information and mask information corresponding to the hair transplant marking area based on the fused features, so as to generate the mask map and confidence level corresponding to the hair transplant marking area.

5. The method for calculating the number of hair transplanted roots based on YOLOv8 and AprilTag according to claim 1, characterized in that, The detection of AprilTag location tags in the preprocessed image specifically includes: Identify AprilTag location tags; Parse the encoded information of the AprilTag location tag; Get the coordinates of the four corner points of the AprilTag location tag.

6. The method for calculating the number of hair transplanted roots based on YOLOv8 and AprilTag according to claim 1, characterized in that, The calculation of the actual area of ​​the area to be planted specifically includes: The pixel side length of the AprilTag location tag is calculated based on the coordinates of its four corner points. Calculate the conversion ratio between pixels and actual size based on the actual side length of the AprilTag positioning tag and the pixel side length; The pixel region corresponding to the outline of the hair transplantation marking area is determined based on the mask image; The initial actual area of ​​the area to be planted is calculated based on the conversion ratio and the pixel area. The initial actual area is input into the trained random forest machine learning model to correct the initial actual area and output the final actual area of ​​the planting area.

7. The method for calculating the number of hair transplanted roots based on YOLOv8 and AprilTag according to claim 6, characterized in that, The random forest machine learning model is trained using the initial actual area as input and the actual area of ​​the head planting region as output.

8. The method for calculating the number of hair transplanted roots based on YOLOv8 and AprilTag according to claim 6, characterized in that, The calculation of the number of hair follicle units for hair transplantation specifically includes: Obtain preset hair transplant density parameters or user-input hair transplant density parameters; The number of hair follicle units to be transplanted is calculated based on the actual area of ​​the final planting area and the hair transplant density parameters.

9. The method for calculating the number of hair transplanted roots based on YOLOv8 and AprilTag according to claim 1, characterized in that, The storage and display of the planting area and the corresponding calculation results specifically include: The system displays the outline of the hair transplant area, the location of the AprilTag positioning tag, the actual area, the hair transplant density parameters, the number of hair follicle units transplanted, and the error range, and stores and exports the calculation results.

10. A hair transplant root count calculation system, used to execute the hair transplant root count calculation method based on YOLOv8 and AprilTag as described in any one of claims 1 to 9, characterized in that, The hair transplant root count calculation system includes: The image acquisition module is used to acquire images containing the outline of the area to be implanted on the patient's forehead and the AprilTag positioning label; The image preprocessing module is used to perform noise reduction and automatic white balance correction on the image to obtain a preprocessed image; The contour recognition module is used to identify the contour of the hair transplantation marking area from the preprocessed image based on the trained YOLOv8 instance segmentation model and output the corresponding mask image. The AprilTag detection and calibration module is used to detect AprilTag positioning tags from the preprocessed image and output corner coordinates, as well as calculate the conversion ratio between pixels and actual size. An area conversion module is used to calculate the actual area of ​​the area to be planted based on the mask image and the conversion ratio. The hair follicle count calculation module is used to calculate the number of hair follicle units to be transplanted based on the actual area and the preset hair transplant density parameters. The results display and export module stores and displays the planting area and the corresponding calculation results.

Citation Information

Patent Citations

  • Hair transplanting density determination method and system based on intelligent comparison

    CN113100937A

  • Intelligent hair transplantation evaluation system based on image analysis

    CN116705336A