Ambroxol hydrochloride liquid filling detection method and system
By using robotic arms and image analysis technology in the filling system, the images of filling bottles are collected and analyzed, and the problem of difficult to detect abnormal filling of ambroxol hydrochloride liquid in the prior art is solved, and efficient and accurate filling is achieved Quality monitoring.
Patent Information
- Application Number
- CN202411525183.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-02-18
AI Technical Summary
The prior art is difficult to accurately detect abnormalities after filling of ambroxol hydrochloride liquids, especially when facing the special physical and chemical properties of the liquid.
The filling bottle is clamped by the robotic arm, and the images to be inspected are collected in front of the black and white background plates respectively, and deviation analysis is performed using the image encoder and analyzer to generate the filling abnormal mark.
Effective testing of ambroxol hydrochloride liquid filling is achieved, ensuring the filling quality and avoiding inefficiency and errors of manual testing.
Smart Images

Figure CN119477836A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of filling detection, and in particular to an ambroxol hydrochloride liquid filling detection method and system. Background Art
[0002] In the field of pharmaceutical production, the filling quality of ambroxol hydrochloride liquid is of vital importance. The accurate filling volume is not only related to the efficacy of the drug, but also to the safety of medication. However, traditional filling detection methods have many limitations. On the one hand, manual detection methods are inefficient and prone to errors. It is difficult to accurately judge whether the liquid filling volume is accurate by manually checking the filled bottles, especially for small deviations. Moreover, long-term manual inspections can easily lead to visual fatigue, further reducing the accuracy and reliability of the detection. On the other hand, some existing automated detection technologies cannot adapt to the special physical and chemical properties of specific products such as ambroxol hydrochloride liquid.
[0003] The prior art has the technical problem that it is difficult to accurately detect filling abnormalities after the ambroxol hydrochloride liquid is filled. Summary of the invention
[0004] The present application provides a method and system for detecting the filling of an ambroxol hydrochloride liquid, which are used to solve the technical problem in the prior art that it is difficult to accurately detect abnormal filling conditions after the ambroxol hydrochloride liquid is filled.
[0005] In view of the above problems, the present application provides a method and system for detecting the filling of ambroxol hydrochloride liquid.
[0006] In a first aspect of the present application, a method for detecting the filling of an ambroxol hydrochloride liquid is provided, the method comprising:
[0007] When the filling of ambroxol hydrochloride liquid is completed, the filling bottle is clamped by the robot arm to the black background board, and the light source is controlled to collect the first image to be inspected based on the first preset lighting parameters. The filling bottle is clamped by the robot arm to the white background board, and the light source is controlled to collect the second image to be inspected based on the second preset lighting parameters; the first preset lighting parameters are processed by the first image encoder to obtain the first coded image; the second preset lighting parameters are processed by the second image encoder to obtain the second coded image; the first image analyzer is used to perform deviation analysis on the first image to be inspected based on the first coded image to obtain a first analysis mark; the second image analyzer is used to perform deviation analysis on the second image to be inspected based on the second coded image to obtain a second analysis mark; when the first analysis mark or / and the second analysis mark are difference marks, an abnormal filling mark of ambroxol hydrochloride liquid is generated and sent to the user end.
[0008] The second aspect of the present application provides an ambroxol hydrochloride liquid filling detection system, the system comprising:
[0009] The image acquisition module to be inspected is used for, when the filling of the ambroxol hydrochloride liquid is completed, to clamp the filling bottle to the black background plate by the mechanical arm, to control the light source to collect the first image to be inspected based on the first preset lighting parameter, and to clamp the filling bottle to the white background plate by the mechanical arm, to control the light source to collect the second image to be inspected based on the second preset lighting parameter; the first coded image acquisition module, the first coded image acquisition module is used to process the first preset lighting parameter through the first image encoder to obtain the first coded image; the second coded image acquisition module, the second coded image acquisition module is used to process the second preset lighting parameter through the second image encoder Processing to obtain a second coded image; a first analysis identification acquisition module, the first analysis identification acquisition module is used to perform a deviation analysis on the first image to be inspected based on the first coded image through a first image analyzer to obtain a first analysis identification; a second analysis identification acquisition module, the second analysis identification acquisition module is used to perform a deviation analysis on the second image to be inspected based on the second coded image through a second image analyzer to obtain a second analysis identification; an abnormal identification generation module, the abnormal identification generation module is used to generate an abnormal identification for ambroxol hydrochloride liquid filling when the first analysis identification and / or the second analysis identification are different identifications, and send it to the user end.
[0010] One or more technical solutions provided in this application have at least the following technical effects or advantages:
[0011] When the filling of ambroxol hydrochloride liquid is completed, the filling bottle is clamped by the mechanical arm to the black background board, and the light source is controlled to collect the first image to be inspected based on the first preset lighting parameters. The filling bottle is clamped by the mechanical arm to the white background board, and the light source is controlled to collect the second image to be inspected based on the second preset lighting parameters; the first preset lighting parameters are processed by the first image encoder to obtain the first coded image; the second preset lighting parameters are processed by the second image encoder to obtain the second coded image; based on the coded image, the image to be inspected is analyzed for deviation to obtain the analysis mark; when the analysis mark is a difference mark, the ambroxol hydrochloride liquid filling abnormal mark is generated and sent to the user end. The technical effect of effectively detecting filling abnormalities and ensuring the filling quality of products is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0013] Figure 1 A schematic flow chart of a method for detecting the filling of ambroxol hydrochloride liquid provided in an embodiment of the present application;
[0014] Figure 2 A schematic diagram of the structure of an ambroxol hydrochloride liquid filling detection system provided in an embodiment of the present application.
[0015] Explanation of the reference numerals: to-be-tested image acquisition module 10 , first coded image acquisition module 20 , second coded image acquisition module 30 , first analysis mark acquisition module 40 , second analysis mark acquisition module 50 , abnormal mark generation module 60 . DETAILED DESCRIPTION
[0016] The present application provides a method and system for detecting the filling of ambroxol hydrochloride liquid, which is used to solve the technical problem in the prior art that it is difficult to accurately detect abnormal filling conditions after the ambroxol hydrochloride liquid is filled.
[0017] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0018] Embodiment 1, as Figure 1 As shown, the present application provides a method for detecting the filling of ambroxol hydrochloride liquid, the method comprising:
[0019] Step S100: After the filling of ambroxol hydrochloride liquid is completed, the filling bottle is clamped in front of a black background plate by a robotic arm, and the light source is controlled to collect a first image to be inspected based on a first preset lighting parameter. The filling bottle is clamped in front of a white background plate by a robotic arm, and the light source is controlled to collect a second image to be inspected based on a second preset lighting parameter.
[0020] Specifically, after the filling of the ambroxol hydrochloride liquid is completed, the inspection work will be carried out immediately. First, the robotic arm uses its precise clamping function to firmly grasp the filling bottle and move it to a specific position in front of the black background board. At this time, the specially set light source is started under the control of the first preset lighting parameters, and the filling bottle located in front of the black background board is illuminated according to the established light intensity, angle, color and other parameters, so as to collect the first image to be inspected. This image clearly presents the appearance state, liquid height, bottle surface condition and other information of the filling bottle under the black background, providing basic data for subsequent inspection and analysis. Then, the robotic arm moves again, transfers the filling bottle from the black background board, and clamps it in front of the white background board. Similarly, under the new instruction, the light source is adjusted according to the second preset lighting parameters, and then the acquisition program is started. Against the background of the white background, the light source illuminates the filling bottle under specific lighting conditions to obtain the second image to be inspected. This image complements the first image to be inspected, showing the details of the filling bottle from different background environment angles, which helps to more comprehensively discover the existing filling problems.
[0021] Step S200: Processing the first preset illumination parameter through a first image encoder to obtain a first encoded image.
[0022] Specifically, the first preset illumination parameter is processed by a generator that has been set as a first image encoder to obtain a first encoded image. This generator is constructed based on a generative adversarial network topology. When receiving the first preset illumination parameter, the generator starts to operate according to its internal complex neural network architecture, which includes multiple hidden layers. The neurons in these hidden layers are interconnected through specific weights and activation functions. The generator's processing of the first preset illumination parameter involves multiple steps. The information contained in the illumination parameter, such as illumination intensity, angle, color, etc., will undergo a series of linear and nonlinear transformations in different hidden layers after entering the generator. For example, features are extracted through convolutional layers, which are related to the spatial distribution of illumination parameters; the extracted features are processed nonlinearly through activation functions (such as ReLU) to enhance the expression ability of the model. As the data flows in the generator, after being processed by multiple hidden layers, the information originally in the form of illumination parameters is gradually converted into a potential image representation that conforms to the internal logic and pattern of the generator. Finally, the output from the output layer of the generator is the first encoded image, which carries the illumination parameter information processed by the generator and provides a key basis for the subsequent deviation analysis of the first image to be tested.
[0023] Step S300: Processing the second preset illumination parameter by a second image encoder to obtain a second encoded image.
[0024] Specifically, the second preset illumination parameter is processed by a generator that has been set as a second image encoder to obtain a second encoded image. This generator is based on a generative adversarial network topology and has a unique neural network architecture. When the second preset illumination parameter is input, the generator starts to work. The neural network inside the generator contains multiple hidden layers, and the neurons in each layer are connected to each other through specific weights and activation functions. For the information in the second preset illumination parameter, such as illumination intensity, angle, color, etc., after entering the generator, it undergoes a series of complex transformations in the hidden layer. The parameter information such as illumination intensity, angle, color, etc. is processed linearly and nonlinearly in different hidden layers, and features related to the parameter space distribution are extracted through the convolution layer, and then nonlinear processing is performed through the activation function (such as ReLU) to enhance the model expression ability. As the data flows in the generator, after being processed by multiple hidden layers, the original illumination parameter information is gradually transformed into a potential image representation that conforms to the internal logic of the generator. Finally, the second encoded image is output from the output layer of the generator, which carries the processed second preset illumination parameter information, providing a key basis for the subsequent deviation analysis of the second image to be inspected.
[0025] Step S400: using a first image analyzer, based on the first coded image, performing deviation analysis on the first image to be inspected to obtain a first analysis identifier.
[0026] Specifically, the first image to be inspected is subjected to deviation analysis based on the first coded image to obtain a first analysis identifier through a discriminator set as the first image analyzer. This discriminator is constructed based on the topological structure of a generative adversarial network, has a specific neural network architecture and analysis mechanism, and receives the first coded image and the first image to be inspected at the same time. The discriminator contains multiple modules for processing the two images, including a structure similar to the feature extraction channel in the first image encoder, which extracts features from the first coded image and the first image to be inspected respectively. For the first coded image, it is obtained by processing the first preset illumination parameter and carries information features related to illumination; for the first image to be inspected, it contains actual visual information of the bottle under a black background. In the feature extraction process, through a series of operations such as convolutional layers and pooling layers, the key features of the two images are extracted respectively, such as feature information such as texture, shape, and color distribution. Then, the discriminator compares and analyzes the features of the two extracted images through a special feature comparison module. The comparison method includes calculating the similarity between feature vectors, by calculating Euclidean distance, cosine similarity, and other methods. According to the result of feature comparison, the discriminator will output a judgment mark. If the feature similarity of the two images meets certain conditions, such as the similarity is higher than a certain set threshold, it is judged as no deviation, and the first analysis mark indicates no deviation; if the feature similarity does not meet the conditions, that is, there is a significant difference, it is judged as deviation, and the first analysis mark indicates deviation. Through such a deviation analysis process, the first analysis mark is finally obtained, which provides a basis for the subsequent judgment of whether the filling is abnormal.
[0027] Step S500: using a second image analyzer, based on the second coded image, performing deviation analysis on the second image to be inspected to obtain a second analysis identifier.
[0028] Specifically, the second image to be inspected is subjected to deviation analysis based on the second coded image to obtain a second analysis identifier by using a discriminator set as the second image analyzer. This discriminator is based on a generative adversarial network topology and has a specific neural network architecture and analysis capability. First, it simultaneously receives the second coded image and the second image to be inspected. The discriminator contains multiple modules for processing the two images, which have a structure similar to the feature extraction channel in the first image analyzer, and performs feature extraction on the second coded image and the second image to be inspected respectively. For the second coded image, it is obtained by processing the second preset illumination parameter and carries information features related to illumination; for the second image to be inspected, it contains the actual visual information of the filling bottle under the white background. In the feature extraction process, through a series of operations such as convolutional layers and pooling layers, the key features of the two images are extracted, such as feature information such as texture, shape, and color distribution. Then, the discriminator compares and analyzes the features of the two extracted images through a special feature comparison module, and the comparison method includes calculating the similarity between feature vectors, such as by calculating Euclidean distance, cosine similarity, and other methods. According to the result of feature comparison, the discriminator will output a judgment mark. If the feature similarity of the two images meets certain conditions, such as the similarity is higher than a certain set threshold, it is judged as no deviation, and the second analysis mark is the mark indicating no deviation; if the feature similarity does not meet the conditions, that is, there is a significant difference, it is judged as deviation, and the second analysis mark is the mark indicating deviation. Through such a deviation analysis process, the second analysis mark is finally obtained, which provides a basis for the subsequent judgment of whether the filling is abnormal.
[0029] Step S600: When the first analysis identifier and / or the second analysis identifier are / is a difference identifier, an abnormal filling identifier of ambroxol hydrochloride liquid is generated and sent to the user end.
[0030] Specifically, the first analysis mark and the second analysis mark are checked and judged. When the first analysis mark or the second analysis mark, or both of them are presented as difference marks at the same time, it means that in the detection process of the ambroxol hydrochloride liquid filling bottle, a problem has been found. At this time, an abnormal mark of ambroxol hydrochloride liquid filling is automatically generated. This abnormal mark is a specific signal or mark used to indicate that the filling process does not meet the standards. Subsequently, this ambroxol hydrochloride liquid filling abnormal mark is sent to the user end, which can be the operator's monitoring equipment, management system or other related receiving terminals. In this way, relevant personnel can receive information about filling abnormalities in a timely manner so as to take further measures, such as checking the filling equipment, retesting the filling bottle, or handling the filled product accordingly.
[0031] In one possible implementation, step 200 further includes:
[0032] Step 210: Configure a generative adversarial network topology, wherein the generative adversarial network topology includes a generator and a discriminator.
[0033] Step 220: Obtain a black background image of the filled bottle after filling without abnormality, wherein the black background image of the filled bottle has a lighting parameter label.
[0034] Step 230: Input the lighting parameter label into the generator to obtain a first generated image.
[0035] Step 240: input the first generated image and the black background filling bottle image into the discriminator for discrimination to obtain a difference discrimination mark.
[0036] Step 250: When the difference discrimination mark is a no-difference mark, the generator is accurately marked for the image.
[0037] Step 260: When the proportion of the number of accurately labeled images is greater than or equal to the convergence proportion in N consecutive trainings, the generator is set to the first image encoder, and the discriminator is set to the first image analyzer.
[0038] Specifically, configuring the topology of a generative adversarial network is the process of building a complex neural network structure that includes a generator and a discriminator. First, determine the network architecture of the generator, which usually consists of multiple hidden layers, which are fully connected layers, convolutional layers, or other types of neural network layers. In a common convolutional generator architecture, it includes multiple convolutional layers and upsampling layers. The convolutional layers are used to extract features of the input data, and the upsampling layers are used to increase the dimensionality of the data to generate the final image. The input layer of the generator receives specific data, in this case, the lighting parameter label, and the output layer generates an image related to the real filling bottle image. At the same time, the network architecture of the discriminator also needs to be configured. The discriminator also consists of multiple hidden layers, and its purpose is to distinguish between real images and images generated by the generator. The input layer of the discriminator receives images generated by the generator and real filling bottle images. Internally, the discriminator extracts features of the image through a series of convolutional layers, pooling layers, and fully connected layers, and determines whether the input image is a real image by comparing these features. In addition, it is necessary to determine the number of neurons in each layer of the generator and discriminator, the type of activation function, and other related parameters. The activation function can enhance the nonlinear expression ability of the neural network. By carefully configuring these parameters, the performance of the generative adversarial network is optimized so that it can better complete the subsequent task, that is, accurately generate and discriminate images related to the detection of ambroxol hydrochloride liquid filling.
[0039] Acquiring images of filled bottles with a black background after filling without any abnormalities is a crucial step. It is necessary to ensure that the filling process has been successfully completed and that the obtained filled bottles have no abnormalities in appearance and internal liquid filling. This involves precise control of the filling equipment and a strict quality inspection process to ensure that each filled bottle meets the standards. Then, these qualified filled bottles are placed on a black background for image acquisition. When acquiring images, it is necessary to record the lighting parameter labels at this time. The lighting parameter labels cover multiple aspects of information, including but not limited to light intensity, lighting angle, lighting color, etc. These lighting parameters are achieved through specific light source settings and control methods, and in subsequent steps, these lighting parameter labels will be used as important input information for the generator part of the generative adversarial network to generate matching images for comparison and analysis. In this way, the appearance characteristics of the filled bottles can be more accurately detected and whether they meet the standards can be determined.
[0040] The lighting parameter labels are input into the pre-configured generator, which begins to process the input information based on its internal complex neural network structure and algorithm mechanism. First, the lighting parameter labels are parsed to identify key information such as light intensity, angle, color, etc. Then, through a series of convolutional layers, activation functions ReLU, pooling layers, and fully connected layers, these lighting parameter information are gradually converted into a potential image representation. In this process, the convolutional layer extracts the features of the lighting parameters in different spatial dimensions, the activation function enhances the nonlinear expression ability of the model, the pooling layer downsamples the features to reduce the amount of data and retain key features, and the fully connected layer is used to integrate and adjust the features. Finally, the generator outputs the first generated image, which is a graphical presentation of the input lighting parameter labels, providing a basis for subsequent discrimination and analysis.
[0041] The first generated image and the image of the bottle with a black background are simultaneously input into the discriminator, which extracts features from the two images through different channels. These channels include operations such as convolutional layers and pooling layers to obtain feature information such as texture, shape, and color of the two images. Then, the two sets of extracted features are compared and analyzed. The comparison method includes calculating the similarity of feature vectors, calculating the Euclidean distance and cosine similarity, and according to the result of feature comparison, the discriminator outputs a difference discrimination mark. If the feature similarity of the two images reaches a certain threshold, the difference discrimination mark is a no-difference mark, otherwise it is a difference mark.
[0042] When the difference identification mark output by the discriminator is a no-difference mark, it means that in this discrimination process, the image generated by the generator is almost the same as the real black background filling bottle image under the evaluation criteria of the discriminator. This is an important signal. At this time, the generator is given an accurate image identification, indicating that the current network parameters and generation mechanism of the generator can successfully produce images that meet the requirements and achieve a high degree of similarity with the real image.
[0043] In the process of N consecutive trainings, if the image generated by the generator is identified as indifferent by the discriminator in each training, an accurate image identification will be obtained. As the training continues, the proportion of the number of accurate image identifications to the total number of training times is calculated. When this proportion is greater than or equal to the preset convergence ratio, it indicates that the generator can stably and high-quality generate images similar to the real images in multiple trials. At this time, the generator is set as the first image encoder. At the same time, the discriminator that cooperates with it is set as the first image analyzer, because it has also proved its ability to accurately distinguish between generated images and real images during the training process. The two will play a key role in the subsequent analysis of filling bottle image deviations. For the case of a white background board, the analysis process is exactly the same as that of a black background board. Also in N consecutive trainings, when the image generated by the generator for the lighting parameter label under a white background meets the judgment criteria of the discriminator, and the proportion of accurately labeled images reaches the convergence proportion, the generator will be set as the first image encoder for the white background, and the discriminator will be set as the first image analyzer for the white background. This setting ensures that no matter whether it is under a black background or a white background, there are suitable tools to accurately analyze the image of the filled bottle, so as to effectively determine whether there is an abnormality in the filling process.
[0044] In one possible implementation, step 240 further includes:
[0045] Step 241: The discriminator includes a first feature extraction channel, a second feature extraction channel and a feature comparison channel, wherein the model structure and model parameters of the first feature extraction channel and the second feature extraction channel are the same.
[0046] Step 242: extracting first image features of the first generated image through the first feature extraction channel.
[0047] Step 243: extracting the second image feature of the black background filling bottle image through the second feature extraction channel.
[0048] Step 244: Compare the first image feature and the second image feature through the feature comparison channel to obtain image feature similarity.
[0049] Step 245: When the image feature similarity is greater than or equal to the image feature similarity threshold, the difference identification mark is a no-difference mark; otherwise, the difference identification mark is a difference mark.
[0050] Specifically, the design of the discriminator includes three key channels, namely the first feature extraction channel, the second feature extraction channel and the feature comparison channel. Among them, the first feature extraction channel and the second feature extraction channel have exactly the same model structure and model parameters, which means that the number of neural network layers, the number of neurons in each layer, the type of activation function, and the weight initialization method are consistent. This consistent design enables the two channels to follow the same rules and logic when extracting features from different images, thereby ensuring that the extracted features are comparable and consistent. For example, when faced with the first generated image and the image of the filling bottle with a black background, the two channels can use the same standards to mine key feature information such as texture, shape, and color in the image, providing a reliable and fair basis for subsequent feature comparisons.
[0051] The first generated image is subjected to feature extraction through the first feature extraction channel, which contains a series of neural network layers and related operations. For example, the convolution layer is used to extract local features of the image, and the pooling layer is used to reduce the amount of data and retain key feature information. Through the continuous processing of these layers, the first image features are gradually extracted from the first generated image, and these first image features can reflect the key information of the first generated image, such as texture, shape, color distribution, etc.
[0052] At the same time, the second feature extraction channel performs feature extraction on the image of the filled bottle with a black background. Since the second feature extraction channel has the same structure and parameters as the first feature extraction channel, the image of the filled bottle with a black background is also processed in a similar manner. After operations such as the convolution layer and the pooling layer, the second image features are extracted from the image of the filled bottle with a black background. These second image features contain the actual conditions of the texture, shape, color distribution, etc. of the real filled bottle image under the black background.
[0053] The feature comparison channel begins to work. It receives the first image features from the first feature extraction channel and the second image features from the second feature extraction channel. First, the feature comparison channel preprocesses the two sets of features to make them suitable for comparison. Then, a specific algorithm is used to calculate the similarity between the two. For example, the Euclidean distance between feature vectors is calculated. The smaller the distance, the higher the similarity; or the cosine similarity is calculated. The closer the value is to 1, the higher the similarity. Through these precise calculation methods, the feature comparison channel finally obtains an image feature similarity value that can accurately reflect the similarity between the first image feature and the second image feature.
[0054] Finally, the difference identification mark is determined based on the obtained image feature similarity. If the image feature similarity is greater than or equal to the preset image feature similarity threshold, it means that the two images are very similar at the feature level, and the difference identification mark is a no difference mark. On the contrary, if the image feature similarity is less than the image feature similarity threshold, it means that there is a significant difference between the two images, and the difference identification mark is a difference mark.
[0055] In a possible implementation, step 241 further includes:
[0056] Step 2411: Collect the image set to be trained and the image feature identification data set to construct a training data set.
[0057] Step 2412: Using the image feature identification dataset as supervision and the set of images to be trained as input, the first feature extraction channel is configured according to the training dataset.
[0058] Specifically, for the collection of the image set to be trained, the diversity and representativeness of the data need to be considered. This requires obtaining images from multiple sources, such as images of filled bottles in actual production environments, carefully designed simulation experiment images, or screening out images that meet the requirements from existing large-scale image databases. These images include different lighting conditions, angles, differences in the appearance of filled bottles (such as shape, color, label style, etc.), and various possible situations (such as normal filling, slight defects, obvious defects, etc.) to ensure that the training data set can fully reflect the various situations that may be encountered in actual application scenarios, so that the model can learn sufficiently rich feature patterns. At the same time, it is also necessary to collect an image feature identification data set, which is a detailed feature description of each image to be trained, obtained by manual annotation, that is, professionals mark various features in the image one by one according to certain standards and specifications, such as whether the shape of the filled bottle is regular, whether the color is normal, whether the label is complete, and whether there are scratches, stains and other defects. In addition, we use automated image processing algorithms and tools to assist in generating some feature identifications. For example, we use image segmentation algorithms to determine the outline of the filling bottle, and then determine whether the shape is regular based on the geometric features of the outline. By combining manual annotation with automated algorithms, we can more efficiently and accurately construct image feature identification datasets. Finally, we combine the collected image set to be trained and the image feature identification dataset in a one-to-one correspondence to construct a training dataset. This training dataset will provide a basis for subsequent model training, ensuring that the model can learn effective feature extraction and discrimination methods from the data.
[0059] Each image in the set of images to be trained is input into the first feature extraction channel in turn. At the same time, for each input image, the image feature identification dataset provides a standard feature description of the image as supervision information. In this process, the neural network structure inside the first feature extraction channel starts to work, and processes the input image through a series of convolutional layers, pooling layers, and fully connected layers, trying to extract features that match the supervision information. For example, if the supervision information indicates that a certain area in the image should have specific shape or color features, the channel will adjust the weights of each layer according to its own network parameters and learning algorithm, so that the features extracted after processing can accurately reflect these requirements. With the continuous input of images and adjustments based on the corresponding supervision information, the first feature extraction channel gradually learns how to accurately extract features that meet the requirements from different input images, thereby completing its own configuration process, so that it can better adapt to subsequent image feature extraction tasks.
[0060] In one possible implementation, step 2412 further includes:
[0061] Step 24121: Divide the training data set into k parts to obtain k training data sets.
[0062] Step 24122: Using the image feature identification dataset as supervision and the set of images to be trained as input, retrieve the first training dataset of the k training datasets to train the first convolutional neural network to obtain a first sub-feature extraction channel.
[0063] Step 24123: until the image feature identification dataset is used as supervision and the set of images to be trained is used as input, the kth training dataset of the k training datasets is retrieved to train the first convolutional neural network, and the kth sub-feature extraction channel is obtained.
[0064] Step 24124: construct a fully connected layer, perform mean statistics on the outputs of the first sub-feature extraction channel to the kth sub-feature extraction channel, and obtain the first feature extraction channel.
[0065] Specifically, the purpose of dividing the training data set is to better utilize the data for model training and optimization. A reasonable division method is used to evenly divide the entire training data set into k parts. This process needs to consider the distribution characteristics of the data to ensure that each training data set can retain the diversity and representativeness of the original data set to a certain extent. For example, if the training data set contains data of different categories or features, when dividing, try to make each data set contain samples of various categories and features to avoid the situation where a data set is too biased towards a certain type of data. Through this division method, k training data sets are finally obtained, and each data set will play an important role in the subsequent model training process.
[0066] The first convolutional neural network is trained using the divided training data set to obtain the first sub-feature extraction channel. First, the image feature identification data set is used as the supervision information to provide the correct target output for model training, that is, the feature identification that each image should have. At the same time, the set of images to be trained is used as input, and these images are input into the network in sequence. Then, the first training data set in the k training data sets is retrieved, which contains a part of the image samples and their corresponding feature identifications. During the training process, the first convolutional neural network learns according to the input image and the corresponding supervision information, extracts features from the image through the convolution layer, compresses features through the pooling layer, integrates features through the fully connected layer, and continuously adjusts the weights and parameters of the network so that the features of the network output match the feature identification in the supervision information as much as possible. After multiple iterations of training, when the output of the network can stably and accurately reflect the features of the input image and conform to the supervision information, the first sub-feature extraction channel is obtained, which has the ability to extract features that meet the requirements from the input image.
[0067] The training process is continued until the k-th training data set is used, and the image feature identification data set is used as the supervision information to always provide accurate standards for model training and guide the network to learn the correct feature extraction method. The set of images to be trained is used as a continuous input source to provide learning materials. In order, the k-th training data set is retrieved from the k training data sets. This data set also contains a part of image samples and their corresponding feature identifications. After inputting these data into the first convolutional neural network, the network continues to adjust its weights and parameters according to the previous learning mechanism through operations such as convolutional layers, pooling layers, and fully connected layers to adapt to this new data. After multiple iterations of training, when the network's output for the k-th training data set can stably and accurately reflect the features of the input image and conform to the supervision information, the k-th sub-feature extraction channel is successfully obtained. It also has the ability to extract features that meet the requirements from the input image. Together with the previously obtained sub-feature extraction channels, it prepares for the subsequent construction of a more complete feature extraction channel.
[0068] Construct a fully connected layer, which processes the outputs of the first sub-feature extraction channel to the kth sub-feature extraction channel, and uses the outputs of these sub-feature extraction channels as the inputs of the fully connected layer, which performs mean statistics on these inputs. Calculate the average value of the output value at each corresponding position. If each sub-feature extraction channel outputs a feature vector containing n elements, then the fully connected layer will calculate the average value of these n elements in the outputs of all sub-feature extraction channels. Through this mean statistical method, the learning results of each sub-feature extraction channel are combined, and their feature information is integrated to finally obtain the first feature extraction channel. This channel combines the advantages of different sub-feature extraction channels and can extract features from the input image more comprehensively and accurately.
[0069] In one possible implementation, step 244 further includes:
[0070] Step 2441: The first image feature includes a first attribute and a first feature value.
[0071] Step 2442: The second image feature includes a first attribute and a second feature value.
[0072] Step 2443: Analyze the first attribute similarity between the first attribute first characteristic value and the first attribute second characteristic value.
[0073] Step 2444: loop analysis until the Mth attribute similarity between the first eigenvalue of the Mth attribute and the second eigenvalue of the Mth attribute is obtained.
[0074] Step 2445: Count the first attribute similarities until the average value of the Mth attribute similarities is obtained, and set it as the image feature similarity.
[0075] Specifically, the first image feature covers multiple information dimensions, including the first attribute and the first eigenvalue. The first attribute is an attribute related to a key aspect of the image, such as color attribute, shape attribute or texture attribute, and the first attribute and the first eigenvalue are the specific quantification of the first attribute in the first image feature. For example, if the first attribute is a color attribute, the first attribute and the first eigenvalue may be a specific numerical representation of a certain color (such as an RGB value), or an identifier of a color category (such as red, blue, etc.); if the first attribute is a shape attribute, the first attribute and the first eigenvalue may be a mathematical description of the shape (such as the radius of a circle, the aspect ratio of a rectangle, etc.).
[0076] Similarly, the second image feature also contains the corresponding first attribute second feature value, which means that for the same attribute, there is also a corresponding description in the second image feature. Similar to the first image feature, the first attribute second feature value in the second image feature is also a quantitative or qualitative description of the attribute in the second image feature. For example, for the color attribute, the first attribute second feature value in the second image feature may be a specific numerical representation or category identifier of another color; for the shape attribute, it may be a mathematical description of another shape. This setting of feature values for the same attribute in different image features provides a basis for the subsequent comparison of the similarity of the two image features on the attribute.
[0077] To analyze the first attribute similarity of the first eigenvalue of the first attribute and the second eigenvalue of the first attribute, it is first necessary to determine the similarity calculation method suitable for the attribute, which depends on the nature of the first attribute. If the first attribute is numerical, such as the brightness value of a certain area in the image, the difference calculation method is used to calculate the difference between the two eigenvalues, and the difference is converted into similarity according to certain rules, such as the smaller the difference, the higher the similarity. If the first attribute is categorical, such as the shape category of an object in the image, the classification matching method is used. If the two eigenvalues belong to the same category, the similarity is high, otherwise it is low. If the first attribute is vectorial, such as the color vector representation of the image, the cosine similarity and other methods are used to calculate the cosine value of the angle between the two vectors. The closer the cosine value is to 1, the higher the similarity. Through these methods, the similarity between the first eigenvalue of the first attribute and the second eigenvalue of the first attribute can be accurately analyzed.
[0078] Start the loop analysis process, starting from the second attribute, and process each attribute in turn according to the same logic and method as the analysis of the similarity of the first attribute. For each new attribute, extract the first eigenvalue of the Mth attribute in the first image feature and the second eigenvalue of the Mth attribute in the second image feature, and then select the appropriate similarity calculation method according to the characteristics of the attribute, such as the difference or ratio calculation similarity for numerical attributes, classification matching for categorical attributes, and cosine similarity for vector attributes. Continue this process and loop the analysis until all M attributes are analyzed, and finally obtain the Mth attribute similarity of the first eigenvalue of the Mth attribute and the second operability value of the Mth attribute.
[0079] All attribute similarities obtained previously are processed comprehensively, starting from the first attribute similarity to the Mth attribute similarity, and all similarity values calculated under different attribute dimensions are taken into consideration. The mean of these attribute similarities is calculated by statistical methods. This mean is calculated by adding all attribute similarity values and then dividing by the total number of attributes M, and the final mean is set as the image feature similarity. It represents the comprehensive similarity between the first image feature and the second image feature in multiple attribute dimensions, and can more comprehensively and accurately measure the similarity relationship between the two images, providing a key basis for subsequent judgment and decision-making.
[0080] In one possible implementation, step 2443 further includes:
[0081] Step 24431: Calculate the sum of the squares of the first eigenvalue of the first attribute and the second eigenvalue of the first attribute, and add a preset small constant to obtain the denominator eigenvalue.
[0082] Step 24432: Calculate twice the product of the first eigenvalue of the first attribute and the second eigenvalue of the first attribute, and add a preset small constant to obtain the molecular eigenvalue.
[0083] Step 24433: Calculate the ratio of the numerator eigenvalue to the denominator eigenvalue, and set it as the first attribute similarity.
[0084] Specifically, the sum of the squares of the two is calculated, that is, the first eigenvalue of the first attribute and the second eigenvalue of the first attribute are squared respectively, and then the two square values are added, and then a preset small constant is added. The purpose of this preset small constant is to avoid special situations such as the denominator being zero or too small in subsequent calculations, so as to obtain the denominator eigenvalue. Calculate twice the product of the first eigenvalue of the first attribute and the second eigenvalue of the first attribute, multiply the two eigenvalues by 2, and then add the preset small constant to obtain the numerator eigenvalue. The numerator eigenvalue calculated previously is ratioed with the denominator eigenvalue. The numerator eigenvalue carries a quantitative information about the relationship between the first eigenvalue of the first attribute and the second eigenvalue of the first attribute, and the denominator eigenvalue is the same. The result obtained by calculating the ratio of the two can accurately reflect the similarity between the two eigenvalues at the first attribute level. This ratio is defined as the first attribute similarity, which provides a key measurement indicator for the first attribute dimension for the subsequent overall evaluation of image features, and further understands the similarity of the two images in this specific attribute.
[0085] Embodiment 2, based on the same inventive concept as the ambroxol hydrochloride liquid filling detection method in the above embodiment, Figure 2As shown, the present application provides a liquid filling detection system for ambroxol hydrochloride, and the embodiments of the present application and the method embodiments are based on the same inventive concept. The system includes:
[0086] The image acquisition module 10 to be inspected is used for, after the filling of the ambroxol hydrochloride liquid is completed, to clamp the filling bottle to a black background plate by a robotic arm, and to control the light source to collect the first image to be inspected based on the first preset lighting parameters, and to clamp the filling bottle to a white background plate by a robotic arm, and to control the light source to collect the second image to be inspected based on the second preset lighting parameters.
[0087] The first coded image acquisition module 20 is used to process the first preset illumination parameter through a first image encoder to obtain a first coded image.
[0088] The second encoded image acquisition module 30 is used to process the second preset illumination parameter through a second image encoder to obtain a second encoded image.
[0089] The first analysis identifier acquisition module 40 is used to perform deviation analysis on the first image to be inspected based on the first coded image through a first image analyzer to obtain a first analysis identifier.
[0090] The second analysis identification acquisition module 50 is used to perform deviation analysis on the second image to be inspected based on the second coded image through a second image analyzer to obtain a second analysis identification.
[0091] The abnormal identification generating module 60 is used to generate an abnormal identification of ambroxol hydrochloride liquid filling when the first analysis identification and / or the second analysis identification are different identifications, and send the abnormal identification to the user end.
[0092] Furthermore, the first coded image acquisition module 20 further includes:
[0093] An adversarial network topology configuration unit, wherein the adversarial network topology configuration unit is used to configure a generative adversarial network topology, wherein the generative adversarial network topology includes a generator and a discriminator.
[0094] A black background filling bottle image acquisition unit is used to obtain a black background filling bottle image with no abnormalities after filling, wherein the black background filling bottle image has a lighting parameter label.
[0095] A first generated image acquisition unit is used to input the lighting parameter label into the generator to obtain a first generated image.
[0096] A difference identification mark acquisition unit is used to input the first generated image and the black background filling bottle image into the discriminator for discrimination to obtain a difference discrimination mark.
[0097] An image accurate identification unit, wherein the image accurate identification unit is used to perform image accurate identification on the generator when the difference discrimination mark is a no-difference mark.
[0098] The first image analyzer setting unit is used to set the generator to the first image encoder and the discriminator to the first image analyzer when the proportion of the number of accurately identified images is greater than or equal to the convergence proportion in N consecutive trainings.
[0099] Furthermore, the difference identification identification acquisition unit further includes:
[0100] A discriminator acquisition unit, wherein the discriminator acquisition unit is used for the discriminator to include a first feature extraction channel, a second feature extraction channel and a feature comparison channel, wherein the model structure and model parameters of the first feature extraction channel and the second feature extraction channel are the same.
[0101] A first image feature extraction unit is used to extract first image features of the first generated image through the first feature extraction channel.
[0102] The second image feature extraction unit is used to extract the second image feature of the black background filling bottle image through the second feature extraction channel.
[0103] An image feature similarity acquisition unit is used to compare the first image feature and the second image feature through the feature comparison channel to obtain image feature similarity.
[0104] The similarity threshold judgment unit is used to determine that when the image feature similarity is greater than or equal to the image feature similarity threshold, the difference discrimination mark is a no-difference mark; otherwise, the difference discrimination mark is a difference mark.
[0105] Furthermore, the discriminator acquisition unit further includes:
[0106] The training data set construction unit is used to collect a set of images to be trained and an image feature identification data set to construct a training data set.
[0107] The first feature extraction channel configuration unit is used to configure the first feature extraction channel according to the training data set, taking the image feature identification data set as supervision and the set of images to be trained as input.
[0108] Furthermore, the first feature extraction channel configuration unit also includes:
[0109] A training data set acquisition unit is used to divide the training data set into k parts to obtain k training data sets.
[0110] The first sub-feature extraction channel acquisition unit is used to use the image feature identification data set as supervision, the set of images to be trained as input, retrieve the first training data set of the k training data sets to train the first convolutional neural network, and obtain the first sub-feature extraction channel.
[0111] The k-th sub-feature extraction channel acquisition unit is used to use the image feature identification data set as supervision, the set of images to be trained as input, retrieve the k-th training data set of the k training data sets to train the first convolutional neural network, and obtain the k-th sub-feature extraction channel.
[0112] A mean statistics unit is used to construct a fully connected layer, perform mean statistics on the outputs of the first sub-feature extraction channel to the kth sub-feature extraction channel, and obtain the first feature extraction channel.
[0113] Furthermore, the image feature similarity acquisition unit further includes:
[0114] The first feature value unit is used for the first image feature to include a first attribute and a first feature value.
[0115] The second feature value unit is used for the second image feature to include a first attribute and a second feature value.
[0116] An attribute similarity analysis unit is used to analyze the first attribute similarity between the first attribute first characteristic value and the first attribute second characteristic value.
[0117] A loop analysis unit, wherein the loop analysis unit is used for loop analysis until the Mth attribute similarity between the Mth attribute first characteristic value and the Mth attribute second characteristic value is obtained.
[0118] A similarity mean statistical unit is used to count the mean values of the first attribute similarities to the Mth attribute similarities, and set the mean values as the image feature similarity.
[0119] Furthermore, the attribute similarity analysis unit further includes:
[0120] A denominator eigenvalue acquisition unit is used to calculate the square sum of the first eigenvalue of the first attribute and the second eigenvalue of the first attribute, and add a preset small constant to obtain the denominator eigenvalue.
[0121] The molecular characteristic value acquisition unit is used to calculate twice the product of the first characteristic value of the first attribute and the second characteristic value of the first attribute, and add a preset small constant to obtain the molecular characteristic value.
[0122] A ratio calculation unit is used to calculate a ratio of the numerator eigenvalue to the denominator eigenvalue, and set it as the first attribute similarity.
[0123] It should be noted that the above-mentioned sequence of the embodiments of the present application is only for description and does not represent the advantages and disadvantages of the embodiments. And the above-mentioned specific embodiments of this specification are described. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0124] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
[0125] This specification and the drawings are merely exemplary illustrations of the present application and are deemed to cover any and all modifications, variations, combinations or equivalents within the scope of the present application. Obviously, a person skilled in the art may make various modifications and variations to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the present application and its equivalents, the present application intends to include these modifications and variations.
Claims
1. A method for detecting the filling of ambroxol hydrochloride liquid, characterized in that: include: When the ambroxol hydrochloride liquid is filled, the filling bottle is clamped by the robotic arm to the black background plate, and the light source is controlled to collect the first image to be inspected based on the first preset lighting parameter; the filling bottle is clamped by the robotic arm to the white background plate, and the light source is controlled to collect the second image to be inspected based on the second preset lighting parameter; Processing the first preset illumination parameter by a first image encoder to obtain a first encoded image; Processing the second preset illumination parameter by a second image encoder to obtain a second encoded image; By means of a first image analyzer, based on the first coded image, performing deviation analysis on the first image to be inspected to obtain a first analysis identifier; By a second image analyzer, based on the second coded image, performing deviation analysis on the second image to be inspected to obtain a second analysis identifier; When the first analysis identification and / or the second analysis identification are different identifications, an abnormal filling identification of the ambroxol hydrochloride liquid is generated and sent to the user end.
2. The method according to claim 1, characterized in that The steps of constructing the first image encoder and the first image analyzer include: Configuring a generative adversarial network topology, wherein the generative adversarial network topology includes a generator and a discriminator; Obtaining a black background filled bottle image with no abnormalities after filling, wherein the black background filled bottle image has a lighting parameter label; Inputting the illumination parameter label into the generator to obtain a first generated image; Inputting the first generated image and the black background filled bottle image into the discriminator for discrimination to obtain a difference discrimination mark; When the difference identification mark is a no-difference mark, accurately marking the image of the generator; When the proportion of accurately labeled images in N consecutive trainings is greater than or equal to the convergence proportion, the generator is set to the first image encoder, and the discriminator is set to the first image analyzer.
3. The method according to claim 2, characterized in that Inputting the first generated image and the black background filled bottle image into the discriminator for discrimination to obtain a difference discrimination mark, including: The discriminator comprises a first feature extraction channel, a second feature extraction channel and a feature comparison channel, wherein the model structure and model parameters of the first feature extraction channel and the second feature extraction channel are the same; extracting a first image feature of the first generated image through the first feature extraction channel; Extracting a second image feature of the black background filling bottle image through the second feature extraction channel; By using the feature comparison channel, the first image feature and the second image feature are compared to obtain image feature similarity; When the image feature similarity is greater than or equal to the image feature similarity threshold, the difference identification mark is a no-difference mark, otherwise, the difference identification mark is a difference mark.
4. The method according to claim 3, characterized in that The first feature extraction channel construction step comprises: Collect the image set to be trained and the image feature identification data set to construct the training data set; The image feature identification data set is used as supervision, the set of images to be trained is used as input, and the first feature extraction channel is configured according to the training data set.
5. The method according to claim 4, characterized in that Taking the image feature identification dataset as supervision and the set of images to be trained as input, configuring the first feature extraction channel according to the training dataset includes: Dividing the training data set into k parts to obtain k training data sets; Taking the image feature identification dataset as supervision and the set of images to be trained as input, retrieving a first training dataset of the k training datasets to train a first convolutional neural network to obtain a first sub-feature extraction channel; Until the image feature identification dataset is used as supervision and the set of images to be trained is used as input, the kth training dataset of the k training datasets is retrieved to train the first convolutional neural network, and the kth sub-feature extraction channel is obtained; A fully connected layer is constructed, and mean statistics are performed on outputs of the first sub-feature extraction channel to the kth sub-feature extraction channel to obtain the first feature extraction channel.
6. The method according to claim 3, characterized in that Comparing the first image feature and the second image feature through the feature comparison channel to obtain image feature similarity includes: The first image feature includes a first attribute first feature value; The second image feature includes a first attribute and a second feature value; Analyzing the first attribute similarity of the first attribute first characteristic value and the first attribute second characteristic value; Circular analysis is performed until the Mth attribute similarity between the first eigenvalue of the Mth attribute and the second eigenvalue of the Mth attribute is obtained; The first attribute similarities are counted until an average value of the Mth attribute similarities is set as the image feature similarity.
7. The method according to claim 6, characterized in that Analyzing the first attribute similarity between the first attribute first characteristic value and the first attribute second characteristic value includes: Calculate the sum of the squares of the first eigenvalue of the first attribute and the second eigenvalue of the first attribute, and add a preset small constant to obtain a denominator eigenvalue; Calculate twice the product of the first characteristic value of the first attribute and the second characteristic value of the first attribute, and add a preset small constant to obtain a molecular characteristic value; The ratio of the numerator eigenvalue to the denominator eigenvalue is calculated and set as the first attribute similarity.
8. An ambroxol hydrochloride liquid filling detection system, characterized in that: include: The image acquisition module to be inspected is used for, when the filling of the ambroxol hydrochloride liquid is completed, clamping the filling bottle to the front of the black background plate by the mechanical arm, controlling the light source to collect the first image to be inspected based on the first preset lighting parameter, and clamping the filling bottle to the front of the white background plate by the mechanical arm, controlling the light source to collect the second image to be inspected based on the second preset lighting parameter; A first coded image acquisition module, the first coded image acquisition module is used to process the first preset illumination parameter through a first image encoder to obtain a first coded image; A second coded image acquisition module, the second coded image acquisition module is used to process the second preset illumination parameter through a second image encoder to obtain a second coded image; A first analysis identifier acquisition module, the first analysis identifier acquisition module is used to perform deviation analysis on the first image to be inspected based on the first coded image through a first image analyzer to obtain a first analysis identifier; A second analysis identification acquisition module, the second analysis identification acquisition module is used to perform deviation analysis on the second image to be inspected based on the second coded image through a second image analyzer to obtain a second analysis identification; The abnormal identification generation module is used to generate an abnormal identification of ambroxol hydrochloride liquid filling when the first analysis identification and / or the second analysis identification are different identifications, and send it to the user end.
Citation Information
Cited By
Image-enhanced overload protector key component defect detection method and system
CN120931638A