Next Article in Journal
Lightweight U-Net for Blood Vessels Segmentation in X-Ray Coronary Angiography
Previous Article in Journal
Evaluating Super-Resolution Models in Biomedical Imaging: Applications and Performance in Segmentation and Classification
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Inspection of Defective Glass Bottle Mouths Using Machine Learning

Setagaya Campas, Tokyo City University, Tokyo 158-8557, Japan
*
Author to whom correspondence should be addressed.
J. Imaging 2025, 11(4), 105; https://doi.org/10.3390/jimaging11040105
Submission received: 5 March 2025 / Revised: 27 March 2025 / Accepted: 28 March 2025 / Published: 29 March 2025
(This article belongs to the Section Image and Video Processing)

Abstract

:
In this study, we proposed a method for detecting chips in the mouth of glass bottles using machine learning. In recent years, Japanese cosmetic glass bottles have gained attention for their advancements in manufacturing technology and eco-friendliness through the use of recycled glass, leading to an increase in the volume of glass bottle exports overseas. Although cosmetic bottles are subject to strict quality inspections from the standpoint of safety, the complicated shape of the glass bottle mouths makes automated inspections difficult, and visual inspections have been the norm. Visual inspections conducted by workers have become problematic because it has become clear that the standard of judgment differs from worker to worker and that inspection accuracy deteriorates after long hours of work. To address these issues, the development of inspection systems for glass bottles using image processing and machine learning has been actively pursued. While conventional image processing methods can detect chips in glass bottles, the target glass bottles are those without screw threads, and the light from the light source is diffusely reflected by the screw threads in the glass bottles in this study, resulting in a loss of accuracy. Additionally, machine learning-based inspection methods are generally limited to the body and bottom of the bottle, excluding the mouth from analysis. To overcome these challenges, this study proposed a method to extract only the screw thread regions from the bottle image, using a dedicated machine learning model, and perform defect detection. To evaluate the effectiveness of the proposed approach, accuracy was assessed by training models using images of both the entire mouth and just the screw threads. Experimental results showed that the accuracy of the model trained using the image of the entire mouth was 98.0%, while the accuracy of the model trained using the image of the screw threads was 99.7%, indicating that the proposed method improves the accuracy by 1.7%. In a demonstration experiment using data obtained at a factory, the accuracy of the model trained using images of the entire mouth was 99.7%, whereas the accuracy of the model trained using images of screw threads was 100%, indicating that the proposed system can be used to detect chips in factories.

1. Introduction

In recent years, Japanese cosmetic glass bottles have garnered significant attention due to advancements in manufacturing technology and their eco-friendly attributes, particularly through the use of recycled glass [1]. Consequently, the export volume of these glass bottles has been increasing [2].
Cosmetic glass bottles are considered high-end products and are therefore subjected to stringent quality inspections. Notably, their necks are often designed with screw threads for capping, and the complexity of these structures frequently results in manufacturing defects. Moreover, previous studies have actively focused on detecting chipping at the top and body of glass bottles; however, chipping in the threaded section has not been extensively investigated [3,4]. Figure 1 illustrates the nomenclature of each part of the glass bottle, their respective positions, and an image depicting chipping that occurs in the threaded region.
In visual inspections, where defective products are assessed by human operators, judgment criteria may vary among individuals. Furthermore, a study by Hida et al. demonstrated that sustained attention declines during prolonged inspection tasks, leading to a 5–10% reduction in inspection accuracy after just five consecutive trials [5]. This calls for the development of inspection equipment that uses image processing to improve productivity. This paper proposes a method for acquiring screw threads at the mouth of glass bottles and a machine learning-based approach for detecting chips using these screw threads. The proposed method is expected to enhance productivity in manufacturing environments.

2. Related Work

In glass bottle manufacturing plants that operate on a mass-production scale, there is a critical need for inspection equipment capable of conducting highly accurate, non-destructive, and non-contact assessments throughout the production process. Typically, camera-based inspection systems integrated along the conveyor line are the standard approach in such facilities. The following is a list of related studies.

2.1. General Image Processing Methods [3,6,7]

