A Medical Syringe Hair Defect Detection Method, System, Device and Medium

Through the deep neural network and hair detection algorithm based on the texture enhancement module layer, the problem of insufficient hair feature extraction in the prior art is solved, efficient detection of hair defects for medical syringes is realized, and detection accuracy and production efficiency are improved.

CN116245818BActive Publication Date: 2025-08-01XIAMEN UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310036931.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-10
Publication Date
2025-08-01
Estimated Expiration
2043-01-10

AI Technical Summary

Technical Problem

The existing machine vision detection methods are difficult to effectively extract hair characteristics, resulting in insufficient accuracy in detecting hair defects in medical syringes, especially in case of high noise interference in production environments.

Method used

A deep neural network based on the texture enhancement module layer is adopted, and the convolution kernel of the grouped convolution layer is used to enable binary encoding of local binary mode operators in the equivalent mode to enhance hair texture feature extraction, and combined with a hair detection algorithm, the defect communication domain is segmented and judged to determine hair defects.

Benefits of technology

It improves the accuracy of hair defect detection for medical syringes, reduces labor costs, solves the problem of background noise interference, and improves production quality and production capacity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116245818B_ABST
    Figure CN116245818B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, system, device and medium for detecting hair defects of medical syringes, relating to the technical field of defect detection of medical devices. The method includes: obtaining an image of a medical syringe to be tested; inputting the image of the medical syringe to be tested into a hair defect segmentation model to obtain several defect connected domains; the hair defect segmentation model is determined based on a deep neural network having a texture enhancement module layer; the texture enhancement module layer includes a grouped convolutional layer; the convolutional kernel of the grouped convolutional layer is determined based on the binary coding of a local binary pattern operator under an equivalent pattern; and using a hair detection algorithm, based on all the defect connected domains, to determine the hair defects in the image of the medical syringe to be tested. The present invention can solve the problems that ordinary neural networks cannot effectively extract hair features to detect hair defects and noise interference, and improve the accuracy of detecting hair defects of medical syringes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of medical device defect detection, and in particular to a method, system, equipment and medium for detecting hair defects in a medical needle tube. Background Art

[0002] Product defect detection is a crucial component of industrial production and a key step in product quality control. Product defects can be broadly categorized into two main categories: inherent product defects and defects caused by the production environment. The former are caused by poor performance of production equipment, while the latter are caused by foreign matter. Foreign matter is often exogenous, meaning it originates in the production environment and is not part of the production process, contaminating the product. While inherent product defects can be effectively mitigated through improvements to production equipment, defects caused by the production environment are diverse and difficult to completely avoid.

[0003] During the production process of medical syringes, foreign material defects are inevitable. Currently, medical syringe manufacturers primarily rely on manual or machine vision inspection to detect defects in syringes. Manual methods are inefficient, costly, and difficult to adapt to the demands of mass production. Although computer vision-based defect detection technology has been successfully applied in various industrial fields, its performance in hair defect detection remains insufficient. This is because hair features in images, such as pixel size, shape, and spatial position, are highly variable and indistinct. Existing machine vision detection methods, including traditional machine learning and deep learning, struggle to directly extract hair features using techniques such as pixel histograms, multi-scale variations, and adjacency matrices. Furthermore, in real-world production environments, wrinkles resembling hair often appear on the inner walls of syringe packaging, hindering hair detection. Therefore, to improve the feature extraction and hair defect detection capabilities of deep neural networks, combining hair feature enhancement techniques with robust hair detection methods is crucial for ensuring the quality and productivity of the medical syringe industry. Summary of the Invention

[0004] The purpose of the present invention is to provide a method, system, equipment and medium for detecting hair defects in medical needle tubes, so as to solve the problem that ordinary neural networks cannot effectively extract hair features to detect hair defects and noise interference, and improve the accuracy of hair defect detection in medical needle tubes.

[0005] To achieve the above object, the present invention provides the following solutions:

[0006] A method for detecting hair defects in a medical needle tube, comprising:

[0007] Acquire an image of the medical needle tube to be tested;

[0008] Input the image of the medical syringe to be measured into the hair defect segmentation model to obtain several defect connected components; the hair defect segmentation model is determined based on a deep neural network with a texture enhancement module layer; the texture enhancement module layer includes a grouped convolutional layer; the convolutional kernel of the grouped convolutional layer is determined based on the binary encoding of the local binary pattern operator in the equivalent pattern;

