Visual identification-based medicine bottle classification method and system
The medicine bottle classification method, which combines visual recognition with neural networks, solves the problems of low efficiency and error-proneness in traditional manual classification. It achieves high-precision and highly adaptable automatic classification of medicine bottles, improving the efficiency and safety of automated dispensing processes.
Patent Information
- Application Number
- CN202511702337.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-19
- Publication Date
- 2026-03-10
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional manual identification and classification of medicine bottles is inefficient and prone to errors, making it difficult to meet the efficiency and safety requirements of automated dispensing processes.
A medicine bottle classification method based on visual recognition and neural networks is adopted. Through visual acquisition, image preprocessing and neural network classification model, high-precision automatic classification of medicine bottles is achieved.
It improves the accuracy and automation of medicine bottle sorting, reduces manual intervention, and enhances the efficiency and safety of the medication dispensing process.
Smart Images

Figure CN121640137A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of item classification and recognition, and in particular to a method and system for classifying medicine bottles based on visual recognition. Background Technology
[0002] In the fields of automated drug sorting and processing and computer vision technology, with the continuous development of technology, automated drug dispensing production lines have gradually become an important means to improve drug production efficiency and quality. The application of robotic arms in automated drug dispensing and other scenarios makes drug dispensing and production more precise and efficient. Automated sorting of different types of medicine bottles is crucial for the smooth operation of the entire dispensing process; it can improve the accuracy and efficiency of dispensing, reduce human error, and thus enhance the safety and reliability of drug production.
[0003] In traditional automated drug dispensing or production processes using dispensing robots, there are several ways to classify medicine bottles. A common practice is to rely on manual identification of the bottle's appearance, including its shape, color, and label text. In some automated production stages, manual identification of the bottle type is also necessary to determine whether to proceed with the ampoule dispensing process or the penicillin dispensing process.
[0004] However, these traditional methods of classifying medicine bottles have significant drawbacks. Manually identifying the appearance of medicine bottles for classification is inefficient, labor-intensive, and susceptible to human error. This method cannot meet the efficiency and safety requirements of automated dispensing processes; therefore, there is an urgent need for a classification scheme that can automatically identify medicine bottles. Summary of the Invention This invention addresses the problem that manual identification of medicine bottles cannot meet the efficiency requirements of automated dispensing processes. It proposes a medicine bottle classification method and system based on visual recognition. By learning multiple features of medicine bottle images through neural networks, it achieves high-precision and highly adaptable automatic classification of medicine bottles, thereby improving the automation level of the dispensing process.
[0005] To achieve the above objectives, the following technical solution is proposed: A vision-based method for classifying medicine bottles includes the following steps: a. Acquire images of the medicine bottles to be classified using a visual acquisition device; b. Perform noise reduction, size normalization, and brightness enhancement on the image; c. Input the processed image into a pre-trained neural network classification model to obtain the category confidence score of the medicine bottle; d. Output the category results of the medicine bottles whose confidence level meets the preset threshold; e. Send the category results to the control module to control the sorting device or robotic arm to execute the corresponding operation process.
[0006] This application primarily employs a combination of visual recognition and neural network algorithms for medicine bottle classification, achieving improved classification accuracy and automation. By preprocessing the images, this application enhances image quality, enabling the neural network classification model to more accurately learn the characteristics of the medicine bottles, thereby outputting reliable classification results.
[0007] Preferably, the denoising process in step b includes Gaussian filtering or median filtering, and the brightness enhancement process includes histogram equalization.
[0008] Preferably, the pre-trained neural network classification model is based on a convolutional neural network architecture. Its input layer receives normalized image data, and its output layer outputs the confidence scores of each category of medicine bottles through the training classification function. During the training process, the pre-processed training samples are divided into a training set and a validation set in an 8:2 ratio. The model parameters are iteratively updated through the Adam optimizer until the accuracy of the validation set is greater than the set value, at which point it is considered to have reached stable convergence. The trained medicine bottle classification model is then saved. Preferably, the preprocessed training sample construction process is as follows: images of medicine bottles to be classified are acquired through a visual acquisition device, and the images are subjected to noise reduction, size normalization and brightness enhancement processing. The images are then subjected to data augmentation processing by random rotation, flipping or cropping to obtain preprocessed training samples.
[0009] A vision-based medicine bottle classification system, comprising: The visual acquisition module is used to acquire images of the medicine bottles to be classified. The data processing module is used to perform noise reduction, size normalization, and brightness enhancement on the image. The classification and recognition module is used to input the processed image into a pre-trained neural network classification model and output the category result of the medicine bottle; The control module is used to receive the category results and control the sorting device or robotic arm to perform the corresponding operations.
[0010] Preferably, the vision acquisition module includes an industrial camera, a ring-shaped fill light source, and a lens assembly, wherein the resolution of the industrial camera is not less than 2 million pixels.
[0011] Preferably, the data processing module includes an industrial computer with a built-in graphics processor to accelerate the real-time calculation of the classification and recognition module.
[0012] Preferably, the neural network classification model of the classification and recognition module is based on a convolutional neural network architecture, and the model supports training and updating of new medicine bottle categories through transfer learning.
[0013] Preferably, the control module includes a programmable logic controller (PLC), which is connected to the classification and recognition module and the robotic arm via a communication interface.
[0014] Preferably, the system further includes a model training module, which is deployed on the server side and is used to iteratively optimize the neural network classification model using validation set data.
[0015] The beneficial effects of this invention are: by learning multiple features of medicine bottle images through neural networks, high-precision and highly adaptive automatic classification of medicine bottles is achieved, thereby improving the automation level of the dispensing process. Attached Figure Description
[0016] Figure 1 This is a flowchart of the method used in this application.
[0017] Figure 2 This is a schematic diagram of the classification and identification results of this application. Detailed Implementation
[0018] The technical solutions in the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings. The described embodiments are only possible technical implementations of the present invention, but are not limited thereto. Other embodiments obtained by those skilled in the art in conjunction with the embodiments of the present invention without creative effort are also within the protection scope of the present invention.
[0019] This application mainly uses a combination of visual recognition and neural network algorithms for medicine bottle classification, which achieves the effect of improving the accuracy and automation of medicine bottle classification. The following is a further detailed description of this application.
[0020] Example 1: This application provides a vision-based method for classifying medicine bottles, referencing... Figure 1 The process includes image acquisition, image preprocessing, image input model processing, and output classification results. Specifically, an image of the medicine bottle to be classified is acquired using a visual acquisition device. After image processing such as denoising, size normalization, and brightness enhancement, the image is input into a pre-trained neural network classification model to obtain the class confidence score of the medicine bottle. Finally, the class results of medicine bottles whose confidence scores meet a preset threshold are output, achieving accurate and efficient automatic identification of medicine bottle categories. This is because image preprocessing improves image quality, allowing the neural network classification model to more accurately learn the characteristics of the medicine bottle, thus outputting reliable classification results. Figure 2 .
[0021] Specifically, in the image acquisition step, the vision acquisition device can be an industrial camera or a high-definition camera. Industrial cameras feature high resolution and high frame rate, enabling them to capture clear and fast images of medicine bottles; high-definition cameras offer advantages such as lower cost and easier installation. The vision acquisition device needs to be installed in a suitable location, such as above the robotic arm's work path, to ensure that it can completely capture images of the medicine bottles to be sorted.
[0022] Sample images of various types of medicine bottles, covering different brands, sizes (e.g., 2ml, 5ml, 10ml, 20ml), shapes (round, square), colors (transparent, brown), types (ampoules, vials), and label information. Each image is labeled with a corresponding category label (e.g., "ampoules, vials") to form an initial dataset.
[0023] Specifically, in the image preprocessing steps, denoising can employ Gaussian filtering or median filtering. Gaussian filtering is a linear smoothing filter suitable for eliminating Gaussian noise. It smooths the image by performing a convolution operation on the image and using a Gaussian function to weighted average the neighboring pixels. Median filtering is a non-linear filter that sorts the pixel values in the neighborhood and takes the median value as the new value for that pixel, effectively removing salt-and-pepper noise. Size normalization scales the image to a preset size, such as 640×640 pixels, to fit the input requirements of the neural network. Brightness enhancement can be achieved using histogram equalization, which adjusts the image's grayscale histogram to make the brightness distribution more uniform and enhance feature contrast. Furthermore, data augmentation processes such as random rotation, flipping, or cropping can be performed on the image to expand the dataset size and prevent model overfitting. Random rotation can be performed within a range of ±15°, horizontal or vertical flipping increases image diversity, and local cropping highlights the key features of the medicine bottle, preventing model overfitting.
[0024] Specifically, in the image input model processing steps, the pre-trained neural network classification model is based on a convolutional neural network architecture, such as an improved convolutional neural network (CNN) based on the YOLOv11 architecture. The input layer of this model receives normalized image data, and the output layer outputs the confidence score for each category of medicine bottles through the training classification function. During training, the pre-processed training samples are divided into training and validation sets in an 8:2 ratio. The model parameters are iteratively updated using the Adam optimizer until the validation set accuracy stabilizes and converges, for example, with an accuracy ≥ 99%. Then, the trained medicine bottle classification model is saved and exported in ONNX format for cross-platform development.
[0025] Specifically, the step of outputting category results will output the category results for medicine bottles whose confidence level meets a preset threshold. The preset threshold is set based on actual needs and model performance; when the category confidence level of a medicine bottle reaches this threshold, the classification result is considered reliable. Afterwards, the category results can be sent to the control module, which can be a programmable logic controller (PLC). This control module connects to the classification and recognition module and the robotic arm via a communication interface to control the sorting device or robotic arm to execute corresponding operational procedures, such as transferring ampoules and vials to different areas.
[0026] The implementation principle of this embodiment is as follows: This embodiment combines visual recognition with neural network algorithms, avoiding the problems of low efficiency and error-proneness in traditional manual classification. Image preprocessing and data augmentation improve image quality and the model's generalization ability, enabling the neural network classification model to accurately learn the multi-dimensional features of the medicine bottle. Simultaneously, combining the classification results with the control module achieves full automation of the medicine bottle classification process, improving the efficiency and safety of the dispensing process, and making a significant improvement and contribution to existing technologies.
[0027] Example 2: The difference between this embodiment and the previous embodiment is that the image preprocessing step in this embodiment can also employ Wiener filtering for denoising. Wiener filtering is an optimal filtering method that filters the image based on its statistical characteristics, minimizing the mean square error, and effectively removes Gaussian noise and salt-and-pepper noise. Furthermore, data augmentation can also employ elastic deformation, simulating images of a medicine bottle under different deformation conditions by elastically transforming the image, further increasing the diversity of the dataset.
[0028] The implementation principle of this embodiment is as follows: This embodiment employs different denoising methods and data augmentation techniques in the image preprocessing step, which can further improve image quality and model adaptability. Wiener filtering can remove noise more accurately, and the elastic deformation data augmentation method allows the model to learn more deformation features of medicine bottles, thereby improving the accuracy and robustness of medicine bottle classification, and further improving and enhancing existing medicine bottle classification schemes.
[0029] Example 3: This application provides a vision-based medicine bottle classification system, including a vision acquisition module, a data processing module, a classification and recognition module, and a control module. The vision acquisition module acquires images of the medicine bottles to be classified. The data processing module performs noise reduction, size normalization, and brightness enhancement on the images. The classification and recognition module inputs the processed images into a pre-trained neural network classification model and outputs the category results of the medicine bottles. The control module receives the category results and controls the sorting device or robotic arm to perform corresponding operations. This achieves the effect of automatic and efficient classification and processing of medicine bottles. This is because the various modules cooperate with each other, forming a complete automated process from image acquisition to classification result output and subsequent operation control.
[0030] Specifically, the vision acquisition module includes an industrial camera, a ring-shaped supplementary lighting source, and a lens assembly. The industrial camera has a resolution of at least 2 megapixels, ensuring clear images of the medicine bottle. The ring-shaped supplementary lighting source can be a ring-shaped LED supplementary light, which provides uniform illumination, avoiding shadows or reflections in the medicine bottle image and ensuring image quality. The lens assembly is selected with appropriate focal length and aperture according to actual needs to achieve the best shooting effect. The vision acquisition module has a frame rate of ≥30fps, adapting to the high-speed operation requirements of the production line. The data processing module is implemented based on an industrial control computer and is responsible for image preprocessing and data format conversion, converting image data into a tensor format that can be recognized by neural networks.
[0031] Specifically, the data processing module includes an industrial control computer (ICC), which has a built-in graphics processor (GPU) to accelerate the real-time calculations of the classification and recognition module. The ICC features high stability and strong processing power, enabling it to quickly preprocess the acquired images. The GPU can process large amounts of data in parallel, significantly improving the model's calculation speed and allowing the system to process medicine bottle images in real time.
[0032] Specifically, the classification module's neural network classification model is based on a convolutional neural network architecture. This model supports training and updates for newly added medicine bottle categories through transfer learning. When classifying new categories of medicine bottles, there is no need to redesign the algorithm; simply updating the model quickly through transfer learning can adapt to the new classification requirements. The classification module integrates the pre-trained medicine bottle classification model, receives real-time pre-processed images, and outputs classification results within 50ms, meeting real-time requirements.
[0033] Specifically, the control module includes a programmable logic controller (PLC), which is connected to the sorting and identification module and the robotic arm via a communication interface. The PLC has advantages such as high reliability and simple programming; it can accurately control the sorting device or robotic arm to execute corresponding operation processes based on the category results output by the sorting and identification module.
[0034] Specifically, the system also includes a model training module, deployed on the server side, used to iteratively optimize the neural network classification model using validation set data. The server side has powerful computing and storage capabilities, enabling efficient model training and parameter updates, ensuring the model's classification accuracy and adaptability.
[0035] The vision acquisition module includes an industrial camera, lens, and light source. The camera resolution is no less than 2 megapixels, and the light source uses a ring-shaped LED supplementary light to ensure clear, glare-free images of the medicine bottles. The model training module is deployed on the server side, and model training is accelerated by GPU, supporting iterative optimization of the model (such as updating the model through transfer learning when adding a new medicine bottle category).
[0036] The classification and recognition module integrates a pre-trained medicine bottle classification model, receives real-time pre-processed images, and outputs classification results within 50ms, meeting real-time requirements.
[0037] The control module uses a PLC controller. After receiving the classification results, it sends control commands to the robotic arm, PLC and other equipment to realize the automatic classification of medicine bottles.
[0038] The implementation principle of this embodiment is as follows: The various modules of the medicine bottle sorting system in this embodiment have clearly defined roles and work collaboratively, achieving full automation of the medicine bottle sorting process. The visual acquisition module ensures the quality of image acquisition, the data processing module improves the usability of the images, the classification and recognition module accurately outputs the classification results, the control module implements subsequent operation control, and the model training module ensures continuous optimization of the model. The entire system improves the automation level and classification accuracy of the dispensing process, reduces manual intervention, and represents a significant improvement and contribution to existing technologies.
[0039] Example 4: The difference between this embodiment and the previous one is that the ring-shaped supplementary light source in the visual acquisition module can be replaced by a strip-shaped supplementary light source. Strip-shaped supplementary light sources have the advantages of concentrated light and adjustable illumination range, allowing for more flexible adjustment of the light angle and intensity based on the placement and shape of the medicine bottle, thus achieving better image quality. Furthermore, the industrial control computer in the data processing module can adopt a distributed computing architecture, distributing computing tasks across multiple nodes for processing, further improving data processing speed.
[0040] The implementation principle of this embodiment is as follows: This embodiment improves the visual acquisition module and data processing module. The strip supplementary lighting source can provide a more flexible lighting scheme to adapt to different medicine bottle sorting scenarios. The distributed computing architecture of the industrial control computer can make full use of the computing resources of multiple nodes, accelerate data processing speed, improve the real-time performance and processing capacity of the system, and further optimize and enhance the existing medicine bottle sorting system.
[0041] The above are all preferred embodiments of this application and are not intended to limit the scope of protection of this application. Therefore, all equivalent changes made in accordance with the structure, shape and principle of this application should be covered within the scope of protection of this application.
Claims
1. A method for classifying a vial based on visual recognition, the method comprising: capturing an image of a vial; and processing the image to determine a classification of the vial. The method comprises the following steps: a. acquiring an image of a medicine bottle to be classified by a visual acquisition device; b. performing denoising, size normalization and brightness enhancement processing on the image; c. inputting the processed image into a pre-trained neural network classification model to obtain the category confidence of the medicine bottle; d. outputting the category result of the medicine bottle whose confidence meets the preset threshold; e. sending the category result to a control module to control the sorting device or the mechanical arm to perform the corresponding operation process.
2. The method of claim 1, wherein, The denoising processing of step b includes Gaussian filtering or median filtering, and the brightness enhancement processing includes histogram equalization processing.
3. The method of claim 1, wherein the method further comprises: The pre-trained neural network classification model is based on a convolutional neural network architecture, the input layer of which receives normalized image data, and the output layer outputs the confidence of each category of medicine bottle through a train classification function; during the training process, the preprocessed training samples are divided into a training set and a validation set in a ratio of 8:2, the model parameters are iteratively updated by an Adam optimizer until the accuracy of the validation set is greater than a set value, and the trained medicine bottle classification model is saved; According to the medicine bottle classification method based on visual recognition of claim 1, the preprocessed training sample construction process is as follows: acquiring an image of a medicine bottle to be classified by a visual acquisition device, performing denoising, size normalization and brightness enhancement processing on the image, and performing random rotation, flipping or cropping data augmentation processing on the image to obtain the preprocessed training sample.
4. A visual recognition-based vial classification system for implementing the visual recognition-based vial classification method of claim 1, characterized by, It comprises: a visual acquisition module for acquiring an image of a medicine bottle to be classified; a data processing module for performing denoising, size normalization and brightness enhancement processing on the image; a classification and identification module for inputting the processed image into a pre-trained neural network classification model and outputting the category result of the medicine bottle; a control module for receiving the category result and controlling the sorting device or the mechanical arm to perform the corresponding operation.
5. The visual recognition based vial classification system of claim 5, wherein, The visual acquisition module comprises an industrial camera, a ring-shaped light source and a lens assembly, and the resolution of the industrial camera is not less than 2 million pixels.
6. The visual recognition based vial classification system of claim 5, wherein, The data processing module comprises an industrial computer, and the industrial computer is built-in with a graphics processing unit to accelerate the real-time calculation of the classification and identification module.
7. The visual recognition based vial classification system of claim 5, wherein, The neural network classification model of the classification and identification module is based on a convolutional neural network architecture, and the model supports training and updating of new medicine bottle categories through transfer learning.
8. The visual recognition based vial classification system of claim 5, wherein, The control module comprises a programmable logic controller connected to the classification and identification module and the mechanical arm through a communication interface.
9. The visual recognition based vial classification system of claim 5, wherein, The system further comprises a model training module deployed on a server end for iteratively optimizing the neural network classification model through validation set data.