A medical instrument part counting system based on YOLOv8 model

The medical device parts counting system based on the YOLOv8 model solves the problem of low efficiency and error-prone manual counting of nails in the production of medical nail boxes. It achieves efficient and accurate parts counting and anomaly feedback, adapts to the testing needs of different types of medical device parts, and reduces human error and cost.

CN122199463APending Publication Date: 2026-06-12SINOPHARM JIENUO MEDICAL SERVICE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SINOPHARM JIENUO MEDICAL SERVICE CO LTD
Filing Date
2026-03-12
Publication Date
2026-06-12

AI Technical Summary

Technical Problem

In the production and packaging process of medical nail boxes, the accuracy of the number of nails affects the quality and safety of medical device products. Existing technologies rely on manual counting, which is inefficient and prone to errors, and cannot meet the stability requirements of continuous production.

Method used

A medical device parts counting system based on the YOLOv8 model is adopted, including dual-channel high-definition acquisition components, supplementary lighting adjustment, preprocessing, modeling, counting and management modules. By adaptively adjusting acquisition parameters and optimizing the detection model, it can handle background interference and solve the problem of overlapping occlusion, and achieve structured storage and real-time feedback.

🎯Benefits of technology

It improves the accuracy and stability of counting, reduces human error and costs, adapts to the testing needs of different types of medical device parts, and ensures smooth production processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122199463A_ABST
    Figure CN122199463A_ABST
Patent Text Reader

Abstract

The application discloses a medical instrument part counting system based on a YOLOv8 model, and relates to the field of counting systems.The counting system comprises a collection module, a preprocessing module and the like.The collection module is integrated by a double-path high-definition collection component and a light supplementing and adjusting component, and is used for collecting overhead image of a medical instrument part carrier.The preprocessing module is used for executing part foreground feature enhancement and background interference suppression processing on different carrier background types.The application optimizes detection adaptation based on part feature differences, improves image quality by adaptively adjusting collection parameters and light supplementing states, reduces interference by targeted processing combined with background characteristics, makes foreground and background contrast clearer, and improves part recognition accuracy by means of exclusive detection parameters and algorithms, so that the counting problem in an overlapping and shielding scene is effectively solved, and the counting result is ensured to be accurate and stable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of counting system technology, specifically to a medical device parts counting system based on the YOLOv8 model. Background Technology

[0002] The YOLOv8 model optimizes the backbone network with a C2f module, employs an anchorless decoupled detection head, and combines an improved loss function to achieve a high efficiency balance between accuracy and speed. It natively supports multiple tasks such as object detection, instance segmentation, and pose estimation, offers multi-scale model selection, achieves a maximum mAP of 53.9% on the COCO dataset, boasts fast inference speed and flexible deployment, and is widely used in computer vision scenarios such as industrial quality inspection and intelligent transportation.

[0003] Patent application No. 202511049795.X discloses an automatic counting method for industrial parts based on deep learning. This application aims to address the problem that "traditional manual counting methods have shown fundamental shortcomings in modern production lines. While the introduction of computer vision technology has ushered in a new era of automated counting, its robustness in dynamic industrial scenarios is insufficient, making it difficult to meet the stability requirements of continuous production. Although deep learning-based target detection methods improve detection accuracy, their industrial application faces multiple obstacles. Model training requires massive amounts of labeled data, and labeling each part type consumes significant manpower and resources. Complex network structures require high-performance computing equipment, leading to significant energy consumption and hardware costs. More importantly, when the production line switches to new parts, traditional models need to be retrained to adapt to feature changes; this lag severely hinders the advancement of flexible production."

[0004] However, in the production and packaging process of medical nail boxes, the accuracy of the nail count directly affects the quality and safety of medical device products. Any counting deviation may lead to product defects, increased rework, and even potential risks to clinical use. Currently, many production lines still rely on manual counting of nails, which is not only inefficient but also prone to fatigue errors under continuous operation.

[0005] To address this, we propose a medical device parts counting system based on the YOLOv8 model. Summary of the Invention

[0006] In view of the above-mentioned shortcomings of the existing technology, the present invention provides a medical device parts counting system based on the YOLOv8 model, which can effectively solve the problems of the existing technology.

[0007] To achieve the above objectives, the present invention is implemented through the following technical solutions; This invention discloses a medical device parts counting system based on the YOLOv8 model, comprising: The acquisition module, integrated with dual-channel high-definition acquisition components and supplementary lighting adjustment components, is used to acquire top-down images of medical device component carriers; the preprocessing module is used to perform foreground feature enhancement and background interference suppression processing for different carrier background types; the modeling module is used to classify medical device components based on feature differences and build independent detection models for each category; the counting module is used to extract, locate, and count the features of the components using the detection models; the management module is used to structure and store the system's acquired images, feature extraction, location, counting, and timestamp data, and synchronously establish data association indexes; the feedback module is used to summarize various component counting data and detection anomaly information, and push the summary results and anomaly alarms to the preset receiving end in real time. The acquisition module is interconnected with a preprocessing module via a wireless network. The preprocessing module is interconnected with a modeling module via a wireless network. The modeling module is interconnected with a counting module via a wireless network. The counting module is interconnected with a management module via a wireless network. The management module is interconnected with a feedback module via a wireless network.

