Abstract
This study presents a real-time edge-based inspection system for detecting subtle defects including black spot defects, discoloration, and short shots in transparent optical molded components. A multi-source imaging platform was established, and a full-factorial design was conducted to evaluate the effects of illumination wavelength, imaging mode, and cropping scale on defect visualization. Brightness equalization, gamma correction, and multi-scale cropping were applied to enhance feature visibility, while rotation, flipping, and brightness perturbation were used for data augmentation. A grid-search strategy optimized the YOLOv8 model across two optimizers, learning rates, and input resolutions, achieving an mAP50–95 exceeding 0.93 for all defect categories. The optimized model was deployed on an edge device integrated with a camera, controlled lighting, and a motorized linear stage, enabling automated, real-time inspection. Compared with manual inspection, the proposed system reduces inspection time from 36 to 3.5 s, an improvement of roughly 92%, while maintaining comparable accuracy. The results demonstrate that the strategic integration of multi-source imaging and targeted image preprocessing enables deep learning architectures to effectively overcome the inherent challenges of low contrast and high reflectance in transparent materials. The primary contribution of this study lies in the successful identification of extremely subtle defects, thereby providing a highly stable and practical edge-computing inspection framework for smart manufacturing environments.
Keywords
Introduction
Transparent optical molded components are widely used in sensing modules, 1 optoelectronic devices, and precision mechanical assemblies. To ensure their optical performance and structural integrity, highly reliable defect inspection is required during manufacturing. 2 However, the intrinsic properties of transparent materials—such as high refractive index, strong transmittance, and complex light-field interactions—often lead to defects that appear with low contrast, blurred edges, and diverse morphological patterns. These characteristics make it difficult for conventional imaging-based inspection methods to accurately identify defects. Furthermore, the surface quality of transparent optical molded components directly affects the performance of optical systems, including light uniformity, imaging clarity, and beam deviation. Therefore, effectively detecting subtle defects such as black spot defects, color divergence, and short shots3,4 in a fast, stable, and consistent manner has become a crucial challenge in optical manufacturing.
Traditional visual inspection relies heavily on manual examination, 5 which is labor-intensive and susceptible to fatigue, subjective judgment, and variations in environmental illumination, leading to inconsistent inspection outcomes. 6 In transparent-component production lines, defect signals are often weaker than background intensity fluctuations, further reducing the reliability of human inspection. With the advancement of smart manufacturing,7,8 deep learning has emerged as a promising solution for improving inspection accuracy and efficiency. 9 YOLO-based detectors are particularly popular due to their high computational efficiency and real-time inference capability. 9 In general, object detectors can be categorized into two-stage and one-stage frameworks.10,11 Two-stage detectors, such as Faster R-CNN, 12 first generate candidate regions and then perform classification and localization refinement, which often leads to strong localization capability but also increases computational latency and implementation complexity. In contrast, one-stage detectors perform classification and localization in a unified forward pass, providing higher inference throughput and better suitability for real-time deployment. In this study, real-time inspection is required to meet the production-line cycle time, and the final model must be deployable on an edge device with stable inference behavior. Therefore, a one-stage detector was prioritized. YOLOv8 was selected because it provides an effective balance between detection accuracy and computational efficiency and offers robust multi-scale feature representation that is advantageous for small, low-contrast defect patterns commonly observed in transparent optical components. Nevertheless, the imaging characteristics of transparent materials introduce additional challenges for deep neural networks, such as weak grayscale differences between defects and background, illumination halos caused by surface reflections, and disturbance from transmitted background textures. Without proper illumination design and image preprocessing, the model may suffer from insufficient gradients, unstable bounding boxes, and limited improvement in mAP during training.
Recent studies have increasingly focused on enhancing real-time defect inspection through lightweight 13 and attention-guided detection architectures. 14 For instance, Fast-YOLOv12 introduces an attention-enhanced lightweight structure to improve real-time performance in steel surface defect detection, 15 demonstrating that architectural simplification combined with feature-guided mechanisms can effectively balance accuracy and computational cost. Similarly, YOLO-WTB proposes an improved YOLO-based framework specifically designed for detecting small-scale damage in wind turbine blades from aerial imagery, highlighting the importance of multi-scale feature extraction and fine-grained defect representation for small-object detection tasks. 16 Beyond model-specific improvements, broader reviews on machine-learning-based defect monitoring have emphasized the growing role of AI in infrastructure and structural inspection systems, particularly in applications requiring automated and scalable monitoring solutions. In addition, classification-oriented approaches, such as Improved GoogLeNet-based crack detection methods, demonstrate that convolutional neural networks remain effective in identifying structural defect categories when defect types are predefined. 17 These studies collectively indicate that while architectural optimization plays a significant role in defect detection performance, imaging conditions, defect scale, and deployment constraints remain equally critical in industrial scenarios. In contrast to studies that primarily focus on modifying detection backbones 18 or introducing attention mechanisms, the present work emphasizes systematic control of illumination conditions, field-of-view scaling, and training hyperparameters under realistic manufacturing constraints. Rather than redesigning the network architecture, this study investigates how controllable industrial variables influence feature visibility and detection stability, and integrates the optimized configuration into an edge-based automated inspection system for transparent optical molded components.
Recent studies have attempted to develop deep-learning-based inspection pipelines for transparent objects. 5 However, issues such as difficulty in data collection, inconsistent imaging conditions, and complex annotation processes remain unsolved. Establishing an integrated system that ensures reliable optical imaging, consistent data quality, and high model performance is therefore an important concern for both industrial and academic communities. 19 Motivated by these challenges, this study conducts a systematic evaluation analysis and optimization of the imaging characteristics, light-source strategies, preprocessing methods, and deep learning model design for transparent optical molded component inspection, with the aim of constructing an automated inspection system deployable directly on production lines.
To address the difficulty of highlighting defects in transparent materials, 20 this work begins with an optical-mechanism analysis 21 comparing the penetration and scattering behaviors of white and red illumination, 22 followed by a systematic evaluation of image quality under various light-source conditions. Considering that transparent-component defects occupy only a small portion of the image and often exhibit blurred boundaries, several preprocessing techniques, including brightness normalization, 23 gamma correction, 24 region cropping, 25 and multi-source image fusion, 26 are implemented to enhance feature visibility for downstream learning. To ensure data quality and training consistency, we also establish classification rules and acquisition procedures for transparent-component images, and apply a full factorial design to investigate how illumination, image resolution, and cropping strategy affect model performance.
In terms of model architecture, YOLOv8 is adopted as the core detection framework, 9 and a hyperparameter grid search 27 (covering optimizers, learning rates, and input resolutions) is conducted to improve the model’s ability to identify small features and maintain stable convergence.28,29 Furthermore, the preprocessing pipeline, data augmentation strategies, loss formulation, and optimizer update rules are mathematically formalized to enhance reproducibility and engineering traceability. Experimental results demonstrate that the proposed system achieves high detection accuracy for black spot defect, color, and short-shot defects, while significantly improving inspection speed and stability, confirming its feasibility for real-world industrial applications.
The objective of this study is to overcome the physical and optical limitations inherent to transparent optical molded components—specifically, the low contrast, blurred boundaries, and reflection noise associated with subtle defects. The core of this research lies in the successful mechatronic integration of customized multi-wavelength illumination, targeted image preprocessing, and edge AI deployment. By systematically applying standard vision tools to effectively extract extremely weak defect signals, the proposed methodology provides a practical, highly scalable, and highly accurate system architecture for the quality inspection of optical components. The system serves as a valuable reference for future research and industrial implementation in transparent-material inspection. The remainder of this paper is organized as follows. Section “Experimental setup” introduces the inspection platform and dataset preparation. Section “Methodology” presents the algorithmic framework and experimental design, including preprocessing strategies and hyperparameter optimization. Section “Result and discussion” discusses experimental results and deployment validation on the edge-based inspection system. Finally, Section “Conclusion” concludes the study and outlines future research directions.
Experimental setup
Imaging acquisition system
To obtain high-quality images capable of revealing micron-scale defects, this study employed an industrial-grade color camera (acA2440-35uc, Basler Co., Ltd., Germany) paired with a fixed-focal-length lens (C23-2528-16M, f = 25 mm, Basler Co., Ltd., Germany). This configuration provides high sensitivity and low-distortion optical performance, ensuring that fine image details are preserved even under the highly transparent conditions typical of optical molded components. The camera incorporates a 16-megapixel sensor with a 2-μm pixel pitch, enabling the detection of defect features approximately 30–40 μm or larger, which is sufficient for identifying black spot defects, short-shot defects, and chromatic anomalies.
Image acquisition was managed uniformly through the Basler Pylon Viewer software, where parameters such as exposure time, gain, white balance, and color transformation were fixed for all samples. This ensured consistency across the dataset and minimized variations caused by environmental lighting or hardware fluctuations. During image capture, each transparent specimen was placed on a fixed sample holder and positioned directly beneath the optical axis of the camera using a precision linear stage. This setup guaranteed consistent viewing geometry, effectively reducing positional deviation, potential reflections, and geometric distortion.
A dual-illumination configuration consisting of red and white backlight sources was integrated within the backlight module to provide stable, uniform, and directional illumination. The broadband white-light source enhanced the visualization of chromatic defects, while the red-light source—characterized by stronger penetration and lower reflective noise—improved the visibility of dark defects such as black spot defects and particulate contaminants. This dual-light-field architecture ensured that defect characteristics under various optical conditions were clearly expressed, forming a reliable basis for subsequent preprocessing and defect detection processes.
Software specifications
All model training, algorithm development, and system integration in this study were conducted within a high-performance computing environment to ensure efficient processing of high-resolution images. The training platform was configured with the Windows 10 Professional (64-bit) operating system, equipped with an AMD Ryzen 9 9900X multi-core processor and an NVIDIA GeForce RTX 4070 SUPER GPU. The latter provides a large number of CUDA cores and high-bandwidth GDDR6X memory, enabling accelerated training of YOLOv8 models under input resolutions up to 1280 × 1280.
The deep learning framework was implemented using PyTorch 2.1.0 with Python 3.13 as the primary programming language. Model training, validation, and inference pipelines were built upon the Ultralytics YOLOv8 library, allowing rapid switching between hyperparameter configurations and facilitating systematic performance comparisons.
In addition, a graphical user interface (GUI) was developed using the PyQt5 framework, enabling seamless integration of camera control, linear-stage positioning, and defect inference within the edge computing platform. This software architecture not only provides high flexibility and modularity but also ensures that trained models can be directly deployed to edge devices with minimal modification. By maintaining consistency between the training environment and the deployment pipeline, the overall development cost is reduced while improving system stability and reliability.
Design of the inspection platform
This study develops an automated inspection platform specifically designed for transparent optical molded parts. As shown in Figure 1, the system is constructed on a rigid aluminum extrusion frame to ensure structural stability and precise component alignment. A motorized linear guide rail is installed beneath the imaging module to position each sample directly below the camera’s optical axis, ensuring repeatable imaging geometry while minimizing angular deviation, reflection artifacts, and perspective distortion.

