Medical waste intelligent identification method based on improved YOLOv11

By embedding the ECA module in YOLOv11 and adopting the SlideLoss and SCID/MCID strategies, the problems of insufficient utilization of mid-layer features and uninterpretable detection results in medical waste detection are solved, achieving efficient, stable medical waste identification and traceable detection results.

CN121437962APending Publication Date: 2026-01-30FUJIAN NORMAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511565470.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-30
Publication Date
2026-01-30

AI Technical Summary

Technical Problem

The existing YOLOv5 and YOLOv8 have problems in medical waste detection, such as insufficient utilization of mid-level detail features, unstable identification of small and densely overlapping targets, insufficient learning of low IoU samples by fixed IoU regression loss, and lack of interpretability of detection results in multi-class co-occurrence scenarios, which makes it difficult to meet the traceability requirements of medical safety supervision.

Method used

An efficient channel attention module (ECA) is embedded in the multi-scale fusion structure of YOLOv11, a regression loss (SlideLoss) based on dynamic weighting of intersection-union ratio (IoU) is adopted, and SCID/MCID subset partitioning and cross-class sensitive NMS strategy are introduced. The Grad-CAM++ interpretability module is integrated to form an end-to-end intelligent recognition system architecture.

Benefits of technology

It significantly improves the learning efficiency and localization accuracy of difficult samples, enhances the mid-level feature representation capability, improves the detection stability and recall rate in multi-class co-occurrence scenarios, realizes the visualization and traceability of detection results, and meets the credibility requirements of medical supervision.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121437962A_ABST
    Figure CN121437962A_ABST
Patent Text Reader

Abstract

The invention relates to a medical waste intelligent identification method based on improved YOLOv11, and belongs to the field of medical waste intelligent identification. According to the method, a P4-ECA module is embedded in a YOLOv11 framework in a fixed point mode, a SlideLoss dynamic weighted regression function is introduced, SCID / MCID subsets are distinguished, a Grad-CAM + + interpretable mechanism is fused, system improvement is formed in the three aspects of structural design, loss optimization and model interpretation, and high-precision, high-robustness and interpretable intelligent recognition of the medical waste is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of intelligent identification of medical waste, specifically relating to an intelligent identification method for medical waste based on an improved YOLOv11. Background Technology

[0002] Currently, object detection technology has evolved from traditional sliding window and handcrafted features (such as HOG and SIFT) to end-to-end learning frameworks based on convolutional neural networks (CNNs). Existing mainstream detection algorithms are mainly divided into two categories:

[0003] 1. Two-stage detectors (such as Faster R-CNN and Cascade R-CNN): After generating candidate boxes through the Region Proposal Network (RPN), classification and regression are performed. They have high accuracy, but are computationally complex and have slow inference speed.

[0004] 2. One-stage detectors (such as SSD, Retina Net, YOLO series): The detection problem is uniformly modeled as a regression task, which can achieve fast detection without relying on candidate regions. It has the advantages of good real-time performance and simple structure.

[0005] Among them, the YOLO (You Only Look Once) series of models, as a typical one-stage detection method, has evolved from YOLOv3 to YOLOv11, mainly improving performance through the following aspects:

[0006] 1) Multi-scale feature fusion (FPN, PAN structure) enhances the ability to perceive small targets;

[0007] 2) Lightweight convolutional modules (CSP, C2f, etc.) reduce computational cost while maintaining expressive power;

[0008] 3) Improved regression loss functions (GIoU, DIoU, CIoU, etc.) enhance positioning accuracy;

[0009] 4) Attention mechanism modules (SE, CBAM, ECA, etc.) to enhance feature selectivity;

[0010] 5) Distributed regression (DFL) and decoupled detection head reduce localization uncertainty;

[0011] 6) Non-maximum suppression (NMS) and Soft-NMS reduce redundant boxes.

[0012] These technologies have been widely applied in fields such as autonomous driving, industrial quality inspection, and waste sorting. However, in the scenario of medical waste detection, due to factors such as small target size, severe occlusion, similar categories, and long-tailed sample distribution, existing known models still face the following challenges:

[0013] (1) Insufficient utilization of mid-level detailed features, resulting in unstable recognition performance for small targets and densely overlapping targets;

[0014] (2) Fixed-form IoU regression loss is insufficient for learning low-IoU samples;