[0009] Adopt a hair detection algorithm to determine the hair defects in the image of the medical syringe to be measured based on all the defect connected components.

[0010] Optionally, adopting a hair detection algorithm to determine the hair defects in the image of the medical syringe to be measured based on all the defect connected components specifically includes:

[0011] If the number of the defect connected components is not equal to 0, then:

[0012] For any one of the defect connected components, taking a set distance as a unit, divide the defect connected component into several independent units, and calculate the diameters of the inscribed circles of all the independent units to obtain a diameter set corresponding to the defect connected component;

[0013] Calculate the diameter standard deviation corresponding to each diameter set and the length of the defect connected component corresponding to each defect connected component respectively;

[0014] For any one of the defect connected components, if the diameter standard deviation is within the set smoothness threshold range and the length of the defect connected component is within the set length threshold range, then determine that the defect connected component is a hair defect in the image of the medical syringe to be measured; if the diameter standard deviation is not within the set smoothness threshold range, or the length of the defect connected component is not within the set length threshold range, then determine that the defect connected component is not a hair defect in the image of the medical syringe to be measured;

[0015] If the number of the defect connected components is equal to 0, or all the defect connected components are not hair defects in the image of the medical syringe to be measured, then determine that there are no hair defects in the image of the medical syringe to be measured.

[0016] Optionally, the method for determining the hair defect segmentation model specifically includes:

[0017] Obtain a medical syringe image dataset; the medical syringe image dataset includes several medical syringe images with hair defects and corresponding segmentation labels;

[0018] Divide the medical syringe image dataset into a training dataset and a validation dataset according to a set ratio;

[0019] Build a deep neural network;

[0020] Taking the accuracy rate of the trained deep neural network on the validation data set meeting the set conditions as the goal, the deep neural network is iteratively trained using the training data set to obtain a hair defect segmentation model.

[0021] Optionally, the deep neural network includes: a first convolutional layer, a second convolutional layer, a third max pooling layer, a fourth convolutional layer, a fifth convolutional layer, a sixth convolutional layer, a seventh max pooling layer, an eighth texture enhancement module layer, a ninth convolutional layer, a tenth convolutional layer, an eleventh convolutional layer, a twelfth convolutional layer, a thirteenth max pooling layer, a fourteenth convolutional layer, a fifteenth upsampling layer, a sixteenth concatenation layer, and a seventeenth convolutional layer connected in series;

[0022] Among them, the eighth texture enhancement module layer is also connected to the sixteenth concatenation layer, and the eighth texture enhancement module layer includes: a grouped convolutional layer and a pointwise convolutional layer connected in series; the convolutional kernel size of the grouped convolutional layer is 3, the stride is 1, the padding is 1, and the number of groups is 58; the convolutional kernel size of the pointwise convolutional layer is 1, the stride is 1, the padding is 1, and the number of groups is 1.

[0023] Optionally, the specific formula for the convolutional kernel of the grouped convolutional layer is:

[0024]

[0025] Among them, is the j-th convolutional kernel of the grouped convolutional layer, is the binary encoding of the local binary pattern operator in the j-th equivalent pattern, c is the parameter value at the center of the convolutional kernel, represents arranged in a counterclockwise manner from the low bit to the high bit with c as the center.

[0026] Optionally, the value of c is 1, and the binary encoding of the local binary pattern operator in the equivalent pattern specifically includes:

[0027] L b={00000000,00000001,0000010,0000011,00000100,00000110,00000111,00001000,00001100,00001110,0001111,0010000,00011000,00011100,0001110,00011111,00100000,00110000,00111000,00111100,00111110,00111111,01000000,01100000,01110000,01111000,01111100,01111110,01111111,10000000,11000000,11100000,11110000,11111000,11111100,11111110,11111111,10000001,10000011,10000111,10001111,10011111,10111111,11000001,11000011,11000111,11001111,11011111,11100001,11100011,11100111,11101111,11110001,11111001,11110111,11111001,11111011,11111101}。

[0028] Optionally, the calculation formula for the length of the defective connected domain is:

[0029] L i =h*n