[0008] Furthermore, the dual-channel high-definition acquisition component of the acquisition module adopts a synchronous triggering mechanism. The optical axes of the two acquisition units are parallel and the spacing is a preset value. During acquisition, the shooting focal length and shooting range are adaptively adjusted based on the size of the carrier to ensure that the overlapping area of ​​the two images is not less than a preset ratio. The supplementary lighting adjustment component dynamically adjusts the supplementary lighting intensity and angle based on the collected ambient light intensity data, the reflectivity of the part surface, and the background reflectivity of the carrier component. The supplementary lighting intensity is: ; In the formula: This is the final fill light intensity; The preset base fill light intensity; These are the weighting coefficients for ambient light intensity, component reflectivity, and background reflectivity, respectively. Minimum ambient light intensity required to capture a clear image; The ambient light intensity is detected in real time by the acquisition module; The surface reflectivity of medical device parts; The background reflectivity of the support component; This is the correction factor for the supplementary lighting angle.

[0009] Furthermore, during the preprocessing module's operation phase, the background type parameters of the carrier are acquired synchronously. These background type parameters include background grayscale variance, texture density, and color channel ratio. Based on these parameters, the background is divided into solid color background without texture, low-texture background, and high-texture background. For solid color backgrounds without texture, an adaptive threshold segmentation algorithm is used to enhance the foreground of the parts. For low-texture backgrounds, background interference is suppressed by combining Gaussian filtering with edge enhancement. For highly textured backgrounds, a processing method combining background subtraction and morphological operations is used, where the size of the structuring element in the morphological operations is determined by the following formula: ; In the formula: The side length of the structuring element; The minimum cross-sectional area of ​​the target counting part; For structural element adaptation coefficients; The standard deviation of the background texture; The preprocessed image is required to meet the requirement that the grayscale contrast between the foreground parts and the background is not lower than a preset threshold. If this requirement is not met, foreground feature enhancement and background interference suppression processing will be performed again.

[0010] Furthermore, in the modeling module's category classification stage, a feature space is constructed based on the core feature parameters of the medical device parts. These core feature parameters include the parts' geometric features, surface features, and topological features. The parts are then categorized using feature similarity calculations. ; In the formula: Let be the feature similarity between the i-th part sample and the j-th part sample; The total number of core feature parameters; The weight of the m-th core feature parameter; These are the normalized values ​​of the i-th and j-th part samples on the m-th core feature parameter, respectively. when If the similarity exceeds a preset threshold, the two part samples are determined to belong to the same category. When constructing independent detection models for each category, the key parameters of the YOLOv8 model are optimized based on the feature distribution of medical device parts that are classified into the same category after feature similarity determination, so that the model can accurately adapt to the detection requirements of the medical device parts of that category.

[0011] Furthermore, the counting module applies the detection model stage to extract feature pyramids from the preprocessed image to obtain multi-scale part feature maps. Then, it uses a non-maximum suppression algorithm to filter candidate bounding boxes for parts. Based on the position coordinates and size information of the candidate bounding boxes, it calculates the overlap and occlusion coefficients of the parts. For parts without overlap or occlusion, the number of candidate bounding boxes is directly counted as a temporary count. For parts with overlap or occlusion, the counting is performed based on the similarity of the part's feature vectors and the complementarity of its geometric shape. ; In the formula: This is the final count result; The count results are for parts that do not overlap or obstruct each other. This represents the number of candidate boxes that overlap or are occluded. The area of ​​the k-th overlapping / occlusion candidate box; Let be the part density coefficient of the k-th candidate box; This refers to the standard cross-sectional area of ​​this type of part; in, The preset value range is [0.8-2]. The larger the ratio of the number of part feature points detected in the candidate box to the number of standard feature points of the part in that category, the larger the value; the smaller the ratio, the smaller the value.

[0012] Furthermore, when performing structured storage, the management module applies a storage architecture of three-level index + data block, where the first-level index is a timestamp index, the second-level index is a part category index, and the third-level index is a collection batch index. The stored data includes: raw and preprocessed data of the acquired images, feature vector matrix of the extracted part features, coordinate set of the positioning results, raw and corrected data of the counting results, and inference confidence data of the detection model; The data association index is built based on a hash algorithm, and the index key value is a combination string of timestamp, part category and collection batch. The stored data is stored in blocks with compression, and the compression algorithm is adaptively selected according to the data type.

[0013] Furthermore, when the feedback module summarizes the count data, it calculates the fluctuation coefficient of the count results of various types of parts within the same collection batch. The fluctuation coefficient is the ratio of the standard deviation to the average value of multiple count results within the batch. Anomaly detection information includes three categories: detection confidence level lower than a preset confidence threshold, aspect ratio of candidate part boxes exceeding the preset proportion range for that category of parts, and count fluctuation coefficient greater than a preset fluctuation threshold. When pushing information to the preset receiver, alarm levels are classified according to the severity of the anomaly, and the determination of alarm levels follows the following rules: ; In the formula: Alert level; , , These are the weighting coefficients; To pre-set the reliability threshold; This represents the lowest confidence level among the test results for this batch. The percentage of candidate boxes that exceed the preset ratio range; This is the preset maximum allowed percentage; This is the volatility coefficient; The preset fluctuation threshold is used; The alarm levels range from 1 to 5, with higher levels indicating more severe anomalies. Different levels correspond to different preset push methods, including pop-up notifications, SMS notifications, and voice alerts.