[0015] (3) In scenarios where multiple categories co-occur, standard NMS is prone to accidentally deleting real bounding boxes;

[0016] (4) The test results lack interpretability and do not meet the traceability requirements of medical safety supervision.

[0017] Therefore, researchers have made various improvements to the publicly available frameworks such as YOLOv5 and YOLOv8, resulting in the following technical solutions.

[0018] (I) Existing technical solution 1: A medical waste detection method based on YOLOv5, which realizes automatic detection and classification of medical waste based on YOLOv5. Its main process is as follows:

[0019] Data construction: Collect images of hospital or laboratory scenes and manually label medical waste targets (needles, gloves, masks, etc.);

[0020] Data augmentation: Performing routine augmentation operations on training samples, such as flipping, rotating, cropping, and adjusting brightness;

[0021] Model structure: YOLOv5's CSPDarknet is used as the backbone network, and the FPN+PAN structure is used for multi-scale feature fusion to output three layers of features: P3, P4, and P5.

[0022] Loss function: Cross-entropy or Focal Loss is used for the classification part, and fixed CIoU loss is used for the regression part;

[0023] Training and Inference: Use SGD or Adam optimizer to set confidence thresholds and NMS thresholds to filter detection results during the inference phase.

[0024] Due to the lack of mid-level feature recalibration and dynamic loss adjustment, this scheme has a low recall rate for small targets such as needles and test tubes in medical waste images; the fixed CIoU is insufficient for learning occluded samples, and the model is prone to false detection or false negative in complex scenes; the uniform threshold NMS has false suppression when multiple classes co-occur; and the results are uninterpretable, which is not conducive to quality auditing and accountability.

[0025] (II) Existing technical solution two: A waste identification method based on YOLOv8 and incorporating the CBAM attention mechanism. This method adds a CBAM or SE attention module to the YOLOv8 framework to enhance feature representation. The main steps include:

[0026] Data augmentation: A combination of augmentation strategies, such as Mosaic, MixUp, and random occlusion, is employed to improve model robustness;

[0027] Network structure: YOLOv8 is used as the baseline model, the backbone network is an improved CSPDarknet structure, and the detection head adopts a decoupled form; CBAM modules (channel + spatial attention) are embedded in multiple feature layers to improve feature weight allocation;

[0028] Loss function: FocalLoss is used for classification, and fixed CIoU or GIoU is used for regression;

[0029] Training and Inference: Cosine annealing learning rate and mixed precision are used for training, and Soft-NMS is used for candidate box selection during the inference phase.

[0030] While the multi-layer embedding of CBAM can enhance feature representation, it significantly increases the number of parameters and inference latency, making it unsuitable for real-time deployment on edge devices. Fixed CIoU loss makes it difficult to distinguish the learning weights of samples in different IoU intervals, resulting in insufficient optimization of low IoU samples. In multi-class co-occurrence scenarios, it is easy to accidentally delete ground truth boxes. The lack of an interpretable module limits the traceability and credibility of detection results in medical scenarios.

[0031] In summary, although existing detection methods based on YOLOv5 and YOLOv8 have made several improvements in feature fusion and attention mechanisms, their core problems remain unresolved:

[0032] 1. Insufficient utilization of mid-level features, resulting in low discrimination against small targets and similar categories;

[0033] 2. Fixed IoU loss lacks a dynamic adaptive mechanism, making it difficult to effectively learn low IoU or difficult samples;

[0034] 3. Insufficient multi-class co-occurrence suppression strategies lead to decreased recall rates in dense target scenarios;

[0035] 4. Lack of interpretable output, failing to meet the traceability requirements of medical regulatory scenarios. Summary of the Invention

[0036] The purpose of this invention is to solve the problems existing in the background technology and provide a smart identification method for medical waste based on the improved YOLOv11.

[0037] To achieve the above objectives, the technical solution of the present invention is: a method for intelligent identification of medical waste based on an improved YOLOv11, comprising the following steps:

[0038] S1. Collect medical waste image data from actual environments and publicly available image dataset websites to obtain the raw dataset;

[0039] S2. Preprocess, augment, and label the original dataset to obtain standardized medical waste training samples;

[0040] S3. Input the obtained training samples into the improved YOLOv11 multi-scale detection network for feature extraction and fusion. In the middle layer feature output branch P4 of the neck, the channel attention module is integrated to recalibrate the scale features channel by channel. The P3-P5 detection heads output the classification probability and bounding box regression respectively.