[0030] where L i is the length of the i-th defective connected domain, h is the set distance, and n is the number of independent units in the i-th defective connected domain.

[0031] A medical syringe hair defect detection system, comprising:

[0032] An image acquisition module for acquiring an image of a medical syringe to be tested;

[0033] A defect segmentation module for inputting the image of the medical syringe to be tested into a hair defect segmentation model to obtain several defective connected domains; the hair defect segmentation model is determined based on a deep neural network having a texture enhancement module layer; the texture enhancement module layer includes a grouped convolution layer; the convolution kernel of the grouped convolution layer is determined based on the binary coding of the local binary pattern operator in the equivalent pattern;

[0034] A defect detection module, which is used to adopt a hair detection algorithm and determine hair defects in the medical syringe image to be measured based on all the defect connected regions.

[0035] An electronic device includes a memory and a processor. The memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the above-mentioned medical syringe hair defect detection method.

[0036] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the above-mentioned medical syringe hair defect detection method.

[0037] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:

[0038] The medical syringe hair defect detection method provided by the present invention determines a hair defect segmentation model based on a deep neural network with a texture enhancement module layer, and uses the hair defect segmentation model to perform defect segmentation on the medical syringe image to be measured. Since the texture enhancement module layer includes a grouped convolutional layer, and the convolutional kernel of the grouped convolutional layer is determined based on the binary coding of the local binary pattern operator in the equivalent pattern, it can effectively extract all the defect connected regions in the medical syringe image to be measured. Finally, using a hair detection algorithm, based on all the defect connected regions, the hair defects in the medical syringe image to be measured are determined, which can improve the accuracy of the hair defect detection of the medical syringe. Description of the Drawings

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required to be used in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0040] Figure 1 It is a flowchart of the medical syringe hair defect detection method provided by the present invention;

[0041] Figure 2 It is a specific flowchart of the medical syringe hair defect detection method provided by the present invention;

[0042] Figure 3 It is a network structure diagram of the deep neural network provided by the present invention;

[0043] Figure 4 It is a hair texture feature map before texture enhancement provided by the present invention;

[0044] Figure 5 It is a hair texture feature map after texture enhancement provided by the present invention;

[0045] Figure 6 Schematic diagram of the method for determining the convolution kernel of the grouped convolution layer provided by the present invention;

[0046] Figure 7 Module diagram of the medical syringe hair defect detection system provided by the present invention.

[0047] Symbol description:

[0048] Image acquisition module - 1, defect segmentation module - 2, defect detection module - 3. Detailed implementation manners

[0049] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0050] The purpose of the present invention is to provide a medical syringe hair defect detection method, system, device and medium to solve the problem that ordinary neural networks cannot effectively extract hair features to detect hair defects and noise interference, and improve the accuracy of hair defect detection of medical syringes.

[0051] To make the above objects, features and advantages of the present invention more obvious and understandable, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific implementation manners.

[0052] Embodiment 1

[0053] As Figure 1 and Figure 2 shown, the present invention provides a medical syringe hair defect detection method, including:

[0054] Step S1: Obtain an image of the medical syringe to be measured.

[0055] Specifically, an image acquisition device is set on the conveyor belt of the medical syringe to obtain a complete image of the medical syringe.

[0056] As a specific implementation manner, step S1 specifically includes:

[0057] Step S1-1: Adjust the relative positions of the image acquisition device and its lighting device with respect to the syringe according to the size of the syringe on the conveyor belt, so that the image acquisition device can capture a complete top view of the syringe.

[0058] Step S1-2: Collect N frames of medical needle tip sequence images {Image0, Image1, …, Image N-1} under the condition of sufficient light source at the top of the medical syringe.

[0059] Step S2: Input the image of the medical syringe to be measured into the hair defect segmentation model to obtain several defect connected regions; the hair defect segmentation model is determined based on a deep neural network with a texture enhancement module layer; the texture enhancement module layer includes a grouped convolutional layer; the convolutional kernel of the grouped convolutional layer is determined based on the binary coding of the local binary pattern operator in the equivalent pattern.