[0014] Furthermore, the formula for calculating the confidence level of a single part inspection is as follows: ; In the formula: The raw predicted score output by the YOLOv8 model; , These are the feature matching correction coefficients and the image sharpness correction coefficients. , All are positive numbers and , The sum is 1; The degree of matching between the detected part features and the preset standard feature library for this category of parts; This represents the theoretical maximum value of the feature matching degree for this category of parts; The image sharpness factor for the region where the part is located is the ratio of the standard deviation of the grayscale gradient of the part region to the preset maximum standard deviation of the gradient.

[0015] Compared with the known prior art, the technical solution provided by this invention has the following beneficial effects: This invention optimizes detection adaptation based on differences in part features. It improves image quality by adaptively adjusting acquisition parameters and supplementary lighting, reduces interference by specifically processing background characteristics, and makes the foreground and background contrast clearer. It also improves the accuracy of part recognition by using dedicated and adapted detection parameters and algorithms, effectively solving the counting problem in overlapping and occluded scenarios, ensuring accurate and stable counting results. Through structured storage, it achieves efficient data management and correlation traceability, provides real-time feedback of counting data and anomaly alarms, and helps to quickly respond to problems. It adapts to the detection needs of different types of medical device parts, balancing detection efficiency and reliability, and provides efficient and practical counting support for medical device production, warehousing and other scenarios. It significantly reduces manual counting errors and costs, thereby ensuring the smooth progress of related workflows. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.

[0017] Figure 1 This is a schematic diagram of a medical device parts counting system based on the YOLOv8 model. Figure 2 This is a schematic diagram illustrating an application scenario of the dual-channel high-definition acquisition component in this invention. Detailed Implementation

[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0019] The present invention will be further described below with reference to embodiments.

