High-speed and high-precision liquid medicine image foreign matter detection, recognition and classification system and method
Through the drug liquid detection system combined with high-resolution image acquisition and deep learning algorithm, the problems of weak anti-interference ability and low recognition accuracy in drug liquid detection are solved, and the automated identification and classification of foreign objects in drug liquid are realized, which improves detection accuracy and speed.
Patent Information
- Application Number
- CN202510530754.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-25
- Publication Date
- 2025-08-08
AI Technical Summary
The prior art has weak anti-interference ability in drug liquid detection and low accuracy in foreign matter recognition, which cannot achieve efficient automated identification and classification, and it is difficult to meet the needs of high-speed and high-precision drug liquid detection.
Real-time image acquisition device is used to collect images in real-time, combine deep learning algorithms to extract foreign object features, establish interference feature databases, and identify and classify using support vector machine algorithms. Through adaptive median filtering and histogram equalization, high-quality image data acquisition and foreign object feature extraction are realized.
It significantly improves the anti-interference ability and recognition accuracy of drug liquid detection, realizes the automated identification and classification of foreign objects in drug liquid, meets the needs of high-speed and high-precision drug liquid detection, and ensures drug quality and safe production.
Smart Images

Figure CN120451650A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of liquid medicine detection, and in particular relates to a high-speed and high-precision liquid medicine image foreign body detection, identification and classification system and method. Background Art
[0002] As a special commodity used directly on the human body, the quality and safety of liquid medicine is directly related to the health of patients and the reputation of medical institutions. Detecting, identifying and classifying foreign matter in liquid medicine through imaging technology is a key link in ensuring the safety of liquid medicine.
[0003] Patent publication number CN102024143A discloses a method for tracking and identifying foreign objects in liquid medicine on a high-speed pharmaceutical production line. Although it proposes a method for identifying foreign objects using multiple frames of images, including acquiring multiple frames of images, searching for targets, extracting target information, and initializing Kalman filter parameters, this method has weak anti-interference capabilities when faced with interference in complex production environments. The accuracy of foreign object identification needs to be improved, making it difficult to achieve efficient automated identification and classification, and unable to meet the needs of high-speed and high-precision liquid medicine detection. Summary of the Invention
[0004] The purpose of the present invention is to provide a high-speed and high-precision system and method for detecting, identifying and classifying foreign matter in liquid medicine images, so as to solve the problems in the prior art of weak anti-interference ability of visible foreign matter detection, low recognition accuracy, and inability to achieve automatic recognition and classification, thereby improving the accuracy and speed of liquid medicine detection and ensuring the quality and safe production of medicines.
[0005] To achieve the above objectives, the present invention provides the following technical solution: a high-speed and high-precision method for detecting, identifying and classifying foreign matter in liquid medicine images, comprising the following steps:
[0006] Through the high-resolution image acquisition device, real-time image acquisition of the liquid medicine on the liquid medicine production line is carried out to obtain the original image data;
[0007] Perform denoising, grayscale processing and image enhancement on the original image data;
[0008] Use deep learning algorithms to extract foreign body features from pre-processed images;
[0009] Establish an interference feature database, compare the extracted foreign body features with the information in the interference feature database, and eliminate interference factors;
[0010] According to the characteristics of foreign objects after interference elimination, the classification model is used to identify and classify foreign objects;
[0011] The results of foreign body identification and classification are output and fed back to the control system of the liquid medicine production line.
[0012] As a preferred technical solution of the present invention, a high-resolution image acquisition device is used to acquire real-time images of the liquid medicine on the liquid medicine production line to obtain original image data. The implementation method is as follows:
[0013] Use an industrial-grade high-speed camera with high resolution and high frame rate, paired with an optical lens of appropriate focal length and large aperture, and equipped with a ring-shaped shadowless light source to ensure clear imaging and uniform lighting; configure a compatible high-performance image acquisition card to ensure stable data transmission; during installation, fix the camera to ensure that the lens optical axis is perpendicular to the central axis of the liquid container; during the debugging process, set the camera resolution and frame rate parameters through the control software, use the light source controller to adjust the light source brightness and color, and optimize the image acquisition card configuration; when triggering acquisition, you can choose software or hardware triggering mode, combine C++ and Python programming languages with OpenCV and Halcon image acquisition libraries to write programs to realize image acquisition, caching, format conversion and storage, and complete the acquisition of original image data.
[0014] As a preferred technical solution of the present invention, the denoising process adopts an adaptive median filtering algorithm, the grayscale process adopts a weighted average method, and the image enhancement process adopts a histogram equalization algorithm.
[0015] As a preferred technical solution of the present invention, in the foreign body feature extraction step, a convolutional neural network model is used to automatically extract the shape, size, and texture feature information of the foreign body in the image.
[0016] As a preferred technical solution of the present invention, a similarity matching algorithm is used to determine whether the currently detected feature is an interference factor.
[0017] As a preferred technical solution of the present invention, the classification model adopts a support vector machine algorithm.
[0018] The present invention also discloses a high-speed and high-precision liquid medicine image foreign body detection, identification and classification system, including
[0019] Image acquisition module: used to collect real-time images of the liquid medicine on the liquid medicine production line and obtain original image data;
[0020] Image preprocessing module: used to perform denoising, grayscale conversion and image enhancement on the original image data;
[0021] Foreign body feature extraction module: uses deep learning algorithms to extract foreign body features from pre-processed images;
[0022] Interference identification and elimination module: establishes an interference feature database, compares the extracted foreign body features with the information in the interference feature database, and eliminates interference factors;
[0023] Foreign body identification and classification module: Based on the characteristics of foreign bodies after interference elimination, the classification model is used to identify and classify foreign bodies;
[0024] Result output and feedback module: used to output the results of foreign body identification and classification, and feed back to the control system of the liquid medicine production line.
[0025] As a preferred technical solution of the present invention, the results of foreign body identification and classification are output and fed back to the control system of the liquid medicine production line. The implementation method is as follows:
[0026] In terms of data format processing, the foreign body identification and classification module organizes the results into a standardized data format, including foreign body type, location coordinates, size information, and also attaches a timestamp and inspection batch identification;
[0027] In terms of output display, the result output and feedback module presents the results through an intuitive visual interface on the display screen; it can also use indicator lights and buzzer devices to indicate the presence of foreign matter in the form of sound and light alarms;
[0028] In the feedback control process, the module transmits the processed data to the control system of the drug solution production line in real time through the industrial communication protocol. After receiving the information, the control system automatically performs corresponding operations according to preset rules, accurately removing drug solutions containing foreign matter, or marking and guiding them to specific areas, thereby realizing automated quality control of the production process.
[0029] Compared with the prior art, the present invention has the following beneficial effects:
[0030] Through high-resolution image acquisition devices and advanced image preprocessing technology, high-quality liquid medicine image data can be obtained, providing a basis for accurate detection of foreign matter;
[0031] Using deep learning algorithms to extract foreign body features can automatically learn and extract the complex features of foreign bodies, with higher accuracy and adaptability than traditional methods;
[0032] Establishing an interference feature database and performing interference identification and elimination significantly improves the anti-interference capability of visible foreign object detection, effectively avoiding the misidentification of interference factors as foreign objects, and greatly improving the accuracy of foreign object identification;
[0033] The support vector machine algorithm is used to identify and classify foreign matter, which can quickly and accurately classify different types of foreign matter, realize the automatic identification and classification of foreign matter in the drug solution, meet the needs of high-speed and high-precision drug solution detection, and ensure the quality and safety of the drug solution. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 This is a flow chart of detection, identification and classification of the present invention;
[0035] Figure 2 This is a schematic diagram of the detection, identification and classification system of the present invention. DETAILED DESCRIPTION
[0036] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0037] Example 1
[0038] See also Figure 1 , which is the first embodiment of the present invention, provides a high-speed and high-precision method for detecting, identifying and classifying foreign matter in liquid medicine images, comprising the following steps:
[0039] Through the high-resolution image acquisition device, real-time image acquisition of the liquid medicine on the liquid medicine production line is carried out to obtain the original image data;
[0040] The original image data is subjected to denoising, grayscale processing and image enhancement processing; the denoising process uses the adaptive median filter algorithm, the grayscale process uses the weighted average method, and the image enhancement process uses the histogram equalization algorithm;
[0041] Using deep learning algorithms, we extract foreign body features from pre-processed images. In this step, we use a convolutional neural network model to automatically extract the shape, size, and texture features of foreign bodies in the image.
[0042] Establish an interference feature database, compare the extracted foreign body features with the information in the interference feature database, and eliminate interference factors;
[0043] According to the characteristics of foreign objects after interference elimination, the classification model is used to identify and classify foreign objects;
[0044] The results of foreign body identification and classification are output and fed back to the control system of the liquid medicine production line.
[0045] In this embodiment, preferably, a high-resolution image acquisition device is used to acquire real-time images of the liquid medicine on the liquid medicine production line to obtain original image data. The implementation method is as follows:
[0046] Use an industrial-grade high-speed camera with high resolution and high frame rate, paired with an optical lens of appropriate focal length and large aperture, and equipped with a ring-shaped shadowless light source to ensure clear imaging and uniform lighting; configure a compatible high-performance image acquisition card to ensure stable data transmission; during installation, fix the camera to ensure that the lens optical axis is perpendicular to the central axis of the liquid container; during the debugging process, set the camera resolution and frame rate parameters through the control software, use the light source controller to adjust the light source brightness and color, and optimize the image acquisition card configuration; when triggering acquisition, you can choose software or hardware triggering mode, combine C++ and Python programming languages with OpenCV and Halcon image acquisition libraries to write programs to realize image acquisition, caching, format conversion and storage, and complete the acquisition of original image data.
[0047] In this embodiment, preferably, an interference feature database is established, and the extracted foreign body features are compared with the information in the interference feature database to eliminate interference factors; based on the foreign body features after interference elimination, the classification model is used to identify and classify foreign bodies, and the implementation method is as follows:
[0048] In actual pharmaceutical production scenarios, we collect image data on a variety of common interference factors, such as light reflections, bubbles, and stains on equipment surfaces. High-speed cameras capture images under varying lighting conditions and production speeds to ensure data diversity. Professional image annotation tools are used to manually accurately annotate interference factors in images, clarifying their location, shape, texture, and other characteristics, providing an accurate data foundation for subsequent database construction.
[0049] Use image processing algorithms, such as edge detection and texture analysis, to extract features from the annotated interference image. Store the extracted features, such as edge contours, texture feature vectors, and color distribution, in a database as structured data. Either a relational or non-relational database can be used, and efficient data indexing can be established to facilitate rapid retrieval and query.
[0050] As the production environment changes or new interference factors emerge, new interference image data is collected regularly, and the above labeling and feature extraction process is repeated to add the new data to the database. At the same time, the existing data in the database is regularly reviewed and optimized, and invalid or erroneous data is deleted to ensure the accuracy and timeliness of the database.
[0051] The cosine similarity algorithm is used to calculate the similarity between the extracted foreign body features and the features in the interference feature database; the foreign body features and interference features are expressed as vectors, and the similarity between the two is determined by calculating the cosine value of the angle between the vectors; a similarity threshold is set, and when the cosine similarity exceeds the threshold, the foreign body feature is determined to be an interference factor;
[0052] In addition to single similarity calculation, multiple features can be integrated for comparison. For example, a comprehensive comparison model can be constructed by combining multiple features such as shape, size, texture, and color. The final comprehensive similarity is obtained by weighted calculation of the similarity scores of different features, thereby improving the accuracy and reliability of the comparison.
[0053] Dynamically adjust the similarity threshold based on changes in the production environment; appropriately relax the threshold when lighting conditions are unstable or production speeds vary significantly; and tighten the threshold when the production environment is stable to adapt to different production scenarios and ensure accurate elimination of interference factors.
[0054] A large amount of interference-free foreign body image data is used to train a support vector machine classification model. The foreign body feature vector is used as input, and the corresponding foreign body type is used as the output label. The parameters of the SVM model are adjusted through an optimization algorithm (such as the sequential minimum optimization algorithm) to construct an accurate classification decision boundary. During the training process, cross-validation and other methods are used to evaluate the model's performance to avoid overfitting.
[0055] The feature vector of the foreign matter after interference elimination is input into the trained SVM classification model. The model quickly determines the type of foreign matter, such as fibers, glass chips, metal particles, etc., based on the established classification decision boundary. The classification results can be output in real time to provide a basis for subsequent liquid treatment.
[0056] Collect new foreign body image data and retrain and optimize the classification model; with the emergence of new types of foreign bodies or changes in production processes, promptly update the model parameters and classification decision boundaries to ensure the accuracy and adaptability of the classification model.
[0057] Example 2
[0058] See also Figure 2 , which is the second embodiment of the present invention, provides a high-speed and high-precision liquid medicine image foreign body detection, identification and classification system, including
[0059] Image acquisition module: used to collect real-time images of the liquid medicine on the liquid medicine production line and obtain original image data;
[0060] Image preprocessing module: used to perform denoising, grayscale conversion and image enhancement on the original image data;
[0061] Foreign body feature extraction module: uses deep learning algorithms to extract foreign body features from pre-processed images;
[0062] Interference identification and elimination module: establishes an interference feature database, compares the extracted foreign body features with the information in the interference feature database, and eliminates interference factors;
[0063] Foreign body identification and classification module: Based on the characteristics of foreign bodies after interference elimination, the classification model is used to identify and classify foreign bodies;
[0064] Result output and feedback module: used to output the results of foreign body identification and classification, and feed back to the control system of the liquid medicine production line.
[0065] In this embodiment, preferably, the results of foreign body identification and classification are output and fed back to the control system of the liquid medicine production line. The implementation method is as follows:
[0066] In terms of data format processing, the foreign body identification and classification module organizes the results into a standardized data format, including foreign body type, location coordinates, size information, and also attaches a timestamp and inspection batch identification;
[0067] In terms of output display, the result output and feedback module presents the results through an intuitive visual interface on the display screen; it can also use indicator lights and buzzer devices to indicate the presence of foreign matter in the form of sound and light alarms;
[0068] In the feedback control process, the module transmits the processed data to the control system of the drug solution production line in real time through the industrial communication protocol. After receiving the information, the control system automatically performs corresponding operations according to preset rules, accurately removing drug solutions containing foreign matter, or marking and guiding them to specific areas, thereby realizing automated quality control of the production process.
[0069] In order to verify the advantages of the present invention in terms of anti-interference ability, recognition accuracy and detection speed, the following comparative experiments are designed and the experimental results are presented:
[0070] Foreign body detection accuracy comparison table
[0071] Experimental conditions:
[0072] Test sample: 1000 images of liquid medicine containing foreign matter (including bubbles, reflections, and other interference);
[0073] Foreign matter types: fibers, glass shards, metal particles;
[0074] Hardware platform: Intel Xeon E5 CPU + NVIDIA Tesla T4 GPU;
[0075] method Accuracy (%) Recall rate (%) F1 score (%) Traditional method (CN102024143A) 82.3 78.5 80.3 The present invention 97.6 96.2 96.9
[0076] Analysis: The deep learning feature extraction of the present invention is combined with the interference database to significantly improve the overall performance of foreign body detection;
[0077] Anti-interference capability verification table:
[0078] Test scenario: Simulate four common interferences in the production line (bubbles, uneven lighting, equipment vibration, and container scratches) and calculate the false detection rate;
[0079] Interference Type False detection rate of traditional methods (%) False detection rate of the present invention (%) bubble 23.1 3.2 Uneven lighting 18.7 2.8 Equipment vibration 15.4 4.1 Container scratches 12.9 1.5
[0080] Conclusion: The interference signature database reduces the false detection rate by more than 85% on average;
[0081] Detection speed comparison table:
[0082] Test conditions:
[0083] Resolution: 4096×2160@200fps;
[0084] Liquid flow rate: 5m / s;
[0085] method Single frame processing time (ms) Maximum supported production line speed (m / s) Traditional methods 45 3.2 The present invention 12 8.5
[0086] Key technologies: Adaptive median filtering algorithm speeds up by 30%; GPU-accelerated CNN feature extraction. Classification model performance comparison table:
[0087] Test dataset:
[0088] 6 types of foreign matter (fiber / glass / metal / rubber / plastic / hair);
[0089] 500 annotated images per class
[0090] Classification Algorithm Accuracy (%) Model inference time (ms) Random Forest 89.2 8 Naive Bayes 76.5 5 SVM (present invention) 96.8 7
[0091] Conclusion: The above experimental data show that compared with the prior art, the present invention has the following advantages:
[0092] Accuracy improvement: F1 score increased from 80.3% to 96.9%;
[0093] Enhanced anti-interference: false detection rate reduced by more than 85%;
[0094] Speed advantage: processing speed increased by 3.75 times, supporting 8.5m / s high-speed production line;
[0095] Classification accuracy: The SVM model performs best in the classification of complex foreign objects.
[0096] Although the embodiments of the present invention have been shown and described, as detailed above, it will be understood by those skilled in the art that various changes, modifications, substitutions and variations may be made to these embodiments without departing from the principles and spirit of the invention, and the scope of the invention is defined by the appended claims and their equivalents.
Claims
1. A high-speed and high-precision method for detecting, identifying and classifying foreign matter in liquid medicine images, characterized by: The steps include: Through the high-resolution image acquisition device, real-time image acquisition of the liquid medicine on the liquid medicine production line is carried out to obtain the original image data; Perform denoising, grayscale processing and image enhancement on the original image data; Use deep learning algorithms to extract foreign body features from pre-processed images; Establish an interference feature database, compare the extracted foreign body features with the information in the interference feature database, and eliminate interference factors; According to the characteristics of foreign objects after interference elimination, the classification model is used to identify and classify foreign objects; The results of foreign body identification and classification are output and fed back to the control system of the liquid medicine production line.
2. The high-speed and high-precision method for detecting, identifying and classifying foreign matter in liquid medicine images according to claim 1, characterized in that: Using a high-resolution image acquisition device, real-time image acquisition of the liquid medicine on the liquid medicine production line is performed to obtain the original image data. The implementation method is as follows: Use an industrial-grade high-speed camera with high resolution and high frame rate, paired with an optical lens of appropriate focal length and large aperture, and equipped with a ring-shaped shadowless light source to ensure clear imaging and uniform lighting; configure a compatible high-performance image acquisition card to ensure stable data transmission; during installation, fix the camera to ensure that the lens optical axis is perpendicular to the central axis of the liquid container; during the debugging process, set the camera resolution and frame rate parameters through the control software, use the light source controller to adjust the light source brightness and color, and optimize the image acquisition card configuration; when triggering acquisition, you can choose software or hardware triggering mode, combine C++ and Python programming languages with OpenCV and Halcon image acquisition libraries to write programs to realize image acquisition, caching, format conversion and storage, and complete the acquisition of original image data.
3. The high-speed and high-precision method for detecting, identifying and classifying foreign matter in liquid medicine images according to claim 1, characterized in that: The denoising process uses the adaptive median filtering algorithm, the grayscale process uses the weighted average method, and the image enhancement process uses the histogram equalization algorithm.
4. The high-speed and high-precision method for detecting, identifying and classifying foreign matter in liquid medicine images according to claim 1, characterized in that: In the foreign body feature extraction step, the convolutional neural network model is used to automatically extract the shape, size, and texture feature information of the foreign body in the image.
5. The high-speed and high-precision method for detecting, identifying and classifying foreign matter in liquid medicine images according to claim 1, characterized in that: A similarity matching algorithm is used to determine whether the currently detected feature is an interference factor.
6. The high-speed and high-precision method for detecting, identifying and classifying foreign matter in liquid medicine images according to claim 1, characterized in that: The classification model uses the support vector machine algorithm.
7. A high-speed, high-precision liquid medicine image foreign body detection, identification and classification system, characterized by: include Image acquisition module: used to collect real-time images of the liquid medicine on the liquid medicine production line and obtain original image data; Image preprocessing module: used to perform denoising, grayscale conversion and image enhancement on the original image data; Foreign body feature extraction module: uses deep learning algorithms to extract foreign body features from pre-processed images; Interference identification and elimination module: establishes an interference feature database, compares the extracted foreign body features with the information in the interference feature database, and eliminates interference factors; Foreign body identification and classification module: Based on the characteristics of foreign bodies after interference elimination, the classification model is used to identify and classify foreign bodies; Result output and feedback module: used to output the results of foreign body identification and classification, and feed back to the control system of the liquid medicine production line.
8. The high-speed, high-precision liquid medicine image foreign body detection, identification and classification system according to claim 7, characterized in that: The results of foreign body identification and classification are output and fed back to the control system of the liquid medicine production line. The implementation method is as follows: In terms of data format processing, the foreign body identification and classification module organizes the results into a standardized data format, including foreign body type, location coordinates, size information, and also attaches a timestamp and inspection batch identification; In terms of output display, the result output and feedback module presents the results through an intuitive visual interface on the display screen; it can also use indicator lights and buzzer devices to indicate the presence of foreign matter in the form of sound and light alarms; In the feedback control process, the module transmits the processed data to the control system of the drug solution production line in real time through the industrial communication protocol. After receiving the information, the control system automatically performs corresponding operations according to preset rules, accurately removing drug solutions containing foreign matter, or marking and guiding them to specific areas, thereby realizing automated quality control of the production process.
Citation Information
Patent Citations
Method for tracking and identifying medicinal liquid impurity images on high-speed medicament production line
CN102024143A
PCBA appearance defect intelligent detection method
CN117664990A
Paster abnormity detection method and system based on flexible circuit board
CN119067936A
AI-driven metallographic image analysis and classification system and method
CN119206714A