[0060] Specifically, based on the acquired images, construct a deep neural network with a texture enhancement module layer to extract defects, and use the hair defect segmentation model determined by the deep neural network based on the deep neural network with a texture enhancement module layer to extract the collected syringe images {Image0, Image1, …, Image N-1}. For any syringe image, several defect connected regions can be obtained.

[0061] As a specific implementation manner, the method for determining the hair defect segmentation model specifically includes:

[0062] Step S2-1: Obtain a medical syringe image dataset; the medical syringe image dataset includes several medical syringe images with hair defects and corresponding segmentation labels. Specifically, collect a medical syringe dataset {X} with a certain number of images with hair defects, and use the labelme tool to label the hair in the medical syringe images to obtain the segmentation labels {Y seg}.

[0063] In this embodiment, the labelme software is used to perform pixel-level annotation on the hair images; the hair pixels on the syringe are labeled with a polygon box to obtain a single-channel annotation image {Y seg}; the hair pixels in the annotation image are the foreground, and the rest are the background; the foreground pixel value is set to 255, and the background pixel value is set to 0.

[0064] Step S2-2: Divide the medical syringe image dataset into a training dataset and a validation dataset according to a set ratio. Specifically, divide the dataset {X, Y seg} into a training dataset A = {X train , Y train_seg} and a validation dataset B = {X val , Y val_seg}.

[0065] Step S2-3: Construct a deep neural network. Specifically, construct a deep neural network with an HLBP convolutional kernel texture enhancement module layer, input the dataset A into the network, and iteratively optimize some network parameters to obtain the optimal hair defect segmentation model M on the dataset B.

[0066] Among them, the "HLBP convolutional kernel texture enhancement module" is defined as depthwise separable convolution, including a grouped convolution layer and a pointwise convolution layer. The convolutional kernel of the grouped convolution layer uses a custom HLBP convolutional kernel, and the parameters of this convolutional kernel are not updated during the network training process.

[0067] See Figure 3 , the deep neural network includes a seventeen-layer network structure, which are respectively the first convolutional layer, the second convolutional layer, the third max pooling layer, the fourth convolutional layer, the fifth convolutional layer, the sixth convolutional layer, the seventh max pooling layer, the eighth texture enhancement module layer, the ninth convolutional layer, the tenth convolutional layer, the eleventh convolutional layer, the twelfth convolutional layer, the thirteenth max pooling layer, the fourteenth convolutional layer, the fifteenth upsampling layer, the sixteenth concatenation layer, and the seventeenth convolutional layer connected in series.

[0068] Among them, for the convolutional layers of the first and second layers, the convolutional kernel size is 5, the stride is 1, the padding is 2, and 32 feature maps are output; after each convolutional layer, there is a batch normalization layer and a ReLU activation layer.

[0069] For the third max pooling layer, the pooling window size is 2×2.

[0070] For the convolutional layers of the fourth, fifth, and sixth layers, the convolutional kernel size is 5, the stride is 1, the padding is 2, and 58 feature maps are output; after each convolutional layer, there is a batch normalization layer and a ReLU activation layer.

[0071] For the seventh max pooling layer, the pooling window size is 2×2.

[0072] The eighth texture enhancement module layer is specifically an HLBP convolutional kernel texture enhancement module, and its specific structure is: the first layer is a grouped convolution layer, the convolutional kernel size is 3, the stride is 1, the padding is 1, the number of groups is 58, the second layer is a pointwise convolution layer, the convolutional kernel size is 1, the stride is 1, the padding is 0, the number of groups is 1, and after each convolutional layer, there is a batch normalization layer and a ReLU activation layer, and 58 feature maps are output.

[0073] For the convolutional layers of the ninth, tenth, eleventh, and twelfth layers, the convolutional kernel size is 5, the stride is 1, the padding is 2, and 128 feature maps are output; after each convolutional layer, there is a batch normalization layer and a ReLU activation layer.

[0074] For the thirteenth max pooling layer, the pooling window size is 2×2.

[0075] The fourteenth convolutional layer has a convolutional kernel size of 15, a stride of 1, a padding of 7, and outputs 512 feature maps. After the convolutional layer, there are a batch normalization layer and a ReLU activation layer.

[0076] The fifteenth upsampling layer has a sampling factor of 2.

[0077] The sixteenth concatenation layer is used to concatenate the output of the eighth layer and the output of the fifteenth layer.