[0020] Example: This embodiment presents a medical device parts counting system based on the YOLOv8 model, such as... Figure 1 As shown, it includes: The acquisition module, which integrates a dual-channel high-definition acquisition component and a supplementary lighting adjustment component, is used to acquire top-view images of the carrier components of medical devices. The dual-channel high-definition acquisition component of the acquisition module adopts a synchronous triggering mechanism. The optical axes of the two acquisition units are parallel and the spacing is a preset value. During acquisition, the shooting focal length and shooting range are adaptively adjusted based on the size of the carrier to ensure that the overlapping area of ​​the two images is not less than a preset ratio. The supplementary lighting adjustment component dynamically adjusts the supplementary lighting intensity and angle based on collected ambient light intensity data, the reflectivity of the part surface, and the background reflectivity of the carrier component. The supplementary lighting intensity is as follows: ; In the formula: This is the final fill light intensity; The preset base fill light intensity; These are the weighting coefficients for ambient light intensity, component reflectivity, and background reflectivity, respectively. Minimum ambient light intensity required to capture a clear image; The ambient light intensity is detected in real time by the acquisition module; The surface reflectivity of medical device parts; The background reflectivity of the support component; This is the correction factor for the fill light angle; The above formula comprehensively considers the real-time ambient light intensity, the reflectivity of the medical device parts surface, and the reflectivity of the carrier background in the acquisition scene. Based on the preset basic supplementary light intensity, the supplementary light intensity is dynamically adjusted by setting the weight coefficients of ambient light intensity, part reflectivity, and background reflectivity, combined with the correction coefficients related to the supplementary light angle and the shooting optical axis angle. At the same time, it refers to the minimum ambient light intensity required to acquire clear images to ensure that the supplementary light effect can be adapted to parts and carriers with different reflective characteristics, and avoid insufficient light or excessive reflectivity affecting the image acquisition quality. in, Preset by the system user The values ​​of are all in the range of (0,1), and The sum is in (1,2], The preset value range is [0.1, 0.9]. The stronger the reflectivity of the material of the medical device part, the larger the value; the weaker the reflectivity of the material, the smaller the value. The value range is preset to [0.1, 0.9]. The stronger the reflectivity of the material and the smoother the surface, the larger the value; the weaker the reflectivity of the material and the rougher the surface, the smaller the value. The value range is [0.3, 1]. The smaller the angle between the fill light angle and the shooting optical axis, the larger the value; the larger the angle between the fill light angle and the shooting optical axis, the smaller the value. The preprocessing module is used to perform foreground feature enhancement and background interference suppression processing on different background types of carrier components; During the preprocessing module operation phase, the background type parameters of the carrier are acquired synchronously. The background type parameters include background grayscale variance, texture density, and color channel ratio. Based on the background type parameters, the background is divided into solid color no texture background, low texture background, and high texture background. For solid color backgrounds without texture, an adaptive threshold segmentation algorithm is used to enhance the foreground of the parts. For low-texture backgrounds, background interference is suppressed by combining Gaussian filtering with edge enhancement. For highly textured backgrounds, a processing method combining background subtraction and morphological operations is used, where the size of the structuring element in the morphological operations is determined by the following formula: ; In the formula: The side length of the structuring element; The minimum cross-sectional area of ​​the target counting part; For structural element adaptation coefficients; The standard deviation of the background texture; The above formula combines the minimum cross-sectional area of ​​the target counting part, the structural element adaptation coefficient, and the standard deviation of the background texture to determine the side length of the structural element for morphological operations. This ensures that the size of the structural element can match the basic shape of the part and also adapt to the interference level of the high-texture background. This ensures that when performing background subtraction and morphological operations, the interference of the high-texture background is effectively suppressed, while the foreground features of the part are fully preserved. The preprocessed image is required to meet the requirement that the grayscale contrast between the foreground parts and the background is not lower than a preset threshold. If the requirement is not met, foreground feature enhancement and background interference suppression processing are performed again. In the background segmentation stage, the background grayscale variance, texture density, and color channel ratio of the carrier are obtained. Then, based on the preset background classification threshold, when the background grayscale variance is less than the first preset threshold, the texture density is lower than the first preset density, and the single color channel ratio is higher than the first preset ratio, it is judged as a solid color background without texture; when the background grayscale variance is between the first preset threshold and the second preset threshold, the texture density is between the first preset density and the second preset density, and the single color channel ratio is between the first preset ratio and the second preset ratio, it is judged as a low texture background; when the background grayscale variance is greater than the second preset threshold, the texture density is higher than the second preset density, and the single color channel ratio is lower than the second preset ratio, it is judged as a high texture background. The second preset threshold and the second preset density are both greater than the first preset threshold and the first preset density, and the second preset proportion is less than the first preset proportion. The modeling module is used to classify medical device parts based on their characteristic differences and to build independent detection models for each category. In the modeling module's category classification stage, a feature space is constructed based on the core feature parameters of medical device parts. These core feature parameters include the parts' geometric features (aspect ratio, area ratio, number of edges), surface features (texture entropy, number of marker points), and topological features (hole distribution, number of grooves). Parts are then categorized using feature similarity calculations. ; In the formula: Let be the feature similarity between the i-th part sample and the j-th part sample; The total number of core feature parameters; The weight of the m-th core feature parameter; These are the normalized values ​​of the i-th and j-th part samples on the m-th core feature parameter, respectively. The above formula constructs a feature space around the multi-dimensional core feature parameters of the part, such as geometric features, surface features, and topological features. Each core feature parameter is assigned a weight with a value between 0 and 1 and a sum greater than 1. By calculating the degree of fit of the normalized values ​​of different part samples on each core feature parameter, the feature similarity between part samples is determined. When the similarity exceeds the preset threshold, they are classified into the same category, realizing accurate classification based on the essential feature differences of the parts, laying the foundation for independent modeling of each category in the future. when If the similarity exceeds a preset threshold, the two part samples are determined to belong to the same category. When constructing independent detection models for each category, based on the feature distribution of medical device parts classified into the same category after feature similarity determination, the key parameters of the YOLOv8 model are optimized in a targeted manner according to the following logic to make the model accurately adapt to the detection requirements of that category of medical device parts: Anchor frame size optimization: Based on the bounding box size dataset of this category of parts, K-means clustering algorithm is used to obtain 3 sets of adapted anchor frames, corresponding to the 3 detection scales of the model. The clustering objective is to minimize the deviation between the aspect ratio of the bounding box and the average length-to-diameter ratio of parts in this category. The anchor frame size satisfies the following condition: The average length-to-diameter ratio of this category of parts. This is the preset allowable deviation value; The above formula is for the bounding box size dataset of the same type of parts. Based on the average aspect ratio of the parts in this type of part, a reasonable allowable deviation range is set. The K-means clustering algorithm is used to obtain 3 sets of anchor boxes, which correspond to the 3 detection scales of the model respectively. During the clustering process, the goal is to minimize the deviation between the aspect ratio of the anchor box and the average aspect ratio, so that the anchor box size is highly adapted to the actual shape of the parts in this type of part, thereby improving the model's accuracy in locating the parts. Optimization of the number of inspection head channels: The number of inspection head channels is determined based on the feature dimensions of this type of part (derived from the total number M of core feature parameters and the feature vector dimension). Where D is the feature vector dimension of the part category and k is the channel adaptation coefficient. Based on the feature complexity preset, it is ensured that the detection head can fully extract the differentiated features of the part category. The above formula determines the number of detection head channels by rounding up based on the feature vector dimension of the part and the channel adaptation coefficient preset based on feature complexity. This ensures that the detection head can fully extract the differentiated features of this type of part, providing sufficient and effective feature support for subsequent classification and localization tasks. Loss function weight optimization: The loss function consists of classification loss. Location loss and confidence loss Composition, total loss The weight coefficients a, b, and c are assigned based on the detection difficulties of this type of part: if the similar features of the parts in this type of part make classification difficult, the value of a is increased; if the size of the parts in this type of part is too small, resulting in insufficient positioning accuracy, the value of b is increased; if the parts in this type of part are easily confused with the background, resulting in a deviation in confidence judgment, the value of c is increased, and a+b+c=1 is satisfied. The initial weight values ​​are preset based on the experience of detecting similar parts, and are fine-tuned through 3-5 rounds of iterations until the validation set loss is minimized. The above formula integrates the three types of loss by assigning weight coefficients. The initial weight values ​​are preset based on the experience of detecting similar parts, and are then fine-tuned through 3-5 rounds of iterations until the loss on the validation set is minimized, so that the model can specifically address the pain points of detecting different types of parts. in, The default value range is (0,1), and ; The counting module is used to extract, locate, and count the features of parts using the detection model; In the detection model stage of the counting module, feature pyramid extraction is performed on the preprocessed image to obtain multi-scale part feature maps. Then, a non-maximum suppression algorithm is used to filter candidate bounding boxes for parts. The overlap and occlusion coefficients of the parts are calculated based on the position coordinates and size information of the candidate bounding boxes. For parts that are neither overlapping nor occluded, the number of candidate bounding boxes is directly counted as a temporary count. For parts that overlap or are occluded, the counting is performed based on the similarity of the part's feature vectors and the complementarity of its geometric shape. ; In the formula: This is the final count result; The count results are for parts that do not overlap or obstruct each other. This represents the number of candidate boxes that overlap or are occluded. Let k be the area of ​​the k-th overlapping / occlusion candidate box; Let be the part density coefficient of the k-th candidate box; This refers to the standard cross-sectional area of ​​this type of part; The above formula first directly counts the number of candidate boxes for non-overlapping and non-occluded parts as the result of non-overlapping part counting. For candidate boxes with overlap or occlusion, the formula combines the area of ​​each candidate box, the part density coefficient, and the standard cross-sectional area of ​​the part of this category. It then calculates the number of parts in each overlapping or occluded candidate box by rounding up. Finally, it summarizes the results to obtain an accurate part counting result, effectively avoiding the impact of overlap and occlusion on the counting accuracy. in, The preset value range is [0.8-2]. The larger the ratio of the number of part feature points detected in the candidate box to the number of standard feature points of the part in that category, the larger the value; the smaller the ratio, the smaller the value. The management module is used to structure and store the system's acquired images, feature extraction, localization, counting, and timestamp data, and to synchronously establish data association indexes. When the management module performs structured storage, it uses a storage architecture of three-level index + data block. The first-level index is the timestamp index, the second-level index is the part category index, and the third-level index is the collection batch index. The stored data includes: raw and preprocessed data of the acquired images (including storage path and data verification code), feature vector matrix of part feature extraction, coordinate set of positioning results (two-dimensional coordinate system with the lower left corner of the bearing as the origin), raw and corrected data of counting results, and inference confidence data of the detection model. The data association index is built based on a hash algorithm, with the index key being a combination of a timestamp, part category, and collection batch. The stored data uses block compression, with the compression algorithm adaptively selected based on the data type: lossless compression for image data and lossy compression for text data. The feedback module is used to summarize various parts counting data and detection anomaly information, and push the summary results and anomaly alarms to the preset receiving end in real time; When the feedback module summarizes the count data, it calculates the fluctuation coefficient of the count results of various parts within the same collection batch. The fluctuation coefficient is the ratio of the standard deviation to the average value of multiple count results within the batch. Anomaly detection information includes three categories: detection confidence level lower than a preset confidence threshold, aspect ratio of candidate part boxes exceeding the preset proportion range for that category of parts, and count fluctuation coefficient greater than a preset fluctuation threshold. When pushing information to the preset receiver, alarm levels are classified according to the severity of the anomaly, and the determination of alarm levels follows the following rules: ; In the formula: Alert level; , , These are the weighting coefficients; To pre-set the reliability threshold; This represents the lowest confidence level among the test results for this batch. The percentage of candidate boxes that exceed the preset ratio range; This is the preset maximum allowed percentage; This is the volatility coefficient; The preset fluctuation threshold; The above formula integrates three types of abnormal detection information: the confidence level of the detection is lower than the preset confidence threshold, the aspect ratio of the candidate box of the part exceeds the preset proportion range of the part category, and the count fluctuation coefficient is greater than the preset fluctuation threshold. Weight coefficients are assigned to each type of abnormal indicator. By calculating the proportion of the difference between the preset confidence threshold and the lowest confidence level of the batch to the preset confidence threshold, the ratio of the proportion of the number of candidate boxes exceeding the preset proportion range to the maximum allowable proportion, and the proportion of the difference between the fluctuation coefficient and the preset fluctuation threshold, and then combining the base value for calculation and rounding down, an alarm level of 1-5 is obtained, which intuitively quantifies the severity of the abnormality. The alarm levels range from 1 to 5, with higher levels indicating more severe anomalies. Different levels correspond to different preset push methods, including pop-up notifications, SMS notifications, and voice alerts. ∈ (0,1), when the high similarity in appearance, small size, or insignificant surface features of medical device parts lead to a significant impact of detection confidence on counting accuracy. The larger the value, the better when the part features are distinct, the detection confidence is generally stable, and the risk of false detection is extremely low. The smaller the value; ∈ (0,1), when the standard aspect ratio tolerance of this type of part is strict, the shape is regular, and the proportional deviation directly points to false detection. The larger the value, the more suitable it is for parts with slight deformation tolerance, high morphological flexibility, and small deviations in proportion that do not affect the validity of the count. The smaller the value; ∈ (0,1), when the parts in the collection batch are densely arranged, easily overlap, or there are slight fluctuations in the collection environment, and the fluctuation in the count has a significant impact on the reliability of the result. The larger the value, the better when the parts are sparsely arranged without overlap, the data collection environment is stable, and the results of multiple counts are highly consistent. The smaller the value; The formula for calculating the confidence level of a single part inspection is: ; In the formula: The raw predicted score output by the YOLOv8 model; , These are the feature matching correction coefficients and the image sharpness correction coefficients. , All are positive numbers and , The sum is 1; The degree of matching between the detected part features and the preset standard feature library for this category of parts; This represents the theoretical maximum value of the feature matching degree for this category of parts; The image sharpness factor for the region where the part is located is the ratio of the standard deviation of the gray-level gradient of the part region to the preset maximum standard deviation of the gradient. The above formula combines the performance parameters of the detection model itself, and also considers the ratio of part feature similarity to maximum feature similarity and image quality index. By setting two coefficients to adjust the influence weight of each part, the model performance parameters are multiplied by the accuracy ratio of feature matching and the image quality index respectively and then summed to comprehensively evaluate the confidence of the detection results. This not only reflects the reliability of feature matching, but also takes into account the impact of image quality on the detection results, so as to provide a comprehensive and accurate confidence basis for subsequent anomaly judgment. The data acquisition module is connected to the preprocessing module via a wireless network. The preprocessing module is connected to the modeling module via a wireless network. The modeling module is connected to the counting module via a wireless network. The counting module is connected to the management module via a wireless network. The management module is connected to the feedback module via a wireless network.

