Accelerated method for detecting subtle defects in medical syringes
By grouping and pruning the medical syringe defect detection model, filters that are sensitive to subtle defects are selected, which solves the problem of limited use of models in real-time applications and low-performance hardware devices in the prior art, and achieves efficient subtle defect detection.
Patent Information
- Application Number
- CN202411721346.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2044-11-28
AI Technical Summary
Existing medical syringe defect detection models are limited in real-time applications and low-performance hardware devices, and are difficult to effectively detect subtle defects.
By grouping and pruning the defect detection model based on convolutional neural networks, filters that are sensitive to subtle defects are selected to ensure that while retaining the model's ability to detect subtle defects, the number of model parameters is reduced and the detection speed is improved.
It realizes that while retaining the ability to detect subtle defects, reduces model complexity and improves detection efficiency, and is suitable for resource-constrained embedded hardware devices.
Smart Images

Figure CN119228787B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of medical device detection, and in particular to a method for accelerating detection of subtle defects in medical syringes. Background Art
[0002] Medical syringe defect detection networks usually have large model sizes and high computational complexity, which limits their use in real-time applications and low-performance hardware devices. In addition, during the production and manufacturing process of medical syringes, defects are inevitable. Some are significant defects that are easy to detect, but there are also many subtle defects that are difficult to detect, such as Figure 1 Shown is a schematic diagram of significant defects and subtle defects in a medical syringe. Since the defect detection model is highly sensitive to pruning, it becomes a critical task to protect the ability to detect subtle defects during pruning.
[0003] Currently, the more mainstream pruning strategy is the weight-based pruning strategy, which evaluates the importance of each weight in the neural network and removes weights that contribute little to the model's prediction performance. However, simply evaluating weights has limited effect on the detection of subtle defects in medical syringes. Summary of the invention
[0004] In view of the above-mentioned deficiencies in the prior art, the purpose of the present invention is to propose a method for accelerating the detection of subtle defects in medical syringes, which aims to group and prune the defect detection model and screen filters that are sensitive to subtle defect features, thereby ensuring that the detection speed is improved while retaining the model's ability to detect subtle defects.
[0005] In order to achieve the above object, the technical solution adopted by the present invention is:
[0006] A method for accelerating detection of minute defects in medical syringes, comprising:
[0007] S1: Collect medical syringe image dataset and preprocess the medical syringe images in the dataset;
[0008] S2: Divide the preprocessed dataset into training set and validation set;
[0009] S3: Build a defect detection model based on convolutional neural network;
[0010] S4: training the defect detection model using the training set, performing a pruning operation during the training process, and obtaining a compact model after verification with a verification set; the pruning operation includes: dividing the filters into a subtle defect group and a significant defect group according to the sensitivity of the filters to subtle defects, and pruning the filters in the subtle defect group;
[0011] S5: Using the compact model to detect defects on medical syringes in real time.
[0012] Optionally, the pruning operation specifically includes:
[0013] S41: Setting pruning rate and defect priority thresholds ;
[0014] S42: Constructing a weighted sensitivity matrix , the weighted sensitivity matrix The weighted sensitivity matrix stores the weighted sensitivity of each filter in the defect detection model to each defect. Each row of represents a defect and each column represents a filter;
[0015] S43: Construct filter sensitivity matrix , the filter sensitivity matrix In the weighted sensitivity matrix On the basis of, the filter identifications are stored in order according to the sensitivity of the filter to each defect;
[0016] S44: Filter sensitivity matrix based on defect priority Reorder to get the minor defect priority matrix , where minor defects have a higher priority than major defects;
[0017] S45: Based on defect priority threshold , for the minor defect priority matrix Divide into minor defect groups by line and significant defect group ;
[0018] S46: For minor defects The filters in are pruned until the pruning rate is reached.
[0019] Optionally, the weighted sensitivity matrix The calculation method is as follows:
[0020]
[0021]
[0022] ,
[0023] in, Indicates The weighted sensitivity matrix of the convolutional layers, express For The sensitivity of the defect express The amplitude of Indicates The convolutional layer filters, is a universal quantification symbol, which means anything. Represents the sequence number of the convolutional layer, Indicates the filter number, Indicates the category number of the defect, Indicates The number of filters in the convolutional layer, represents the number of categories of defects, express The gradient of represents the medical syringe image containing the k-th defect, where express The loss function is express The output, express The L1 norm of Indicates The maximum L1 norm of all filters in the convolutional layer.
[0024] Optionally, the filter sensitivity matrix The filters are stored in order from largest to smallest according to their sensitivity to each defect. The sequence number in as the column index.
[0025] Optionally, the expression of the column index is: ,in, Indicates the filter number, Indicates The first defect High sensitivity filter.
[0026] Optionally, the minor defect priority matrix The calculation method is as follows:
[0027]
[0028]
[0029]
[0030] in, Represents the filter sensitivity matrix according to the defect priority P by row A function to sort in descending order. Indicates the priority of the first defect. Indicates the priority of the second defect. Indicates The priority of the defects, represents the number of categories of defects, Indicates The number of pixels with this defect, It is The number of pixels with this defect.
[0031] Optionally, in step S44, the filter sensitivity matrix is sorted row by row according to the defect priority. Arrange in descending order to get the minor defect priority matrix Step S45 specifically includes: Medium defect priority is higher than the defect priority threshold The rows are assigned to the minor defect group , the defect priority is lower than the defect priority threshold Assign rows to the significant defect group .
[0032] Optionally, step S46 specifically includes:
[0033] Minor defects Transpose and expand it row-wise into a 1D vector ;
[0034] from In the process, filters are selected and deleted in order from high to low according to the defect priority without duplication until the pruning rate is reached.
[0035] Optionally, the medical syringe image dataset is collected on the device side using a conveyor system and a camera, the medical syringe images in the dataset are preprocessed and steps S2 to S4 are completed on the server side, and the compact model is deployed to the device side to detect defects on the medical syringes in real time.
[0036] Optionally, the ratio of the number of samples in the training set to that in the validation set is 9:1.
[0037] Optionally, preprocessing of the medical syringe images in the dataset includes image smoothing and filtering.
[0038] The beneficial effects of the present invention are:
[0039] In order to retain the ability of the defect detection model of medical syringes to detect subtle defects, the convolutional neural network is pruned in groups to screen out filters that are sensitive to subtle defects. While ensuring that the detection network maintains a balanced and fair detection capability for all defects, the complexity of the model is reduced and the efficiency of the model is improved, which is critical for defect detection of medical syringes. Through the special pruning strategy for the medical syringe defect detection task of the present invention, high-precision medical syringe defect detection can be achieved, which can play an important role in the field of medical device production and quality inspection, and provide a reliable technical support for improving the quality and production efficiency of medical devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 Schematic diagram showing significant and minor defects in medical syringes;
[0041] Figure 2 It is a schematic diagram of the process of the acceleration method for detecting fine defects of medical syringes according to an embodiment of the present invention;
[0042] Figure 3 It is a schematic diagram of the structure of the equipment end for medical syringe image acquisition and medical syringe defect detection according to an embodiment of the present invention;
[0043] Figure 4 Shown is a sample image of a medical syringe collected by an embodiment of the present invention;
[0044] Figure 5 FIG. 1 is a schematic diagram showing the principle of a pruning operation according to an embodiment of the present invention;
[0045] Figure 6 The weighted sensitivity matrix of the embodiment of the present invention is shown as follows: Schematic diagram of the principle. DETAILED DESCRIPTION
[0046] In order to more clearly understand the technical content, achieved purposes and effects of the present invention, the present invention is described in detail below in conjunction with specific implementation methods and in conjunction with the accompanying drawings. It should be noted that, in the absence of conflict, the implementation methods of the present invention and the features in the implementation methods can be combined with each other. In the following description, many specific details are set forth in order to fully understand the present invention. The described implementation methods are only part of the implementation methods of the present invention, rather than all implementation methods. Based on the implementation methods in the present invention, all other implementation methods obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.
[0047] Please refer to Figure 2 As shown, an embodiment of the present invention provides a method for accelerating detection of subtle defects in medical syringes, comprising:
[0048] S1: Collecting a medical syringe image dataset and preprocessing the medical syringe images in the dataset; specifically, using a conveyor belt system and an industrial camera on the device side to collect the medical syringe image dataset and transmit it to the server side, and the server side performs preprocessing operations on the images in the dataset, such as image smoothing and filtering; the medical syringe images are high-resolution images;
[0049] S2: Divide the preprocessed data set into a training set and a validation set; the ratio of the number of samples in the training set to that in the validation set is 9:1;
[0050] S3: construct a defect detection model based on a convolutional neural network; specifically, select and load an existing defect detection model based on a convolutional neural network on the server side;
[0051] S4: training the defect detection model using the training set, performing a pruning operation during the training process, and obtaining a compact model after verification with a verification set; the pruning operation includes: dividing the filters into a subtle defect group and a significant defect group according to the sensitivity of the filters to subtle defects, and pruning the filters in the subtle defect group;
[0052] S5: deploying the compact model to the device end, and using the compact model to detect defects on the medical syringe in real time. Figure 3 The figure shows the structure of the device end of an embodiment of the present invention. The device end is composed of a conveyor belt system, a camera, a display screen and a control panel. The medical syringe is placed on the conveyor belt system for transmission. The camera collects the image of the medical syringe and can display it on the display screen. The control panel can control the device end to collect images or perform defect detection. Figure 4 Shown is a sample image of a medical syringe collected by an embodiment of the present invention.
[0053] like Figure 5 As shown, based on the above embodiment, in an extended embodiment, the pruning operation specifically includes:
[0054] S41: Get medical syringe training set images , obtain the parameters of the defect detection model, including convolutional layer information; set the pruning rate and defect priority threshold ;
[0055] The following steps are performed in sequence for the convolutional layers that need to be pruned in the defect detection model:
[0056] S42: Constructing a weighted sensitivity matrix , the weighted sensitivity matrix The weighted sensitivity matrix stores the weighted sensitivity of each filter in the defect detection model to each defect. Each row of represents a defect and each column represents a filter;
[0057] S43: Construct filter sensitivity matrix , the filter sensitivity matrix In the weighted sensitivity matrix On the basis of, the filter identifications are stored in order according to the sensitivity of the filter to each defect;
[0058] S44: Filter sensitivity matrix based on defect priority Reorder to get the minor defect priority matrix , where the priority of minor defects is greater than that of significant defects; specifically, the filter sensitivity matrix is row-wise calculated according to the defect priority. Arrange in descending order to get the minor defect priority matrix ;
[0059] S45: Based on defect priority threshold , for the minor defect priority matrix Divide into minor defect groups by line and significant defect group ; Specifically, the minor defect priority matrix Medium defect priority is higher than the defect priority threshold The rows are assigned to the minor defect group , the defect priority is lower than the defect priority threshold Assign rows to the significant defect group Since subtle defects usually have fewer samples and lower pixel coverage in the medical syringe defect detection task, in order to further focus on subtle defects, the subtle defect priority matrix Divide into minor defect groups by line and significant defect group .
[0060] S46: For minor defects The filters in are pruned until the pruning rate is reached.
[0061] In the pruning process, this embodiment prunes the network according to the importance of filters in the subtle defect group to preferentially retain filters that are more sensitive to subtle defects, thereby ensuring the ability of the compact model remaining after pruning to detect subtle defects.
[0062] In a specific implementation, step S46 specifically includes:
[0063] Minor defects Transpose and expand it row-wise into a 1D vector ;
[0064] from In the process, filters are selected and deleted in order from high to low according to the defect priority without duplication until the pruning rate is reached.
[0065] This embodiment uses the transposition operation to make the pruning process more intuitive and easier to implement.
[0066] like Figure 6 As shown, based on the above embodiment, in an extended embodiment, the convolution layer information includes the amplitude information of the filter in the convolution layer, the sensitivity information of the filter, etc. The amplitude information is normalized to obtain the amplitude, and the sensitivity extracted from the sensitivity information is multiplied to obtain the weighted sensitivity matrix Specifically, the weighted sensitivity matrix The calculation method is as follows:
[0067]
[0068]
[0069] ,
[0070] in, Indicates The weighted sensitivity matrix of the convolutional layers, express For The sensitivity of the defect express The amplitude of Indicates The convolutional layer filters, is a universal quantification symbol, which means anything. Represents the sequence number of the convolutional layer, Indicates the filter number, Indicates the category number of the defect. Indicates The number of filters in the convolutional layer, represents the number of categories of defects, express The gradient of represents the medical syringe image containing the k-th defect, where express The loss function is express The output, express The L1 norm of Indicates The maximum L1 norm of all filters in the convolutional layer.
[0071] The weighted sensitivity matrix of this embodiment comprehensively considers the sensitivity of the filter to defects. and the filter amplitude , the filter amplitude The larger the value, the stronger the feature detection capability of the filter, and the higher the weight in the detection model. Coming Soon The difference between the model output before and after setting to 0. The larger the value, the greater the difference. For Compared with the existing pruning strategies, the pruning strategy based on weighted sensitivity in this embodiment has the advantage of retaining both the general basic feature extraction capability and defect feature detection capability of the model.
[0072] Based on the above embodiment, in an extended embodiment, the filter identifiers are stored in order according to the sensitivity of the filter to each defect, specifically: the filter identifiers are stored in order from large to small according to the sensitivity of the filter to each defect. The serial number in is used as the column index; the expression of the column index is: ,in, Indicates the filter number, Indicates The first defect The filter with high sensitivity is , so this expression means The first defect The high sensitivity filter is .
[0073] Since the sensitivity of each filter to different defects may be different, the sensitivity of each filter to different defects is determined by rearrangement. Specifically, by constructing the filter sensitivity matrix , adding column indices to indicate the order of the filter’s sensitivity to each defect.
[0074] Based on the above embodiment, in an extended embodiment, the subtle defect priority matrix The calculation method is as follows:
[0075]
[0076]
[0077]
[0078] in, Represents the filter sensitivity matrix according to the defect priority P by row A function to sort in descending order. Indicates the priority of the first defect. Indicates the priority of the second defect. Indicates The priority of the defects, represents the number of categories of defects, and Both represent the category number of the defect Indicates The number of pixels of the defect category is the number of pixels of the defect category currently calculated. It is The number of pixels of each defect is used to sum the number of pixels of all categories of defects.
[0079] The minor defect priority matrix of this embodiment , the filter sensitivity matrix The defects are re-ranked according to their priority, and a strategy is adopted to prioritize the retention of filters that are sensitive to subtle defects in order to protect the model's ability to detect subtle defects.
[0080] In summary, the present invention provides a method for accelerating the detection of subtle defects in medical syringes to solve the problem that traditional acceleration methods easily cause the medical syringe defect detection model to lose its ability to detect subtle defects. The present invention performs group pruning on the defect detection model based on the convolutional neural network, and preferentially retains filters that are sensitive to subtle defect features, thereby ensuring that the model parameters are reduced and the model detection speed is improved while retaining the model's ability to detect subtle defects. The present invention can effectively reduce the complexity of the hardware deployment of the defect detection model, greatly reduce the amount of network computing, and provide strong support for the deployment of the medical syringe defect detection model on resource-constrained embedded hardware devices.
[0081] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Therefore, any modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the technical solution of the present invention are still within the scope of the technical solution of the present invention.
Claims
1. A method for accelerating the detection of fine defects in medical syringes, characterized in that: include: S1: Collect medical syringe image dataset and preprocess the medical syringe images in the dataset; S2: Divide the preprocessed dataset into training set and validation set; S3: Build a defect detection model based on convolutional neural network; S4: training the defect detection model using the training set, performing a pruning operation during the training process, and obtaining a compact model after verification with a verification set; the pruning operation includes: dividing the filters into a subtle defect group and a significant defect group according to the sensitivity of the filters to subtle defects, and pruning the filters in the subtle defect group; S5: Using the compact model to detect defects on medical syringes in real time; The pruning operation specifically includes: S41: Setting pruning rate and defect priority thresholds ; S42: Constructing a weighted sensitivity matrix , the weighted sensitivity matrix The weighted sensitivity matrix stores the weighted sensitivity of each filter in the defect detection model to each defect. Each row of represents a defect and each column represents a filter; S43: Construct filter sensitivity matrix , the filter sensitivity matrix In the weighted sensitivity matrix Based on the sensitivity of the filter to each defect, the filters are stored in order from large to small. The column index in ; S44: Filter sensitivity matrix based on defect priority Reorder to get the minor defect priority matrix , where the priority of subtle defects is greater than that of significant defects; specifically, in step S44, the filter sensitivity matrix is sorted row by row according to the defect priority. Arrange in descending order to get the minor defect priority matrix ; S45: Based on defect priority threshold , for the minor defect priority matrix Divide into minor defect groups by row and significant defect group Step S45 specifically includes: the minor defect priority matrix Medium defect priority is higher than the defect priority threshold The rows are assigned to the minor defect group , the defect priority is lower than the defect priority threshold Assign rows to the significant defect group S46: For minor defects The filters in are pruned until the pruning rate is reached.
2. The method for accelerating detection of fine defects of medical syringes according to claim 1, characterized in that: The weighted sensitivity matrix The calculation method is as follows: , in, Indicates The weighted sensitivity matrix of the convolutional layers, express For The sensitivity of the defect express The amplitude of Indicates The convolutional layer filters, is a universal quantification symbol, which means anything. Represents the sequence number of the convolutional layer, Indicates the filter number, Indicates the category number of the defect, Indicates The number of filters in the convolutional layer, represents the number of categories of defects, express The gradient of represents the medical syringe image containing the k-th defect, where express The loss function is express The output, express The L1 norm of Indicates The maximum L1 norm of all filters in the convolutional layer.
3. The method for accelerating the detection of fine defects in medical syringes according to claim 1, characterized in that: The expression for the column index is: ,in, Indicates the filter number, Indicates The first defect High sensitivity filter.
4. The method for accelerating the detection of fine defects in medical syringes according to claim 1, characterized in that: The Minor Defect Prioritization Matrix The calculation method is as follows: in, Represents the filter sensitivity matrix according to the defect priority P by row A function to sort in descending order. Indicates the priority of the first defect. Indicates the priority of the second defect. Indicates The priority of the defects, represents the number of categories of defects, Indicates The number of pixels with this defect, It is The number of pixels with this defect.
5. The method for accelerating the detection of fine defects in medical syringes according to claim 1, characterized in that: Step S46 specifically includes: Minor defects Transpose and expand it row-wise into a 1D vector ; from In the process, filters are selected and deleted in order from high to low according to the defect priority without duplication until the pruning rate is reached.
6. The medical syringe fine defect detection acceleration method according to claim 1, characterized in that: The medical syringe image dataset is collected on the device side using a conveyor system and a camera, the medical syringe images in the dataset are preprocessed and steps S2 to S4 are completed on the server side, and the compact model is deployed on the device side to detect defects on the medical syringes in real time.
7. The method for accelerating the detection of fine defects in medical syringes according to claim 1, characterized in that: The sample number ratio of the training set and the validation set is 9:1.
Citation Information
Patent Citations
Structured network model compression acceleration method based on multistage pruning
CN110619385A
System and method for detecting syringe seal defects
CN114414583A