In a study by Huimin Ma et al., a 360-degree inspection of a bottle’s sides and an examination of its top surface were conducted using six cameras for the sides and two cameras for the top surface [3]. For chip detection, the captured image is first converted to grayscale, followed by dynamic correction of luminance values. This correction is performed by comparing the average luminance value of the pixel of interest with that of neighboring pixels. If the pixel of interest has a higher luminance value than the average, it is replaced with the smallest luminance value in the neighborhood, as it may indicate a missing region. Subsequently, luminance values are adjusted by computing the difference between the corrected pixel and its original value, extracting only areas with a high likelihood of missing pixels. The extracted image is then binarized to detect chips. However, since this method was designed for beverage bottles without screw threads, it cannot be applied to glass bottles with screw threads due to variations in light reflection properties. Consequently, this approach is unsuitable for the glass bottles examined in this study.
A patented technique for glass bottle inspection process is the use of a ring-shaped inspection gate [6]. In this method, a camera and a dome-shaped light source are installed on top of the glass bottle to take pictures. By shooting from directly above the glass bottle, the top surface of the bottle and the upper part of the screw threads appear as a ring in the shot image. The photographed image is then searched for areas that exceed an arbitrary shade difference, and these areas are detected as chips or scratches. With this method, the top surface and the upper part of the screw thread can be inspected normally because the image is taken from the top. However, if chips exist in the lower part of the screw thread or in the second round of the screw thread, the chips cannot be detected.
The authors proposed a method for detecting chipping on a 180-degree thread on the half face of a bottle using an infrared surface light source and three infrared cameras [7]. This method was shown to be able to inspect a screw thread area of 180 degrees on the half face of the bottle with an accuracy of approximately 99%. However, there are problems with this method: the chipping threshold is determined based on known chipping, so it cannot handle unknown chipping, and the parameters for determining the inspection area are set in detail, so it is difficult to apply the method to other types of bottles.

2.2. Classification Tasks Using Machine Learning [4,8,9]

Over recent years, significant research has been conducted on inspection systems utilizing machine learning, driven by advancements in GPU precision.
Image classification tasks using machine learning include sorting fruit types [8] and detecting defects in cast parts [9].
In a study related to glass bottles inspection, M.A.E. Latina et al. have conducted a study on defect detection in empty glass bottles based on deep learning with CNN using the MobileNetV2 model [4]. This method leverages machine learning to detect various defects, ranging from large scratches to small chips and stains, on the sides and bottoms of empty bottles. As a result, defective bottles can be identified with a high accuracy of 98%. In addition, this approach utilizes two Raspberry Pi devices for integration into an industrial application and employs the lightweight MobileNetV2 model. However, the inspection is limited to the bottle’s body and bottom, as shown in Figure 2, and is not applicable to the mouth, which features a more complex geometry.

3. Proposed Method

This study proposes an inspection method capable of detecting chips in the mouths of glass bottles with complex shapes. An infrared camera and an infrared backlight are utilized for image acquisition. The captured images are then processed and used as a dataset for a machine learning model, which classifies them into two categories: “chipped” and “not chipped.” The main objective of this study is to detect cracks and chips of about 5 mm that occur on threads as “chips”. An image showing examples of chips that occur is shown in Figure 3.

3.1. Capturing Bottle Images

The method previously used by the authors is used for filming [7]. The glass bottles used in this study are transparent, so when the glass bottles are photographed through an infrared surface light source, light penetrates the smooth surface of the glass bottles without chips as shown in Figure 4 and the image appears white. However, if there are chips or scratches on the glass surface, the light is diffusely reflected on the surface, making the area appear darker. This property is used to detect chips and scratches. In addition, a cut filter is used to shield the light from ambient light. By shading ambient light, inspections can be performed without being affected by lighting in the factory or inspection area.

3.2. Configuration of the Proposed System

Figure 5 illustrates the proposed system for this study. First, an infrared camera captures images of glass bottles as they move along a conveyor. The screw thread regions are extracted from the captured images and used to train the model, with separate datasets for training and testing. The accuracy of the model is then evaluated based on the test data.

3.3. Image Preprocessing

As a pre-processing step, an image of only the screw threads is acquired from the captured image. Figure 6 shows the acquisition flow. Image preprocessing was conducted to obtain parallel screw thread images. This process included acquiring thread coordinates, generating mask images, and performing labeling, utilizing methods previously developed by the authors [7].

3.3.1. Detection of the Screw Thread Endpoints [7]

To extract the screw threads, the endpoints of the glass bottle were identified. Figure 7a illustrates the search process from the left side. The pixel with the lowest luminance value corresponding to the bottle’s contour was retained, and based on its coordinate information, the leftmost point and the second leftmost point were acquired as the endpoints of the screw threads. The top and bottom boundaries of the screw threads were determined by scanning a few additional pixels above and below these retained points, as shown in Figure 7b.
In the figure, the magenta and cyan dots represent the outline coordinates of the scanned glass bottle, the black dots indicate the retained coordinates of the screw thread endpoints, and the dark blue and green dots denote the top and bottom boundaries of the screw threads identified through this process. The blue arrows in A in the figure show the scanning and the arrows in B show the search area.

3.3.2. Mask Generation and Screw Thread Range Detection [7]

If there are threads at both ends based on the obtained contour information, the thread range can be obtained, as shown by the solid line. However, if the screw threads are lost in the middle (upper example in Figure 8), the coordinate information on one side is available but not the other side, so the range of the screw threads cannot be accurately obtained as shown by the dotted line.
Therefore, a mask image, as shown in Figure 9, was generated to accurately define the extent of the screw threads. The mask image was designed with sufficient thickness to fully cover the top and bottom of the threads, and the thread region was identified by detecting continuous shadow areas present above and below the screw threads. The slope of the mask image was determined based on the inclination of the threads.