[0021] In this embodiment, the acquisition module acquires top-down images of the medical device component carrier. The preprocessing module then performs foreground feature enhancement and background interference suppression for different carrier background types. The modeling module categorizes the medical device components based on their feature differences and builds independent detection models for each category. The counting module then applies the detection models to extract, locate, and count the components. The management module then performs structured storage of the system's acquired images, feature extraction, location, counting, and timestamp data, and simultaneously establishes a data association index. Finally, the feedback module summarizes the various component count data and detection anomaly information and pushes the summary results and anomaly alarms to a preset receiving end in real time.

[0022] In the above embodiments, the system can adapt to different environments and component carrying scenarios, accurately optimize detection adaptability, effectively handle component overlap and occlusion problems, and significantly improve counting accuracy and stability; it can standardize the storage of relevant data and establish associated indexes, provide real-time feedback on abnormal situations, assist in the efficient production management of medical components, provide reliable data support for production, inventory and other processes, and reduce human error and management costs.

[0023] Application example: XX Medical Device Manufacturer needs to perform batch counting of medical stainless steel screws of two specifications, M1 and M2. The above-mentioned counting system was used, with the carriers being a plain plastic disc, a low-texture rubber pad, and a high-texture metal tray, respectively.

[0024] After system startup, the dual-channel high-definition acquisition components of the acquisition module are triggered synchronously, keeping the optical axes parallel. The shooting focal length and range are adaptively adjusted according to the dimensions of the three carrier components, ultimately achieving an 85% overlap between the two images. The supplementary lighting adjustment component detects ambient light intensity in real time and dynamically adjusts the supplementary lighting intensity based on the surface reflectivity (0.7 for medical stainless steel screws, 0.3 for solid-color plastic disc backgrounds, 0.4 for low-texture rubber pad backgrounds, and 0.8 for high-texture metal tray backgrounds), as well as the angle correction coefficient (0.8) corresponding to a 30° angle between the supplementary lighting angle and the shooting optical axis. Ultimately, the supplementary lighting intensities for the three carrier components are 320 lux, 310 lux, and 330 lux, respectively, ensuring clear image acquisition.