[0078] The seventeenth layer is a convolutional layer with a convolutional kernel size of 1, a stride of 1, a padding of 0, and the output is the hair defect segmentation result including several defect connected regions.

[0079] Step S2-4: Taking the accuracy of the trained deep neural network on the validation data set meeting the set conditions as the goal, iteratively training the deep neural network using the training data set to obtain a hair defect segmentation model.

[0080] As a specific implementation, during the iterative training process, the loss function is defined as the DCE cross-entropy loss function, and the optimization algorithm uses the SGD optimizer. Among them, the convolutional kernel in the grouped convolution of the eighth layer of the network is a fixed HLBP convolutional kernel and does not participate in the parameter update of the overall network.

[0081] The prototype of the HLBP convolutional kernel is taken from the Local Binary Pattern (LBP) operator. The LBP operator is an operator used to describe the local texture features of an image, with the advantages of rotation invariance and gray invariance. There are 58 operators in its equivalent pattern. To enhance the texture information of hair in the low-level features, the binary encoding of the 58 equivalent pattern LBP operators is used as the convolutional kernel parameters to enhance the hair texture information. The decimal representation of this LBP operator is: L = {0, 1, 2, 3, 4, 6, 7, 8, 12, 14, 15, 16, 24, 28, 30, 31, 32, 48, 56, 60, 62, 63, 64, 96, 112, 120, 124, 126, 127, 128, 129, 131, 135, 143, 159, 191, 192, 193, 195, 199, 207, 223, 224, 225, 227, 231, 239, 240, 241, 243, 247, 248, 249, 251, 252, 253, 254, 255}, and in binary encoding it is: L b={00000000,00000001,0000010,0000011,00000100,00000110,00000111,00001000,00001100,00001110,0001111,0010000,00011000,00011100,0001110,00011111,00100000,00110000,00111000,00111100,00111110,00111111,01000000,01100000,01110000,01111000,01111100,01111110,01111111,10000000,11000000,11100000,11110000,11111000,11111100,11111110,11111111,10000001,10000011,10000111,10001111,10011111,10111111,11000001,11000011,11000111,11001111,11011111,11100001,11100011,11100111,11101111,11110001,11111001,11110111,11111001,11111011,11111101}。

[0082] Convert L b to a 3×3 convolution kernel using the following formula:

[0083]

[0084] where is the j-th convolution kernel of the grouped convolution layer, is the binary encoding of the local binary pattern operator in the j-th equivalent pattern, c is the parameter value at the center of the convolution kernel, means arranging in a counterclockwise manner from the lowest bit to the highest bit with c as the center.

[0085] For example, S(00000001, c) is expressed as:

[0086]

[0087] In the present invention, the convolution kernel of the grouped convolution layer in the texture enhancement module layer in the above step S2-3 is set to which can enhance the hair texture features. The enhancement effect of the hair features is as shown in Figure 4 and Figure 5 .

[0088] As a specific implementation, the value of c is 1.