3.3.3. Screw Thread Range Detection Using Labeling [7]

The OpenCV “Connected Components With Stats” function [10,11] is used to obtain the extent of missing threads by detecting continuous regions of shadow. The process is shown in Figure 10. The area shown in red in the figure indicates the contiguous area from the left, and the area shown in green indicates the contiguous area from the right.
The label information obtained was then used to generate a mask image that matched the extent of the threads. Figure 11 shows the generated mask image and the composite image.

3.3.4. Rotation Correction

Based on the coordinate values obtained by the labeling process, trimming is performed to create a screw thread image. As shown in Figure 12, a parallel thread image is obtained by performing rotation correction based on the tilt of the image created.

3.4. Model Selection

In the field of image processing, convolutional neural networks (CNNs) have garnered significant attention due to their high accuracy and economic potential. Common CNN architectures used in image processing and classification include AlexNet [12], VGG16 [13], InceptionV3 [14], ResNet [15], and MobileNetV2 [16].
Convolutional computation plays a crucial role in computer vision tasks. However, due to the deep and complex structure of most networks, processing time and computational costs tend to increase. MobileNetV2, on the other hand, mitigates these challenges by employing an inverse residual structure and a linear bottleneck design, thereby reducing convolutional computation. Additionally, previous studies have demonstrated that MobileNetV2 is memory-efficient and achieves superior accuracy compared to other models [8,9]. Table 1 shows the accuracy of each model presented in previous studies [8].
Based on these advantages, MobileNetV2 architecture was adopted in this study. As hyperparameters, the learning rate was set to 0.00001, the batch size to 16, and the number of epochs to 500; categorical cross-entropy was used as the loss function, and Adam was employed as the optimization method. To avoid over-training the model, an early stopping strategy of 20 epochs was introduced during training. This strategy monitors the performance of the model during training and stops training when signs of overtraining are detected. Figure 13 shows the structure of the training model and Table 2 and Table 3 show the details of the hyperparameters used.

Data Argumentation

The number of chipped glass bottles used in this study was small, approximately 40. Since this amount of data may not be sufficient to train a CNN, data augmentation was used to generate a final image with a resolution of 500 × 50 pixels. The data augmentation techniques applied to the dataset are listed in Table 4.
Regarding flipping, this study generates training images for both the entire glass bottle mouth and the screw thread region. Therefore, only left-to-right mirroring was applied to the full mouth image, as vertical inversion could potentially distort the inherent characteristics of the glass bottle. Additionally, even with left-to-right inversion, as shown in Figure 11, a pattern where the screw thread terminates at the midpoint appears at both endpoints. Hence, this transformation is not expected to impact on the learning process.
Regarding rotation, small-angle rotations were applied to preserve the essential characteristics of the glass bottle, particularly when considering the analysis of the entire mouth image.

4. Experiments

Two experiments were conducted to demonstrate the effectiveness of this study. In Experiment 1, we confirmed the inspection accuracy of the training model by using the screw thread image dataset, which was extracted from the image of the glass bottle mouth. For comparison, we also confirmed the inspection accuracy of the training model by using the entire mouth image for training. In Experiment 2, we conducted a demonstration experiment to check the inspection accuracy of images taken at an actual factory. The inspection accuracy was evaluated using the indices of fit rate, reproducibility, F value, and correct response rate.

4.1. Experimental Environment

Bottle images were acquired using an experimental environment previously created by the authors [7]. Figure 14 illustrates the experimental environment and the glass bottles used in the study. Table 5 lists the components and their specifications for the experimental setup. In addition, Figure 15 provides a detailed diagram of the camera arrangement. The central camera was positioned 14 cm from the glass bottle, while the left and right cameras were angled at 30° and spaced 13 cm from the glass bottle.

4.2. Taking Bottle Images

In the factory, glass bottles flowing on a conveyor belt are placed by a machine. In the recreated environment, the bottles were placed manually on the conveyor and photographed. The bottles that are swept onto the conveyor look like Figure 16 on the camera. Bottles flowing on the conveyor are photographed with respect to two markers (indicated by red circles) and cut out. In this example, the center camera is shown, which takes two images, one on each side of the figure. We believe that the position of the marker can be changed accordingly when a different type of glass bottle is used, but this study was not conducted with any different types of glass bottles.

4.3. Experiment 1

In this experiment, half of the chipped surface was rotated by 180° in 30° increments, and 7 × 4 images were captured and used as training data. A total of 99 bottles (70 defect-free and 29 defective) were prepared for training, while 40 bottles (30 defect-free and 10 defective) were used for validation. The total number of images captured was 938 for defect-free bottles (640 for training and 298 for validation) and 932 for defective bottles (668 for training and 244 for validation). The data were padded as described in Section 3.4 and expanded tenfold for each original image. A training model was developed using both the screw thread and entire mouth images to assess the inspection accuracy. The number of training and test data images is presented for each experiment; however, only the training data images were utilized for model training, with 80% allocated for training and 20% for validation. Thus, no test data were used in the training process.