[0025] The preprocessing module first obtains the background grayscale variance, texture density, and color channel ratio for each component. It determines the background: the solid-color plastic tray has a solid-color, textureless background, and an adaptive threshold segmentation algorithm is used to enhance the screw foreground; the low-texture rubber pad has a low-texture background, and background interference is suppressed through a combination of Gaussian filtering and edge enhancement; the high-texture metal tray has a high-texture background, and background subtraction and morphological operations are combined for processing, with the structuring element side length for the morphological operations determined to be 5 pixels. After preprocessing, the grayscale contrast between the screw and the background reaches 45 for all three backgrounds, meeting the preset threshold requirement.

[0026] The modeling module constructs a feature space based on the geometric features (aspect ratio, area ratio, number of edges), surface features (texture entropy, number of marker points), and topological features (hole distribution, number of grooves) of two screw sizes. After calculating feature similarity, the screws are clearly divided into two classes, M1 and M2. For M1 screws, three sets of fitting anchor frames are obtained through K-means clustering, and the number of detection head channels is determined to be 256. Due to the smaller size of M1 screws, the classification loss weight is set to 0.3, the localization loss weight is set to 0.5, and the confidence loss weight is set to 0.2. After four rounds of iteration and fine-tuning, the validation set loss is minimized. The model parameters for M2 screws are optimized in the same way, and the final classification loss weight is determined to be 0.4, the localization loss weight is 0.3, and the confidence loss weight is 0.3.