Illustration of the inspection platform: (a) optical path configuration and (b) mechanical setup of the automated inspection system.
The lighting module adopts a backlight configuration (Figure 1(b)), consisting of a uniform illumination panel enclosed within a shielding structure to suppress ambient light interference. White light is used to reveal chromatic and discoloration-related defects, whereas red light provides enhanced penetration and reduced surface reflection noise, enabling clearer visualization of dark micro-defects such as black spot defects or embedded particles. The fixed industrial camera mounted above the platform maintains a constant focus and imaging distance, ensuring consistent brightness distribution and reducing spatial variability during repeated inspections.
To coordinate all electromechanical components, the system integrates an Arduino-based control module for switching light sources, triggering the industrial camera, and driving the linear guide rail. A Python-based control interface further synchronizes hardware operations with the YOLOv8 detection model, enabling automated image acquisition and immediate defect inference. This architecture allows the inspection task to proceed from sample placement, positioning, illumination, image capture, inference, and result output in a fully integrated sequence.
The complete configuration provides high mechanical rigidity, low vibration, and excellent reproducibility, making the platform suitable for high-throughput and real-time inspection of transparent optical parts. The stable integration of lighting, positioning, and imaging modules forms a reliable foundation for subsequent deep learning–based defect detection.
Methodology
The YOLOv8 architecture adopted in this study follows the standard backbone–neck–head configuration provided in the official implementation. The backbone extracts hierarchical features, the neck aggregates multi-scale representations, and the detection head performs bounding-box regression and classification. It should be emphasized that this work does not introduce structural modifications to the YOLOv8 architecture. Instead, the primary contribution of this study is the successful extraction and identification of extremely weak defect signals (e.g. subtle black spots and discolorations) from highly transparent, low-contrast optical molded components. This achievement is realized by systematically adapting standard, off-the-shelf deep learning tools and deeply integrating them with domain-specific optical imaging and preprocessing workflows. Therefore, a detailed architectural diagram is not reproduced here, as the adopted framework remains consistent with the publicly available YOLOv8 implementation.
Experimental workflow and system pipeline
The experimental workflow of this study consists of seven major stages: image acquisition, image preprocessing, data categorization, data augmentation, deep learning model training, hyperparameter optimization, and edge deployment. The overall structure is illustrated in Figure 2. Since transparent materials often suffer from uneven illumination and weak defect signals caused by high transmittance and irregular reflections, the workflow emphasizes maintaining consistent lighting conditions and stable image quality as its core principles.