4.3.1. Screw Thread Image Learning Experiment 1

Among the 932 defective images, 328 screw threads with chips were identified in the training set and 141 in the validation set. The bottle images used for training is shown in Figure 17, and summarizing the number of images are shown in Table 6.

4.3.2. Experimental Results (Screw Thread)

Accuracy was evaluated using 621 validation images against the model trained on the acquired screw thread images. Table 7 shows the confusion matrix of the detection results.

4.3.3. Mouth Image Learning Experiment 1

For comparison, images of the entire mouth were utilized for training to assess inspection accuracy. The number of defective images obtained was 942. The number of good images was matched to the number of defective images, and the number of images for verification was 298 good and 244 defective images, respectively. The bottle images used for training is shown in Figure 18, and summarizing the number of images are shown in Table 8.

4.3.4. Experimental Results 1 (Mouth of the Bottle Image)

Accuracy was evaluated using 542 validation images against a model trained on images of the entire mouth. Table 9 shows the confusion matrix of the detection results.

4.3.5. Comparison of Experimental Results 1

Table 10 summarizes the inspection accuracy using the entire mouth and the screw threads only.

4.3.6. Discussion of Experimental Results 1

Experimental results indicated that the model trained on images of screw threads achieved a detection accuracy of 99.7%, surpassing the 98.0% accuracy of the model trained on images of the entire mouth. In manufacturing, it is crucial to prevent defective products from being misclassified as acceptable. Regarding the recall of defective products, the model trained on thread images achieved a recall of 98.6%, whereas the model trained on entire mouth images had a recall of 95.5%, demonstrating an improvement of approximately 3.1%. Figure 19 illustrates an example of a defective product misclassified as non-defective when evaluated using the entire mouth image yet correctly identified as defective with the screw thread image. This case suggests that false positives are more likely when chips overlap with the glass bottle’s shadow and that limiting the analysis to the screw thread region accentuates the relative area of chipping, thereby improving detection accuracy.
The proposed method was shown to be effective because the model using only screw thread images improved the correctness rate by 1.7% compared to the model in which the entire mouth was trained.

4.3.7. Comparison with Previous Studies

To validate the effectiveness of the proposed method, the results were compared with those of prior studies. The studies referenced for comparison include a glass bottle scratch inspection method using image processing [3,7] and a glass bottle scratch inspection method utilizing machine learning [4]. Table 11 provides a summary of the evaluation of these previous studies and the inspections conducted in this study.
The conventional study utilizing image processing required different threshold values to determine chipping for each bottle. When the threshold was optimized, the inspection accuracy reached 98% in the conventional study [3] (left side of the table) and 99.0% in the conventional study [7] (right side of the table). In comparison, the proposed method eliminates the need to set a threshold for defective bottles, achieving an inspection accuracy of 99.7%, thus demonstrating superior accuracy and confirming the effectiveness of the proposed method.
For the conventional study based on patented technology, the accuracy of the test is not publicly available [6]. However, the proposed method addresses the limitation of not being able to detect screw threads in the second and subsequent rounds, proving its effectiveness.
The conventional study which employed machine learning did not include the mouth area in the inspection scope [4]. The proposed method, however, has been shown to inspect the mouth region with the same level of accuracy as in the conventional study.

4.4. Experiment 2

Building on the results of Experiment 1, an experiment was conducted to validate the feasibility of inspecting images captured on a factory production line. In this experiment, a subset of new factory images was combined with the dataset from Experiment 1, and the model was retrained. The learned model was then used to verify the inspection accuracy of the factory images.

4.4.1. Production Line Demonstration of Screw Thread Image

The factory was able to obtain a larger number of sample bottles (300) for good products due to production, but 13 sample bottles were used for defective products, yielding 33 images. Of these 33 images, 16 were incorporated into the Experiment 1 data set for training, along with 60 good images. The trained model was then used to validate the data captured at the factory. Figure 20 provides images taken at the factory and added to the data set. Table 12 provides the details of the image data obtained at the factory prior to integration, while Table 13 presents the details of the actual data sets used.

4.4.2. Experimental Results 2 (Screw Thread)

The accuracy of the model trained on the acquired screw thread images was evaluated using 1682 images for validation. Table 14 shows the confusion matrix of the detection results.

4.4.3. Mouth Image Production Line Demonstration Test

For comparison, the factory-obtained data were also integrated and used to train the model on images of the entire mouth area to assess its accuracy. Figure 21 provides images taken at the factory and added to the data set. Table 15 outlines the details of the factory-obtained image data prior to integration, while Table 16 presents the details of the actual dataset utilized.

4.4.4. Experimental Results 2 (Mouth of the Bottle Image)

Accuracy was tested against a model trained on images of the entire mouth area, evaluating 1174 images for validation. The confusion matrix of detection results is shown in Table 17.

4.4.5. Comparison of Experimental Results 2

Table 18 summarizes the inspection accuracy using the entire mouth and the threads only.

4.4.6. Discussion of Experimental Results 2