[0027] The counting module applies an optimized model to extract multi-scale feature maps from the preprocessed image and filters candidate boxes using non-maximum suppression. Specifically, in the solid-color plastic disk, there are 28 candidate boxes for the M1 screw with no overlap or occlusion, and 3 overlapping / occluded candidate boxes. After splitting and counting, 5 candidate boxes are obtained, resulting in a final count of 33 for the M1 screw. In the low-texture rubber pad, the M2 screw has 22 candidate boxes with no overlap or occlusion, and a final count of 22. In the high-texture metal tray, there are 25 candidate boxes for the M1 screw with no overlap or occlusion, and 1 overlapping candidate box is split and counted, resulting in 2 candidate boxes, resulting in a final count of 27.

[0028] The management module adopts a storage architecture of three-level indexes (timestamp, part category, and acquisition batch) plus data blocks to store various types of acquired images, feature vector matrices, positioning coordinates, counting results, and inference confidence data. It constructs associated indexes through hash algorithms, performs lossless compression on image data, and performs lossy compression on text data.

[0029] The feedback module calculates that the fluctuation coefficient of the various screw count results of this batch is 0.03, the detection minimum confidence level is 0.92, no candidate box aspect ratio exceeds the preset range, and it is determined that there is no abnormality. The count results of a total of 60 M1 screws and 22 M2 screws are pushed to the enterprise production management system in real time.

[0030] In summary, the system in the above embodiments optimizes detection adaptation based on differences in part features, improves image quality by adaptively adjusting acquisition parameters and supplementary lighting, reduces interference by specifically processing background characteristics, makes the contrast between foreground and background clearer, and improves the accuracy of part recognition by using dedicated and adapted detection parameters and algorithms. It effectively solves the counting problem in overlapping and occluded scenarios, ensuring accurate and stable counting results. Through structured storage, it achieves efficient data management and correlation traceability, provides real-time feedback of counting data and anomaly alarms, helps to quickly respond to problems, adapts to the detection needs of different types of medical device parts, and balances detection efficiency and reliability. It provides efficient and practical counting support for medical device production, warehousing and other scenarios, significantly reduces manual counting errors and costs, and thus ensures the smooth progress of related workflows.

[0031] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions will not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A medical device parts counting system based on the YOLOv8 model, characterized in that, include: The acquisition module, which integrates a dual-channel high-definition acquisition component and a supplementary lighting adjustment component, is used to acquire top-view images of the carrier components of medical devices. The preprocessing module is used to perform foreground feature enhancement and background interference suppression processing on different background types of carrier components; The modeling module is used to classify medical device parts based on their characteristic differences and to build independent detection models for each category. The counting module is used to extract, locate, and count the features of parts using the detection model; The management module is used to structure and store the system's acquired images, feature extraction, localization, counting, and timestamp data, and to synchronously establish data association indexes. The feedback module is used to summarize various parts counting data and detection anomaly information, and push the summary results and anomaly alarms to the preset receiving end in real time.

2. The medical device parts counting system based on the YOLOv8 model according to claim 1, characterized in that, The dual-channel high-definition acquisition component of the acquisition module adopts a synchronous triggering mechanism. The optical axes of the two acquisition units are parallel and the spacing is a preset value. During acquisition, the shooting focal length and shooting range are adaptively adjusted based on the size of the carrier to ensure that the overlapping area of ​​the two images is not less than a preset ratio. The supplementary lighting adjustment component dynamically adjusts the supplementary lighting intensity and angle based on the collected ambient light intensity data, the reflectivity of the part surface, and the background reflectivity of the carrier component. The supplementary lighting intensity is: ; In the formula: This is the final fill light intensity; The preset base fill light intensity; These are the weighting coefficients for ambient light intensity, component reflectivity, and background reflectivity, respectively. Minimum ambient light intensity required to capture a clear image; The ambient light intensity is detected in real time by the acquisition module; The surface reflectivity of medical device parts; The background reflectivity of the support component; This is the correction factor for the supplementary lighting angle.

3. The medical device parts counting system based on the YOLOv8 model according to claim 1, characterized in that, During the operation of the preprocessing module, the background type parameters of the carrier are acquired synchronously. The background type parameters include background grayscale variance, texture density, and color channel ratio. Based on the background type parameters, the background is divided into solid color no texture background, low texture background, and high texture background. For solid color backgrounds without texture, an adaptive threshold segmentation algorithm is used to enhance the foreground of the parts. For low-texture backgrounds, background interference is suppressed by combining Gaussian filtering with edge enhancement. For highly textured backgrounds, a processing method combining background subtraction and morphological operations is used, where the size of the structuring element in the morphological operations is determined by the following formula: ; In the formula: The side length of the structuring element; The minimum cross-sectional area of ​​the target counting part; For structural element adaptation coefficients; The standard deviation of the background texture; The preprocessed image is required to meet the requirement that the grayscale contrast between the foreground parts and the background is not lower than a preset threshold. If this requirement is not met, foreground feature enhancement and background interference suppression processing will be performed again.