[0041] S4. A regression loss based on dynamic weighting of intersection-union ratio (IoU) is adopted and jointly trained with the classification loss to obtain the detection model;

[0042] S5. Based on the trained detection model, determine the inference threshold on the validation set and perform inference, outputting the target category, bounding box coordinates and confidence score to achieve automatic identification of medical waste.

[0043] Furthermore, in step S1, the medical waste category set includes at least one or more of the following: needles, syringes, infusion bottles, blood bags, test tubes, scalpel blades, gloves, masks, gauze, cotton swabs, and plastic bags.

[0044] Furthermore, in step S2, data augmentation includes horizontal and vertical flipping, random cropping, random rotation, random brightness adjustment, and adding Gaussian blur; all data augmentation operations synchronously update the annotation information to ensure that the labels are consistent with the image.

[0045] Furthermore, in step S2, the standardized medical waste training samples are divided into a single-class instance SCID subset and a multi-class instance MCID subset based on the number of labeled target categories.

[0046] Furthermore, in step S3, the channel attention module is an efficient channel attention ECA, which consists of global average pooling and one-dimensional convolution. The convolution kernel size is odd and preferably 3. The channel weights obtained by Sigmoid activation are used to recalibrate the P4 feature map channel by channel.

[0047] Furthermore, in step S4, the regression loss based on the crossover union ratio (IoU) is dynamically weighted as SlideLoss. It adaptively adjusts the sample weights based on the IoU between the predicted bounding box and the ground truth bounding box, assigning higher weights to low IoU samples or difficult samples, and exponentially decaying the weights of high IoU samples, thereby strengthening the learning of difficult samples.

[0048] Furthermore, the weighting function of SlideLoss is centered on the mean μ of the positive sample IoU and set a boundary δ, where δ is a positive number, forming a "slide-like" weighting strategy. Its regression term is expressed as L_reg=w(IoU)∙L_base, where w(IoU) decreases monotonically with respect to IoU, and L_base is the location base term.

[0049] Furthermore, L_base is a CIoU or similar IoU-type positioning loss.

[0050] Furthermore, the training employs the AdamW optimizer in conjunction with a cosine annealing learning rate scheduling strategy.

[0051] Furthermore, in step S5, the detection head simultaneously outputs a classification branch and a regression branch at each scale. The regression branch can output a distributed regression vector to characterize the localization uncertainty.

[0052] Furthermore, in step S5, a Grad-CAM++ attention heatmap is generated during the inference phase for result interpretation and visualization analysis.

[0053] Compared with existing technologies, the present invention has the following advantages: Methodologically, the present invention addresses the limitations of existing medical waste detection methods based on YOLOv5 and YOLOv8 in terms of feature representation, loss function design, multi-class co-occurrence handling, and interpretability, and proposes several structured improvements; the main advantages are as follows:

[0054] (a) Advantage 1: It implements an IoU adaptive dynamic weighted target regression mechanism, which significantly improves the learning efficiency and localization accuracy of difficult samples.

[0055] Existing technologies using CIoU / GIoU employ fixed loss forms, treating low-IoU and high-IoU samples equally, making it difficult to adaptively strengthen the learning of difficult samples. This invention introduces a SlideLoss dynamic weighted loss function into the regression branch; it constructs a sliding weight function centered on the mean μ of positive sample IoU and with a boundary δ as the adjustment range; it assigns higher weights to low-IoU samples and applies exponential decay to high-IoU samples; it strengthens the learning of low-IoU samples in the early stages of training and, in the mid-to-late stages, cooperates with Distributed Regression (DFL) to suppress boundary jitter.

[0056] (ii) Advantage 2: By embedding a high-efficiency channel attention (ECA) module at a fixed point in the P4 layer, the mid-layer feature representation capability and small target recognition performance are enhanced.

[0057] In existing technologies, the attention mechanism is embedded in scattered locations or is computationally complex, resulting in insufficient utilization of mid-level features and poor performance in detecting small targets and similar-looking targets. This invention selects the P4 mid-level feature branch as the fixed point for attention enhancement within the multi-scale fusion structure of YOLOv11; embeds an ECA module (global average pooling + one-dimensional convolution + sigmoid activation) to locally model the relationships between channels; and enhances the mid-level feature representation through channel-by-channel recalibration without significantly increasing computational overhead.