Experimental workflow diagram.
In the image acquisition stage, an industrial camera equipped with switchable illumination sources is used. Fixed exposure, luminance, and imaging geometry are employed to ensure reproducible image capture. Given that transparent optical molded components are highly sensitive to the angle and wavelength of illumination, the experimental setup prioritizes establishing a stable optical field and a unified imaging environment, thereby minimizing the influence of lighting variations on subsequent image processing and defect identification. After acquisition, the preprocessing stage applies brightness equalization, color correction, and field-of-view adjustments to mitigate interference from backlight regions and localized reflections, while enhancing the luminance contrast of defect features. The resulting standardized images serve as the basis for subsequent classification-mode construction. Multiple imaging categories are then defined according to lighting conditions, rendering modes, and field-of-view types to assess how different imaging configurations influence defect visibility. These classification outcomes are detailed in later sections.
Following preprocessing, the workflow proceeds to data augmentation. Rotation, flipping, and brightness perturbation are applied to simulate potential imaging variations arising from diverse part orientations and lighting scenarios, enabling the model to learn defect representations with greater robustness and generalization capability. Since the visual appearance of defects in transparent optical molded components is highly sensitive to illumination, data augmentation plays a crucial role in enhancing the stability of defect recognition.
During the model training stage, the YOLOv8 architecture is employed. Training is conducted under different classification modes to compare how various imaging conditions influence feature learning. Detailed training configurations are presented in subsequent sections. After initial training, hyperparameter optimization is performed to systematically evaluate several training configurations for transparent-object defect detection and to determine the most suitable settings for this type of imagery. The search strategy and parameter definition are described later in the methodology.
Finally, the optimized model is deployed onto an edge computing device and integrated with camera control, illumination switching, and automated decision-making mechanisms to achieve real-time defect inspection. This stage ensures that the trained model not only performs well in offline experiments but also maintains reliability and operational efficiency in practical factory environments.
Image dataset construction and classification scheme
Transparent materials exhibit high transmittance, low reflectance, and strong sensitivity to backlight illumination during optical imaging. As a result, subtle defects typically manifest with extremely weak intensity contrast and blurred boundaries. Establishing an imaging dataset with reproducible and diverse illumination conditions is therefore essential for enabling deep-learning models to effectively learn the defect characteristics of transparent optical molded components. In this study, multiple imaging modes were constructed according to the optical variations produced under different light-source wavelengths and field-of-view conditions. The classification criteria follow the imaging configurations listed in Tables 1 and 2, which serve as the basis for subsequent model training and optical-behavior analysis.
Fixed parameter configuration for the full-factorial design.
Variable parameter configuration in the full-factorial design.
The image acquisition system comprises an industrial camera, a fixed-focal-length lens, and a dual-light-source illumination module. All images were captured under unified exposure, gain, and white-balance settings to ensure dataset repeatability. Each transparent workpiece was placed on a fixed sample stage, and a precision linear guide positioned it at the center of the camera’s optical axis, ensuring consistent viewing geometry across all samples. To compare defect visualization under different optical conditions, both white-light and red-light sources were used, with image outputs maintained in color format. White light provides a broadband spectrum that tends to induce scattering and multi-angle reflections on transparent surfaces, often resulting in nonuniform brightness and localized high-intensity regions. Nevertheless, its full spectral content enhances the visibility of chromatic-related defects such as discoloration. In contrast, red light, with its narrower wavelength band and higher penetration capability, produces images with lower reflection noise and stronger contrast for dark defects, making it advantageous for capturing black spot defects, dark anomalies, and extremely small granules. The combined use of dual light sources enables the collection of a diverse range of defect appearances under varying illumination fields.
After image acquisition, the dataset was categorized according to light-source type and color-presentation mode, as summarized in Table 1. This classification emphasizes the brightness distribution and chromatic contrast characteristics of transparent-part defects under different optical conditions. Furthermore, because defects in transparent optical molded components typically occupy only a very small proportion of the full image, additional classification based on field-of-view scaling and cropping strategy was performed according to Table 2. Uncropped images preserve the overall structure and are suitable for analyzing global brightness distribution. Cropped modes, such as
Through the multilayer classification approaches defined in Tables 1 and 2, this study establishes a dataset that accurately reflects the imaging behaviors of transparent optical molded components under various illumination fields, color conditions, and spatial scales. The resulting dataset not only supports robust model training with sufficient representativeness but also enables systematic analysis of brightness and texture differences across imaging modes. Moreover, this structured dataset serves as the foundation for subsequent full-factorial experiments and performance comparisons, ensuring measurement consistency and methodological rigor throughout the entire research process.
Image preprocessing and visual enhancement methods
Transparent materials inherently exhibit strong light transmission, low reflectance, and susceptibility to backlight interference, which often introduce high-brightness regions, low-contrast zones, and scattered noise in captured images. As a result, subtle defects such as black spot defects, color deviations, or local micro-particles typically appear with blurred boundaries and only minimal luminance variation. Appropriate preprocessing strategies are therefore essential to enhance the quality of feature extraction and to ensure that the deep learning model can effectively distinguish defect-related texture patterns. Unlike general natural-image enhancement tasks, the objective of preprocessing in transparent optical inspection is not to maximize global contrast but to stabilize illumination distribution and selectively enhance defect-relevant luminance gradients. Because transparent substrates exhibit strong backlight-induced halos and multi-path reflections, aggressive contrast-equalization techniques (e.g. histogram-based adaptive methods) may amplify reflective artifacts and sensor noise. Therefore, this study adopts illumination-consistent brightness normalization and monotonic gamma mapping to preserve structural continuity while improving the visibility of low-intensity defect regions. After constructing the raw dataset, this study first analyzed the geometric characteristics and optical behaviors of transparent-component defects. As illustrated in Figure 3, most defects occupy only a very small portion of the image frame, and their visual representation can vary significantly depending on illumination angle and localized reflective interfaces. Without preprocessing, these defects may be overshadowed by over-exposed regions or lose boundary clarity in darker areas, ultimately reducing the capability of the model to correctly identify defect features.