[0089] In this embodiment, the convolution kernel set obtained by using the convolution kernel determination method as Figure 6 shown It is: {[[0,0,0],[0,1,0],[0,0,0]],[[0,0,0],[0,1,1],[0,0,0]],[[0,0,1],[0,1,0],[0,0,0]],[[0,0,1],[0,1,1],[0,0,0]],[[0,1,0],[0,1,0],[0,0,0]],[[0,1,1],[0,1,0],[0,0,0]],[[0,1,1],[0,1,1],[0,0,0]],[[1,0,0],[0,1,0],[0,0,0]],[[1,1,0],[0,1,0],[0,0,0]],[[1,1,1],[0,1,0],[0,0,0]],[[1,1,1],[0,1,1],[0,0,0]],[[0,0,0],[1,1,0],[0,0,0]],[[1,0,0],[1,1,0],[0,0,0]],[[1,1,0],[1,1,0],[0,0,0]],[[1,1,1],[1,1,0],[0,0,0]],[[1,1,1],[1,1,1],[0,0,0]],[[0,0,0],[0,1,0],[1,0,0]],[[0,0,0],[1,1,0],[1,0,0]],[[1,0,0],[1,1,0],[1,0,0]],[[1,1,0],[1,1,0],[1,0,0]],[[1,1,1],[1,1,0],[1,0,0]],[[1,1,1],[1,1,1],[1,0,0]],[[0,0,0],[0,1,0],[0,1,0]],[[0,0,0],[0,1,0],[1,1,0]],[[0,0,0],[1,1,0],[1,1,0]],[[1,0,0],[1,1,0],[1,1,0]],[[1,1,0],[1,1,0],[1,1,0]],[[1,1,1],[1,1,0],[1,1,0]],[[1,1,1],[1,1,1],[1,1,0]],[[0,0,0],[0,1,0],[0,0,1]],[[0,0,0],[0,1,0],[0,1,1]],[[0,0,0],[0,1,0],[1,1,1]],[[0,0,0],[1,1,0],[1,1,1]],[[1,0,0],[1,1,0],[1,1,1]],[[1,~,1],[1,1,0],[1,1,1]],[[1,1,1],[1,1,1],[1,1,1]],[[0,0,0],[0,1,1],[0,0,1]],[[0,0,1],[[0,1,1],[0,0,1]],[[0,1,1],[0,1,1],[0,0,1]],[[1,1,1],[0,1,1],[0,0,1]],[[1,1,1],[1,1,1],[0,0,1]],[[1,1,1],[1,1,1],[1,0,1]],[[0,0,0],[0,1,1],[0,1,1]],[[0,0,1],[0,1,1],[0,1,1]],[[0,1,1],[0,1,1],[0,1,1]],[[1,1,1],[0,1,1],[0,1,1]],[[1,1,1],[1,1,1],[0,1,1]],[[0,0,0],[0,1,1],[1,1,1]],[[0,0,1],[0,1,1],[1,1,1]],[[0,1,1],[0,1,1],[1,1,1]],[[1,1,1],[0,1,1],[1,1,1]],[[0,0,0],[1,1,1],[1,1,1]],[[1,0,0],[1,1,1],[1,1,1]],[[0,1,1],[1,1,1],[1,1,1]],[[1,0,0],[1,1,1],[1,1,1]],[[1,0,1],[1,1,1],[1,1,1]],[[1,1,0],[1,1,1],[1,1,1]]}。,

[0090] Step S3: Adopt a hair detection algorithm to determine the hair defects in the medical syringe image to be measured based on all the defect connected regions.

[0091] As a specific implementation manner, step S3 specifically includes:

[0092] If the number of the defect connected regions is not equal to 0, then:

[0093] For any defect connected region, taking a set distance as a unit, divide the defect connected region into several independent units, and calculate the diameters of the inscribed circles of all the independent units to obtain a diameter set corresponding to the defect connected region.

[0094] Calculate the diameter standard deviation corresponding to each diameter set and the length of the defect connected region corresponding to each defect connected region respectively.

[0095] For any defect connected region, if the standard deviation of the diameter is within the set smoothness threshold range and the length of the defect connected region is within the set length threshold range, it is determined that the defect connected region is a hair defect in the medical syringe image to be tested; if the standard deviation of the diameter is not within the set smoothness threshold range or the length of the defect connected region is not within the set length threshold range, it is determined that the defect connected region is not a hair defect in the medical syringe image to be tested.

[0096] If the number of the defect connected regions is equal to 0, or all the defect connected regions are not hair defects in the medical syringe image to be tested, it is determined that there are no hair defects in the medical syringe image to be tested.

[0097] The above step S3 can also be specifically described as follows:

[0098] Step S3-1: Number the k defect connected regions extracted in step S2 as {f(1), f(2), …, f(k)}.

[0099] Step S3-2: For any pixel block f(k), divide the pixel block into n independent units with a set distance h as the unit, calculate the inscribed circles of all the independent units, and obtain the diameter set Preferably, h is set to 10.

[0100] Step S3-3: Calculate the standard deviation SD i of each diameter set R i and the length L i of this pixel block, which are used to measure the smoothness and length of the hair, where n is the number of independent units in the i-th defect connected region.

[0101] Step S3-4: Let the smoothness threshold range of the hair defect be (T1, T2), and the length threshold range be (l1, l2). If SD i and L i both satisfy this threshold range at the same time, then f(i) is determined to be a hair defect. On the contrary, if SD i and L i do not satisfy this threshold range in one item, then f(i) is determined to be an interference item. Preferably, T1 is set to 0, T2 is set to 1.4, l1 is set to 20, and l2 is set to 100.

[0102] Step S3-5: Repeat step S3-2 and step S3-4 until all pixel blocks (i.e., all defect connected regions) are judged.

[0103] Example 2

[0104] To implement the method corresponding to the first embodiment above to achieve the corresponding functions and technical effects, the following provides a medical syringe hair defect detection system. As Figure 7 shown, the system includes:

[0105] An image acquisition module 1 for acquiring an image of a medical syringe to be tested.

[0106] A defect segmentation module 2 for inputting the image of the medical syringe to be tested into a hair defect segmentation model to obtain several defect connected regions; the hair defect segmentation model is determined based on a deep neural network with a texture enhancement module layer; the texture enhancement module layer includes a grouped convolutional layer; the convolutional kernel of the grouped convolutional layer is determined based on the binary encoding of the local binary pattern operator in the equivalent pattern.

[0107] A defect detection module 3 for using a hair detection algorithm to determine the hair defects in the image of the medical syringe to be tested based on all the defect connected regions.

[0108] Embodiment III

[0109] The embodiment of the present invention further provides an electronic device, including a memory and a processor. The memory is used to store a computer program, and the processor is used to run the computer program so that the electronic device executes the medical syringe hair defect detection method in Embodiment I. The electronic device can be a server.

[0110] In addition, the present invention also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the medical syringe hair defect detection method in Embodiment I.

[0111] In summary, the present invention provides a syringe hair defect detection method, system, device and medium based on deep texture feature enhancement. For the medical syringe to-be-detected image collected on the production line, the hair defects existing in the medical syringe are detected by using the syringe hair defect detection method based on deep texture feature enhancement. The specific process includes: Step 1, setting an image acquisition device on the medical syringe conveyor belt to acquire a complete medical syringe image; Step 2, based on the acquired image, constructing a deep neural network with a hair texture enhancement module to extract defects; Step 3, based on the extracted defects, using a hair detection algorithm to detect whether there are hair defects in the syringe. After adopting the above solution, the present invention can detect the hair defects in the medical syringe by means of a two-stage method of deep hair texture feature enhancement and hair detection. This detection method can effectively reduce the labor cost of enterprises, solve the problem that ordinary neural networks cannot extract hair features, and solve the interference problem of background noise, such as packaging box wrinkles, during the production process of syringe products, and improve the quality of medical syringe products.

[0112] In this specification, the various embodiments are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts among the various embodiments, reference can be made to each other. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple. For the relevant parts, reference can be made to the description in the method section.

[0113] Specific examples are used in this article to elaborate on the principles and implementation manners of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those of ordinary skill in the art, based on the idea of the present invention, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation on the present invention.

Claims

1. A medical syringe hair defect detection method, characterized in that, Including: Obtain a medical syringe image to be measured; Input the medical syringe image to be measured into a hair defect segmentation model to obtain several defect connected components; The hair defect segmentation model is determined based on a deep neural network with a texture enhancement module layer; the texture enhancement module layer includes a grouped convolutional layer; the convolutional kernel of the grouped convolutional layer is determined based on the binary encoding of the local binary pattern operator in the equivalent pattern; Adopt a hair detection algorithm, and based on all the defect connected components, determine the hair defects in the medical syringe image to be measured, specifically including: If the number of the defect connected components is not equal to 0, then: For any defect connected component, taking a set distance as a unit, divide the defect connected component into several independent units, and calculate the diameters of the inscribed circles of all the independent units to obtain a diameter set corresponding to the defect connected component; Calculate the diameter standard deviation corresponding to each diameter set and the length of the defect connected component corresponding to each defect connected component respectively; For any defect connected component, if the diameter standard deviation is within a set smoothness threshold range and the length of the defect connected component is within a set length threshold range, then determine that the defect connected component is a hair defect in the medical syringe image to be measured; if the diameter standard deviation is not within the set smoothness threshold range or the length of the defect connected component is not within the set length threshold range, then determine that the defect connected component is not a hair defect in the medical syringe image to be measured; If the number of the defect connected components is equal to 0, or all the defect connected components are not hair defects in the medical syringe image to be measured, then determine that there are no hair defects in the medical syringe image to be measured.

2. The medical syringe hair defect detection method according to claim 1, characterized in that, The method for determining the hair defect segmentation model specifically includes: Obtain a medical syringe image dataset; the medical syringe image dataset includes several medical syringe images with hair defects and corresponding segmentation labels; Divide the medical syringe image dataset into a training dataset and a validation dataset according to a set ratio; Construct a deep neural network; Taking the accuracy of the trained deep neural network on the validation dataset meeting a set condition as the goal, use the training dataset to iteratively train the deep neural network to obtain a hair defect segmentation model.

3. The medical syringe hair defect detection method according to claim 2, wherein The deep neural network includes: a first convolutional layer, a second convolutional layer, a third max pooling layer, a fourth convolutional layer, a fifth convolutional layer, a sixth convolutional layer, a seventh max pooling layer, an eighth texture enhancement module layer, a ninth convolutional layer, a tenth convolutional layer, an eleventh convolutional layer, a twelfth convolutional layer, a thirteenth max pooling layer, a fourteenth convolutional layer, a fifteenth upsampling layer, a sixteenth concatenation layer, and a seventeenth convolutional layer connected in series; Among them, the eighth texture enhancement module layer is also connected to the sixteenth concatenation layer, and the eighth texture enhancement module layer includes: a grouped convolutional layer and a pointwise convolutional layer connected in series; the convolutional kernel size of the grouped convolutional layer is 3, the stride is 1, the padding is 1, and the number of groups is 58; the convolutional kernel size of the pointwise convolutional layer is 1, the stride is 1, the padding is 1, and the number of groups is 1.

4. The method for detecting hair defects in a medical needle tube according to claim 3, wherein: The specific formula of the convolutional kernel of the grouped convolutional layer is: Among them, is the j-th convolution kernel of the grouped convolution layer, is the binary encoding of the local binary pattern operator in the j-th equivalent pattern, and c is the parameter value at the center of the convolution kernel. denotes arranged in a counterclockwise manner from the lowest bit to the highest bit with c as the center.

5. The medical syringe hair defect detection method according to claim 4, characterized in that, The value of c is 1, and the binary encoding of the local binary pattern operator in the equivalent pattern specifically includes: L b ={00000000,00000001,0000010,0000011,00000100,00000110, 00000111,00001000,00001100,00001110,0001111,0010000,00011000,00011100,0001110,00011111,00100000,00110000,00111000,00111100,00111110,00111111,01000000,01100000,01110000,01111000,01111100,01111110,01111111,10000000,11000000,11100000,11110000,11111000,11111100,11111110,11111111,10000001,10000011,10000111,10001111,10011111,10111111,11000001,11000011,11000111,11001111,11011111,11100001,11100011,11100111,11101111,11110001,11111001,11110111,11111001,11111011,11111101}。 6. The medical syringe hair defect detection method according to claim 1, characterized in that, The calculation formula for the length of the defective connected region is: L i = h * n Among them, L i is the length of the i-th defective connected domain, h is the set distance, and n is the number of independent units in the i-th defective connected domain.

7. A medical needle tube hair defect detection system, used to implement the medical needle tube hair defect detection method according to claim 1, characterized in that: including: An image acquisition module for acquiring an image of a medical syringe to be measured; A defect segmentation module for inputting the image of the medical syringe to be measured into a hair defect segmentation model to obtain several defective connected regions; the hair defect segmentation model is determined based on a deep neural network having a texture enhancement module layer; the texture enhancement module layer includes a grouped convolutional layer; the convolutional kernel of the grouped convolutional layer is determined based on the binary encoding of the local binary pattern operator in the equivalent pattern; A defect detection module for using a hair detection algorithm to determine the hair defects in the image of the medical syringe to be measured based on all the defective connected regions.

8. An electronic device, characterized in that, including a memory and a processor, the memory is used for storing a computer program, and the processor runs the computer program to enable the electronic device to execute the medical syringe hair defect detection method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, It stores a computer program, and when the computer program is executed by a processor, it implements the medical syringe hair defect detection method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Anti-vibration machine vision detection method of foreign matters in liquid medicine

    CN102519984A

  • Flexible film defect detection device based on machine vision and detection method thereof

    CN108414531A