System and method for monitoring visible foreign matters in medicine
Through X-ray imaging technology and the server-side image processing module, combined with the visible foreign object recognition model, the problem of inaccurate detection when the drug is colored or turbid is solved, and efficient, accurate detection and early warning of visible foreign objects in the drug is achieved.
Patent Information
- Application Number
- CN202411664533.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-03-14
AI Technical Summary
Existing drug visible foreign object detection technology is difficult to achieve accurate and reliable detection and early warning when the drug is colored or turbid, and the detection efficiency is low and the accuracy is not high.
X-ray imaging mechanism is used to penetrate drugs through X-rays to generate drug detection images, and use the server-side image preprocessing, feature extraction, identification and alarm modules, combined with the visible foreign object recognition model, to achieve accurate identification and early warning of visible foreign objects in drugs.
When the drug is colored or turbid, accurate and reliable detection and warning of visible foreign objects in the drug can be achieved, improving detection efficiency and accuracy, and avoiding missed and missed detection.
Smart Images

Figure CN119619185A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of drug quality detection, and in particular to a system and method for monitoring visible foreign matter in drugs. Background Art
[0002] The quality and safety of drugs are directly related to the life and health of patients. During the drug production process, drugs may contain visible foreign matter due to various reasons, such as hair, needle tips, hair, plastic fragments, rubber plug particles, etc. The presence of these foreign matter will not only affect the appearance and quality of the drugs, but also pose a serious threat to the health of patients. Therefore, the detection of visible foreign matter in drugs is an important part of drug quality control.
[0003] Existing drug visible foreign matter detection mainly adopts offline detection or online detection. Offline detection is to take a small amount of a certain representative sample and dissolve it into liquid with water for microscopic observation or instrument detection to detect the specific number of visible foreign matter. It is a destructive detection method with the advantage of high detection accuracy, but the disadvantage is low efficiency and poor representativeness.
[0004] Online testing uses manual or machine testing on each bottle of product. The disadvantage is that the missed detection error is large, especially when the sample itself cannot be tested due to color or turbidity, and it is mainly for colorless injection liquids.
[0005] Based on this, there is an urgent need for a visible foreign matter monitoring system and method in medicines, which can achieve accurate and reliable detection and early warning of visible foreign matter in medicines when the medicines themselves have color or produce turbidity, greatly improving the efficiency of visible foreign matter detection while achieving high accuracy of detection. Summary of the invention
[0006] One of the purposes of the present invention is to provide a system and method for monitoring visible foreign matter in medicines, which can achieve accurate and reliable detection and early warning of visible foreign matter in medicines when the medicines themselves have color or produce turbidity, greatly improving the efficiency of visible foreign matter detection while achieving high accuracy of detection.
[0007] In order to achieve the above-mentioned object, a system for monitoring visible foreign matter in medicines is provided, comprising an X-ray imaging mechanism and a service end in communication connection with the X-ray imaging mechanism;
[0008] X-ray imaging mechanism, used to generate X-rays through a ray machine, penetrate the inspected drugs, output corresponding drug inspection images and feed them back to the server;
[0009] The server includes:
[0010] A receiving module, used for receiving the drug detection image output by the X-ray imaging mechanism;
[0011] An image preprocessing module is used to perform preprocessing operations on the received drug detection images;
[0012] A feature extraction module is used to extract key features of the drug detection image after preprocessing based on a preset key feature extraction model;
[0013] An image recognition module is used to identify visible foreign matter in the drug inspection image according to the extracted key features and based on a preset visible foreign matter recognition model, and output corresponding visible foreign matter recognition data;
[0014] The alarm module is used to determine whether the corresponding inspected drug is qualified based on the output visible foreign matter identification data. If not, the inspected drug is judged to be an unqualified product and an early warning message is issued. If so, the inspected drug is judged to be a qualified product.
[0015] Technical principles and effects of this solution: In this solution, X-rays are first generated by an X-ray imaging mechanism, and the X-rays are used to penetrate the inspected drugs to obtain corresponding drug inspection images and then feed them back to the server. After that, after the server receives the drug inspection image output by the X-ray imaging mechanism, the first step is to preprocess the received drug inspection image. The preprocessing operation can remove noise and other interference factors from the drug inspection image, thereby improving the reliability and accuracy of key feature extraction of subsequent drug inspection images.
[0016] The second step is to extract key features of the preprocessed drug inspection image based on the preset key feature extraction model. Then, through the preset visible foreign matter recognition model, the key features corresponding to the drug inspection image are input as input data into the visible foreign matter recognition model, thereby realizing the corresponding visible foreign matter recognition data. The last step is to judge whether the corresponding inspected drug is qualified based on the output visible foreign matter recognition data. If not, the inspected drug is judged to be an unqualified product and a warning message is issued. If so, the inspected drug is judged to be a qualified product.
[0017] Compared with the prior art which adopts taking a small amount of a certain representative sample and dissolving it into liquid with water for microscopic observation or instrument detection, detecting the specific number of visible foreign matter or manually or machine-testing each bottle of product, this scheme utilizes the physical property of X-rays that can penetrate various materials of different densities that ordinary visible light cannot penetrate. By penetrating the glass bottle packaging of the medicine and performing X-ray scanning on the medicine, the visible foreign matter hidden in the medicine can be directly observed. The X-ray penetration technology does not need to physically destroy or dissolve the medicine, and can directly scan the entire bottle of medicine, which greatly reduces the time and complexity of sample processing and realizes the function of non-destructive detection.
[0018] X-rays can penetrate various materials of different densities, including glass bottles and drugs themselves. Even if the drugs are colored or turbid, it will not affect the accuracy of the test results. At the same time, X-ray imaging technology has high resolution and can clearly display tiny foreign matter in drugs to ensure the accuracy of detection. Then, by combining with the visible foreign matter recognition model, the detection of visible foreign matter in drugs is carried out, which greatly improves the recognition rate of visible foreign matter and the accuracy of visible foreign matter detection. When the drugs themselves are colored or turbid, accurate and reliable detection and early warning of visible foreign matter in drugs can be achieved, which greatly improves the efficiency of visible foreign matter detection and achieves high accuracy of detection.
[0019] Of course, X-ray scanning can cover the entire interior of the drug container, ensuring that foreign objects in all areas can be detected, avoiding missed inspections, and achieving all-round inspection of the inspected drugs. At the same time, the entire inspection process does not require contact with the drugs, avoiding the risk of cross contamination and ensuring the safety of the drugs.
[0020] Further, the X-ray imaging mechanism includes a ray machine for generating X-rays, a fixed station for placing the inspected medicine, and an image imaging mechanism, and the image imaging mechanism includes a controller, a communication module, a panel detector, and a display module; the controller is electrically connected to the communication module, the display module, and the panel detector respectively;
[0021] The controller is used to communicate with the server through the communication module.
[0022] Beneficial effects: In this solution, when it is necessary to image the inspected drugs, first place the inspected drugs on a fixed workstation. When ensuring that the X-ray machine, the inspected drugs and the panel detector are at the same height, start the X-ray machine to generate X-rays, which will then penetrate the inspected drugs. The X-rays are then transmitted to the panel detector, and then the controller is used to convert the X-ray information on the panel detector into an electrical signal, which is then transmitted to the display module for imaging display after A / D processing. At this point, the drug inspection image displayed on the display module is uploaded to the server through the communication module, facilitating subsequent image recognition operations on the server.
[0023] Compared with the prior art method of using cameras on the production line to take photos to identify foreign matter on the surface of the medicine and remove it, but being unable to identify visible foreign matter hidden in the medicine, the present application utilizes the strong penetrating power of X-rays to directly observe and identify visible foreign matter hidden in the medicine, greatly improving the recognition rate of visible foreign matter in the medicine.
[0024] Furthermore, the image preprocessing module includes:
[0025] A grayscale processing module, used for grayscale processing of received drug detection images;
[0026] A normalization module is used to normalize the drug detection image after grayscale processing;
[0027] A filtering module, used for filtering the normalized drug detection image;
[0028] The enhancement module is used to perform contrast enhancement operation on the drug detection image after the filtering operation to form a final pre-processed drug detection image.
[0029] Beneficial effects: In this solution, a series of preprocessing operations such as grayscale processing, normalization processing, filtering operation and contrast enhancement operation are performed on the received drug detection image to remove the noise in the image, enhance the useful features, and improve the effect and efficiency of subsequent processing.
[0030] Furthermore, the server also includes:
[0031] A historical data collection module is used to obtain historical drug detection images with annotated content from a historical database, and divide each historical drug detection image with annotated content into a training set and a verification set according to a preset ratio;
[0032] A building module for building a visible foreign body recognition model;
[0033] A training module, for randomly generating a plurality of parameter groups, each parameter in the parameter group being a parameter corresponding to a visible foreign body recognition model, extracting historical key features of the historical drug detection images in the training set based on a preset key feature extraction model according to the historical drug detection images with annotated content in the training set, and inputting the extracted historical key features into the visible foreign body recognition model corresponding to each parameter group, outputting corresponding training recognition result data, and calculating the recognition loss value corresponding to each parameter group based on the recognition result data and the corresponding annotated content and a preset recognition loss value calculation formula;
[0034] The calculation formula of the recognition loss value is:
[0035]
[0036] In the formula, S is the recognition loss value, n is the total number of samples corresponding to this training, and y i is the true value corresponding to the i-th sample, is the identification value corresponding to the i-th sample; P is a random number between 0 and 1, suijizhi is a random threshold, S y is a preset loss threshold;
[0037] A screening module is used to select parameter groups whose recognition loss values are less than or equal to the preset loss threshold value according to the recognition loss values corresponding to the parameter groups and based on the preset loss threshold value, and determine the parameter value selection range corresponding to the parameters in the next iterative training according to the parameter values of the parameters corresponding to the selected parameter groups, and re-execute the training module until the number of iterations reaches the preset number of iterations, select the parameter group with the smallest recognition loss value, and output the visible foreign body recognition model corresponding to the parameter group with the smallest recognition loss value;
[0038] A verification module is used to extract historical key features of the historical drug detection images in the verification set based on the historical drug detection images with annotated content in the verification set based on a preset key feature extraction model, and input the historical key features corresponding to the verification set into the visible foreign matter recognition model output by the screening module, output the verification prediction recognition data corresponding to each historical drug detection image in the verification set, and calculate the corresponding recognition accuracy based on the verification prediction recognition data and the corresponding annotated content based on the recognition accuracy calculation formula, and determine whether the recognition accuracy is greater than a preset accuracy threshold. If so, the corresponding visible foreign matter recognition model is a feasible model, otherwise the corresponding visible foreign matter recognition model is an infeasible model, and the training module is re-executed;
[0039] The recognition accuracy calculation formula is:
[0040]
[0041] Where Z is the recognition accuracy, m is the total number of historical drug detection images in the validation set, and x j Area(B pred ∩B true To verify the intersection area between the predicted recognition data and the corresponding annotation content, Area(B pred ∪B true ) is the union area of the verification prediction recognition data and the corresponding annotation content.
[0042] Useful effect: In this solution, historical drug testing images with annotated content are automatically obtained from the historical database, and the training set and validation set are divided according to the preset ratio, which reduces manual intervention and improves the efficiency of data preparation.
[0043] By randomly generating multiple parameter groups, training the model, and calculating the recognition loss value, the parameter space can be effectively explored and the best parameter combination can be found. Through multiple iterative training, the model parameters are gradually optimized until the preset number of iterations is reached, ensuring that the model is continuously improved during the training process, and finally outputting the visible foreign object recognition model with the best performance. By combining the mean square error and the random threshold, the recognition loss of the model is comprehensively evaluated to ensure that the model can maintain high performance in different situations. The introduction of the random threshold is to increase the randomness and diversity of model training and prevent the model from overfitting. By introducing the random threshold in the loss calculation, the training process of the model can be balanced to a certain extent, so that it can maintain high performance in different situations.
[0044] Based on the preset loss threshold, the parameter group with the smallest recognition loss value is selected, and the parameter value selection range for the next iteration training is determined, and the model parameters are gradually optimized, which improves the training efficiency and performance of the model. In each iteration, the selection range of the parameter value is dynamically adjusted according to the selected parameter group, avoiding blind search and improving the efficiency of parameter optimization. The recognition accuracy of the model is evaluated through the validation set to ensure that the model has good generalization ability on unseen data. Based on the recognition accuracy calculation formula, the overlap of multiple drug detection images is comprehensively considered to provide a more comprehensive evaluation index.
[0045] Furthermore, the X-ray imaging mechanism also includes a switching mechanism arranged on the X-ray machine, the switching mechanism includes a first motor electrically connected to the controller, the first motor is arranged on the side wall of the X-ray machine, a connecting rod is fixed on the motor shaft of the first motor, a rotating disk is fixedly connected to the connecting rod, an outer frame is evenly arranged on the side wall of the rotating disk, a filter is arranged in the outer frame, and the filter is located above the X-ray port of the X-ray machine.
[0046] Beneficial effect: In this solution, filters with different parameters are set on the outer frame, and then the first motor is rotated through the control of the controller, so that the filters at the X-ray port of the X-ray machine are different, so that the matching of the X-ray energy corresponding to the X-ray and the inspected medicine can be optimized.
[0047] The present invention also provides a method for monitoring visible foreign matter in medicines, using the above-mentioned system for monitoring visible foreign matter in medicines, comprising the following steps:
[0048] S1, generate X-rays through the ray machine, penetrate the inspected drugs, output the corresponding drug inspection images and feed them back to the server;
[0049] S2, the service end receives the drug detection image output by the X-ray imaging mechanism;
[0050] S3, performing preprocessing operations on the received drug inspection images;
[0051] S4, extracting corresponding key features from the drug detection image after the preprocessing operation;
[0052] S5. According to the extracted key features, based on a preset visible foreign matter recognition model, the visible foreign matter in the drug inspection image is recognized, and the corresponding visible foreign matter recognition data is output;
[0053] S6. According to the output visible foreign matter identification data, determine whether the corresponding inspected drug is qualified. If not, determine that the inspected drug is an unqualified product and issue a warning message. If so, determine that the inspected drug is a qualified product. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 The present invention is a logic block diagram of a system and method for monitoring visible foreign matter in medicines in the first embodiment of the present invention.
[0055] Figure 2 Schematic diagram of the structure of the X-ray imaging mechanism in the first embodiment of the present invention.
[0056] Figure 3 This is a system and method for monitoring visible foreign matter in medicines in Embodiment 1 of the present invention. DETAILED DESCRIPTION
[0057] The following is further described in detail through specific implementation methods:
[0058] The symbols in the drawings of the specification include: X-ray machine 1, drug to be inspected 2, fixing rod 3, panel detector 4, cylinder 5, and mounting base 6.
[0059] Embodiment 1
[0060] A system for monitoring visible foreign matter in medicines, basically as follows Figure 1 and Figure 2 As shown, it includes an X-ray imaging mechanism and a server connected to the X-ray imaging mechanism for communication;
[0061] The X-ray imaging mechanism is used to generate X-rays through the ray machine 1, penetrate the inspected drug 2, output the corresponding drug inspection image and feed it back to the server;
[0062] The X-ray imaging mechanism includes a ray machine 1 for generating X-rays, a fixed station for placing the inspected medicine 2, and an image imaging mechanism, and the image imaging mechanism includes a controller, a communication module, a panel detector 4, and a display module; the controller is electrically connected to the communication module, the display module, and the panel detector 4 respectively;
[0063] The controller is used to communicate with the service end through the communication module. In this embodiment, the fixed station is a corresponding fixed rod 3, and a platform for placing the inspected medicine 2 is provided on the upper end surface of the fixed rod 3. The X-ray machine 1 is moved in the vertical direction by the cylinder 5. The panel detector 4 is arranged on the mounting seat 6.
[0064] The X-ray imaging mechanism further includes a switching mechanism disposed on the X-ray machine 1, the switching mechanism including a first motor electrically connected to the controller, the first motor being disposed on the side wall of the X-ray machine 1, a connecting rod being fixed on the motor shaft of the first motor, a rotating disk being fixedly connected to the connecting rod, a peripheral frame being evenly disposed on the side wall of the rotating disk, a filter being disposed in the peripheral frame, and the filter being located above the X-ray port of the X-ray machine 1. In this embodiment, when the filter is rotated to be directly above the X-ray port of the X-ray machine 1, the X-rays generated by the X-ray machine 1 will pass through the filter.
[0065] The controller adopts a single-chip microcomputer or a PLC. In the present embodiment, an STM32 series single-chip microcomputer is adopted, specifically an STM32H7 high-performance series single-chip microcomputer. The communication module includes a wired communication module and a wireless communication module, and the controller is connected to the service end through the communication module. In the present embodiment, the wired communication module adopts Ethernet, RS485 and the like to transmit data. The wireless communication module includes one or more of a WiFi module, a Bluetooth module, a ZigBee module and a Lora module. In the present embodiment, the wireless communication module includes a WiFi module.
[0066] Before imaging, the X-ray machine, the inspected medicine and the panel detector are first adjusted to the same height so that the X-rays of the X-ray machine can penetrate the inspected medicine and then be transmitted to the panel detector. Then, according to actual needs, the first motor is started to select the filter directly above the X-ray port of the X-ray machine until the corresponding filter is selected.
[0067] Then start the X-ray machine to generate X-rays, which will penetrate the inspected medicines. The X-rays are then transmitted to the panel detector. The controller is then used to convert the X-ray information on the panel detector into electrical signals. After A / D processing, the signals are transmitted to the display module for imaging display and sent to the server through the communication module.
[0068] The server includes:
[0069] A receiving module, used for receiving the drug detection image output by the X-ray imaging mechanism;
[0070] An image preprocessing module is used to perform preprocessing operations on the received drug detection images;
[0071] The image preprocessing module comprises:
[0072] A grayscale processing module, used for grayscale processing of received drug detection images;
[0073] A normalization module is used to normalize the drug detection image after grayscale processing;
[0074] A filtering module, used for filtering the normalized drug detection image;
[0075] The enhancement module is used to perform contrast enhancement operation on the drug detection image after the filtering operation to form a final pre-processed drug detection image.
[0076] The feature extraction module is used to extract key features of the drug detection image after the preprocessing operation based on the preset key feature extraction model; in this embodiment, the convolutional neural network technology is used to extract key features, that is, the corresponding key feature extraction model is the corresponding convolutional neural model. Specifically, the features of the image are extracted using convolution operations and pooling operations. The convolution operation performs convolution operations on the image through a filter to extract key information of the image; the pooling operation refines the feature image to reduce the size and number of parameters of the feature image while retaining key information. Through multi-layer convolution and pooling operations, high-level abstract features are gradually extracted to realize the recognition and classification of complex images, which can achieve better recognition effects.
[0077] An image recognition module is used to identify visible foreign matter in the drug inspection image according to the extracted key features and based on a preset visible foreign matter recognition model, and output corresponding visible foreign matter recognition data;
[0078] The server also includes:
[0079] A historical data collection module is used to obtain historical drug detection images with annotated content from a historical database, and divide each historical drug detection image with annotated content into a training set and a verification set according to a preset ratio;
[0080] A building module for building a visible foreign body recognition model;
[0081] The training module is used to randomly generate a number of parameter groups, each parameter in the parameter group is a parameter corresponding to the visible foreign body recognition model, and according to the historical drug detection images with annotated content in the training set, based on a preset key feature extraction model, the historical key features of the historical drug detection images in the training set are extracted, and the extracted historical key features are input into the visible foreign body recognition model corresponding to each parameter group, and the corresponding training recognition result data is output, and according to the recognition result data and the corresponding annotation content, the recognition loss value corresponding to each parameter group is calculated based on a preset recognition loss value calculation formula; when the visible foreign body recognition model is trained, the corresponding key feature extraction model has completed the corresponding training and determined the various types of the output key features.
[0082] The calculation formula of the recognition loss value is:
[0083]
[0084] In the formula, S is the recognition loss value, n is the total number of samples corresponding to this training, and y i is the true value corresponding to the i-th sample, is the identification value corresponding to the i-th sample; P is a random number between 0 and 1, suijizhi is a random threshold, S y is a preset loss threshold;
[0085] A screening module is used to select parameter groups whose recognition loss values are less than or equal to the preset loss threshold value according to the recognition loss values corresponding to the parameter groups and based on the preset loss threshold value, and determine the parameter value selection range corresponding to the parameters in the next iterative training according to the parameter values of the parameters corresponding to the selected parameter groups, and re-execute the training module until the number of iterations reaches the preset number of iterations, select the parameter group with the smallest recognition loss value, and output the visible foreign body recognition model corresponding to the parameter group with the smallest recognition loss value;
[0086] In this embodiment, for example, the corresponding parameter values corresponding to a certain parameter in each parameter group are selected, and they are a, b, c, d, e, and f, respectively, where a>b>c>d>e>f. Then, when updating in the future, the value range of the corresponding parameter is a to f, and random selection is performed within the interval of a to f. In this embodiment, the visible foreign body recognition model is constructed using BP neural network technology. Specifically, a three-layer BP neural network model is first constructed, including an input layer, a hidden layer, and an output layer. In this embodiment, the key features corresponding to the historical drug detection images with annotated content are used as the input of the input layer, so there is one node in the input layer, and the corresponding output is the visible foreign body recognition data, such as the type of visible foreign body, the size of the visible foreign body, and the location data of the visible foreign body. Therefore, there are 3 nodes in the output layer. For the hidden layer, this embodiment uses the following formula to determine the number of hidden layer nodes: Where L is the number of nodes in the hidden layer, n is the number of nodes in the input layer, m is the number of nodes in the output layer, and a is a number between 1 and 10. In this embodiment, it is taken as 8, so there are 10 nodes in the hidden layer. BP neural network usually uses Sigmoid differentiable function and linear function as the excitation function of the network. This paper selects the S-type tangent function tansig as the excitation function of the hidden layer neurons. The prediction model selects the S-type logarithmic function tansig as the excitation function of the output layer neurons.
[0087] A verification module is used to extract historical key features of the historical drug detection images in the verification set based on the historical drug detection images with annotated content in the verification set based on a preset key feature extraction model, and input the historical key features corresponding to the verification set into the visible foreign matter recognition model output by the screening module, output the verification prediction recognition data corresponding to each historical drug detection image in the verification set, and calculate the corresponding recognition accuracy based on the verification prediction recognition data and the corresponding annotated content based on the recognition accuracy calculation formula, and determine whether the recognition accuracy is greater than a preset accuracy threshold. If so, the corresponding visible foreign matter recognition model is a feasible model, otherwise the corresponding visible foreign matter recognition model is an infeasible model, and the training module is re-executed;
[0088] The recognition accuracy calculation formula is:
[0089]
[0090] Where Z is the recognition accuracy, m is the total number of historical drug detection images in the validation set, and x j Area(B pred ∩B trueTo verify the intersection area between the predicted recognition data and the corresponding annotation content, Area(B pred ∪B true ) is the union area of the verification prediction recognition data and the corresponding annotation content.
[0091] The alarm module is used to determine whether the corresponding inspected drug 2 is qualified according to the output visible foreign matter identification data. If not, the inspected drug is judged to be an unqualified product and an early warning message is issued. If yes, the inspected drug 2 is judged to be a qualified product. In this embodiment, through the penetration of X-rays and the cooperation of the subsequent visible foreign matter identification model, the detection of 50um visible foreign matter can be achieved. Of course, the size of the visible foreign matter detection can be adjusted according to actual needs during specific use. In this embodiment, online or offline non-destructive detection is effectively performed on visible foreign matter in sterile preparations for injection, sterile raw materials, dark liquid preparations or light-proof packaging drugs. X-rays have the physical property of penetrating various materials of different densities that ordinary visible light cannot penetrate. By penetrating the glass bottle packaging of the drug, the drug is scanned by X-rays, and the visible foreign matter that may exist in the drug is accurately identified and quantified in combination with various modules on the service end.
[0092] like Figure 3 As shown, this embodiment also discloses a method for monitoring visible foreign matter in medicines, using the above-mentioned system for monitoring visible foreign matter in medicines, including the following steps:
[0093] S1, generate X-rays through the ray machine 1, penetrate the inspected drug 2, output the corresponding drug inspection image and feed it back to the server;
[0094] S2, the service end receives the drug detection image output by the X-ray imaging mechanism;
[0095] S3, performing preprocessing operations on the received drug inspection images;
[0096] S4, extracting corresponding key features from the drug detection image after the preprocessing operation;
[0097] S5. According to the extracted key features, based on a preset visible foreign matter recognition model, the visible foreign matter in the drug inspection image is recognized, and the corresponding visible foreign matter recognition data is output;
[0098] S6. According to the output visible foreign matter identification data, determine whether the corresponding inspected drug 2 is qualified. If not, determine that the inspected drug is an unqualified product and issue a warning message. If so, determine that the inspected drug 2 is a qualified product.
[0099] The above is only an embodiment of the present invention. The common sense such as the known specific structure and characteristics in the scheme is described too much here. The ordinary technicians in the relevant field know all the common technical knowledge in the technical field of the invention before the application date or priority date, can know all the existing technologies in the field, and have the ability to apply the conventional experimental means before that date. The ordinary technicians in the relevant field can improve and implement this scheme in combination with their own abilities under the enlightenment given by this application. Some typical known structures or known methods should not become obstacles for ordinary technicians in the relevant field to implement this application. It should be pointed out that for those skilled in the art, without departing from the structure of the present invention, several deformations and improvements can be made, which should also be regarded as the protection scope of the present invention, which will not affect the effect of the implementation of the present invention and the practicality of the patent. The protection scope required by this application shall be based on the content of its claims, and the specific implementation methods and other records in the specification can be used to interpret the content of the claims.
Claims
1. A system for monitoring visible foreign matter in medicines, characterized in that: It includes an X-ray imaging organization and a server end connected to the X-ray imaging organization for communication; X-ray imaging mechanism, used to generate X-rays through a ray machine, penetrate the inspected drugs, output corresponding drug inspection images and feed them back to the server; The server includes: A receiving module, used for receiving the drug detection image output by the X-ray imaging mechanism; An image preprocessing module is used to perform preprocessing operations on the received drug detection images; A feature extraction module is used to extract key features of the drug detection image after preprocessing based on a preset key feature extraction model; An image recognition module is used to identify visible foreign matter in the drug inspection image according to the extracted key features and based on a preset visible foreign matter recognition model, and output corresponding visible foreign matter recognition data; The alarm module is used to determine whether the corresponding inspected drug is qualified based on the output visible foreign matter identification data. If not, the inspected drug is judged to be an unqualified product and an early warning message is issued. If so, the inspected drug is judged to be a qualified product.
2. A system for monitoring visible foreign matter in medicines according to claim 1, characterized in that: The X-ray imaging mechanism includes a ray machine for generating X-rays, a fixed station for placing the inspected medicines, and an image imaging mechanism, and the image imaging mechanism includes a controller, a communication module, a panel detector, and a display module; the controller is electrically connected to the communication module, the display module, and the panel detector respectively; The controller is used to communicate with the server through the communication module.
3. A system for monitoring visible foreign matter in medicines according to claim 2, characterized in that: The image preprocessing module comprises: A grayscale processing module, used for grayscale processing of received drug detection images; A normalization module is used to normalize the drug detection image after grayscale processing; A filtering module, used for filtering the normalized drug detection image; The enhancement module is used to perform contrast enhancement operation on the drug detection image after the filtering operation to form a final pre-processed drug detection image.
4. A system for monitoring visible foreign matter in medicines according to claim 3, characterized in that: The server also includes: A historical data collection module is used to obtain historical drug detection images with annotated content from a historical database, and divide each historical drug detection image with annotated content into a training set and a verification set according to a preset ratio; A building module for building a visible foreign body recognition model; A training module, for randomly generating a plurality of parameter groups, each parameter in the parameter group being a parameter corresponding to a visible foreign body recognition model, extracting historical key features of the historical drug detection images in the training set based on a preset key feature extraction model according to the historical drug detection images with annotated content in the training set, and inputting the extracted historical key features into the visible foreign body recognition model corresponding to each parameter group, outputting corresponding training recognition result data, and calculating the recognition loss value corresponding to each parameter group based on the recognition result data and the corresponding annotated content and a preset recognition loss value calculation formula; The calculation formula of the recognition loss value is: In the formula, S is the recognition loss value, n is the total number of samples corresponding to this training, and y i is the true value corresponding to the i-th sample, is the identification value corresponding to the i-th sample; P is a random number between 0 and 1, suijizhi is a random threshold, S y is a preset loss threshold; A screening module is used to select parameter groups whose recognition loss values are less than or equal to the preset loss threshold value according to the recognition loss values corresponding to the parameter groups and based on the preset loss threshold value, and determine the parameter value selection range corresponding to the parameters in the next iterative training according to the parameter values of the parameters corresponding to the selected parameter groups, and re-execute the training module until the number of iterations reaches the preset number of iterations, select the parameter group with the smallest recognition loss value, and output the visible foreign body recognition model corresponding to the parameter group with the smallest recognition loss value; A verification module is used to extract historical key features of the historical drug detection images in the verification set based on the historical drug detection images with annotated content in the verification set based on a preset key feature extraction model, and input the historical key features corresponding to the verification set into the visible foreign matter recognition model output by the screening module, output the verification prediction recognition data corresponding to each historical drug detection image in the verification set, and calculate the corresponding recognition accuracy based on the verification prediction recognition data and the corresponding annotated content based on the recognition accuracy calculation formula, and determine whether the recognition accuracy is greater than a preset accuracy threshold. If so, the corresponding visible foreign matter recognition model is a feasible model, otherwise the corresponding visible foreign matter recognition model is an infeasible model, and the training module is re-executed; The recognition accuracy calculation formula is: Where Z is the recognition accuracy, m is the total number of historical drug detection images in the validation set, and x j Area(Bp) is the overlap between the verification prediction recognition data and the corresponding annotation content corresponding to the jth drug detection image. red ∩B true To verify the intersection area between the predicted recognition data and the corresponding annotation content, Area(B pred ∪B true ) is the union area of the verification prediction recognition data and the corresponding annotation content.
5. A system for monitoring visible foreign matter in medicines according to claim 4, characterized in that: The X-ray imaging mechanism also includes a switching mechanism arranged on the X-ray machine, the switching mechanism includes a first motor electrically connected to the controller, the first motor is arranged on the side wall of the X-ray machine, a connecting rod is fixed on the motor shaft of the first motor, a rotating disk is fixedly connected to the connecting rod, an outer frame is evenly arranged on the side wall of the rotating disk, a filter is arranged in the outer frame, and the filter is located above the X-ray port of the X-ray machine.
6. A method for monitoring visible foreign matter in medicines, using a system for monitoring visible foreign matter in medicines according to any one of claims 1 to 5, characterized in that: The following steps are involved: S1, generate X-rays through the ray machine, penetrate the inspected drugs, output the corresponding drug inspection images and feed them back to the server; S2, the service end receives the drug detection image output by the X-ray imaging mechanism; S3, performing preprocessing operations on the received drug inspection images; S4, extracting key features of the drug inspection image after the preprocessing operation based on a preset key feature extraction model; S5. According to the extracted key features, based on a preset visible foreign matter recognition model, the visible foreign matter in the drug inspection image is recognized, and the corresponding visible foreign matter recognition data is output; S6. According to the output visible foreign matter identification data, determine whether the corresponding inspected drug is qualified. If not, determine that the inspected drug is an unqualified product and issue a warning message. If so, determine that the inspected drug is a qualified product.