[0058] (III) Advantage 3: Proposes SCID / MCID dual subset partitioning and cross-class sensitive NMS strategy to improve detection stability and recall in multi-class co-occurrence scenarios.

[0059] Existing methods generally employ a uniform NMS threshold across various dense scenarios, which can easily lead to false suppression of real targets or duplicate detection. This invention divides the training data into two subsets—Single-Class Instances (SCID) and Multi-Class Instances (MCID)—based on the number of targets in the samples. During the inference phase, cross-class sensitive NMS / Soft-NMS is introduced for the MCID subset, allowing dynamic adjustment of suppression weights across different classes. Combined with a threshold adaptive strategy, the confidence and NMS parameters are searched in a grid during the validation phase to obtain the optimal combination.

[0060] (iv) Advantage 4: Integration of Grad-CAM++ interpretability module to achieve visualization, traceability and decision verification of results.

[0061] Existing detection methods typically only output bounding boxes and confidence scores, lacking interpretability and visualization, making it difficult to meet the medical industry's requirements for "traceability" and "credible decision-making." This invention embeds the Grad-CAM++ module during the inference stage, calculating the contribution of each pixel position to the prediction result based on second-order gradients; it automatically generates high-resolution attention heatmaps and displays the model's area of ​​interest in real time within the user interface.

[0062] (V) Advantage 5: It forms a complete end-to-end intelligent recognition system architecture, with multi-module collaboration and cross-platform compatibility.

[0063] Existing methods mostly focus on model-level research, lacking end-to-end system integration and deployment solutions. This invention designs a complete system architecture that includes data management, training management, inference services, user interface, and continuous learning modules; it uses the ONNX format to export model weights, supporting TensorRT and ONNXRuntime engines; and it achieves low-latency inference on GPU / CPU / edge devices and multilingual user interface interaction. Attached Figure Description

[0064] Figure 1 This is a schematic diagram of the intelligent identification method for medical waste based on the improved YOLOv11 of the present invention.

[0065] Figure 2 This is a schematic diagram of the improved YOLOv11 (YESG) model structure of the present invention;

[0066] Figure 3 This is the user interface of the medical waste identification system based on the improved YOLOv11 detection framework of the present invention. Detailed Implementation

[0067] The technical solution of the present invention will now be described in detail with reference to the accompanying drawings. Figure 1 This is a schematic diagram of the intelligent identification method for medical waste based on the improved YOLOv11 of the present invention. Figure 2 A schematic diagram of the improved YOLOv11 (YESG) model structure; Figure 3 This is the user interface for a medical waste identification system implemented based on the detection framework of this invention. The accompanying drawings are for illustrative purposes only and not for limitation.

[0068] This invention proposes a smart identification method for medical waste based on an improved YOLOv11, comprising the following steps:

[0069] S1. Collect medical waste image data from actual environments and publicly available image dataset websites to obtain the raw dataset;

[0070] S2. Preprocess, augment, and label the original dataset to obtain standardized medical waste training samples;

[0071] S3. Input the obtained training samples into the improved YOLOv11 multi-scale detection network for feature extraction and fusion. In the middle layer feature output branch P4 of the neck, the channel attention module is integrated to recalibrate the scale features channel by channel. The P3-P5 detection heads output the classification probability and bounding box regression respectively.

[0072] S4. A regression loss based on dynamic weighting of intersection-union ratio (IoU) is adopted and jointly trained with the classification loss to obtain the detection model;

[0073] S5. Based on the trained detection model, determine the inference threshold on the validation set and perform inference, outputting the target category, bounding box coordinates and confidence score to achieve automatic identification of medical waste.

[0074] The following is a detailed implementation process of the present invention.

[0075] This invention discloses an intelligent identification method for medical waste based on an improved YOLOv11. The overall idea is to address the challenges of small targets, dense overlap, occlusion, and similar appearance in medical waste images by building upon the YOLOv11 baseline model. On the one hand, efficient channel attention (ECA) is introduced into the P4 branch of the neck mid-layer feature output to improve feature representation and category discrimination capabilities. On the other hand, SlideLoss with sliding perception is used to replace the traditional CIoU regression loss and dynamic weighting is applied to difficult samples. At the same time, an end-to-end data construction, training, threshold selection, inference, and interpretable quality inspection process is provided.