The experimental results demonstrated that the model trained on screw thread images produced no false positives or negatives for either good or defective products, achieving a 100% accuracy rate. In contrast, the model trained on entire mouth images detected three false positives for good products, resulting in an accuracy rate of 99.7%. These findings confirm the effectiveness of the proposed method, as it improves accuracy by 0.3% compared to the full-mouth image approach. In the entire mouth image analysis, defect precision was 85.0%, the lowest recorded metric, partly due to the limited number of defective bottles tested. To improve accuracy, we plan to increase the number of test images of defective bottles in future experiments. Furthermore, the results indicate that the proposed system is suitable for detecting chipping in screw threads within a factory line.

4.5. About the Number of Sheets in the Data Set

In Experiment 1 of this study, 100 good bottles and 39 defective bottles were used, resulting in 640 good and 668 defective bottle images. Through data augmentation, the dataset was expanded to approximately 14,000 images for training. The inspection accuracy was high, achieving 99.7%.
In Experiment 2, an additional 319 good and 176 defective bottle images obtained from the factory were incorporated. The inspection accuracy remained at 99.7% when validated using factory-acquired images; however, the precision for defective bottles was relatively low at 85%, likely due to the limited number of defective bottle images available.
In both experiments, the training model utilizing only the screw threaded section demonstrated a significant improvement in accuracy compared to the model trained on the entire mouth, despite having a smaller training dataset. This suggests that restricting the inspection area to the threaded section can enhance inspection accuracy, even with a limited number of training images.
For future research, we plan to conduct further experiments in the factory to collect a larger dataset of bottle images and enhance inspection accuracy.

5. Conclusions

In this study, we proposed a method for detecting chips in the mouth of glass bottles using machine learning. In recent years, Japanese glass bottles for cosmetics have been attracting attention from the perspective of environmental friendliness due to improved manufacturing technology and the use of recycled glass, and the amount of glass bottles exported overseas has been increasing. Although glass bottles for cosmetics are required to undergo strict quality inspections from a safety perspective, the complicated shape of the glass bottle mouth makes automated inspections difficult, and visual inspections have been the norm. Manual visual inspection by workers presents challenges due to inconsistencies in judgment criteria among individuals and a decline in inspection accuracy over extended working hours. To address these issues, glass bottle inspection systems utilizing image processing and machine learning have been actively developed in recent years. Conventional image processing-based inspection methods can detect chips in glass bottles; however, they are limited to bottles without screw threads. In the glass bottles examined in this study, light from the illumination source undergoes diffuse reflection due to the presence of screw threads, leading to reduced detection accuracy. Additionally, in machine learning-based inspection methods, the evaluation is typically restricted to the body and bottom of the bottle, excluding the mouth area from analysis. To overcome these limitations, this study proposes a method that extracts screw thread regions from bottle images, develops a machine learning model, and performs defect detection based on the extracted features.
To evaluate the effectiveness of the proposed method, its accuracy was assessed by training models using images of the entire mouth and screw threads separately. The experimental results showed that the model trained on entire mouth images achieved an accuracy of 98.0%, whereas the model trained on screw thread images achieved an accuracy of 99.7%, indicating a 1.7% improvement in accuracy with the proposed method. In an experiment using factory-acquired data, the model trained on entire mouth images achieved 99.7% accuracy, while the model trained on screw thread images achieved 100%, confirming the feasibility of the proposed system for detecting chips in a factory setting. We have shown that this method can be used to detect defects in glass bottles with consistently high accuracy, regardless of human concentration.

6. Future Plans

In this experiment, the imaging and inspection systems operated independently because the accuracy was verified only for the images captured. In the future, we would like to integrate imaging and inspection systems, increase the number of defective samples to improve inspection accuracy, and expand the data set by generating defective bottles using GAN. In addition, we aim to handle various cases of the same type of bottles with chips on the opposite side, as well as to study the possibility of inspecting various types of glass bottles.

Author Contributions

The individual contributions were investigation, methodology, validation, software, writing (first draft preparation, revision, and editing): D.T. Supervision, project administration, writing (editing): Y.B. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The raw data supporting the conclusions of this article will be made available by the authors on request.

Acknowledgments

We thank Koa Glass Co., Ltd. for providing the glass bottles used in the experiment and Nakajima of the Technical Department for his cooperation with the experiment.

Conflicts of Interest

The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results.

