Convolutional neural network-based glass bottle bottom hollow mold number identification method
By employing multi-stage image preprocessing and a lightweight convolutional neural network model, combined with industrial interactive design, the problem of high-precision real-time identification of hollow mold numbers at the bottom of glass bottles was solved, enabling efficient tracing and automatic rejection of faulty molds, and improving the intelligence and quality control capabilities of the production line.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-24
- Publication Date
- 2026-03-10
AI Technical Summary
Existing technologies are insufficient for accurately, reliably, and in real-time identifying the hollow mold number at the bottom of transparent glass bottles in industrial settings. This makes it difficult to effectively trace and remove defective mold products, resulting in a high rate of defective products and impacting production efficiency and quality stability.
Employing a multi-stage image preprocessing strategy including polarization correction, edge enhancement, and morphological closure, combined with a lightweight convolutional neural network model, it achieves refined identification of hollow mold numbers. Furthermore, through industrial interactive design and linkage with a programmable logic controller, it enables real-time identification and automatic alarm or shutdown mechanisms.
It improves the accuracy and stability of mold number recognition, meets the real-time detection requirements of high-speed production lines, lowers the threshold for use, enhances the intelligence and quality control level of production lines, and significantly reduces the defect rate.
Smart Images

Figure CN121640489A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of industrial product quality detection and intelligent manufacturing, and is applied to the production process of glass bottles, and particularly relates to a glass bottle bottom hollow mold number recognition method based on a convolutional neural network. BACKGROUND
[0002] In the large-scale industrial production process of glass bottles, product quality control is highly dependent on the state management of the mold. Each glass bottle bottom is usually pressed with a uniquely identified mold number, which is presented in a hollow font form, and the material is consistent with the bottle body, which is transparent glass. When the mold is worn, cracked or deformed due to long-term use, it often causes repetitive defects in the same batch of products. Therefore, accurately identifying the hollow mold number on the bottle bottom is of great significance for tracing the source of the problem, timely removing the faulty mold, and preventing the production of batch unqualified products.
[0003] Current technical means for glass bottle mold number recognition face many challenges in actual application. Since the hollow font itself is a transparent structure, the gray difference between it and the bottle bottom background is extremely weak, and it is difficult to form a clear contrast under normal imaging conditions. At the same time, factors such as uneven lighting, strong bottle body reflection and dust interference are common in industrial sites, further exacerbating the complexity of image acquisition. Traditional image processing methods based on fixed threshold segmentation or edge detection perform poorly in such low-contrast, high-noise scenarios, often leading to broken font outlines, missing features, and difficulty in stable extraction of effective information, making the recognition reliability difficult to meet production needs.
[0004] In recent years, although some research attempts to introduce deep learning models for industrial character recognition, there are still obvious limitations in this specific scenario of glass bottle hollow mold number. Some general convolutional neural network structures have large parameter quantities and high computational complexity, making it difficult to respond to the recognition needs of high-speed pipelines in real time. More importantly, existing models generally do not optimize the "edge surrounding hollow" structure specific to hollow fonts, and lack effective modeling of font wear, local occlusion, strong reflection and other degradation scenarios in actual working conditions, resulting in insufficient model generalization ability and poor robustness.
[0005] In addition, the prior art focuses on the implementation of a single identification function, and has not yet built a complete technical chain covering data preprocessing, model training, real-time inference, and human-computer interaction. There is a lack of fine image enhancement and feature extraction strategies for hollow transparent characters, as well as operation interfaces and system integration capabilities that adapt to industrial sites. It is difficult for operators to conveniently configure parameters, view recognition results, or trace historical records, increasing the use threshold. Most systems fail to effectively link with programmable logic controllers (PLCs) and other devices on the production line, and cannot automatically trigger an alarm or shutdown mechanism after identifying an anomaly, causing faulty molds to continue running and resulting in high rates of defective products, which seriously affects overall production efficiency and product quality stability. SUMMARY
[0006] The present application aims to solve the problem that the prior art cannot accurately, in real time, and reliably identify hollow mold numbers on the bottom of transparent glass bottles in industrial sites, and cannot effectively trace and eliminate faulty mold products. Therefore, a glass bottle bottom hollow mold number recognition method based on a convolutional neural network is proposed. The present application realizes high-precision, real-time, and industrial hollow mold number recognition through fine image processing for hollow transparent fonts, lightweight model training, special code implementation, and industrial interaction design. It is suitable for glass bottle production quality control in the food and pharmaceutical industries and has wide application value.
[0007] The present application achieves the purpose by adopting the following technical solutions: A glass bottle bottom hollow mold number recognition method based on a convolutional neural network, comprising the following steps: S1. Collecting training glass bottle bottom images through an industrial camera, and obtaining training data after preprocessing and data optimization enhancement; S2. Selecting a basic model and improving its model structure, and initializing the model after structure improvement through pre-training weights; S3. Training the initialized model using the training data, and obtaining a hollow mold number recognition model after training. The hollow mold number recognition model is processed to be lightweight, and the corresponding lightweight model is obtained; S4. Deploying the lightweight model to a glass bottle production line. The lightweight model receives actual glass bottle bottom images from the glass bottle production line, outputs recognition results after inference, and pushes them to the interactive linkage end of the glass bottle production line; S5. The interactive linkage end presents the actual glass bottle bottom image, recognition results, and corresponding statistical data in a visual manner, and triggers the linkage of industrial equipment in the glass bottle production line according to the recognition results.
[0008] Preferably, in step S1, after batch reading the training glass bottle bottom images collected by the industrial camera, the images are stored in categories according to the corresponding hollow mold numbers; and the image legality is verified by calculating the image definition before batch reading.
[0009] Preferably, in step S1, the preprocessing process includes Gaussian denoising, polarized light correction, grayscale, hollow font edge enhancement, adaptive binarization and morphological closing operation on the training glass bottle bottom images; wherein the polarized light correction eliminates the diffuse reflection of the glass bottle by collecting images of different polarization angles of the same glass bottle bottom and fusing them, and improves the gray difference of the hollow font in the image; the hollow font edge enhancement enhances the inner and outer edges of the hollow font by using the Laplacian operator; and the morphological closing operation is used to fill the broken edges of the hollow font to ensure the continuity of the outline.
[0010] Preferably, in step S1, when performing data optimization and enhancement processing, the preprocessed training glass bottle bottom images are divided according to a preset proportion to generate a training set and a test set; the data enhancement operations on the training set and the test set both include random rotation, horizontal flip, illumination disturbance, Gaussian noise and local wear simulation; wherein the random rotation is used to simulate the deviation of the glass bottle bottom in the glass bottle production line; the horizontal flip is used to simulate the deviation of the installation direction of the industrial camera; the illumination disturbance is used to simulate the illumination fluctuation of the glass bottle production line during the day / night; the Gaussian noise is used to simulate the sensor noise interference of the industrial camera; and the local wear simulation is used to simulate the font wear caused by mold aging by randomly shielding a preset percentage area of the font edge of the hollow mold number.
[0011] Further, in step S2, the basic model selects a ResNet18 model which adopts a standard convolution and a residual connection structure; when improving the model structure, the original old fully connected layer of the ResNet18 model is removed and replaced by the following two new fully connected layers: The first new fully connected layer has a preset number of neurons and uniformly uses a ReLU activation function, and its output is transmitted to the second new fully connected layer; The output dimension number of the second new fully connected layer is equal to the number of mold number categories corresponding to the training glass bottle bottom image, and uniformly uses a Softmax activation function; the mold number category corresponding to the training glass bottle bottom image corresponds to the production mold category actually used in the glass bottle production line.
[0012] Preferably, after loading the pre-trained weights, a preset percentage of the feature extraction layers in the front of the improved ResNet18 model is frozen, so that only the remaining unfrozen feature extraction layers and the two new fully connected layers are trained in the subsequent model training.
[0013] Specifically, in step S3, the training parameters including batch size and training rounds are pre-configured before training; during training, cross-entropy loss is used as the loss function, and the weight decay is realized by the optimizer to suppress overfitting; the cosine annealing scheduling is used for learning rate scheduling, so that the learning rate gradually decays during the training process; the recognition accuracy is calculated on the pre-divided test set every time a training round is completed, and when the recognition accuracy of a continuous preset number of training rounds reaches the preset percentage threshold, the training process is stopped; the model parameters corresponding to the highest recognition accuracy are saved, that is, the trained hollow mold number recognition model is obtained, and is used as the basis for lightweight processing.
[0014] Preferably, the hollow mold number recognition model is subjected to lightweight processing, including channel pruning, pruning fine-tuning and model compression; the channel pruning is performed on the convolution and residual connection structure of the hollow mold number recognition model, the L1 norm of each channel is calculated and sorted, and the channel whose L1 norm is less than the average value of the convolution structure by a preset percentage is removed; the pruning fine-tuning loads the hollow mold number recognition model after channel pruning, uses a preset percentage of samples in the original training data for fine-tuning training, and configures a separate learning rate and training rounds; the model compression first converts the hollow mold number recognition model after pruning fine-tuning into ONNX format, and then uses TensorRT quantization for compression operation to obtain the corresponding lightweight model.
[0015] Specifically, in step S4, the industrial camera real-time collects the glass bottle bottom image in the glass bottle production line, performs the same preprocessing operation as in step S1, locates and extracts the font outline of the hollow mold number in the image, and inputs it into the deployed lightweight model; the lightweight model calculates the Softmax probability output, takes the class with the maximum Softmax probability as the corresponding mold number recognition result, and pushes it to the interactive linkage end of the glass bottle production line.
[0016] Preferably, in step S5, the interactive linkage end is pre-configured with a dynamically updated fault list and a rejection delay; when the mold number of the recognition result received by the interactive linkage end exists in the fault list, the interactive linkage end sends a rejection instruction and a corresponding rejection delay to the PLC unit of the glass bottle production line, and the PLC unit controls the industrial equipment to reject the glass bottle corresponding to the mold number of the recognition result.
[0017] In summary, due to the adoption of the technical solution, the present application has the following advantages: The present application improves the accuracy and stability of mold number recognition by targeting the special imaging characteristics of the hollow transparent font at the bottom of the glass bottle. The multi-stage image preprocessing strategy of polarized light correction, edge enhancement and morphological closure effectively enhances the structural features of the low-contrast hollow characters, combined with the feature extraction ability of the lightweight convolutional neural network, greatly improves the recognition failure problem caused by the contour breakage of the traditional method.
[0018] The model of the present application is small in size and fast in reasoning speed after lightweight design, and can be directly deployed on industrial edge computing devices without relying on cloud resources, fully meeting the stringent requirements of real-time detection of high-speed pipeline, and avoiding the delay risk caused by network transmission. At the same time, the present application as a whole covers three functions of model training, real-time recognition and man-machine interaction, realizes the whole process closed loop from data preparation to production linkage, and is convenient for later maintenance and function expansion.
[0019] The present application is also deeply integrated into the industrial application scene, supports seamless docking with programmable logic controllers of production lines, and can automatically trigger alarms or pause stations when identifying abnormal mold numbers, effectively blocking the circulation of defective products. Through log recording and statistical analysis, quality can be traced and process can be optimized. By introducing multi-dimensional data enhancement strategies simulating real working conditions, the model has strong robustness to interference factors such as light changes, font wear and environmental noise. With the intuitive and friendly visual operation interface, ordinary production line workers can easily complete parameter configuration and result viewing, significantly reducing the use threshold. The overall scheme not only guarantees high recognition accuracy, but also effectively improves the intelligentization and quality control level of glass bottle production. BRIEF DESCRIPTION OF DRAWINGS
[0020] The embodiments and technical solutions of the present application are further described in detail by the following drawings, specifically including two drawings, as follows: Figure 1 The overall flowchart of the hollow mold number recognition method of the present application is briefly shown in the figure; Figure 2 The improved structure diagram of the basic model in the method of the present application is shown in the figure. DETAILED DESCRIPTION
[0021] In order to make the purpose, technical scheme and advantages of the embodiments of the present application more clear, the technical scheme in the embodiments of the present application will be described clearly and completely below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.
[0022] Therefore, the following detailed description of embodiments of the application provided in the accompanying drawings is not intended to limit the scope of the application claimed, but merely represents selected embodiments of the application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor are within the scope of protection of the present application.
[0023] A glass bottle bottom hollow mold number recognition method based on a convolutional neural network, Figure 1 The overall flow of the method is shown, which can be referred to simultaneously, and the key steps of the method can be summarized as follows: S1, collect the training glass bottle bottom images by an industrial camera, and obtain the training data after preprocessing and data optimization enhancement; S2, select a basic model and improve the model structure, and initialize the model after structure improvement by pre-training weight; S3, train the initialized model using the training data, and obtain the hollow mold number recognition model after training; perform lightweight processing on the hollow mold number recognition model, and obtain the corresponding lightweight model; S4, deploy the lightweight model to the glass bottle production line, the lightweight model receives the actual glass bottle bottom image input in the glass bottle production line, outputs the recognition result after inference, and pushes it to the interactive linkage end of the glass bottle production line; S5, the interactive linkage end presents the actual glass bottle bottom image, the recognition result and the corresponding statistical data in a visual way, and triggers the linkage of the industrial equipment of the glass bottle production line according to the recognition result.
[0024] The present embodiment will introduce the details and preferred contents of each step in the above step sequence.
[0025] Firstly, in step S1, after batch reading the training glass bottle bottom images collected by the industrial camera, the images are classified and stored according to the corresponding hollow mold numbers. When batch reading, the image legality is verified by calculating the image definition in advance. When calculating, the condition of variance ≥ 300 is selected to exclude blurred and overexposed images, so as to ensure the quality of input data.
[0026] As a preferred step S1, the preprocessing process includes Gaussian denoising, polarized light correction, grayscale, hollow font edge enhancement, adaptive binaryzation and morphological closing operation on the training glass bottle bottom images.
[0027] In this embodiment, to improve the recognition accuracy of hollow lettering on the bottom of glass bottles, a series of preprocessing operations are performed on the acquired original images. First, Gaussian smoothing is applied to the images to effectively suppress dust interference and local light spot noise common in industrial environments, preventing such noise from obscuring the true edge information of the hollow lettering. Next, a polarization fusion strategy is employed, weighted and fused images of the same bottle bottom acquired under two orthogonal polarization directions. This significantly reduces diffuse reflection interference from the transparent glass surface, enhances the grayscale difference between the hollow lettering area and the background, and achieves a level of clear contrast.
[0028] The fused color image is converted to grayscale. This process uses weighted calculations based on the human eye's sensitivity to different color channels to preserve the contrast features of the hollow font edges to the greatest extent possible. To further highlight the structural characteristics of the hollow font, an edge enhancement filter is introduced. A convolution kernel containing the Laplacian operator is used to sharpen the image, enhancing the boundary response of the inner and outer contours of the hollow characters and mitigating the edge blurring or loss caused by the similar grayscale levels of the hollow font structure and the background.
[0029] An adaptive thresholding method is employed for image binarization. This method dynamically sets the segmentation threshold based on the average grayscale value of the local neighborhood of the image. This allows for flexible handling of uneven lighting on the bottle bottom surface, preventing character breakage due to excessively high thresholds in bright light areas and avoiding misjudgment of the background due to excessively low thresholds in dim light areas, thus ensuring the integrity of the overall structure of the hollow font. Finally, morphological closure operations are performed on the binarized result, using structuring elements to fill in minor breaks or gaps at the edges of the characters, especially repairing pixel loss caused by wear on the bottle bottom, ensuring the continuous closure of the hollow font's outline, providing a foundation for subsequent feature extraction and recognition.
[0030] In step S1 of this embodiment, when performing data optimization and enhancement processing, the preprocessed training glass bottle bottom images are divided in an 8:2 ratio to generate corresponding training and test sets; at the same time, it is ensured that the number of samples for each mold number is consistent in the training and test sets to avoid sample bias that could cause the model to favor the majority class.
[0031] Data augmentation operations performed on both the training and test sets included random rotation, horizontal flipping, illumination perturbation, Gaussian noise, and localized wear simulation. Random rotation was used to simulate the angular deviation of the glass bottle bottom on the glass bottle production line; horizontal flipping was used to simulate the deviation of the industrial camera's installation orientation; illumination perturbation was used to simulate daytime / nighttime illumination fluctuations on the glass bottle production line; Gaussian noise was used to simulate sensor noise interference from the industrial camera; and localized wear simulation was used to simulate font wear caused by mold aging by randomly obscuring 5% to 10% of the font edge of the hollow mold number.
[0032] After data augmentation, the number of samples in the dataset is greatly expanded, which improves the robustness of the model to industrial disturbances during training.
[0033] In step S2 of this embodiment, the base model is the ResNet18 model, which adopts a standard convolutional and residual connection structure. This structure is designed around residual connections and takes into account the advantages of lightweight, easy training, and strong generalization ability. It can reduce parameters while ensuring accuracy and is suitable for industrial edge devices such as embedded computers.
[0034] like Figure 2 As shown, when improving the model structure, the original fully connected layers of the ResNet18 model are removed and replaced with the following two new fully connected layers: The first new fully connected layer has 512 neurons and uses the ReLU activation function uniformly. Its output is passed to the second new fully connected layer. The number of output dimensions of the second fully connected layer is equal to the number of mold number categories corresponding to the bottom images of the glass bottles used for training, and both layers use the Softmax activation function. The mold number categories corresponding to the bottom images of the glass bottles used for training correspond to the actual production mold categories used in the glass bottle production line.
[0035] This implementation improves upon the original ResNet18 model by considering the actual application environment of glass bottle production. Due to the strict limitations on inspection speed and equipment cost in the production line, a lightweight network with standard convolutional and residual connection structures is selected as the backbone. This significantly reduces computational complexity while retaining the effective extraction capability of key visual features of the bottle bottom. The fully connected layers of the original model are designed for large-scale general classification tasks, but their output dimensions do not match the mold number recognition task targeted by this implementation, and therefore are removed.
[0036] The newly introduced first fully connected layer constructs a high-dimensional intermediate feature space, which helps to integrate multi-dimensional discrimination information such as the shape, arrangement, and local texture of the hollow font in the bottle bottom image, and enhances the model's expressive power through ReLU nonlinear activation. The second fully connected layer directly maps to the set of mold categories used in actual production, and its output, after Softmax normalization, can clearly indicate the mold number to which the input image belongs. The entire network structure achieves high-accuracy identification of hollow mold numbers while maintaining a small parameter scale, meeting the requirements of embedded deployment and real-time inference.
[0037] As a preferred embodiment of this method, after loading the pre-trained weights, the first 80% of the feature extraction layers of the improved ResNet18 model are frozen. This allows subsequent model training to focus on the remaining 20% of the unfrozen feature extraction layers and two new fully connected layers, accelerating training convergence. This approach efficiently utilizes the general visual features learned by the ResNet18 model on large-scale image data when used as a pre-trained model, and then adapts it to the hollow mold number recognition task targeted by this embodiment. Since the front-end network of the improved ResNet18 model is mainly responsible for extracting low- to mid-level general image features, including edges, textures, and local structures, these features have strong commonalities between natural images and industrial bottle bottom images. Therefore, freezing them after loading the pre-trained weights avoids overfitting or feature degradation caused by excessive parameter tuning on small-scale specialized datasets.
[0038] By fine-tuning only the last 20% of the feature extraction layers closest to the output and the two newly added fully connected layers, the model's deep semantic perception capability for key details such as hollow fonts is preserved. Simultaneously, the number of parameters requiring optimization is significantly reduced, training computational costs are substantially lowered, model convergence speed is accelerated, and generalization performance under limited labeled sample conditions is improved. This approach thus balances the effectiveness of transfer learning with the efficiency requirements of model iteration in industrial scenarios, facilitating rapid model deployment.
[0039] In step S3 of this embodiment, training parameters including batch size and training epochs are pre-configured before training. In this embodiment, the batch size is set to 32, which is compatible with industrial computers with 16GB of memory, and the upper limit of the training epochs is 50. During training, the cross-entropy loss function is selected as the training objective function because it is naturally suitable for multi-class classification tasks and can effectively measure the difference between the predicted probability distribution and the true label. To address the problem of uneven distribution of mold number categories, this embodiment introduces a category weight mechanism in the cross-entropy loss. For mold number categories with fewer samples, the system automatically assigns a higher loss weight, making the model pay more attention to the learning of a few categories during training, thereby alleviating the recognition bias caused by data skew and improving the fairness and accuracy of the overall recognition.
[0040] To suppress overfitting, this implementation uses an optimizer to achieve weight decay. By applying L2 regularization constraints to the model parameters, the growth of parameter amplitudes is limited, prompting the model to learn more generalized feature representations. Considering the limited sample size and significant environmental interference in industrial scenarios, this measure helps improve the model's robustness and stability on unknown data.
[0041] In this implementation, cosine annealing is used to schedule the learning rate, allowing it to smoothly and gradually decrease from its initial value to near zero. Compared to fixed learning rates or step-wise decay, this non-linear decay strategy provides finer control over the optimization process, maintaining a faster convergence speed in the early stages of training and fine-tuning with a smaller learning rate in later stages. This helps the model escape local minima and converge to a better solution. After each training epoch, the system evaluates the model's recognition accuracy on a pre-defined test set independent of the training set. This test set contains representative samples of various mold numbers to objectively reflect the model's generalization ability. When the test recognition accuracy reaches or exceeds 98% for three consecutive training epochs, the system determines that the model has sufficiently converged and terminates training. This early stopping mechanism not only effectively prevents overfitting but also significantly saves computational resources and time costs.
[0042] Finally, the system selects and saves the model parameters corresponding to the training round with the highest test recognition accuracy. This model is the final training result of the hollow mold number recognition model, possessing high accuracy and good generalization ability. This model will serve as the basis for subsequent lightweight processing and will be deployed to resource-constrained edge devices or embedded systems to meet the practical needs of industrial sites for real-time performance, low power consumption, and high reliability.
[0043] As a preferred embodiment of this method, the hollow mold number recognition model is subjected to lightweight processing, including channel pruning, fine-tuning after pruning, and model compression.
[0044] Channel pruning, a key aspect of lightweight processing, aims to identify and remove redundant channels that contribute little to the model output, thereby reducing computational load and parameter size without significantly degrading model performance. This implementation specifically targets the convolutional and residual connection structures widely used in hollow mold number recognition models. While this structure already possesses low computational complexity, its importance can be quantified by further analyzing the L1 norm of each channel—the sum of the absolute values of the channel weights. Channels with smaller L1 norms typically correspond to weaker feature responses and have limited impact on the final classification decision. Therefore, this implementation sets a threshold of 30% of the average L1 norm of all channels in the convolutional layer. Channels below this threshold are systematically pruned, effectively compressing the model size while maintaining recognition accuracy.
[0045] While the pruned model has a more compact structure, the removal of some channels may disrupt the original parameter distribution and feature representation capabilities, leading to a temporary performance decrease. Therefore, this implementation introduces a post-pruning fine-tuning mechanism. The pruned model is loaded, and short-term retraining is performed using 10% to 20% of representative samples from the original training dataset. This fine-tuning process employs an independently configured learning rate, typically lower than the initial training phase, and involves only about 5 to 10 training epochs. The aim is to restore or even improve model accuracy with minimal computational overhead, while avoiding the resource waste caused by full retraining. The data used for fine-tuning retains the original category distribution, ensuring a balanced recovery of the recognition capabilities for various mold numbers.
[0046] After completing structural optimization and parameter fine-tuning, this implementation further improves deployment efficiency through model compression technology. First, the fine-tuned model is converted to ONNX (Open Neural Network Exchange) format, which has good cross-platform compatibility, facilitates subsequent toolchain processing, and provides a standardized interface for industrial deployment. Then, the ONNX model is processed using the quantization compression scheme provided by TensorRT. The method performs INT8 quantization, converting the original 32-bit floating-point parameters into 8-bit integer representations. This significantly reduces memory usage and computational bandwidth requirements while preserving key numerical accuracy through TensorRT's calibration mechanism. The resulting lightweight model not only has a significantly reduced size but also a markedly improved inference speed, enabling efficient operation on industrial edge devices equipped with GPUs or dedicated AI accelerators, meeting the stringent requirements of production lines for real-time recognition and low-latency response.
[0047] In step S4 of this embodiment, an industrial camera acquires real-time images of the bottom of glass bottles on the glass bottle production line. After performing the same preprocessing operation as in step S1, the font outline of the hollow mold number in the image is located and extracted, and then input into the deployed lightweight model. The lightweight model calculates the output Softmax probability, and the category with the highest Softmax probability is taken as the corresponding mold number recognition result, which is then pushed to the interactive linkage terminal of the glass bottle production line.
[0048] In this embodiment, an industrial camera continuously captures images of the bottom of bottles transported on the glass bottle production line at a high frame rate, ensuring comprehensive monitoring of every bottle. The captured images then undergo a preprocessing procedure consistent with step S1. The preprocessed images are sent to a mold number region contour positioning module to extract the font contour region of the hollow mold number, effectively eliminating interference from other structures on the bottle bottom. Subsequently, the cropped mold number region image is input into a lightweight model deployed on an edge computing device for inference.
[0049] After receiving the input image, the lightweight model calculates the Softmax probability distribution for each mold number category through forward propagation. The Softmax function converts the original logits into normalized probability values, making it easier to intuitively measure the model's confidence in each category. The system selects the category with the highest probability value as the final recognition result and pushes it along with the confidence information to the interactive linkage terminal of the glass bottle production line. This design not only ensures the interpretability of the recognition results but also provides a basis for subsequent anomaly detection; for example, a manual review mechanism can be triggered when the highest probability is significantly lower than a threshold.
[0050] In this embodiment, the industrial camera model can be Basler acA1920-155um. The pypylon library is used for camera initialization, setting acquisition parameters including exposure time, gain, and frame rate. After acquiring image frames in real time, they are converted to OpenCV format for subsequent processing. When locating and extracting the font outline of the hollow mold number in the image, only the outermost outline is retained, excluding the smaller outlines inside the hollow font. Then, the area of each outline is calculated, retaining the outline corresponding to the size of the hollow mold number pixels on the bottom of the bottle. Next, region cropping and normalization are performed. The minimum bounding rectangle of the outline is calculated, and the region is cropped and scaled to meet the input requirements of the lightweight model.
[0051] The lightweight model disables gradient calculation during inference to accelerate inference. If the hardware terminal where the lightweight model is deployed supports a GPU, the model and data can be moved to the GPU, significantly reducing the inference time per frame. For the recognition results, Socket TCP communication is used with JSON data format, which is then pushed to the interactive linkage terminal of the glass bottle production line.
[0052] In this embodiment, the lightweight model can record relevant input and output data and equipment information from the glass bottle production line as a local log during inference. Each log entry can include a timestamp, cumulative count, identification mold number, confidence level, equipment status, etc., which facilitates subsequent traceability.
[0053] In step S5 of this embodiment, the image display area of the interactive linkage terminal can use a PictureBox control to refresh the corresponding transmitted bottle bottom image in real time and overlay the recognized mold number text; the data statistics area can use a Label control to display the cumulative number of recognitions, the number of successful recognitions, the success rate, etc.
[0054] As a preferred embodiment, in step S5, the interactive linkage terminal is pre-configured with a dynamically updated fault list. This list is maintained in real time by the production management system based on historical quality data, mold wear reports, or quality inspection feedback. The fault list records the mold numbers currently known to have defect risks, such as molds that may cause bottle bottom defects due to cracks, deformation, or poor cleaning. Simultaneously, a corresponding rejection delay parameter is configured for each type of faulty mold or the entire production line. This parameter reflects the transmission time and distance relationship from the image acquisition position to the physical rejection device, ensuring that the rejection action is precisely synchronized with the target glass bottle in space and time.
[0055] When the mold number received by the interactive linkage terminal matches any item in the fault list from the identification results, a control command containing the mold number identifier and the corresponding rejection delay is immediately generated and sent to the PLC unit on the production line via an industrial communication protocol. The PLC unit performs timing or position tracking based on the rejection delay parameter, triggering an action at the precise moment the target glass bottle reaches the rejection actuator, such as a pneumatic pusher or robotic arm, separating it from the normal flow path to the waste channel. The entire process achieves closed-loop control from visual recognition to physical response, effectively preventing glass bottles produced by defective molds from flowing into subsequent processes or leaving the factory, significantly improving product quality consistency and production automation levels.
Claims
1. A method for recognizing a hollow mold number of a glass bottle bottom based on a convolutional neural network, characterized in that, The method comprises the following steps: S1, collecting glass bottle bottom images for training by an industrial camera, and obtaining training data after pre-processing and data optimization enhancement; S2, selecting a basic model and improving the model structure, and initializing the model after structure improvement by pre-training weights; S3, training the initialized model using the training data, and obtaining a hollow mold number recognition model after training; Lightweight processing is performed on the hollow mold number recognition model to obtain a corresponding lightweight model; S4, deploying the lightweight model to a glass bottle production line, the lightweight model receiving actual glass bottle bottom images input from the glass bottle production line, outputting recognition results after inference, and pushing the recognition results to an interactive linkage end of the glass bottle production line; S5, the interactive linkage end presents the actual glass bottle bottom image, the recognition result and the corresponding statistical data in a visual manner, and triggers the linkage of the industrial equipment of the glass bottle production line according to the recognition result.
2. The glass bottle bottom hollow mold number identification method according to claim 1, characterized in that: In step S1, after batch reading of the glass bottle bottom images for training collected by the industrial camera, the images are stored in categories according to the corresponding hollow mold numbers; image legality verification is performed by calculating the image definition before batch reading.
3. The method of claim 1, wherein the method further comprises: determining the number of the glass bottle bottom hollow mold based on the number of the glass bottle bottom hollow mold. In step S1, the pre-processing process includes Gaussian denoising, polarized light correction, grayscale, hollow font edge enhancement, adaptive binarization and morphological closing operation of the glass bottle bottom images for training; wherein the polarized light correction eliminates the diffuse reflection light of the glass bottle by collecting different polarization angle images of the same glass bottle bottom and fusing them, and improves the gray difference of the hollow font in the image; the hollow font edge enhancement enhances the inner and outer edges of the hollow font by using the Laplacian operator; the morphological closing operation is used to fill the broken edges of the hollow font to ensure the continuity of the outline.
4. The glass bottle bottom hollow mold number identification method according to claim 1, characterized in that: In step S1, when performing data optimization enhancement processing, the pre-processed glass bottle bottom images for training are divided according to a preset proportion to generate a training set and a test set; the data enhancement operations on the training set and the test set both include random rotation, horizontal flip, illumination disturbance, Gaussian noise and local wear simulation; wherein the random rotation is used to simulate the deviation of the glass bottle bottom in the glass bottle production line; the horizontal flip is used to simulate the deviation of the installation direction of the industrial camera; the illumination disturbance is used to simulate the illumination fluctuation of the glass bottle production line during the day / night; the Gaussian noise is used to simulate the sensor noise interference of the industrial camera; the local wear simulation is used to simulate the font wear caused by mold aging by randomly shielding a preset percentage area of the font edge of the hollow mold number.
5. The glass bottle bottom hollow mold number identification method according to claim 1, characterized in that: In step S2, the basic model is selected as a ResNet18 model which adopts a standard convolution and residual connection structure; when the model structure is improved, the original old fully connected layer of the ResNet18 model is removed and replaced by the following two new fully connected layers: The first new fully connected layer has a preset number of neurons and uniformly uses a ReLU activation function, and its output is transmitted to the second new fully connected layer; The output dimension number of the second layer of new full connection layer is equal to the number of mold number categories corresponding to the training glass bottle bottom image, and a Softmax activation function is uniformly used; the mold number category corresponding to the training glass bottle bottom image corresponds to the production mold category actually used in the glass bottle production line.
6. The method of claim 5, wherein the method further comprises: After loading the pre-training weight, the improved ResNet18 model is frozen in the front part of the preset percentage of feature extraction layers, so that only the remaining un-frozen feature extraction layers and the two new full connection layers are trained in the subsequent model training.
7. The method of claim 1, wherein: In step S3, the training parameters including batch size and training rounds are pre-configured before training; the cross-entropy loss is used as the loss function during training, and the weight decay is realized through the optimizer to suppress overfitting; the cosine annealing scheduling is used for learning rate scheduling, so that the learning rate gradually decays during the training process; Every time a training round is completed, the recognition accuracy is calculated on the pre-divided test set, and when the recognition accuracy of a continuous preset number of training rounds reaches a preset percentage threshold, the training process is stopped. The model parameters corresponding to the highest recognition accuracy are saved, and the hollow mold number recognition model after training is obtained, which is used as the basis for lightweight processing.
8. The method of claim 7, wherein the method further comprises: determining the number of the glass bottle bottom hollow mold based on the number of the glass bottle bottom hollow mold. The hollow mold number recognition model is subjected to lightweight processing, including channel pruning, pruning fine-tuning and model compression; the channel pruning is performed on the convolution and residual connection structure of the hollow mold number recognition model, the L1 norm of each channel is calculated and sorted, and the channels with L1 norm less than the mean value of the convolution structure by a preset percentage are removed; The fine-tuning after pruning loads the hollow mold number recognition model after channel pruning, fine-tunes the model using a preset percentage of samples in the original training data, and configures a separate learning rate and training rounds; the model compression first converts the hollow mold number recognition model after fine-tuning to ONNX format, and then uses TensorRT quantization to compress the model to obtain the corresponding lightweight model.
9. The glass bottle bottom hollow mold number identification method according to claim 1, characterized in that: In step S4, the industrial camera real-time collects the glass bottle bottom image in the glass bottle production line, performs the same preprocessing operation as in step S1, locates and extracts the font outline of the hollow mold number in the image, and inputs it into the deployed lightweight model; the lightweight model calculates the output Softmax probability, takes the class with the maximum Softmax probability as the corresponding mold number recognition result, and pushes it to the interactive linkage end of the glass bottle production line.
10. The glass bottle bottom hollow mold number identification method according to claim 1, characterized in that: In step S5, the interactive linkage end is pre-configured with a dynamically updated fault list and a rejection delay; when the mold number of the recognition result received by the interactive linkage end exists in the fault list, the interactive linkage end sends a rejection instruction and the corresponding rejection delay to the PLC unit of the glass bottle production line, and the PLC unit controls the industrial equipment to reject the glass bottle corresponding to the mold number of the recognition result.