[0076] The images collected include (but are not limited to) on-site images of hospital department operating areas, medical waste temporary storage rooms, transport vehicles and disposal sites, as well as medical waste scene images that can be authorized for use on publicly available image dataset websites, covering multiple lighting, multiple devices (mobile phones / industrial cameras), multiple backgrounds and multiple densities of scenes.

[0077] The collected medical waste category set includes at least one or more of the following: needles, syringes, infusion bottles, blood bags, test tubes, scalpel blades, gloves, masks, gauze, cotton swabs, and plastic bags; the categories can be expanded according to application needs, and the category mapping table and training configuration are updated when expanding.

[0078] For annotation standardization, the YOLO general bounding box format <class,x_c,y_c,w,h> is adopted, where coordinates and scale are normalized to [0,1]. The bounding box should fit the target's bounding rectangle as closely as possible, avoiding excessive enclosing of the background or truncating key parts of the target.

[0079] For quality control issues, the labeling process uses a "two-person labeling + one-person review" approach. Samples with consistency (category consistency rate and IoU with the human baseline) below the threshold are returned for relabeling. Samples with occlusion, glare, or extremely small targets are labeled "difficult cases" to facilitate subsequent sampling and weighting.

[0080] For the data partitioning problem, the data is partitioned according to a three-part method of training / validation / test (e.g., 7:2:1); and the samples are divided into single-class instances (SCID) and multi-class instances (MCID) subsets based on the number of target classes in the graph, in order to evaluate the performance under different complexity scenarios.

[0081] For the size alignment problem, the input is scaled to a square size (e.g., 640×640) using the letterbox strategy, while keeping the aspect ratio of the original image unchanged and filling it with constant pixels; the scaling ratio r and translation offset (Δx,Δy) are recorded for coordinate restoration during the inference stage.