Defect size.
To mitigate these issues, three preprocessing mechanisms were adopted: brightness equalization, color correction, and field-of-view (FOV) cropping. Brightness equalization compensates for global illumination non-uniformity introduced by the backlight module, thereby improving grayscale consistency and accentuating local luminance gradients around defect regions. For color-related defects, color correction reduces white-balance drift and enhances chromatic contrast, enabling the model to capture variations in hue more effectively.
Given that transparent-component defects occupy an extremely small spatial proportion, multiple FOV scaling and cropping strategies were incorporated to amplify defect visibility. As shown in Figure 4, the dataset was expanded using several cropping formats, including

Different sampling regions: (a)
Since the visual manifestation of defects is highly dependent on illumination spectrum, background condition, and imaging geometry, this study further examined how different imaging conditions influence defect appearance. As demonstrated in Figure 5, the same type of defect can present completely different visual characteristics under white light, red light, or varying FOV scales. Black spot defects generally exhibit higher contrast under longer-wavelength red illumination, whereas color-shift defects are more strongly influenced by spectral composition and white-light scattering. These variations highlight the necessity of constructing multi-condition datasets and justify the use of full factorial experimental design to quantitatively evaluate the effect of imaging parameters on model performance. Through optical-behavior analysis, brightness and color normalization, and multi-scale cropping strategies, this study establishes a representative and consistent transparent-component defect dataset. These preprocessing procedures provide a stable foundation for subsequent data-augmentation steps and hyperparameter optimization, ensuring reliable and repeatable model training. The selected preprocessing operations were intentionally constrained to computationally lightweight transformations to ensure compatibility with real-time edge deployment.