References

  1. Japan Glass Bottle Association. Returnable Bottle. Available online: https://glassbottle.org/ecology/returnable/ (accessed on 27 September 2024).
  2. Japan Cosmetic Industry Association. Cosmetics Statistics. Available online: https://www.jcia.org/user/statistics/trade (accessed on 27 September 2024).
  3. Ma, H.M.; Su, G.D.; Wang, J.Y.; Ni, Z. A glass bottle defect detection system without touching. In Proceedings of the Proceedings. International Conference on Machine Learning and Cybernetics, Beijing, China, 4–5 November 2002; Volume 2, pp. 628–632. [Google Scholar] [CrossRef]
  4. Latina, M.A.; John Van Russel, R.; Santos, F.D. Empty Glass Bottle Defect Detection Based on Deep Learning with CNN Using SSD MobileNetV2 Model. In Proceedings of the 2022 IEEE 14th International Conference on Humanoid, Nanotechnology, Information Technology, Communication and Control, Environment, and Management (HNICEM), Boracay Island, Philippines, 1–4 December 2022; pp. 1–6. [Google Scholar]
  5. Hida, T.; Chihara, T.; Seo, A. Effect of object handling on accuracy of visual inspection. Proc. Annu. Conf. Jpn. Ergon. Soc. 2012, 48, 454–455. [Google Scholar]
  6. Harada, T.; Suzuki, G. Container Mouth Inspection Method and Device. Patent No. 4986255, 8 August 2011. [Google Scholar]
  7. Tomita, D.; Bao, Y. Detection of Chips on the Threaded Part of Cosmetic Glass Bottles. J. Imaging 2025, 11, 77. [Google Scholar] [CrossRef] [PubMed]
  8. Gulzar, Y. Fruit Image Classification Model Based on MobileNetV2 with Deep Transfer Learning Technique. Sustainability 2023, 15, 1906. [Google Scholar] [CrossRef]
  9. Sambandam, S.G.; Purushothaman, R.; Baig, R.U.; Javed, S.; Hoang, V.T.; Tran-Trung, K. Intelligent surface defect detection for submersible pump impeller using MobileNet V2 architecture. Int. J. Adv. Manuf. Technol. 2023, 124, 3519–3532. [Google Scholar] [CrossRef]
  10. OpenCV. Structural Analysis and Shape Descriptors. Available online: https://docs.opencv.org/3.4/d3/dc0/group__imgproc__shape.html (accessed on 27 September 2024).
  11. FBolelli, F.; Allegretti, S.; Baraldi, L.; Grana, C. Spaghetti Labeling: Directed Acyclic Graphs for Block-Based Connected Components Labeling. IEEE Trans. Image Process. 2020, 29, 1999–2012. [Google Scholar] [CrossRef]
  12. Krizhevsky, A.; Sutskever, I.; Hinton, G.E. Imagenet Classification with Deep Convolutional Neural Networks. Adv. Neural Inf. Process. Syst. 2012, 25, 84–90. [Google Scholar]
  13. Simonyan, K.; Zisserman, A. Very Deep Convolutional Networks for Large-Scale Image Recognition. arXiv 2014, arXiv:1409.1556. [Google Scholar]
  14. Szegedy, C.; Vanhoucke, V.; Ioffe, S.; Shlens, J.; Wojna, Z. Rethinking the Inception Architecture for Computer Vision. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, 27–30 June 2016; pp. 2818–2826. [Google Scholar]
  15. He, K.; Zhang, X.; Ren, S.; Sun, J. Deep Residual Learning for Image Recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, 27–30 June 2016; pp. 770–778. [Google Scholar]
  16. Sandler, M.; Howard, A.; Zhu, M.; Zhmoginov, A.; Chen, L.C. Mobilenetv2: Inverted Residuals and Linear Bottlenecks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–22 June 2018; pp. 4510–4520. [Google Scholar]