[0082] For basic enhancement issues, including horizontal / vertical flipping, random rotation (preferably ±15°), random cropping (ensuring the target's visible area is ≥30%), brightness / contrast / gamma adjustment, and Gaussian blur (odd kernel size), all enhancement operations are performed simultaneously to update the labels, avoiding label drift.

[0083] For multi-scale training problems, each epoch randomly samples from a preset input size set {640,704,768,…} to improve scale generalization ability, which is especially beneficial for recalling very small target categories.

[0084] For class imbalance problems, stratified random sampling and class weight reweighting are adopted; if necessary, FocalLoss (γ∈[1,5]) is used in the classification branch to reduce the dominance effect of easy samples.

[0085] like Figure 2 As shown in the overall structure, this invention uses YOLOv11 “n” and “m” scales as the baseline, extracts multi-level features from the backbone, performs bidirectional feature fusion in the neck, and outputs three-scale features of P3, P4, and P5; the detection head outputs classification and regression branches in parallel at each scale, and introduces distributed regression (DFL) to characterize boundary uncertainty.

[0086] The initial convolutional structure of the model's backbone is that the input image passes through two convolutional layers (3×3, stride=2, BN, SiLU) in sequence, with the number of channels increasing from 3 to 16 to 32; then it enters the C3k2 module (containing the bottleneck residual unit Bottleneck) to complete the early low-level texture and edge feature extraction.

[0087] The model is downsampled in the first stage and then enters the second C3k2 module after passing through Conv(64, stride=2). It uses a combination of 1×1 and 3×3 convolutions and residual stacking to improve expressive power while controlling the number of parameters. The number of output channels is increased to 128 in this stage.

[0088] In the second stage of model downsampling, the model enters the third C3k2 module via Conv(128, stride=2). The module contains nested C3k units (containing lightweight residuals from cascaded 1×1 and 3×3 convolutions), which expands the effective receptive field and enhances local texture modeling with low computational cost.

[0089] In the third stage of model downsampling, the model enters the fourth C3k2 module via Conv(256, stride=2) and continues to use nested C3k residuals to accumulate high-level semantics. Subsequently, multi-scale pooling (5×5) is performed through SPPF (Spatial Pyramid Pooling-Fast) to aggregate the global context.

[0090] The model uses pre-fusion for attention, and the SPPF output is cascaded with the C2PSA module. C2PSA internally includes PSABlock, which has qkv convolutional projection (1×1) and depth-separable positional information convolution (3×3, groups = number of channels), and is equipped with a feedforward network (FFN, 1×1 ascending and descending dimension + BN / SiLU) for lightweight global and local attention fusion.

[0091] The model uses a top-down path (FPN) to upsample high-level features (×2) and concatenate them with adjacent low-level features before integrating them into C3k2. The first upsampling and concatenation step forms the key fusion node of the P4 path, where the ECA module is inserted in this invention.

[0092] The model ECA integration location and form are placed in Figure 2 The module in the middle has the structure AdaptiveAvgPool2d→Conv1d(k=3,padding=1,no bias)→Sigmoid; it performs local interaction on the channel vector after P4 fusion and generates channel-wise weights, which are then multiplied with the P4 features channel by channel to achieve channel recalibration.

[0093] Then, the propagation continues from top to bottom, and another upsampling and concat are performed to enter C3k2 to obtain the P3 fused feature; then, two downsampling and concat are performed along the bottom-up path to reconstruct the enhanced features of P4 and P5 respectively, thus realizing PAN path aggregation.

[0094] The model detection head consists of three scale branches (P3, P4, P5), each receiving features from the neck region, with 64 / 128 / 256 input channels. Each branch first separates spatial and channel information through a decoupling unit (a combination of DWConv3×3 and 1×1 pointwise convolution), and maps the features uniformly to an 80-channel intermediate representation. On these 80-channel features, the decoupled output head generates a K-dimensional classification score and a 4×B-dimensional regression distribution (B=16 in this embodiment, determined by the Conv2d(16,1) setting of DFL). During inference, the expected continuous bounding box parameters are obtained from the B-bin discrete distribution of the four edges (l, t, r, b), thus working with the DFL layer to form the final prediction.

[0095] Distributed regression (DFL) discretizes the continuous positions of the four sides of the boundary into several bins (in this embodiment, the DFL layer is Conv2d(16→1)), learns the probability distribution of each bin, and recovers the continuous boundary through expectation / weighting during inference, thereby improving the stability and precision of localization.

[0096] The model's shape is defined as follows: the input is (batch_size, H, W, 3), and the P3, P4, and P5 features obtained through Backbone / Neck correspond to higher / medium / lower semantic levels, respectively. In this embodiment, the typical channel sizes are P3: 64, P4: 128, and P5: 256, which satisfies the balance between lightweight design and expressive power.

[0097] The total loss is defined as L = λ_clsL_cls + λ_regL_reg, where L_cls is the classification loss and L_reg is the regression loss, using SlideLoss.

[0098] The SlideLoss form is L_reg = w(IoU)∙L_base. Where L_base can be one of the DFL and IoU classes (GIoU / CIoU / EIoU) or a linear combination thereof; the weight function w(IoU) decreases monotonically with IoU.

[0099] The sliding weights are set in a small range with δ>0 centered on the mean μ of the IoU of positive samples. When the sample IoU falls below the region [μ-δ,μ+δ], the weights are significantly increased, and the weights decay exponentially for high IoU samples, thereby highlighting the learning of difficult samples such as low IoU, occlusion, and blurred edges.

[0100] SlideLoss accelerates fitting of difficult samples in the early stages and suppresses localization jitter in the mid-to-late stages when combined with DFL. Compared with CIoU alone, this invention has better overall performance in terms of recall, mAP@0.5:0.95 and boundary smoothness.

[0101] For the model optimizer problem, AdamW is used; after learning, linear warm-up is performed first, followed by cosine annealing or one-cycle scheduling; weight decay and momentum coefficients are set according to empirical intervals and then fine-tuned on the validation set.

[0102] The model training strategy is to enable mixed precision (AMP) and gradient accumulation to adapt to different GPU memory. Each epoch calculates metrics such as mAP@0.5, mAP@0.5:0.95, Precision, and Recall on the validation set, and saves the best weights for deployment.

[0103] To address class imbalance in the model, class weights are applied to long-tail classes; if necessary, a minimum sampling lower bound is set for rare classes to ensure convergence.

[0104] The model threshold search problem involves performing a grid search on the validation set for confidence thresholds and NMS / Soft-NMS thresholds (e.g., confidence ∈ [0.05, 0.70], NMS ∈ [0.30, 0.70]), using F1 or mAP optimization as the selection criterion to obtain the optimal threshold combination for deployment.

[0105] The model inference process is as follows: input preprocessing → forward inference → filtering by confidence threshold → performing NMS or Soft-NMS to remove redundancy → restoring the coordinates to the original image scale according to the r and (Δx,Δy) recorded in the letterbox → outputting the target category, bounding box coordinates and confidence.

[0106] When there is cross-class overlap and the business allows for the coexistence of multiple classes, a class-sensitive NMS strategy is adopted to reduce cross-class false suppression; when occlusion is severe, Soft-NMS is selected to retain weak but real overlapping targets.

[0107] To meet the requirements of transparency and traceability in medical scenarios, the model uses Grad-CAM++. During the inference stage, Grad-CAM++ heatmaps can be generated, and the contribution of each location to the prediction is estimated based on the second-order gradient to obtain a high-resolution attention heatmap.

[0108] The model system architecture consists of five major modules: data management, training management, inference service, and user interface. The modules interact with each other via HTTP / message queue, which facilitates horizontal expansion and version management.

[0109] The model detection system interface includes an image / catalog selection area, a model switching area (supporting YESG-n / YESG-m and SCID / MCID), a detection result area, and a result list area; it supports switching between Chinese and English and one-click saving of detection images.

[0110] The model system results are presented as follows: the detection results area overlaid with the prediction box, category, and confidence level in real time; the side panel displays the inference time, number of targets, and main categories; and the list area provides the category, confidence level, and coordinates (xmin, ymin, xmax, ymax) by index.

[0111] for Figure 2The overall structure of the model is as follows: Layer (0) to (1): two Conv layers (3×3, stride=2, BN, SiLU), channels 3→16→32, to complete basic edge and texture extraction; Layer (2) C3k2: composed of a Bottleneck wrapped by 1×1 dimensionality reduction and 1×1 dimensionality increase convolutions, with the internal Bottleneck using 3×3 convolution stacking, outputting to 64 channels; realizing residual feature aggregation under low computational cost; Layer (3) Conv downsampled to 64 channels and entered Layer (4) C3k2, continuing residual stacking, outputting to 128 channels, enhancing the semantics of the middle and low layers; Layer (5) Conv downsampled Up to 128 channels; Layer (6) C3k2 with nested C3k (containing 1×1 / 3×3 / 1×1 and two Bottlenecks) to enhance semantic expression and maintain lightweight feature channels; Layer (7) Conv downsamples to 256 channels; Layer (8) C3k2 + two stacked C3k as high-level semantic convergence before entering SPPF; Layer (9) SPPF: multi-scale context aggregation is achieved through three 5×5 max pooling stacks, and the output is boosted back to 256 channels by 1×1; Layer (10) C2PSA: contains PSABlock (qkv projection 1×1, depth-separable positional encoding 3×3, FFN1) ×1 (upgrading and downgrading), lightweight introduction of global / local attention; layer (11) Upsample×2 and layer (12) Concat are fused with low-level features, and enter layer (13) C3k2 for cross-layer information integration, forming the prototype of P4 fusion features; layer (14) ECA: AdaptiveAvgPool2d→Conv1d(k=3,pad=1)→Sigmoid, the output channel weights are multiplied with the output of layer (13) channel by channel to complete the P4 channel recalibration, which is one of the key improvements of this invention; layer (15) Upsample×2 and layer (16) Concat are then entered into layer (17) C3k2 is used to obtain the P3 fusion feature; then layer (18) Conv downsampling and layer (19) Concat, layer (20) C3k2 return to P4; then layer (21) Conv downsampling and layer (22) Concat, layer (23) C3k2 are used to obtain the enhanced P5; layer (24) Detect: the three scale branches receive P3 / P4 / P5 respectively, and internally they are first decoupled by DWConv+1×1Conv, then a set of DWConv+1×1Conv is stacked and then 80-dimensional intermediate channels are output by 1×1 convolution; finally, distributed regression is generated through DFL layer Conv2d(16→1). The three branches share the design but do not share the weights.

[0112] thus, Figure 2 Each level has clearly stated that it will ensure that the written descriptions are consistent with the actual project implementation, so as to facilitate review, verification and project reproduction.

[0113] Model training must be performed on a GPU server; inference can be deployed on GPUs / CPUs / edge devices. For cross-platform compatibility, it is recommended to export the optimal weights to ONNX; the inference engine can be either ONNXRuntime or TensorRT.

[0114] The medical waste identification system selects the model size (n / m) based on real-time requirements; half-precision inference is enabled when necessary to reduce latency. While maintaining accuracy, the confidence threshold can be appropriately increased to reduce the number of candidate boxes.

[0115] The medical waste identification system supports catalog-level batch processing.

[0116] This implementation fully supports the key technical features in the claims: S1 Data acquisition and annotation → S2 Preprocessing and enhancement → S3 Improve YOLOv11 and integrate ECA in P4, multi-scale detection in P3~P5 → S4 Replace CIoU with SlideLoss and conduct joint training → S5 Determine the threshold on the validation set and infer the output; use Grad-CAM++ for interpretation.

[0117] The above are preferred embodiments of the present invention. Any changes made to the technical solution of the present invention that do not exceed the scope of the technical solution of the present invention shall fall within the protection scope of the present invention.

Claims

1. An improved YOLOv11-based medical waste intelligent recognition method, characterized in that, It comprises the following steps: S1, collecting medical waste image data from the actual environment and the online public image dataset website to obtain an original dataset; S2, preprocessing, data enhancement and labeling the original dataset to obtain standardized medical waste training samples; S3, inputting the obtained training samples into an improved YOLOv11 multi-scale detection network for feature extraction and fusion, integrating a channel attention module in the neck of the middle layer feature output branch P4, and re-labeling the scale features channel by channel, and outputting classification probability and bounding box regression quantity from P3-P5 detection heads respectively; S4, using a regression loss based on IoU dynamic weighting, and jointly training with the classification loss to obtain a detection model; S5, based on the trained detection model, determining the inference threshold on the validation set and performing inference to output the class, bounding box coordinates and confidence of the target, and realizing automatic recognition of medical waste.

2. The medical waste intelligent recognition method based on improved YOLOv11 according to claim 1, characterized in that, In step S1, the medical waste class set at least includes one or more of needle, syringe, infusion bottle, blood bag, test tube, surgical blade, glove, mask, gauze, cotton swab and plastic bag.

3. The medical waste intelligent recognition method based on improved YOLOv11 according to claim 1, characterized in that, In step S2, data enhancement includes horizontal and vertical flipping, random cropping, random rotation, random brightness adjustment and adding Gaussian blur; all data enhancement operations update the labeling information synchronously to ensure that the label is consistent with the image.

4. The medical waste intelligent recognition method based on improved YOLOv11 according to claim 1, characterized in that, In step S2, the standardized medical waste training sample is divided into single-class instance SCID subset and multi-class instance MCID subset according to the number of labeled target classes.

5. The medical waste intelligent recognition method based on improved YOLOv11 according to claim 1, characterized in that, In step S3, the channel attention module is an efficient channel attention ECA, which is composed of global average pooling and one-dimensional convolution, and the convolution kernel size is an odd number and preferably 3, and the channel weight obtained by Sigmoid activation is used to re-label the P4 feature map channel by channel.

6. The medical waste intelligent recognition method based on improved YOLOv11 according to claim 1, characterized in that, In step S4, the regression loss based on IoU dynamic weighting is SlideLoss, which adjusts the sample weight based on the IoU of the predicted box and the real box, gives higher weight to low IoU samples or difficult samples, and exponentially decays the weight of high IoU samples, so as to strengthen the learning of difficult samples.

7. The medical waste intelligent recognition method based on improved YOLOv11 according to claim 6, characterized in that, The weight function of SlideLoss takes the mean value μ of positive sample IoU as the center and sets a boundary δ, δ is a positive number, forming a "slide" weighting strategy, and its regression term is represented as L_reg=w(IoU)∙L_base, wherein w(IoU) is monotonically decreasing with respect to IoU, and L_base is a positioning base term.

8. The medical waste intelligent recognition method based on improved YOLOv11 according to claim 7, characterized in that, The L_base is CIoU or its similar IoU type positioning loss.

9. The medical waste intelligent recognition method based on improved YOLOv11 according to claim 1, characterized in that, In step S5, the detection head outputs a classification branch and a regression branch at each scale, and the regression branch can output a distributed regression vector to represent the positioning uncertainty.

10. The medical waste intelligent recognition method based on improved YOLOv11 according to claim 1, characterized in that, In step S5, Grad-CAM++ attention heat map is generated in the inference stage for result explanation and visual analysis.