Defect samples: (a) black spot defect, (b) short shot, (c) discoloration under white-light illumination, and (d) discoloration under red-light illumination.
Full factorial experimental design
The defect visualization characteristics of transparent optical molded components are simultaneously influenced by multiple factors, including light-source spectrum, image field-of-view, and preprocessing strategies. To systematically analyze how these imaging conditions affect the performance of deep-learning–based defect detection, this study adopts a full factorial experimental design, ensuring that all imaging variables are independently and systematically evaluated. The selected factors include light-source type, image representation mode, and cropping strategy, corresponding to the imaging configurations summarized in Tables 1 and 2. This structured approach enables a clear investigation of the independent contributions and interactions of each imaging condition on transparent-defect recognition.
Regarding optical factors, white light and red light are considered the primary illumination conditions. White-light images contain full-spectrum color information and are well-suited for detecting chromatic defects; however, they are more susceptible to brightness non-uniformity caused by multi-spectral reflections. In contrast, red light provides stronger penetration and lower reflective interference, making it particularly effective for enhancing the visibility of dark defects such as black spot defects. Owing to these fundamentally different imaging behaviors, the light-source spectrum is treated as one of the key factors in the full factorial design. The selected factors were not intended to exhaust the theoretical parameter space, but to represent controllable industrial variables under practical inspection conditions. In manufacturing environments, light-source configuration and field-of-view cropping are the two primary adjustable parameters affecting defect visibility and detection performance. Therefore, the experimental matrix was designed to systematically evaluate these key operational variables rather than to explore all possible combinations.
The image representation mode reflects the role of chromatic information in defect identification. RGB images preserve color-related features crucial for detecting discoloration defects, while grayscale images emphasize intensity variations and often enhance the contrast around defect boundaries. This factor allows the evaluation of how color content affects the model’s ability to learn texture- and contrast-related features.
The field-of-view factor is derived from the cropping strategies listed in Table 2. Transparent defects are typically small in size and appear randomly across the component surface; therefore, cropped images significantly increase the proportion of defect-relevant regions and improve the model’s efficiency in extracting local features. Finer cropping reduces large-scale brightness shifts and reflective noise, thereby increasing the relative contrast of subtle defects. Incorporating different cropping scales into the factor design enables a systematic investigation of how field-of-view selection influences model performance.
All factors described above are combined in a full factorial manner, allowing every imaging condition to be fairly compared under consistent data augmentation and training pipelines. By evaluating model performance in terms of mAP50–95, precision, and recall across all imaging modes, this study quantifies the relative importance of light-source spectrum, field-of-view, and image representation in defect visualization and feature extraction. The experiment further reveals the interactions among imaging factors during deep model learning. This full factorial design not only provides a structured and systematically controlled framework for dataset construction but also offers a clear and quantitative basis for determining model training strategies and hyperparameter optimization, enabling an objective comparison of defect-detection performance under various imaging conditions.
Hyperparameter grid search
A grid search strategy was employed to systematically evaluate the influence of multiple training hyperparameters on the detection performance of transparent optical molded component defects. Considering that such defects typically exhibit low contrast and subtle local textures, the selected hyperparameters were chosen to capture factors that strongly affect model convergence behavior, feature sensitivity, and training stability. The tested hyperparameters include the optimizer, learning rate, and input resolution, as summarized in Table 3. Two optimizers were included (SGD and AdamW) to represent distinct parameter-update mechanisms. SGD provides stable and smooth gradient descent that benefits late-stage convergence, making it suitable for enhancing robustness in the presence of weak and blurred defect boundaries. AdamW, on the other hand, incorporates decoupled weight decay and adaptive learning-rate adjustments, enabling faster early-stage feature extraction and improved generalization when dealing with subtle grayscale variations commonly found in transparent optical defects. The tested learning rates (0.01, 0.005, and 0.001) represent typical high-, medium-, and low-speed convergence settings, enabling the evaluation of their sensitivity to subtle defect features. For input resolution, three sizes (320, 640, and 1280) were examined to investigate the trade-off between fine-grained texture preservation and computational load.
Hyperparameter grid search.
By exhaustively testing all combinations of these hyperparameters, the proposed grid search enables a systematical evaluation of their contributions to model performance. The evaluation is based on mAP50–95, Precision, and Recall, ensuring that the selected optimal hyperparameter set provides balanced performance, robust convergence, and reliable defect detection across different imaging conditions.
Algorithmic framework and engineering formulation
Optical contrast formation in transparent optical molded components
In transparent molded components, defect visibility is governed by illumination–material interaction rather than pure surface reflectance. Unlike opaque substrates, transparent polymers allow partial light transmission and internal scattering, resulting in intensity distributions that are strongly dependent on illumination uniformity. The captured image intensity at pixel coordinate (x, y) can be expressed as equation (1).
where
which indicates that observable defect contrast is directly modulated by illumination intensity. In practical inspection systems, backlight diffusion and optical misalignment may introduce spatial brightness drift. Under such conditions, defect contrast can be weakened even when material variation exists. This multiplicative coupling explains the necessity of illumination stabilization prior to deep-learning training. Without such compensation, convolutional networks may learn brightness bias rather than defect morphology.
Illumination-consistent preprocessing strategy
Based on the optical characteristics described above, preprocessing was designed to reduce large-scale illumination variation while preserving defect-related structural information. Linear brightness normalization was first applied according to equation (3).
where
Since defects typically occupy only a small portion of the full image, multi-scale field-of-view cropping was introduced. For an image of size
More sophisticated contrast-enhancement methods such as adaptive histogram equalization and deep learning-based super-resolution were considered during preliminary trials. However, adaptive histogram equalization tended to amplify reflection halos in transparent optical molded components, leading to increased false-positive activations. Super-resolution approaches significantly increased computational overhead and introduced additional training complexity, which contradicted the objective of achieving lightweight edge deployment. Therefore, linear normalization combined with gamma correction was selected as a stable and computationally efficient compromise.
Detection model formulation and optimization
The YOLOv8 architecture was adopted as the core detection framework due to its multi-scale feature pyramid and decoupled detection head, which are suitable for detecting small and low-contrast defects. The overall detection loss is defined as equation (5).
where
Result and discussion
Before presenting quantitative results, it should be clarified that this study addresses an object detection task rather than binary product classification. In the adopted YOLOv8 framework, defect localization and classification are jointly performed within the detection head, and model performance is evaluated using object-level mAP metrics. Since the dataset emphasizes defect annotation rather than product-level categorization, conventional class imbalance concerns associated with binary classification tasks are not directly applicable.
Effect of preprocessing methods on detection performance
Transparent materials typically exhibit strong background interference due to their high transmittance, while their defects—such as black spot defects, discoloration, and short shots—typically occupy only a very small proportion of the image. Without appropriate preprocessing, deep learning models may inadvertently focus on background patterns rather than true defect characteristics. To address this issue, this study compares four field-of-view (FOV) cropping strategies (

Performance of the model after image pre-processing: (a)
As summarized in Table 4, the
Training results for black spot defects.
To further verify the consistency introduced by the preprocessing strategy, repeated inference experiments were performed. Ten consecutive predictions on the same sample demonstrated bounding-box center deviations of less than three pixels, indicating that the adopted preprocessing procedures, including brightness normalization, gamma correction, fixed-exposure imaging, and FOV cropping—effectively reduce imaging variability. Such stability is particularly critical for transparent optical molded components, where minor illumination fluctuations can noticeably alter defect visibility. These results indicate that image preprocessing plays a critical role in transparent-object defect detection. Among all evaluated strategies, the
Influence of illumination band on defect visibility and detection
Transparent polymer materials exhibit high optical transmittance, and the visualization of surface and internal defects strongly depends on the illumination wavelength, incident direction, and scattering behavior. To investigate the influence of lighting on image quality and detection accuracy, this study compares the imaging characteristics of white-light and red-light illumination and evaluates their impact on the YOLOv8 model through a multi–light-source enhancement strategy.
White light, due to its broadband spectral distribution, often induces surface reflections, refraction, and multi-band interference on transparent optical molded components. These effects may obscure or average out the subtle chromatic variations associated with color–shift defects, thereby reducing overall image contrast. In contrast, red light (620–750 nm) offers stronger penetration and suppresses multiple internal scattering, resulting in clearer grayscale contrast between defects and background regions. This behavior is confirmed in our experiments: as shown in Table 5 and Figure 7, the mAP of models trained on red-light images is consistently higher than that of those trained on white-light images. The improvement is particularly evident for color–shift defects, whose primary visual signatures lie in subtle variations of hue and saturation on or within transparent substrates. Under white-light illumination, these variations are easily disturbed by multi-spectral reflections; red light effectively suppresses irrelevant spectral components, producing more stable chromatic contrast. This enhancement allows the YOLOv8 model to better capture the geometric and luminance attributes associated with color anomalies.
Model performance of white-light and red-light samples under different sampling regions.

Model performance under different illumination conditions: (a) white light/
These findings demonstrate that the choice of illumination wavelength is not merely a photographic setting but a critical factor that determines deep-learning detection performance. Selecting an appropriate light band with strong defect–visualization capability establishes an optical foundation for reliable transparent-part inspection. To further verify the effectiveness of multi-light-source enhancement, this study evaluates YOLOv8 performance under white-light and red-light illumination using defective samples of
Grid-search-based hyperparameter optimization
After identifying the optimal image cropping strategy and illumination conditions, this study further conducted a systematic evaluation of hyperparameter optimization for the YOLOv8 model to achieve the best performance in transparent optical defect detection. Owing to the characteristics of transparent materials, such as weak defect boundaries, low contrast, and extremely small defect scales, the accuracy and stability of deep learning models remain highly dependent on suitable hyperparameter settings, even when preprocessing and illumination strategies have already been optimized. Therefore, based on the full-factorial framework established in Section “Methodology,” a three-factor, three-level grid search was employed to systematically examine the influence of optimizer type, learning rate, and input resolution on model performance. Three defect categories were evaluated: black spot defect, discoloration, and short shot.
In this experiment, the best-performing
Result of grid-search-based hyperparameter optimization.
The results show that high-resolution inputs (1280) consistently yield superior feature extraction performance across all defect types. This is particularly evident in black spot defect and short shot defects, where small-scale geometric features require fine-grained spatial details to be accurately captured. Regarding optimizers, SGD with a learning rate of 0.01 and AdamW with a learning rate of 0.005 demonstrated the best overall performance. Among them, SGD/0.01 achieved the highest accuracy for black spot defect (0.943) and short shot (0.988), while AdamW/0.005 provided the most stable and rapid early-stage convergence for discoloration defects (0.929), as illustrated in Table 6. The behavior is further reflected in the training curves shown in Figure 8: SGD exhibits higher late-stage stability, whereas AdamW excels in early detection of faint boundaries and subtle intensity variations, making it highly suitable for low-contrast transparent defects.

Performance of the model under hyperparameter optimization: (a) black spot defect/SGD/0.01, (b) black spot defect/AdamW/0.005, (c) discoloration/SGD/0.01, (d) discoloration/AdamW/0.005, (e) short shot/SGD/0.01, and (f) short shot/AdamW/0.005.
From the systematic evaluation of all hyperparameter combinations, two sets of configurations were identified as globally optimal, with an average mAP50–95 exceeding 0.935 across all defect categories. These results confirm that even with optimized preprocessing and illumination, refined hyperparameter tuning can still significantly boost overall detection performance. Notably, YOLOv8 demonstrates strong sensitivity to small-scale features—attributable to its deeper feature pyramid and decoupled head design—which enables robust detection in low-contrast, boundary-blurred, and optically complex environments. This outcome aligns with existing literature, further supporting YOLOv8 as an appropriate choice for defect inspection of transparent optical molded components.
Through full-factorial analysis and an practical baseline grid search, this study establishes a traceable and scientifically grounded optimization procedure. The identified hyperparameter settings ensure that the final model maintains stable and high-accuracy performance under diverse imaging conditions, thereby providing a reliable foundation for subsequent edge deployment and real-time inspection applications.
Following the aforementioned optimization evaluation, this study further conducted a benchmark comparison between the YOLOv8 and R-CNN models based on the established hyperparameter configurations, image cropping strategies, and illumination conditions. As evidenced by the performance metrics in Table 7, the experimental results demonstrate that, under identical parameter settings, the overall detection performance of YOLOv8 surpasses that of R-CNN. Consequently, for the highly specific task of detecting subtle defects in transparent optical components, the lightweight YOLOv8 architecture exhibits significant practical advantages for real-world engineering implementation and edge deployment.
Benchmark comparison between faster R-CNN and YOLOv8n for black spot defects.
Edge-computing inspection interface
After completing model optimization and identifying the best training configuration, the YOLOv8-based defect detection model was deployed on an edge-computing platform. The system integrates an industrial camera, dual-light-source module, microswitch trigger, linear positioning stage, and an Arduino-based motion controller to construct a real-time inspection device tailored for transparent optical molded components. As illustrated in Figure 9, the graphical user interface (GUI) developed in this study consolidates all system functions, including sample positioning, image acquisition, defect inference, automatic decision-making, and result storage, into a single operational panel, offering high usability and system cohesion.

GUI interface showing: (a) the manual operation mode and (b) the automatic inspection mode.
The GUI supports both manual and automatic operation modes. In manual mode, users may adjust camera position, illumination intensity, and exposure settings as needed. In automatic mode, the inspection cycle is initiated immediately upon receiving a trigger signal from the microswitch. The system then performs sequential operations including sample alignment, image acquisition, defect detection, and visualization of the classification results. This automation enables continuous inspection without human intervention and ensures consistency and reproducibility across all measurements.
The interface also provides intuitive visual feedback, including defect bounding boxes, good/NG classification indicators, and a detailed inspection log. Images classified as defect-free are highlighted in green, while defective samples include bounding-box annotations that indicate the defect type and model confidence score. Such visualization not only enhances operational clarity for on-site personnel but also improves the traceability of each inspection step, facilitating downstream process optimization.
To validate the overall performance of the edge-computing inspection system, three primary defect types (black spot defect, discoloration, and short shot) were evaluated using real production samples. As summarized in Table 8, manual inspection requires an average of 36 s per sample and remains susceptible to operator fatigue, subjective variability, and ambient-light differences, leading to inconsistent results. In contrast, the proposed AI-based edge system completes each inspection within 3.5 s, with the actual model inference time accounting for only about 0.1% of the overall inspection cycle, while the remaining time is mainly attributed to the rail movement time configured to match the cycle of the injection molding machine. While maintaining high stability and repeatability, the proposed system achieves a speed nearly 10 times faster than manual inspection. The overall detection accuracy across all defect categories reached 91.4%, with black spot defect and discoloration defects consistently identified, demonstrating the suitability of the proposed optical and image-processing strategy for transparent optical molded components.
Actual inspection time and detection accuracy.
Importantly, the edge device performs inference entirely on local hardware without reliance on cloud computing, thereby eliminating network latency and avoiding potential data-privacy concerns associated with transmitting large quantities of image data from the production floor. The full inference pipeline operates within the cycle time of injection molding machinery, enabling seamless integration with real-time manufacturing workflows. Upon receiving the completion signal from the molding machine, the system automatically initiates the inspection sequence, reducing labor requirements and significantly improving measurement consistency.
For model development and training, experiments were conducted on a high-performance workstation equipped with an NVIDIA RTX 4070 SUPER to ensure efficient hyperparameter exploration and convergence stability. For real-world deployment, however, the optimized YOLOv8 model was executed on an industrial edge device utilizing integrated graphics processing without reliance on high-end discrete GPUs. The detailed hardware specifications are listed in Table 9. Under this edge configuration, the camera input images had a resolution of 2448 × 2048 pixels and were in color format, while the system still achieved an average inference speed of approximately 40 frames per second (FPS), corresponding to about 25 ms per frame. Compared with the inference speed of 15.6 FPS for R-CNN, this represents an improvement of approximately 2.5 times, demonstrating that the proposed framework is suitable for practical edge deployment in manufacturing environments. The developed edge-computing inspection system demonstrates outstanding performance in terms of detection speed, accuracy, operational stability, and system usability. Through the integration of a high-coherence GUI, controlled illumination, and optimized image-processing strategies, the proposed platform fulfills the industrial requirements for high efficiency, reliability, and reproducibility in transparent optical molded component inspection. These results confirm the system’s strong applicability and value for practical deployment in smart manufacturing environments.
Hardware and system specifications of the edge deployment device.
It should be noted that the present study focuses on systematically evaluating key controllable industrial variables rather than exhaustively exploring the entire theoretical parameter space. The selected light-source configurations and cropping strategies represent practical inspection conditions commonly adjustable in manufacturing environments. While additional factors such as alternative optical geometries, sensor types, or broader illumination spectra may further influence detection performance, these variables were intentionally beyond the scope of the current investigation. Future work will extend validation across more diverse inspection setups to further assess generalization robustness.
Conclusion
This study addresses the long-standing challenges of defect inspection in transparent optical molded parts, including low contrast, blurred boundaries, and strong sensitivity to illumination conditions. By integrating optical enhancement, image preprocessing, deep learning optimization, and edge-based deployment, this work establishes a complete intelligent inspection framework capable of detecting small-scale defects such as black spot defects, discoloration, and short shots in real manufacturing environments.
The research first investigates the optical behaviors of transparent optical molded components under different illumination wavelengths and constructs representative datasets using both white-light and red-light imaging. Through luminance equalization, gamma correction, and multi-scale field-of-view cropping, the proposed preprocessing pipeline effectively enhances local defect contrast and visibility, allowing the model to better capture subtle gradients and texture variations. Results from the full-factorial experiment demonstrate that the
For the deep-learning module, YOLOv8 is employed as the core detection framework, and grid-search hyperparameter optimization is performed across optimizers, learning rates, and input resolutions. Experimental results show that transparent-defect learning is highly sensitive to training configuration due to weak boundaries and minimal luminance variation. Among the tested combinations, SGD (learning rate = 0.01, resolution = 1280) achieves the highest overall performance, consistently obtaining mAP50–95 values above 0.93 for black spot defect, discoloration, and short-shot defects. These results confirm that an appropriately optimized network can robustly accommodate the variability of transparent-defect morphology, contrast, and appearance. The optimized model is subsequently deployed on an edge-computing platform integrated with a motorized linear slide, illumination controller, and industrial camera, forming a real-time automated inspection system. Practical tests show that the system requires only 3.5 s per part—representing a 92% reduction in inspection time compared with manual inspection (36 s)—while maintaining stable detection accuracy above mAP50–95 = 0.93. The edge-based execution eliminates network latency and ensures fully local inference, making the system suitable for in-line operation in injection-molding production environments.
This work provides a validated, high-performance inspection architecture that satisfies industrial requirements for accuracy, stability, speed, and real-time operation. The proposed framework not only delivers a deployable solution for transparent optical molded components but also establishes a methodological foundation for future research on multi-illumination fusion, transparent-material imaging enhancement, and interpretable deep-learning models for manufacturing quality control.
Footnotes
Handling Editor: Aarthy Esakkiappan
Author contributions
Yuan-Hsi Chu & You-Huan Lin: Conceptualization, Methodology, Software, Formal analysis, Investigation, Resources, Data curation, Writing—original draft, Writing—review & editing, Visualization. Kun-Cheng Ke: Methodology, Validation, Writing—review & editing, Supervision, Project administration, Funding acquisition.
Funding
The authors disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This research was supported by the National Science and Technology Council (NSTC), Republic of China (Taiwan), under grant numbers NSTC 112-2221-E-003-021-MY2 and NSTC 114-2221-E-003-006-MY2. Additional support was provided by the Higher Education Sprout Project of National Taiwan Normal University and the Ministry of Education (MOE), Taiwan.
Declaration of conflicting interests
The authors declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Data availability statement
Data supporting the findings of this study are available from the corresponding author upon reasonable request.*
AI declaration
Declaration of generative AI and AI-assisted technologies in the manuscript preparation process.