Figure 1. Parts of a glass bottle and an example of the chipping focused on in this study.
Figure 1. Parts of a glass bottle and an example of the chipping focused on in this study.
Jimaging 11 00105 g001
Figure 2. Scope of inspection in conventional research (inspection of bottle bottom (a) and bottle body (b)).
Figure 2. Scope of inspection in conventional research (inspection of bottle bottom (a) and bottle body (b)).
Jimaging 11 00105 g002
Figure 3. Examples of deficiencies covered in this study (Chips are present on the threads of all bottles).
Figure 3. Examples of deficiencies covered in this study (Chips are present on the threads of all bottles).
Jimaging 11 00105 g003
Figure 4. Overview of glass bottle photography. (If there are no chips, light passes through intact (a). When there are chips, light reflects diffusely through the chips, resulting in a dark reflection (b)) [7].
Figure 4. Overview of glass bottle photography. (If there are no chips, light passes through intact (a). When there are chips, light reflects diffusely through the chips, resulting in a dark reflection (b)) [7].
Jimaging 11 00105 g004
Figure 5. Configuration of the proposed system.
Figure 5. Configuration of the proposed system.
Jimaging 11 00105 g005
Figure 6. Pre-processing flowchart.
Figure 6. Pre-processing flowchart.
Jimaging 11 00105 g006
Figure 7. Process to search both ends of the screw threads. (A process that searches both ends (a) and a process that further searches the screw thread region (b)) [7].
Figure 7. Process to search both ends of the screw threads. (A process that searches both ends (a) and a process that further searches the screw thread region (b)) [7].
Jimaging 11 00105 g007
Figure 8. Screw thread range depicted when both endpoints are successfully identified (solid line) [7].
Figure 8. Screw thread range depicted when both endpoints are successfully identified (solid line) [7].
Jimaging 11 00105 g008
Figure 9. Generated mask image (a) and the resulting composite image (b) [7].
Figure 9. Generated mask image (a) and the resulting composite image (b) [7].
Jimaging 11 00105 g009
Figure 10. Labeling process using Connected Components with Stats (binarized image (a), labeled image (b), composite image (c)) [7].
Figure 10. Labeling process using Connected Components with Stats (binarized image (a), labeled image (b), composite image (c)) [7].
Jimaging 11 00105 g010
Figure 11. Generated mask and synthesized images. Label image (a), mask image (b), composite image (c) [7].
Figure 11. Generated mask and synthesized images. Label image (a), mask image (b), composite image (c) [7].
Jimaging 11 00105 g011
Figure 12. Rotation correction. Composite image of original image and label image (a), cropped image (b), image with rotation correction (c).
Figure 12. Rotation correction. Composite image of original image and label image (a), cropped image (b), image with rotation correction (c).
Jimaging 11 00105 g012
Figure 13. Composition of the learning model.
Figure 13. Composition of the learning model.
Jimaging 11 00105 g013
Figure 14. Experimental environment. Experimental setup (a) and glass bottle used in the study (b).
Figure 14. Experimental environment. Experimental setup (a) and glass bottle used in the study (b).
Jimaging 11 00105 g014
Figure 15. Schematic drawing of the experimental environment [7].
Figure 15. Schematic drawing of the experimental environment [7].
Jimaging 11 00105 g015
Figure 16. How to take bottle images (taken when a glass bottle is placed in the marker area indicated by the red circle) [7].
Figure 16. How to take bottle images (taken when a glass bottle is placed in the marker area indicated by the red circle) [7].
Jimaging 11 00105 g016
Figure 17. Image used for screw thread learning experiment 1 (good image (a), chipped image (b)).
Figure 17. Image used for screw thread learning experiment 1 (good image (a), chipped image (b)).
Jimaging 11 00105 g017
Figure 18. Mouth image used for experiment 1 (good image (a), chipped image (b)).
Figure 18. Mouth image used for experiment 1 (good image (a), chipped image (b)).
Jimaging 11 00105 g018
Figure 19. Example of false detection at the entire mouth (a) and correct determination at the screw threads (b).
Figure 19. Example of false detection at the entire mouth (a) and correct determination at the screw threads (b).
Jimaging 11 00105 g019
Figure 20. Image used for screw thread learning experiment 2 (good image (a), chipped image (b)).
Figure 20. Image used for screw thread learning experiment 2 (good image (a), chipped image (b)).
Jimaging 11 00105 g020
Figure 21. Mouth image used for experiment 2 (good image (a), chipped image (b)).
Figure 21. Mouth image used for experiment 2 (good image (a), chipped image (b)).
Jimaging 11 00105 g021
Table 1. Accuracy of each model in fruit classification [8].
Table 1. Accuracy of each model in fruit classification [8].
ModelsPrecisionRecallF1-Score
AlexNet0.810.790.83
VGG160.790.800.80
Inception V30.840.820.81
ResNet0.820.810.82
MobileNetV20.890.910.89
Table 2. Finetuned hyperparameters (* epoch may vary due to early stopping).
Table 2. Finetuned hyperparameters (* epoch may vary due to early stopping).
ParametersValue
Epochs500 *
OptimizerAdam
Learning rate0.00001
Batch size16
Table 3. Details on early stopping.
Table 3. Details on early stopping.
ParametersValue
Monitoring metricValidation Loss
Patience20
Initiation epoch100
Table 4. Data augmentation techniques used in the system.
Table 4. Data augmentation techniques used in the system.
Data Augmentation ModeChanges
Random flippingRandomly flips the image horizontally.
Random rotationRotates the image between −3° and 3° so that the features of the glass bottle are not lost.
GrayscaleGrayscales the image and reduces the number of features.
FilteringApplies a bilateral filter to the image to remove noise.
Change color spaceChanges the color space.
ContrastChanges the brightness of the image.
Table 5. Equipment used in the experiment.
Table 5. Equipment used in the experiment.
Component PartsSpecification
CameraManufacturerBaumer, Frauenfeld,
Switerland
Model numberVCXU-32M
Resolution 2048 × 1536
LensManufacturerVS TECHNOLOGY,
Tokyo, Japan
Model numberVS-1218VM
FilterManufacturerZOMEI, Shenzhen, China
Model numberZOMEI IR850
Infrared backlightManufacturerLeimac, Siga, Japan
Model numberIFD-300/200IR-850
Light source power supplyManufacturerLeimac, Siga, Japan
Model numberIWDV-300S-24
Table 6. Detail of image of glass bottle screw threads used in experiment 1.
Table 6. Detail of image of glass bottle screw threads used in experiment 1.
Images for TrainingImages for Verification
superior article3520480
defective product3608141
total (number)7128621
Table 7. Confusion matrix of experimental results 1 (screw thread image).
Table 7. Confusion matrix of experimental results 1 (screw thread image).
PredictionSuperior ArticleDefective Product
Correct
Superior article4800
Defective product2139
Table 8. Details of the image of the mouth of the glass bottle used in experiment 1.
Table 8. Details of the image of the mouth of the glass bottle used in experiment 1.
Images for TrainingImages for Verification
superior article7040298
defective product7348244
total (number)14,388542
Table 9. Confusion matrix of experimental results 1 (mouth of the bottle image).
Table 9. Confusion matrix of experimental results 1 (mouth of the bottle image).
PredictionSuperior ArticleDefective Product
Correct
Superior article2980
Defective product11233
Table 10. Evaluation of results 1 (screw threads image and mouth of the bottle image).
Table 10. Evaluation of results 1 (screw threads image and mouth of the bottle image).
Screw Thread ImageMouth Image
Superior articlePrecision99.6%96.4%
Recall100%100%
F1 Score99.8%98.2%
Defective productPrecision100%100%
Recall98.6%95.5%
F1 Score99.3%97.7%
Detection accuracy99.7%98.0%
Table 11. Comparison with previous studies (* previous research [4] does not distinguish between good and bad products in the inspection confusion matrix).
Table 11. Comparison with previous studies (* previous research [4] does not distinguish between good and bad products in the inspection confusion matrix).
Previous Research
(Image Processing) [3,7]
Previous Research *
(Machine Learning) [4]
Proposed MethodEntire Mouth Image
Superior
article
Precision98.0%98.0%98.8%99.6%96.4%
Recall98.0%100%99.3%100%100%
F1 Score98.0%99.0%99.0%99.8%98.2%
Defective
product
Precision98.0%100%-100%100%
Recall98.0%98.0%-98.6%95.5%
F1 Score98.0%99.0%-99.3%97.7%
Detection accuracy98.0%99.0%98.199.7%98.0%
Table 12. Detail of image of glass bottle screw threads used in experiment 2 (images taken at the factory).
Table 12. Detail of image of glass bottle screw threads used in experiment 2 (images taken at the factory).
Images for Learning (Factory Shooting)Images for Verification
superior article3191665
defective product17617
total (number)4951682
Table 13. Detail of image of glass bottle screw threads used in experiment 2 (dataset from Experiment 1 combined with images taken at the factory).
Table 13. Detail of image of glass bottle screw threads used in experiment 2 (dataset from Experiment 1 combined with images taken at the factory).
Images for Learning
superior article3839
defective product3784
total (number)7623
Table 14. Confusion matrix of experimental results (screw thread image).
Table 14. Confusion matrix of experimental results (screw thread image).
PredictionSuperior ArticleDefective Product
Correct
Superior article16650
Defective product017
Table 15. Details of the image of the mouth of the glass bottle used in experiment 2 (images taken at the factory).
Table 15. Details of the image of the mouth of the glass bottle used in experiment 2 (images taken at the factory).
Images for Learning (Factory Shooting)Images for Verification
superior article6601157
defective product17617
total (number)8361174
Table 16. Details of the image of the mouth of the glass bottle used in experiment 2 (dataset from Experiment 1 combined with images taken at the factory).
Table 16. Details of the image of the mouth of the glass bottle used in experiment 2 (dataset from Experiment 1 combined with images taken at the factory).
Images for Learning
superior article7700
defective product7524
total (number)15,224
Table 17. Confusion matrix of experimental results (mouth of the bottle image).
Table 17. Confusion matrix of experimental results (mouth of the bottle image).
PredictionSuperior ArticleDefective Product
Correct
Superior article11543
Defective product017
Table 18. Evaluation of results 2 (screw threads image and mouth of the bottle image).
Table 18. Evaluation of results 2 (screw threads image and mouth of the bottle image).
Screw Thread ImageMouth Image
Superior articlePrecision100%100%
Recall100%99.7%
F1 Score100%99.8%
Defective productPrecision100%85.0%
Recall100%100%
F1 Score100%91.9%
Detection accuracy100%99.7%
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Tomita, D.; Bao, Y. Inspection of Defective Glass Bottle Mouths Using Machine Learning. J. Imaging 2025, 11, 105. https://doi.org/10.3390/jimaging11040105

AMA Style

Tomita D, Bao Y. Inspection of Defective Glass Bottle Mouths Using Machine Learning. Journal of Imaging. 2025; 11(4):105. https://doi.org/10.3390/jimaging11040105

Chicago/Turabian Style

Tomita, Daiki, and Yue Bao. 2025. "Inspection of Defective Glass Bottle Mouths Using Machine Learning" Journal of Imaging 11, no. 4: 105. https://doi.org/10.3390/jimaging11040105

APA Style

Tomita, D., & Bao, Y. (2025). Inspection of Defective Glass Bottle Mouths Using Machine Learning. Journal of Imaging, 11(4), 105. https://doi.org/10.3390/jimaging11040105

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop