Drug production quality informatization management and control method and system
By calculating the distinction index of each pixel point in the drug image and performing clustering processing, the problem of inaccurate separation of drug areas caused by dust and background interference in the prior art is solved, and accurate calculation of drug uniformity and real-time alarm are achieved, and detection accuracy and production quality control efficiency are improved.
Patent Information
- Application Number
- CN202510293288.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-13
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2045-03-13
AI Technical Summary
The prior art is susceptible to dust and background interference when testing drugs, and cannot accurately separate the drug area, resulting in inaccurate detection.
By calculating the distinction index of each pixel point, the K-means clustering algorithm is used to cluster pixel points to obtain the best clustering result, accurately separate the drug area, and calculate the drug uniformity, which triggers an alarm when the uniformity exceeds the preset range.
It effectively reduces background interference, improves the accuracy of drug area separation, realizes accurate calculation of drug uniformity and real-time alarms, and reduces the risk of inflow of unqualified products.
Smart Images

Figure CN119809460A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and more specifically, to a method and system for informatization control of drug production quality. Background Art
[0002] In the production process of granular drugs, due to the granulation process, equipment wear, drying process, dust collection and dust removal system and improper operation, there may be too much dust, which makes it impossible to accurately detect whether the drug meets the standard. In the granulation process, improper selection of binders, insufficient stirring time or unreasonable spray parameter settings will lead to excessive fine powder in the granules. In terms of equipment, wear of cutters and templates will affect the quality of particles and produce more dust. If the drying temperature is not appropriate, the particles will be dry on the outside and wet on the inside or produce fine powder. If the dust collection and dust removal system is not designed reasonably or the dust collector is not efficient, fine dust cannot be effectively removed. During the operation, improper operations such as pouring and mixing will also cause dust to fly. These dusts will make it difficult to observe the particle level of the drug in the image during drug detection, which will further lead to more noise when using images for granular drug evaluation, or the background and particle pixels cannot be effectively distinguished at locations with high dust concentration.
[0003] At present, a Chinese patent document with authorization announcement number CN118150412B discloses a drug particle size detection and analysis method and system based on near-infrared spectroscopy. This method utilizes near-infrared spectroscopy detection. Based on the same absorbance of samples of the same type, the method greatly improves the detection efficiency through a qualitative clustering model, and predicts the particle size outside the known particle size range through a partial least squares model, thereby achieving non-destructive and pollution-free online rapid and accurate detection of samples.
[0004] The above method is easily affected by dust and background interference and cannot accurately separate the drug area to detect whether the drug meets the standards. Summary of the invention
[0005] In order to solve the problem in the prior art that the drug area cannot be accurately separated due to dust and background interference, the present invention provides solutions in the following aspects.
[0006] In a first aspect, the present invention provides a method for information management and control of drug production quality, including: collecting drug images, calculating the discrimination index of each pixel in the image; clustering the pixels according to the discrimination index and position coordinates of the pixel points to obtain an optimal clustering result; calculating the uniformity of the drug according to the number of pixels contained in each cluster in the optimal clustering result, and issuing an alarm when the uniformity of the drug is not within a preset range; the calculation of the discrimination index of each pixel in the image specifically includes: calculating the drug subordination value of each pixel point and background dependent values , ,in, Represents pixel RGB vector, represents the standard RGB vector of the drug, Represents the standard RGB vector of the background; calculates the discrimination index , ,in, Represents pixel The drug dependency value of Represents pixel The background dependent value of .
[0007] By calculating the differentiation index through the drug subordinate value and background subordinate value of the pixel point, the difference between the background and the drug is increased, and the possibility of interference and misjudgment in subsequent calculations is reduced; clustering processing is performed using the differentiation index and position information of the pixel point to obtain the best clustering result and accurately obtain each drug area. The uniformity of the drug is calculated based on the number of pixels in each cluster, and it can be detected whether the size of all drugs meets the standard. When the calculated uniformity of the drug exceeds the preset range, the system can automatically trigger an alarm to prompt the abnormal situation in time. This helps to quickly discover and deal with potential problems during production or quality control, and reduce the risk of unqualified products entering the market. The above solution solves the problem that the existing technology is easily disturbed by dust and background when detecting drugs, and cannot accurately separate drug areas.
[0008] Preferably, the drug uniformity is calculated by: dividing all clusters into background clusters and drug clusters according to the discrimination index of each pixel point in each cluster in the best clustering result; calculating the drug uniformity , ,in, Indicates the number of pixels contained in the smallest drug cluster, Indicates the number of pixels contained in the largest drug cluster, Represents the standard deviation of the number of pixels contained in all drug clusters.
[0009] By counting the number of pixels in each drug cluster in the best clustering result, and using the minimum, maximum, and standard deviation of the number of pixels in each drug cluster to calculate the drug uniformity, this method can objectively and accurately reflect the distribution of drugs in the image, avoiding the subjectivity of relying on manual experience for judgment. First, all clusters are divided into background clusters and drug clusters based on the discrimination index of pixel points, thereby effectively eliminating background interference and ensuring that the subsequent calculation of drug uniformity only focuses on actual drugs.
[0010] Preferably, clustering the pixels to obtain the best clustering result specifically includes: constructing a pixel vector, the vector consisting of a distinguishing index and a position coordinate of the pixel; clustering all the pixels using a K-means clustering algorithm according to the vector, wherein the K value during clustering is Inner iteration, obtain the clustering result corresponding to each K value; calculate the evaluation value of each clustering result, and take the clustering result corresponding to the maximum evaluation value as the best clustering result; the evaluation value , , where T is the total number of pixels in the drug image, is the discrimination index of pixel c, v is the total number of clusters in the best clustering result, is a vector constructed from the discrimination index and position coordinates of pixel c, is a vector constructed by the distinguishing index and position coordinates of the cluster center of the ith cluster, wherein the ith cluster does not include the cluster where the pixel point c is located, is a vector constructed by the discrimination index and position coordinates of the cluster center of the cluster where the pixel c is located.
[0011] This method integrates the discrimination index and position coordinates, and uses K-means clustering and quantitative evaluation mechanisms to achieve accurate classification of pixels, providing a solid technical guarantee for the subsequent accurate calculation of drug uniformity and real-time alarm, thereby showing significant beneficial effects in improving detection accuracy, realizing automated monitoring, and enhancing system robustness. Moreover, the optimal K value is adaptively selected using the evaluation value, reducing the subjective interference of artificially set clustering clusters and ensuring the optimality of the clustering results.
[0012] Preferably, the collecting of drug images includes: setting a high-definition camera at a position perpendicular to the drug carrying plate.
[0013] The vertical arrangement ensures that the camera is facing the carrier plate, which can eliminate the perspective distortion caused by squinting, thereby ensuring that information such as the shape and size of the medicine is captured truthfully.
[0014] Preferably, all clusters are divided into background clusters and drug clusters according to the discrimination index of each pixel point in each cluster in the best clustering result, including: calculating the average discrimination index of all pixel points in each cluster cluster, and using Otsu threshold segmentation method to divide all clusters into background clusters and drug clusters.
[0015] By averaging the discrimination index of all pixels in each cluster, the overall characteristics of the cluster can be comprehensively reflected, reducing the impact of single pixel outliers or noise on the judgment results. The Otsu threshold segmentation method can automatically solve an optimal threshold that maximizes the difference between classes and accurately divides the clusters into background clusters and drug clusters. This method reduces the subjectivity of manually setting thresholds and improves the objectivity and consistency of segmentation results.
[0016] Preferably, the Greater than the amount of medicine.
[0017] Preferably, the alarm is issued when the uniformity of the medicine is not within a preset range, including: issuing an alarm through the color of an alarm light and / or the sound of an alarm bell.
[0018] In a second aspect, the present invention further provides a drug production quality information management and control system, comprising: a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-mentioned drug production quality information management and control method.
[0019] The beneficial effects of the present invention are as follows: the differentiation index is calculated by the drug subordinate value and the background subordinate value of the pixel point, which increases the difference between the background and the drug, and reduces the possibility of interference and misjudgment in subsequent calculations; clustering is performed using the differentiation index and position information of the pixel point to obtain the best clustering result and accurately obtain each drug area. The uniformity of the drug is calculated. When the calculated drug uniformity exceeds the preset range, the system can automatically trigger an alarm to prompt the abnormal situation in time. This helps to quickly discover and deal with potential problems during production or quality control, and reduce the risk of unqualified products entering the market. The above scheme solves the problem that the existing technology is easily interfered by dust and background when detecting drugs, and cannot accurately separate drug areas. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein: Figure 1 This is a flow chart of a method for informatization control of drug production quality provided by an embodiment of the present invention; Figure 2 It is a block diagram of a drug production quality information management and control system provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0021] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical invention in the embodiments of the present invention. Obviously, the described embodiments are 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 those skilled in the art without creative work are within the scope of protection of the present invention.
[0022] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0023] Figure 1 1 is a flowchart of a method for informatization control of drug production quality according to an embodiment of the present invention, comprising the following steps: S101, collecting a drug image, and calculating a discrimination index for each pixel in the image.
[0024] In the production process of a batch of drugs, these drugs are distributed on the carrier plate. In order to collect the most accurate image information of these drugs, it is necessary to set a high-definition camera at a position perpendicular to the carrier plate, so as to eliminate the perspective distortion caused by squint, thereby ensuring that the shape, size and other information of the drugs are captured truthfully. In some embodiments, some carrier plates are relatively long or large, and multiple high-definition cameras may need to be set, which will not be described in detail here.
[0025] In the collected drug images, in order to reduce the interference of the background on subsequent calculations, it is necessary to enhance the distinction between the background and the drug. In the present invention, the method provided is to calculate the drug subordination value and the background subordination value of each pixel point to calculate its discrimination index, and the discrimination index is the index that distinguishes whether the pixel point belongs to the background or the drug. The specific calculation process is: calculate the drug subordination value of each pixel point and background dependent values , ,in, Represents pixel RGB vector, represents the standard RGB vector of the drug, Represents the standard RGB vector of the background; calculates the discrimination index , ,in, Represents pixel The drug dependency value of Represents pixel The background dependent value of .
[0026] Calculate the drug-subordinate value and background-subordinate value of each pixel to preliminarily determine whether the pixel is more likely to belong to the drug or the background. If it belongs to the drug, its discrimination index , is a value in [0,2]. If it belongs to the background, its discrimination index , is a value belonging to [-2,0]. By distinguishing the exponential formula, the difference between the pixels belonging to the drug and the pixels belonging to the background is enhanced, solving the problem of inaccurate separation of background and drug caused by excessive dust in drug production.
[0027] S102, clustering the pixels according to the discrimination index and position coordinates of the pixels to obtain the best clustering result.
[0028] The above scheme specifically includes: constructing a pixel vector, the vector consisting of a distinguishing index and a position coordinate of the pixel; clustering all the pixels using a K-means clustering algorithm according to the vector, wherein the K value during clustering is Inner iteration, obtain the clustering result corresponding to each K value; calculate the evaluation value of each clustering result, and take the clustering result corresponding to the maximum evaluation value as the best clustering result; the evaluation value , , where T is the total number of pixels in the drug image, is the discrimination index of pixel c, v is the total number of clusters in the best clustering result, is a vector constructed from the discrimination index and position coordinates of pixel c, is a vector constructed by the distinguishing index and position coordinates of the cluster center of the ith cluster, wherein the ith cluster does not include the cluster where the pixel point c is located, is a vector constructed by the discrimination index and position coordinates of the cluster center of the cluster where the pixel c is located.
[0029] The p is greater than the number of drugs in the image. If p is less than or equal to the number of drugs in the image, it is considered that the pixels of each drug cannot be clustered into one category.
[0030] There are many pills on the carrier plate. The pixels are clustered using the discrimination index and position coordinates. The best clustering result can cluster the pixels of the same pill into one category as much as possible. Although the discrimination indexes of the pixels contained in different pills are close, their position coordinates are far apart, so they will not affect each other.
[0031] In the calculation formula of the evaluation value w, It represents the distance between the pixel point c and the cluster center of the nearest neighbor cluster. The distance between pixel c and the cluster center of the cluster to which it belongs. It quantifies the degree of separation of the pixel from its own cluster and other clusters. If the pixel is very close to the cluster center (close within the cluster) and far away from the cluster centers of other clusters, then this ratio will be much greater than 0; on the contrary, if the pixel is not compact enough within the cluster or the boundary with other clusters is not obvious, this value will be close to 0. Multiplying it by the absolute value of the discrimination index of the pixel can make the pixel with a larger absolute value of the discrimination index, that is, the pixel that obviously belongs to the drug or the background, contribute more to the evaluation value of the clustering result. Finally, the average of all pixels can be calculated to evaluate the clustering result as a whole.
[0032] S103, calculating the uniformity of the drug according to the number of pixels contained in each cluster in the best clustering result, and giving an alarm when the uniformity of the drug is not within a preset range.
[0033] The calculation of drug uniformity is specifically as follows: according to the discrimination index of each pixel point in each cluster in the best clustering result, all clusters are divided into background clusters and drug clusters; the drug uniformity is calculated. , ,in, Indicates the number of pixels contained in the smallest drug cluster, Indicates the number of pixels contained in the largest drug cluster, Represents the standard deviation of the number of pixels contained in all drug clusters.
[0034] In some embodiments, all clusters are divided into background clusters and drug clusters according to the discrimination index of each pixel point in each cluster in the best clustering result, including: calculating the average discrimination index of all pixel points in each cluster cluster, and using Otsu threshold segmentation method to divide all clusters into background clusters and drug clusters.
[0035] Specifically, for each cluster, the average discrimination index of all its pixels needs to be calculated first, and the average discrimination index of all clusters is regarded as a set of data. The Otsu threshold segmentation method is used to find an optimal threshold. The clusters with an average discrimination index less than the threshold are background clusters, and the clusters with an average discrimination index greater than or equal to the threshold are drug clusters. The Otsu threshold segmentation method is a well-known technique for finding the optimal threshold, which will not be described in detail here.
[0036] Each drug cluster corresponds to a drug, and the number of pixels contained in the drug cluster corresponds to the size of the drug. In the drug uniformity formula, It reflects the difference between the smallest and largest drug particles. The larger the value, the more serious drugs that do not meet the requirements appear. It reflects the deviation of the size of all drugs in the image from the average size. The larger the value, the more it means that the sizes of drugs in the image are different. Drug uniformity uses the number of pixels of the smallest drug cluster and the largest drug cluster and the standard deviation of the number of pixels of all drug clusters to calculate a comprehensive index, which objectively and accurately reflects the distribution of drugs in the image as a whole. The larger the drug uniformity, the more uniform the distribution of drug sizes in the image, and the more it meets the standard. On the contrary, the less it meets the standard, the more alarm light color and / or alarm bell sound are needed to alarm.
[0037] The present invention calculates the differentiation index through the drug subordinate value and background subordinate value of the pixel point, thereby increasing the difference between the background and the drug and reducing the possibility of interference and misjudgment in subsequent calculations; clustering is performed using the differentiation index and position information of the pixel point to obtain the best clustering result and accurately obtain each drug area. The uniformity of the drug is calculated. When the calculated drug uniformity exceeds the preset range, the system can automatically trigger an alarm to prompt abnormal conditions in time. This helps to quickly discover and deal with potential problems during production or quality control, and reduce the risk of unqualified products entering the market. The above scheme solves the problem that the existing technology is easily affected by dust and background interference when detecting drugs, and cannot accurately separate drug areas.
[0038] The present invention also provides a drug production quality information management and control system. Figure 2 As shown, the system includes a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a method for information management and control of drug production quality described in the present invention is implemented.
[0039] The system also includes other components familiar to those skilled in the art, such as a communication bus and a communication interface, whose configuration and functions are known in the art and thus will not be described in detail here.
[0040] In the present invention, the aforementioned memory may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, apparatus or device. For example, a computer-readable storage medium may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc., or any other medium that can be used to store the required information and can be accessed by an application, a module, or both. Any such computer storage medium may be part of a workshop device or accessible or connectable to a workshop device. Any application or module described in the present invention may be implemented using computer-readable / executable instructions that may be stored or otherwise maintained by such a computer-readable medium.
[0041] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly defined.
[0042] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternative inventions to the embodiments of the present invention described herein may be employed.
Claims
1. A method for informatization control of drug production quality, characterized in that: include: Collecting drug images and calculating the discrimination index of each pixel in the images; Cluster the pixels according to their discrimination index and position coordinates to obtain the best clustering result; Calculating the uniformity of the drug according to the number of pixels contained in each cluster in the optimal clustering result, and giving an alarm when the uniformity of the drug is not within a preset range; The calculating of the discrimination index of each pixel in the image specifically includes: calculating the drug subordination value of each pixel and background dependent values , ,in, Represents pixel RGB vector, represents the standard RGB vector of the drug, The standard RGB vector representing the background; Calculate the discrimination index , ,in, Represents pixel The drug dependency value of Represents pixel The background dependent value of .
2. The method for informatization control of drug production quality according to claim 1, characterized in that: The calculation of drug uniformity is specifically as follows: According to the discrimination index of each pixel in each cluster in the best clustering result, all clusters are divided into background clusters and drug clusters; Calculate drug uniformity , ,in, Indicates the number of pixels contained in the smallest drug cluster, Indicates the number of pixels contained in the largest drug cluster, Represents the standard deviation of the number of pixels contained in all drug clusters.
3. The method for informatization control of drug production quality according to claim 1, characterized in that: The clustering of the pixels to obtain the best clustering result specifically includes: Constructing a pixel point vector, wherein the vector is composed of a distinguishing index and a position coordinate of the pixel point; According to the vector, all pixels are clustered using the K-means clustering algorithm, where the K value during clustering is Inner iteration, obtain the clustering result corresponding to each K value; calculate the evaluation value of each clustering result, and take the clustering result corresponding to the maximum evaluation value as the best clustering result; the evaluation value , , where T is the total number of pixels in the drug image, is the discrimination index of pixel c, v is the total number of clusters in the best clustering result, is a vector constructed from the discrimination index and position coordinates of pixel c, is a vector constructed by the distinguishing index and position coordinates of the cluster center of the ith cluster, wherein the ith cluster does not include the cluster where the pixel point c is located, is a vector constructed by the discrimination index and position coordinates of the cluster center of the cluster where the pixel c is located.
4. The method for informatization control of drug production quality according to claim 1, characterized in that: The collecting of drug images comprises: A high-definition camera is arranged at a position perpendicular to the medicine carrying plate.
5. The method for informatization control of drug production quality according to claim 2, characterized in that: The method of dividing all clusters into background clusters and drug clusters according to the discrimination index of each pixel in each cluster in the best clustering result includes: The average discrimination index of all pixels in each cluster was calculated, and all clusters were divided into background clusters and drug clusters using the Otsu threshold segmentation method.
6. The method for informatization control of drug production quality according to claim 3, characterized in that: Said Greater than the amount of medicine.
7. The method for informatization control of drug production quality according to claim 1, characterized in that: The method of giving an alarm when the uniformity of the medicine is not within a preset range includes: Alarms are given by warning light colors and / or alarm bell sounds.
8. A drug production quality information management and control system, characterized in that: include: A memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method for information management and control of drug production quality as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Method for extracting liver region in ultrasound image
CN106504239A
Method for fast count and integrality detection of tablets under complex environment
CN108805854A
Data processing method for textile production
CN115578388A
Hyperspectral detection method for medical foreign matters
CN118347954A
Cover film surface defect detection method based on machine vision
CN119273684A