4. A medical device parts counting system based on the YOLOv8 model according to claim 1, characterized in that, In the classification stage of the modeling module, a feature space is constructed based on the core feature parameters of medical device parts. The core feature parameters include the geometric features, surface features, and topological features of the parts, and the parts are classified by feature similarity calculation. ; In the formula: Let be the feature similarity between the i-th part sample and the j-th part sample; The total number of core feature parameters; The weight of the m-th core feature parameter; These are the normalized values ​​of the i-th and j-th part samples on the m-th core feature parameter, respectively. when If the similarity exceeds a preset threshold, the two part samples are determined to belong to the same category. When constructing independent detection models for each category, the key parameters of the YOLOv8 model are optimized based on the feature distribution of medical device parts that are classified into the same category after feature similarity determination, so that the model can accurately adapt to the detection requirements of the medical device parts of that category.

5. A medical device parts counting system based on the YOLOv8 model according to claim 1, characterized in that, The counting module applies the detection model stage, extracts feature pyramids from the preprocessed image to obtain multi-scale part feature maps, and then filters part candidate boxes through a non-maximum suppression algorithm. Based on the position coordinates and size information of the candidate boxes, the overlap and occlusion coefficient of the parts are calculated. For parts that are neither overlapping nor occluded, the number of candidate boxes is directly counted as a temporary count; for parts that overlap or are occluded, the count is split based on the similarity of the part's feature vectors and the complementarity of its geometric shape. ; In the formula: This is the final count result; The count results are for parts that do not overlap or obstruct each other. The number of candidate boxes that overlap or are occluded; The area of ​​the k-th overlapping / occlusion candidate box; Let be the part density coefficient of the k-th candidate box; This refers to the standard cross-sectional area of ​​this type of part; in, The preset value range is [0.8-2]. The larger the ratio of the number of part feature points detected in the candidate box to the number of standard feature points of the part in that category, the larger the value; the smaller the ratio, the smaller the value.

6. A medical device parts counting system based on the YOLOv8 model according to claim 1, characterized in that, When the management module performs structured storage, it applies a storage architecture of three-level index + data block. The first-level index is a timestamp index, the second-level index is a part category index, and the third-level index is a collection batch index. The stored data includes: raw and preprocessed data of the acquired images, feature vector matrix of the extracted part features, coordinate set of the positioning results, raw and corrected data of the counting results, and inference confidence data of the detection model; The data association index is built based on a hash algorithm, and the index key value is a combination string of timestamp, part category and collection batch. The stored data is stored in blocks with compression, and the compression algorithm is adaptively selected according to the data type.

7. A medical device parts counting system based on the YOLOv8 model according to claim 1, characterized in that, When the feedback module summarizes the count data, it calculates the fluctuation coefficient of the count results of various parts within the same collection batch. The fluctuation coefficient is the ratio of the standard deviation to the average value of multiple count results within the batch. Anomaly detection information includes three categories: detection confidence level lower than a preset confidence threshold, aspect ratio of candidate part boxes exceeding the preset proportion range for that category of parts, and count fluctuation coefficient greater than a preset fluctuation threshold. When pushing information to the preset receiver, alarm levels are classified according to the severity of the anomaly, and the determination of alarm levels follows the following rules: ; In the formula: Alert level; , , These are the weighting coefficients; To pre-set the reliability threshold; This represents the lowest confidence level among the test results for this batch. The percentage of candidate boxes that exceed the preset ratio range; This is the preset maximum allowed percentage; This is the volatility coefficient; The preset fluctuation threshold is used; The alarm levels range from 1 to 5, with higher levels indicating more severe anomalies. Different levels correspond to different preset push methods, including pop-up notifications, SMS notifications, and voice alerts.

8. A medical device parts counting system based on the YOLOv8 model according to claim 7, characterized in that, The formula for calculating the confidence level of a single part inspection is: ; In the formula: The raw predicted score output by the YOLOv8 model; , These are the feature matching correction coefficients and the image sharpness correction coefficients. , All are positive numbers and , The sum is 1; The degree of matching between the detected part features and the preset standard feature library for this category of parts; This represents the theoretical maximum value of the feature matching degree for this category of parts; The image sharpness factor for the region where the part is located is the ratio of the standard deviation of the grayscale gradient of the part region to the preset maximum standard deviation of the gradient.

9. A medical device parts counting system based on the YOLOv8 model according to claim 1, characterized in that, The acquisition module is interconnected with a preprocessing module via a wireless network. The preprocessing module is interconnected with a modeling module via a wireless network. The modeling module is interconnected with a counting module via a wireless network. The counting module is interconnected with a management module via a wireless network. The management module is interconnected with a feedback module via a wireless network.