Light source adaptive dimming system, light source adaptive dimming method and related device
Patent Information
- Application Number
- CN202610895010.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-22
- Publication Date
- 2026-09-29
- Estimated Expiration
- 2046-06-22
AI Technical Summary
[0004]本申请提供一种光源自适应调光系统、光源自适应调光方法及相关装置,用以改善相关技术中的调光方案存在调试效率低且一致性差的问题
[0034]本申请提供的光源自适应调光系统、光源自适应调光方法及相关装置,其中的系统包括:壳体;光源模块,安装于壳体,用于产生照明光束;光源驱动单元,与光源模块连接,用于调节光源模块的亮度值;相机,安装于壳体,用于采集被测物图像;主控单元,与光源驱动单元和相机连接,且部署有瑕疵检测模型,主控单元被配置为:控制光源驱动单元以预设步长自动遍历多组亮度值组合;在每组亮度值组合下,触发相机采集图像,并利用瑕疵检测模型对图像进行推理,获得瑕疵检测的评估指标;根据评估指标,从遍历过的亮度值组合中选取使评估指标最优的一组亮度值组合作为目标亮度参数。
Smart Images

Figure CN122421143B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of automatic optical inspection technology, specifically to a light source adaptive dimming system, a light source adaptive dimming method, and related devices. Background Technology
[0002] Automated Optical Inspection (AOI) technology is widely used in surface defect detection in fields such as computer, communication, and consumer electronics (3C) products, semiconductors, and precision manufacturing. In AOI systems, the light source is a key determinant of image quality; its illumination angle, brightness, and color combination directly affect the system's ability to identify defects such as scratches, dents, oxidation, and dirt. With the continuous improvement of appearance quality requirements for consumer electronics products, the types of defects to be detected are becoming increasingly diverse (from micron-level shallow scratches to surface color differences and oxidation), and the materials to be detected also cover a variety of materials with different optical reflection properties, including metals, glass, and plastics. How to provide optimal lighting conditions for different materials and different defect types has become a core technical challenge that urgently needs to be addressed in the field of AOI inspection.
[0003] In related technologies, light source parameters are typically adjusted based on human experience. Specifically, for products under test with different materials and defect types, operators set the light source parameters based on experience, observe the images captured by the camera, and if the effect is unsatisfactory, adjust the light source parameters, repeating the above process until the contrast between the defect and the background meets the subjective judgment requirements. However, this method suffers from low adjustment efficiency and poor consistency. Summary of the Invention
[0004] This application provides a light source adaptive dimming system, a light source adaptive dimming method, and related devices to improve the problems of low debugging efficiency and poor consistency in dimming schemes in related technologies.
[0005] In a first aspect, this application provides a light source adaptive dimming system, comprising:
[0006] case;
[0007] The light source module, mounted in the housing, is used to generate an illumination beam;
[0008] A light source driving unit, connected to the light source module, is used to adjust the brightness value of the light source module;
[0009] A camera, mounted on the housing, is used to acquire images of the object being measured;
[0010] The main control unit, connected to the light source driving unit and the camera, and equipped with a defect detection model, is configured to: control the light source driving unit to automatically traverse multiple sets of brightness value combinations at a preset step size; trigger the camera to acquire images under each set of brightness value combinations, and use the defect detection model to infer the images to obtain evaluation indicators for defect detection; and select the set of brightness value combinations that makes the evaluation indicators optimal from the traversed brightness value combinations as the target brightness parameter.
[0011] In one possible implementation, the light source module includes at least a first light source module and a second light source module; the first light source module is arranged in the inner ring of the housing for providing bright field illumination; the second light source module is arranged around the perimeter of the housing for providing dark field illumination.
[0012] In one possible implementation, the second light source module includes an adjustable lamp holder that is rotatably mounted on the housing to adjust the illumination angle.
[0013] In one possible implementation, a light shield is provided on the adjustable lamp holder.
[0014] In one possible implementation, the light source module includes independently controlled red, green, and blue light-emitting diode channels; the light source driving unit is used to adjust the brightness values of the red, green, and blue light-emitting diode channels respectively, with the brightness adjustment range of each channel being 0 to 255 levels.
[0015] Secondly, this application provides a light source adaptive dimming method, applied to the main control unit of a light source adaptive dimming system as described in any of the first aspects, the light source adaptive dimming method comprising:
[0016] In an adaptive dimming system for controlling light sources, the light source driving unit automatically traverses multiple combinations of brightness values with a preset step size.
[0017] Under each combination of brightness values, the camera in the adaptive dimming system of the light source is triggered to acquire an image of the object under test.
[0018] The deployed defect detection model is used to infer the collected images to obtain the evaluation index of defect detection;
[0019] Based on the evaluation criteria, the set of brightness values that optimizes the evaluation criteria is selected from the traversed combinations of brightness values as the target brightness parameter.
[0020] In one possible implementation, the defect detection model is a deep learning-based instance segmentation model; the evaluation metrics include at least one of defect type, defect quantity, defect detection confidence, and grayscale contrast between the defect area and the background area.
[0021] In one possible implementation, based on evaluation metrics, a set of brightness value combinations that optimizes the evaluation metrics is selected as the target brightness parameter from the traversed brightness value combinations. This includes: comparing the evaluation metrics of the current brightness value combination with those of the current optimal brightness value combination, according to a priority order of defect type first, defect quantity second, and overall evaluation score third; if the number of defect types detected under the current brightness value combination is greater than the number of defect types detected under the current optimal brightness value combination, then the current brightness value combination is updated to the current optimal brightness value combination; if the number of defect types detected under the current brightness value combination is equal to the current optimal brightness value combination... If the number of defects detected under the current brightness value combination is greater than the total number of defects detected under the current optimal brightness value combination, then the current brightness value combination is updated to the current optimal brightness value combination. If the number of defects detected and the total number of defects detected under the current brightness value combination are both equal to the number of defects detected and the total number of defects detected under the current optimal brightness value combination, and the overall evaluation score of the current brightness value combination is higher than the overall evaluation score of the current optimal brightness value combination, then the current brightness value combination is updated to the current optimal brightness value combination. After the traversal is completed, the current optimal brightness value combination is used as the target brightness parameter.
[0022] In one possible implementation, the comprehensive evaluation score is a weighted sum of the confidence level of defect detection and the grayscale contrast between the defect area and the background area.
[0023] In one possible implementation, the adaptive dimming method for the light source further includes: fixing the target brightness parameters into the production configuration file as the basis for setting the light source during the online testing phase.
[0024] Thirdly, this application provides a light source adaptive dimming device, applied to the main control unit of a light source adaptive dimming system as described in any of the first aspects, the light source adaptive dimming device comprising:
[0025] The control module is used to control the light source driving unit in the light source adaptive dimming system to automatically traverse multiple sets of brightness value combinations with a preset step size.
[0026] The trigger module is used to trigger the camera in the adaptive dimming system to acquire images of the object under each combination of brightness values.
[0027] The inference module is used to infer the acquired images using the deployed defect detection model to obtain evaluation metrics for defect detection.
[0028] The processing module is used to select the set of brightness values that optimizes the evaluation index from the traversed combinations of brightness values as the target brightness parameter.
[0029] Fourthly, this application provides a main control unit, including: a processor, and a memory communicatively connected to the processor;
[0030] Memory is used to store instructions executed by the computer;
[0031] A processor for executing computer-executable instructions stored in memory to implement any of the methods of the second aspect.
[0032] Fifthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed, are used to implement the method of the second aspect.
[0033] In a sixth aspect, this application provides a computer program product, including a computer program that, when executed, implements the method of the second aspect.
[0034] The adaptive dimming system, method, and related apparatus for a light source provided in this application include: a housing; a light source module installed in the housing for generating an illumination beam; a light source driving unit connected to the light source module for adjusting the brightness value of the light source module; a camera installed in the housing for acquiring images of the object under test; and a main control unit connected to the light source driving unit and the camera, and equipped with a defect detection model. The main control unit is configured to: control the light source driving unit to automatically traverse multiple sets of brightness value combinations at a preset step size; trigger the camera to acquire images under each set of brightness value combinations, and use the defect detection model to infer the images to obtain evaluation indicators for defect detection; and select the set of brightness value combinations that optimizes the evaluation indicators from the traversed brightness value combinations as the target brightness parameter.
[0035] This application integrates a light source module, a light source driving unit, a camera, and a main control unit with a defect detection model deployed in the housing. The main control unit controls the light source driving unit to automatically traverse multiple sets of brightness value combinations. Under each set of brightness value combinations, the camera is triggered to acquire images and obtain corresponding evaluation indicators based on the defect detection model. Then, the optimal brightness value combination is selected as the target brightness parameter according to the evaluation indicators. This can replace the debugging method of repeated trial and error relying on human experience in related technologies. It can automatically complete the optimization of light source parameters without human subjective judgment, thereby significantly improving debugging efficiency. At the same time, since the evaluation indicators are objective quantitative standards output by the defect detection model, the subjective differences between different operators and different debugging times are eliminated, thereby significantly improving the consistency of detection. Attached Figure Description
[0036] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0037] Figure 1 A schematic diagram of a light source adaptive dimming system provided as an exemplary embodiment of this application;
[0038] Figure 2 Another schematic diagram of a light source adaptive dimming system provided as an exemplary embodiment of this application;
[0039] Figure 3 A schematic diagram of the layout of a first light source module provided for an exemplary embodiment of this application;
[0040] Figure 4 A schematic diagram of the uniformity distribution of the first light source module provided for an exemplary embodiment of this application;
[0041] Figure 5 A schematic diagram of the layout of the second light source module provided for an exemplary embodiment of this application;
[0042] Figure 6 A schematic diagram of the overall structure and installation of the light source module provided for an exemplary embodiment of this application;
[0043] Figure 7 A schematic flowchart of a light source adaptive dimming method provided for an exemplary embodiment of this application;
[0044] Figure 8 A schematic diagram of adaptive light source detection results provided for an exemplary embodiment of this application;
[0045] Figure 9 A schematic diagram of a light source adaptive dimming device provided as an exemplary embodiment of this application;
[0046] Figure 10 A schematic diagram of the structure of the main control unit provided for an exemplary embodiment of this application.
[0047] In the diagram, 10—Adaptive dimming system; 11—Housing; 12—Light source module; 13—Light source drive unit; 14—Camera; 15—Main control unit; 151—Processor; 152—Memory; 153—Communication interface; 16—Object under test; 90—Adaptive dimming device; 91—Control module; 92—Trigger module; 93—Inference module; 94—Processing module.
[0048] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0049] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application.
[0050] The terms "first," "second," etc., used in this application's specification and some aspects are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, products, or apparatus.
[0051] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with relevant laws, regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0052] In related technologies, solutions based on manual adjustment of light source parameters heavily rely on human experience, requiring repeated adjustments to brightness or switching of lighting conditions based on image perception. This approach is inefficient when dealing with a large number of light source parameter combinations, and the results are inconsistent across different adjustment times and operators, making it difficult to adapt to production scenarios involving multiple product lines and frequent model changes. Even with the introduction of detection models, if the illumination parameters remain fixed, the recognition performance of the detection model will be limited by the quality of the input image, making it impossible to dynamically optimize imaging conditions from the source. Therefore, the overall detection accuracy, stability, and efficiency still face significant bottlenecks.
[0053] To address the aforementioned issues, this application provides an adaptive dimming scheme for a light source. Through coordinated control between the main control unit, the light source driving unit, and the camera, a closed-loop control mechanism is formed, encompassing "parameter distribution - image acquisition - model inference - index evaluation - parameter update." Specifically, the main control unit controls the light source driving unit to automatically traverse multiple sets of brightness value combinations at a preset step size. Under each set of brightness value combinations, the camera is triggered to acquire images. Then, a deployed defect detection model is used to infer the images, obtaining evaluation indices for defect detection. Based on these evaluation indices, the set of brightness value combinations that best meets the evaluation indices is selected as the target brightness parameter. This automatic dimming technology, based on defect detection result feedback, replaces the traditional trial-and-error debugging method that relies on manual experience. It eliminates subjective differences between different operators and different debugging times, enabling the system to automatically acquire optimal lighting parameters for objects with different materials and defect types. This significantly improves debugging efficiency and the consistency of detection results, thus providing a reliable optical foundation for subsequent stable and accurate defect detection.
[0054] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0055] Figure 1 A schematic diagram of a light source adaptive dimming system provided as an exemplary embodiment of this application. Figure 1 As shown, the micro-light source adaptive dimming system 10 includes: a housing 11, a light source module 12, a light source driving unit 13, a camera 14, and a main control unit 15, wherein:
[0056] Casing 11;
[0057] The light source module 12 is mounted on the housing 11 and is used to generate an illumination beam;
[0058] The light source driving unit 13 is connected to the light source module 12 and is used to adjust the brightness value of the light source module 12;
[0059] Camera 14, mounted on housing 11, is used to acquire images of the object being measured;
[0060] The main control unit 15 is connected to the light source driving unit 13 and the camera 14, and is equipped with a defect detection model. The main control unit 15 is configured to: control the light source driving unit 13 to automatically traverse multiple sets of brightness value combinations with a preset step size; trigger the camera 14 to acquire images under each set of brightness value combinations, and use the defect detection model to infer the images to obtain the evaluation index of defect detection; and select the set of brightness value combinations that makes the evaluation index optimal from the traversed brightness value combinations as the target brightness parameter.
[0061] The housing 11 refers to the main structure that supports and protects the light source module 12, camera 14, light source drive unit 13, and main control unit 15 in the adaptive dimming system 10. It provides mounting references, spatial positioning, and electrical layout conditions for each component, and maintains a relatively stable optical structure during detection, thereby reducing the impact of external vibrations, dust, and stray light on the imaging results. In terms of position and relationship, the housing 11 typically forms the external frame of the system. The light source module 12 and camera 14 are installed at different predetermined positions within the housing, while the light source drive unit 13 and main control unit 15 can be arranged in the electrical control area or the back area inside the housing, and connected to the light source module 12 via wiring harnesses, cables, or terminals. Block 12 is connected to camera 14. In terms of shape and material, in one possible embodiment, housing 11 can be a metal ring housing to enhance structural rigidity and heat dissipation capacity. In another possible embodiment, it can be an aluminum alloy integrated frame housing to facilitate processing and installation while also taking into account lightweight. In yet another possible embodiment, it can be an engineering plastic injection molded housing to meet low cost and insulation requirements. In terms of size and proportion, the external dimensions of housing 11 can be configured according to the size of the object being measured and the detection field of view. Its internal cavity should be able to accommodate the installation space of light source module 12 and camera 14. The central area of housing should preferably maintain a predetermined coaxial or near-coaxial relationship with the camera optical axis and the illumination center to ensure the consistency of the acquired images.
[0062] The light source module 12 refers to a controlled light-emitting component installed inside the housing 11, used to output an illumination beam to the surface of the object under test. It provides stable and adjustable illumination conditions during the detection process, ensuring that defects such as scratches, indentations, dirt, oxidation spots, or color differences on the surface of the object under test create sufficient differences in brightness or texture in the image, thus providing clear input for subsequent defect detection model recognition. In terms of position and relationship, the light source module 12 is electrically connected to and controlled by the light source driving unit 13. It is typically arranged around the camera lens, or installed on the corresponding mounting surface of the housing 11 in a ring, array, strip, or partitioned manner to form uniform illumination, oblique illumination, or locally enhanced illumination of the object under test. In terms of shape and material, in one possible embodiment, the light source module 12 can be a ring-shaped lamp panel structure with multiple light-emitting diodes (LEDs) arranged on it. In another possible embodiment, the light-emitting unit (LED) can be a partitioned array structure to allow for independent adjustment of illuminance in different directions or areas. In yet another possible embodiment, it can be a light guide plate structure to achieve beam homogenization output through light guide material. In terms of size and proportion, the light-emitting area of the light source module 12 is usually matched with the camera's field of view. Its outer diameter, width, or array distribution range can be adapted according to the contour of the object being measured to ensure that the measured area is within the effective illumination coverage and to reduce uneven edge illumination.
[0063] The light source driving unit 13 refers to the electric drive control component connected to the light source module 12 and used to adjust the brightness value of the light source module 12. It controls the current, voltage, or pulse duty cycle of the light source module 12 according to the brightness parameters issued by the main control unit 15, thereby realizing programmable changes in light intensity and enabling the system to automatically traverse multiple sets of brightness value combinations according to a preset step size. In terms of location and relationship, the light source driving unit 13 is usually installed in the electrical control cavity inside the housing or in a control box adjacent to the outside of the housing. It is connected to the light source module 12 via a power line and to the main control unit 15 via a communication line. The main control unit 15 can send brightness setting commands to it, and the light source driving unit 13 outputs corresponding drive signals according to the commands. In terms of form and material, in one possible embodiment, the light source driving unit 13 can be a printed circuit board (PCB) board-type driving module; in another possible embodiment, it can be an integrated box-type driver; and in yet another possible embodiment, it can be a modular plug-in driver. Internally, it can employ a constant current driving chip and pulse width modulation (PWM) technology. Modulation (PWM) unit or digital programmable current regulation module; in terms of size and proportion, the shape of the light source driving unit 13 is usually adapted to the reserved electrical control space inside the housing. Its heat dissipation area, number of interfaces and wiring length should meet the driving requirements of the corresponding light source module 12 and ensure stable output during continuous dimming.
[0064] Camera 14 refers to an image acquisition device installed on housing 11 for acquiring images of the object under test. It acquires image data of the object's surface under different brightness combinations and transmits the images to the main control unit 15 for inference analysis by the defect detection model. In terms of position and relationship, camera 14 is installed at the lens mounting position or center hole position of housing 11, with the lens facing the object under test. It is typically arranged coaxially or nearly coaxially with the light source module 12 to reduce viewing angle deviation and improve image reproducibility. Camera 14 communicates with the main control unit 15 via a data cable, and the main control unit 15 can trigger its acquisition action after a change in light source brightness. Regarding form and material, in one possible embodiment, camera 14 can be a complementary metal-oxide-semiconductor (CMOS) camera; in another possible embodiment, it can be a charge-coupled device (CCD) camera. The device (CCD) camera, in another possible embodiment, can be a high-speed industrial camera to meet the requirements of different production line cycles and image clarity; in terms of size and proportion, the lens focal length, field of view, and mounting depth of the camera 14 should match the housing structure and the size of the object being measured, so that the measured area falls completely within the imaging range and the focus position is stably located on the detection plane. For example, Figure 2 Another schematic diagram of a light source adaptive dimming system provided as an exemplary embodiment of this application. (See diagram below.) Figure 2 As shown, the lens of camera 14 is set towards the object being measured 16, and is arranged coaxially or nearly coaxially with the light source module 12.
[0065] The main control unit 15 refers to the control and decision-making core connected to the light source driving unit 13 and the camera 14, and equipped with a defect detection model. It controls the light source driving unit 13 to automatically traverse multiple sets of brightness value combinations according to a preset step size, drives the camera 14 to acquire images under each set of brightness value combinations, performs defect detection inference on the images to obtain evaluation indicators, and then selects the set of brightness value combinations that best meets the evaluation indicators from the traversed combinations as the target brightness parameter. In terms of location and relationship, the main control unit 15 can be located in the control area inside the housing, in an external industrial control computer, or in an edge computing box, and is connected to the light source driving unit 13 and the camera via wired communication or an industrial bus. 14. Interaction: On the one hand, it is responsible for issuing brightness traversal instructions; on the other hand, it is responsible for receiving images, calling the defect detection model, and outputting optimization results. In terms of form and material, the main control unit 15 can be an embedded industrial control board in one possible embodiment, an edge computing box in another possible embodiment, and an industrial computer in yet another possible embodiment, and can integrate a processor, memory, image interface, and communication interface inside. In terms of size and proportion, the installation size of the main control unit 15 can be configured according to the reserved space inside the housing and heat dissipation requirements. Its computing power is matched with the image frame rate and the number of traversal parameters to ensure that parameter search and result judgment are completed within the detection cycle.
[0066] Based on the above analysis, the adaptive dimming system for a light source provided in this application embodiment, during operation, firstly, the main control unit 15 sends a first set of brightness parameters to the light source driving unit 13 according to a preset dimming strategy, causing the light source module 12 to output an illumination beam of corresponding intensity. Under this illumination condition, the object under test 16 forms a set of images with specific contrast and reflection distribution characteristics. Subsequently, the main control unit 15 triggers the camera 14 to acquire the current image and inputs the acquisition result into the defect detection model deployed in the main control unit 15 for inference. The model forms evaluation indicators based on the degree of defect manifestation in the image, the separation effect between defects and background, and the identifiability of the target area. The main control unit 15 then switches to the next set of brightness value combinations according to a preset step size, repeating the illumination, image acquisition, and inference process, so that the image quality and detection performance corresponding to each set of brightness parameters are included in the same optimization process, and the brightness value combination with the best evaluation indicators is selected as the target brightness parameter. Because this solution does not rely on manual experience to directly set a fixed brightness, but instead uses a defect detection model to provide feedback evaluation of the actual acquired images, the determination of light source parameters is directly linked to the final detection task. Therefore, it can automatically find more suitable lighting conditions for different materials, surface conditions, and defect types, fundamentally improving recognition biases caused by high-light interference, overexposure, insufficient contrast, or texture fluctuations. This enhances the consistency, stability, and adaptability of detection results and reduces reliance on manual experience for model changeover adjustments. Furthermore, because the system uses a preset step size to traverse multiple brightness value combinations, it achieves a balance between parameter search range and search efficiency, making the light source adjustment process controllable and repeatable. This makes it suitable for online appearance inspection scenarios in 3C product manufacturing that are time-sensitive, have diverse product categories, and require high quality. It should be understood that the above example is for demonstration purposes only and is not limiting. In actual applications, the light source module, camera type, driving method, and specific form of the defect detection model can all be replaced or adjusted accordingly.
[0067] The adaptive dimming system provided in this application integrates a light source module, a light source driving unit, a camera, and a main control unit with a defect detection model deployed in the housing. The main control unit controls the light source driving unit to automatically traverse multiple sets of brightness value combinations. Under each set of brightness value combinations, the camera is triggered to acquire images and obtain corresponding evaluation indicators based on the defect detection model. Then, the optimal brightness value combination is selected as the target brightness parameter according to the evaluation indicators. This can replace the debugging method of repeated trial and error relying on human experience in related technologies. It can automatically complete the optimization of light source parameters without human subjective judgment, thereby significantly improving debugging efficiency. At the same time, since the evaluation indicators are objective quantitative standards output by the defect detection model, the subjective differences between different operators and different debugging times are eliminated, thereby significantly improving detection consistency.
[0068] Considering that in related technologies, the light source structure is mostly designed with a fixed angle, which cannot flexibly adapt to the detection requirements of materials with different refractive indices, in some embodiments, the light source module includes at least a first light source module and a second light source module; the first light source module is arranged in the inner ring of the housing to provide bright field illumination; the second light source module is arranged around the perimeter of the housing to provide dark field illumination.
[0069] In one possible embodiment, a first light source module and a second light source module constitute a light source unit for providing composite illumination to the object under test. The first light source module is an illumination component arranged in the inner ring region of the housing, used to project uniform light onto the surface of the object under test from a relatively vertical or near-vertical direction. The second light source module is an illumination component arranged in the outer periphery region of the housing, used to provide lateral supplementary lighting to the edges, uneven structures, and minor defects of the object under test surface at a lower incident angle. The function of the first light source module is to provide stable background brightness for the object under test, enabling the overall outline, color differences, and surface contamination of the workpiece to form a relatively continuous grayscale distribution in the image. The function of the second light source module is to enhance the scattering characteristics and edge contrast of defects such as scratches, indentations, burrs, cracks, or foreign objects in the image using the dark-field imaging principle, thereby improving the sensitivity of the defect detection model to different types of defects. In terms of location and relationship, the first light source module is installed in the inner ring of the housing, typically arranged circumferentially around the camera's image capture hole or detection window, so that the light emitted can cover the central area of the camera's field of view as much as possible. The second light source module is arranged around the perimeter of the housing, usually located outside the first light source module and forming a concentric or near-concentric ring-shaped stacked relationship with it, so as to form oblique incident illumination from the outside in. The first and second light source modules can be fixed in independent brackets, ring mounting plates, or positioning slots in the housing, and are electrically connected to the light source drive unit through wires, so that the brightness value, start / stop status, or combined illumination status can be independently adjusted under the control of the main control unit. In terms of form and material, in one possible embodiment, the first light source module can be an inner ring light source formed by a ring LED light board, a flexible printed circuit (FPC) light strip, or a planar bright field light source formed by a light guide plate and an LED array. The second light source module can be a segmented LED bead array, a ring side-emitting light strip, or multiple sets of strip oblique lighting groups. The substrates of both can be aluminum substrates, flame retardant grade 4 (FR-4) rigid circuit boards, or flexible FPC materials. The light-emitting devices can be white LEDs, red green blue (RGB) LEDs, or red green blue white (RGBW) LEDs to adapt to different surface materials and color conditions of the tested objects. In terms of size and proportion, the inner diameter of the first light source module is usually matched with the field of view coverage of the camera lens, while its outer diameter is smaller than the inner diameter of the second light source module to avoid mutual occlusion of the illumination areas; the outer diameter of the second light source module is usually adapted to the circumferential boundary inside the housing, and the radial distance between the inner and outer rings can be set according to the size of the object being measured and the camera installation height, so that the first light source module can form a more uniform bright field illumination while the second light source module can maintain a sufficient oblique angle and effective illumination range, thereby taking into account both the overall gray uniformity and the defect edge enhancement effect.It should be understood that the above examples are for illustrative purposes only and are not intended to be limiting.
[0070] For example, Figure 3 This is a schematic diagram of the layout of a first light source module provided for an exemplary embodiment of this application. (See attached diagram.) Figure 3 As shown in (a), the first light source module adopts a perforated backlight design. The front is a 205mm × 205mm square structure with a pre-drilled square hole in the center for the camera to capture images, and mounting holes (such as four M3 mounting holes, 5mm deep) distributed around the perimeter for fixation. Figure 3 As shown in (b), the first light source module has a side thickness of 18mm, mounting structures on both sides, and wiring terminals at the bottom; Figure 3 As shown in (c), the back of the first light source module is a light-emitting surface of 214mm×225mm, wherein the width and length of the effective light-emitting area are 200mm and 211mm respectively, and the size of the central square hole is 50mm×50mm. Figure 4 A schematic diagram illustrating the uniformity distribution of the first light source module provided for an exemplary embodiment of this application. (See diagram below.) Figure 4 As shown in the figure, this diagram visually reflects the uniform attenuation characteristics of light from the center to the edge, meeting the requirement of stable illumination for defect detection. This first light source module is suitable for bright-field illumination and is typically used to detect oxidation, color difference, and obvious indentations on metal surfaces.
[0071] Accordingly, Figure 5 A schematic diagram of the layout of the second light source module provided for an exemplary embodiment of this application. (See diagram below.) Figure 5 As shown in (a), the second light source module adopts a surround layout design, with an overall outer contour size of 307.5mm × 307.5mm and an internal effective light-emitting area size of 279mm × 279mm. Four light-emitting surfaces are evenly distributed around the perimeter, each measuring 218mm × 218mm, with a spacing of 235.5mm between the light-emitting surfaces. The top of the module has 4 M3 mounting holes for fixing. Figure 5 As shown in (b), the second light source module has a side thickness of 38 mm. This second light source module is suitable for dark-field illumination and is typically used to detect the contrast of light scratches on tempered glass or glossy surfaces.
[0072] For example, Figure 6 This is a schematic diagram illustrating the overall structure and installation of the light source module, provided as an exemplary embodiment of this application. Figure 6 As shown, the overall structure of the light source module adopts a surrounding layout. The first light source module is arranged in the inner ring of the housing, and the second light source module is arranged around the perimeter of the housing. The outer diameter of the main body is 279.4 mm, and there are 8 M3 threaded holes above the light source, with a distribution circle diameter of 290.3 mm (i.e., as shown). Figure 6The PCD (Φ290.3mm) shown is used to fix the camera or lens adapter plate; it has eight 3.1mm diameter through holes at the bottom, with a distribution circle diameter of 278.3mm, for fixing the light source to the frame or the stage of the object being measured; multiple light-emitting surfaces are evenly distributed around the light source, including two specifications with a length of 80mm and 41mm, which evenly emit light through a light guide plate or a diffuser plate, and a pre-drilled aperture in the center for the camera to capture the image, suitable for defect detection on various material surfaces. In addition, the maximum outer diameter is, for example, 294mm, and the overall height is controlled within 45mm to adapt to narrow Z-axis spaces.
[0073] It should be noted that the parameters in the above figures, such as the size of the light-emitting surface, the size of the square hole, and the size of the light source module, are all examples. In actual applications, they can be appropriately adjusted according to specific testing requirements, the characteristics of the object being tested, and installation space limitations. No restrictions are imposed here.
[0074] Correspondingly, when the system starts, the main control unit can control the first and second light source modules to illuminate with different brightness combinations based on the material, surface condition, and preset detection strategy of the workpiece to be inspected. The first light source module provides bright field illumination to the workpiece in the inner ring area, ensuring a relatively consistent background brightness for the overall texture, color difference, and stains on the surface of the workpiece in the image captured by the camera. Meanwhile, the second light source module projects oblique light into the edges and surface microstructures of the workpiece in a dark field manner around the perimeter of the housing, making the scattering and shadow changes caused by surface scratches, pits, protrusions, burrs, etc., more obvious. Subsequently, as the main control unit iterates through different brightness combinations, it can adjust the output intensity of the two light sources separately, triggering the camera to acquire images under each combination. The images are then input into the defect detection model for inference to obtain the corresponding evaluation indicators. Since bright field illumination can improve overall imaging stability, while dark field illumination can amplify local defect features, when the two are arranged in the same housing through inner and outer rings, more discriminative image information can be obtained on workpieces with different materials, colors, and surface roughness. Based on this, the main control unit selects the brightness combination that optimizes the evaluation indicators, thereby improving the system's adaptability to multiple types of defects, imaging consistency, and detection stability without relying on frequent adjustments based on human experience. This provides a more reliable image basis for subsequent automatic optical inspection.
[0075] In this embodiment, by setting the light source module to include a first light source module (bright field illumination) arranged in the inner ring of the housing and a second light source module (dark field illumination) arranged around the housing, the same system can meet the detection needs of materials with different refractive indices. For defects such as oxidation and color difference on metal surfaces, bright field illumination can be used to obtain high-contrast images, while for shallow scratches on glass or high-gloss surfaces, dark field illumination can be used to enhance the edge scattering characteristics of micro-defects. This effectively improves the problem that fixed-angle light sources cannot flexibly adapt to the detection needs of different materials and significantly enhances the optical adaptability to different defect types.
[0076] In some embodiments, the second light source module includes an adjustable lamp holder that is rotatably mounted on the housing to adjust the illumination angle.
[0077] The adjustable lamp holder is a mounting base used to support the second light source module and adjust its light emission direction. It is rotatably mounted to the housing, allowing the second light source module to change its orientation relative to the housing around a predetermined axis; for example, it can rotate ±90 degrees on each side. Figure 5As shown in (b)), manual adjustment is supported. Its function and purpose are to allow the light beam to sweep across the surface of the object being measured in different directions by changing the incident angle of the illumination from the dark field light source when there are defects such as high reflection, minor scratches, indentations, or edge undulations on the surface of the object being measured. This changes the reflection difference and shadow visibility between the defect and the background, thereby improving the visibility of the defect outline, depth variation, and local scattering characteristics. In terms of its position and relationship, the adjustable lamp holder is usually arranged around the perimeter of the housing or in the corresponding installation area of the second light source module. The second light source module is fixed or mounted on the adjustable lamp holder, so that the rotation of the lamp holder drives the second light source module to rotate synchronously. The adjustable lamp holder can be connected to the housing through a rotating shaft, hinge seat, rotating bracket, or rotating ring, and the angle can be maintained with the cooperation of the housing's limiting structure, locking structure, or angle calibration structure. Regarding its shape and material, in one possible embodiment, the adjustable lamp holder can be an arc-shaped base, its outer contour matching the curvature of the housing side; in another possible embodiment, the adjustable lamp holder can be a fan-shaped bracket to facilitate a certain range of swing within a small installation space; in yet another possible embodiment, the adjustable lamp holder can be an arc-shaped turntable structure to provide smoother rotational support. In one possible embodiment, the material can be aluminum alloy or stainless steel to improve structural rigidity and wear resistance; in another possible embodiment, it can be engineering plastic to reduce weight and facilitate molding; in yet another possible embodiment, it can be a metal and polymer composite material to balance strength and friction performance. The connecting parts can use metal bushings, wear-resistant bushings, or self-lubricating bearings to reduce rotational resistance and improve repeatability. In terms of size and proportion, the rotation radius of the adjustable lamp holder is usually matched with the installation radius of the second light source module. Its width and thickness must meet the requirements of light source installation, wiring, and rotation avoidance. An assembly gap is generally reserved between the lamp holder and the side wall of the housing to avoid interference. Its rotation angle can be set within a certain range according to the material and defect type of the object being measured. For example, it can form a continuously adjustable or stepped adjustable deflection angle around the central axis to obtain the best dark field lighting effect under different working conditions. If necessary, a limiting structure can also be set to limit the minimum and maximum angles to prevent excessive rotation from causing line pulling or light offset.
[0078] Correspondingly, when the system is started, the second light source module, supported by the adjustable lamp holder, is positioned at a preset installation angle relative to the housing. This preset installation angle refers to one or more reference illumination angles that are pre-set and fixed before the inspection begins, based on the typical material of the object being tested, common defect types, or historical inspection experience. For example, for glass cover plate inspection, the second light source module can be preset to a 30° grazing angle; for metal frame inspection, it can be preset to a 15° grazing angle. This preset installation angle can be manually set by the operator during equipment debugging and can be adjusted during production changeovers based on different objects being tested. Subsequently, as the material, surface condition, and defect type of the workpiece to be tested change, the adjustable lamp holder rotates around the rotatable connection between itself and the housing, thereby causing the second light source module to change the incident direction and grazing angle of the emitted beam. Because dark field illumination is more sensitive to minute surface undulations and abrupt edge changes, when the illumination angle is adjusted to suit the current state of the object being measured, the defect area is more likely to produce local shadows, enhanced reflection, or scattering differences, making the defect features in the image acquired by the camera clearer and more stable, and providing higher quality input for the main control unit to make subsequent inference judgments based on the defect detection model.
[0079] In this embodiment, by setting an adjustable lamp holder, the imaging adaptability under different materials and different defect scenarios can be improved by mechanically adjusting the illumination angle of the second light source module without changing the overall detection structure. This reduces the risk of high light interference, insufficient contrast and missed detection caused by fixed illumination angle, thereby improving the detection stability and recognition accuracy of the automatic optical inspection system.
[0080] In some embodiments, the adjustable lamp holder is provided with a light shield.
[0081] A light shield is a light-limiting component used to block light from non-target directions. Its main function is to limit the light output range of the second light source module and suppress stray reflected light that may be generated around the adjustable lamp holder, thereby allowing the illumination beam to act more concentratedly on the surface of the object being measured. The light shield is usually placed around the light-emitting end or the outer edge of the adjustable lamp holder and matches the light output direction of the second light source module, so that it can still effectively shield lateral outflow light when the illumination angle is adjusted by rotation. It can be assembled with the adjustable lamp holder by fixed connection, snap-fit connection or detachable connection, which is convenient for replacement or maintenance under different detection objects and different process requirements. In one possible embodiment, the light shield can be made into a cylindrical cover, a horn cover or a semi-enclosed cover to adapt to different light limiting and focusing requirements. Its material can be ferrous metal, black flame-retardant plastic or composite material with a matte coating to reduce surface reflectivity and enhance light absorption effect. Its inner surface can also be provided with matte texture, light-absorbing coating or microstructure light-absorbing layer to further reduce the interference of internal scattered light on the imaging area. The opening diameter of the light shield is typically not less than the effective light-emitting area size of the second light source module. The length of the shield and the opening diameter can be set to a certain aspect ratio to achieve a balance between light-shielding performance and illumination coverage. The shield wall thickness can be set according to structural strength, weight control, and assembly space requirements. It should be understood that the above-mentioned shapes, materials, and dimensional relationships are merely illustrative and not limiting.
[0082] During operation, when the system starts up and enters the detection state, the main control unit controls the second light source module to adjust its brightness value while driving the adjustable lamp holder to rotate to a predetermined illumination angle. This ensures that the light emitted by the second light source module illuminates the surface of the object under test in an incident manner suitable for dark-field imaging. Because the adjustable lamp holder is equipped with a light shield, the light can only exit from the limited opening area. Side-scattered light from non-target directions, ambient stray light, and reflected light from inside the housing are all blocked, thereby reducing the possibility of these invalid light rays entering the camera's field of view. This allows the illumination beam to more concentratedly form a localized high-contrast dark-field effect, making minor defects such as scratches, indentations, particles, and dirt on the surface of the object under test more easily visible in the image. This, in turn, facilitates stable inference of the image by the subsequent defect detection model.
[0083] Based on the above analysis, it can be seen that the setting of the light shield can further improve the illumination directionality and imaging consistency without changing the overall dimming logic, reduce the impact of high light interference and background noise on the detection results, thereby improving the adaptability and defect identification stability of the automatic optical inspection system on workpieces with different materials and surface conditions.
[0084] In some embodiments, the light source module includes independently controlled red, green, and blue light-emitting diode channels; the light source driving unit is used to adjust the brightness values of the red, green, and blue light-emitting diode channels respectively, with the brightness adjustment range of each channel being 0 to 255 levels.
[0085] The red, green, and blue LED channels refer to three illumination channels located within the light source module, each corresponding to red, green, and blue light output and capable of independent controlled emission. Essentially, they are a separable channel light source structure for outputting illumination light of different wavelengths. Their function is to optimize the overall color temperature, spectral composition, and overall illuminance of the object being tested by adjusting the luminous flux of different wavelengths according to detection requirements. This enhances the grayscale or texture differences in images of different material surfaces, different colored coatings, and different types of defects. In terms of location and relationship, the three LED channels can be integrated within the same light source module and electrically connected to their respective output terminals of the light source driver unit, forming independent red, green, and blue dimming branches. During control, the main control unit can send brightness control commands to each branch to allow for individual or coordinated adjustment of the three channels within the same detection cycle. Regarding its form and materials, in one possible embodiment, the three-color light-emitting diode channels can be in the form of discrete packaged LED arrays, with each channel consisting of several LEDs of the same color arranged in a matrix. In another possible embodiment, co-packaged RGB LED chips or RGB integrated LED beads can be used to integrate red, green, and blue light-emitting units into the same package. In yet another possible embodiment, RGBW hybrid integrated LED beads or multi-band narrowband LED arrays can also be used to adapt to more complex spectral adjustment requirements. The corresponding mounting substrate can be an aluminum substrate, a ceramic substrate, or a flexible circuit substrate to take into account heat dissipation, insulation, and assembly compatibility. The driving circuit can adopt constant current drive, PWM dimming, or a hybrid dimming method combining constant current and PWM to ensure the output stability of each channel at different brightness levels. Regarding size and proportions, the number of LEDs, their arrangement density, and the channel spacing for each channel can be configured based on illumination uniformity and the internal space of the housing. The effective light-emitting area of a single channel can be matched according to the detection field of view size. Channels should maintain a relatively consistent spot coverage relationship to avoid overall color shift. When the brightness value varies within the range of 0 to 255 levels, it can correspond to discrete level control from channel shutdown to maximum output. Different channels can be adjusted using the same timing interval or optimized separately with different timing intervals to establish a finer spectral ratio. It should be understood that the specific packaging form, number of light-emitting devices, and driving method of the above three-color channels can all be adjusted according to actual applications. The above examples are for demonstration purposes only and are not limiting.
[0086] For example, the light source module uses a high-density 3528 RGBW four-in-one LED, supporting independent RGB control. Correspondingly, the light source driver unit supports three-channel independent PWM dimming, with each channel's brightness adjustment range from 0 to 255 levels. It can control the brightness values of the red, green, and blue LED channels separately, thereby mixing to produce lighting light of any color and brightness. Its response time is less than 10 milliseconds, enabling rapid response to brightness adjustment commands issued by the main control unit and achieving real-time changes in light source brightness. The light source driver unit supports RS232 (Recommended Standard 232) or Ethernet communication, allowing data interaction with the main control unit via standard industrial communication protocols, receiving brightness setting commands and transmitting drive status. In addition, the light source driver unit also supports an externally triggered strobe mode, which can synchronously trigger the light source module to set the brightness and turn it on at the moment the camera captures an image, and immediately turn it off or reduce the brightness after the acquisition is completed, thereby reducing light source heat, extending LED lifespan, and adapting to the testing needs of high-speed production lines.
[0087] When the system starts up and enters the detection state, the main control unit first generates an initial brightness combination based on the material, color, or preset detection strategy of the object being tested. It then drives the light source drive unit to output corresponding control signals to the red, green, and blue LED channels, causing each channel to emit light according to the set brightness level. As the main control unit automatically traverses multiple brightness value combinations at preset step sizes, the red, green, and blue illumination lights, superimposed in different ratios, form different comprehensive color spectra and illuminance distributions. When these lights illuminate the surface of the object being tested, different image responses are generated due to the material's reflectivity, defect morphology, and surface color differences. The camera simultaneously acquires images under each brightness value combination. The defect detection model infers from the images and outputs evaluation indicators, which the main control unit uses to compare the impact of each combination on the degree of defect visibility. When a particular brightness value combination makes the contrast between the defect and the background more obvious and reduces false detection interference, that set of parameters can be selected as the target brightness parameter. By independently controlling and limiting the brightness of the red, green, and blue channels to a discrete range of 0 to 255 levels, the system can quickly form a suitable spectral combination for different test objects, thereby improving the visibility of defects and image consistency under complex surface conditions, reducing overexposure, underexposure, or insufficient contrast caused by fixed single illumination, and thus improving the adaptability of adaptive dimming and detection stability.
[0088] The above embodiments illustrate the implementation of the adaptive dimming system for light sources. Next, specific embodiments will be used to illustrate the application of this adaptive dimming system for light sources.
[0089] Figure 7This is a schematic flowchart illustrating a light source adaptive dimming method provided as an exemplary embodiment of this application. The light source adaptive dimming method provided in this application embodiment is applied to the main control unit of a light source adaptive dimming system as described in any of the above embodiments. Figure 7 As shown, the adaptive dimming method for this light source includes:
[0090] S701, the light source driving unit in the adaptive dimming system automatically traverses multiple combinations of brightness values with a preset step size.
[0091] The preset step size refers to the interval parameter between adjacent brightness values when performing discretization search within the adjustable brightness range. This interval parameter can be a fixed value or different values can be set according to different brightness ranges to balance traversal efficiency and search accuracy. For example, the preset step size is 32. The brightness value combination refers to the set of brightness parameters set simultaneously for one or more light source channels. When the system includes bright field light source, dark field light source, or red, green and blue three-color light-emitting diode channels, each brightness value combination corresponds to the joint output state of each channel at the same time.
[0092] During the initialization phase after system startup, the main control unit (i.e., the intelligent decision-making layer) first executes a series of calibration and parameter preset operations for the hardware and software environment. Specifically, the main control unit first instructs the light source driver unit to turn on all connected light source modules. During this process, the system performs a "light source mask (mask) setting" operation. This light source mask is a digital filter based on bitmap logic. By presetting a digital matrix in the image sensor sampling space, a controllable optimal light source combination suitable for detecting defects in the object under test is formed. The key feature of this step is that, through software-level constraints on physical space combined with automated artificial intelligence reasoning, it can eliminate the complex process of manual light source debugging by orders of magnitude, reduce the light source debugging cycle, and thus promote improved product testing quality and efficiency.
[0093] Based on this, the main control unit first reads the dimming strategy file or default parameter template corresponding to the current detection task to determine the light source channels involved in the traversal, the adjustable range of each channel, the step size setting, and the traversal order. Combined with the dependent light source adaptive dimming system structure, the first light source module set in the inner ring of the housing can provide bright field illumination, while the second light source modules set around the perimeter of the housing can provide dark field illumination. When the second light source module is equipped with an adjustable lamp holder, the illumination angle can be pre-adjusted to a position suitable for the material of the object being tested before detection, and then the main control unit automatically traverses the brightness. In one possible embodiment, if the light source module includes independently controlled red, green, and blue LED channels, and the brightness adjustment range of each channel is 0 to 255 levels, the main control unit can discretely select values for the three color channels according to a step size of 5 levels, 10 levels, or a zoned variable step size, and then generate multiple sets of candidate brightness value combinations according to preset combination rules. For example, for highly reflective metallic surfaces, a smaller step size can be used to refine the search in the lower brightness range to avoid overexposure from obscuring shallow scratches; for plastic parts with strong diffuse reflection, the step size can be increased in the medium to high brightness range to improve the search speed.
[0094] Correspondingly, after the main control unit sends control commands to the light source driving unit, the light source driving unit sequentially switches to each group of brightness value combinations and returns status confirmation information after each switch. To ensure the lighting stability during subsequent image acquisition, the main control unit can set a stabilization waiting time or read the output stabilization flag in the drive feedback before proceeding to the next processing stage. For multi-channel lighting scenarios, the main control unit can also generate candidate sets using full combination traversal, partial combination traversal, or restricted combination traversal based on experience boundaries; for example, first fix the bright field brightness to traverse the dark field brightness, then fix the dark field brightness to refine the bright field brightness, or first perform a coarse search on the three color channels, and then perform a local fine search around the preliminary optimal area, thereby reducing the total number of traversals. Based on the above analysis, it can be seen that by changing the search for light source parameters from manual trial and error to a programmed traversal under the automatic control of the main control unit, a repeatable lighting test sequence can be established under different materials, different surface conditions, and different defect manifestations. This allows subsequent image acquisition and evaluation to be based on unified and traceable parameters, reducing inconsistencies in debugging caused by differences in human experience from the source.
[0095] S702. Under each combination of brightness values, the camera in the adaptive dimming system of the light source is triggered to acquire an image of the object under test.
[0096] In practice, after the light source driving unit switches to the current brightness value combination and completes stable output, the main control unit sends a trigger command to the camera. The camera then acquires an image of the current object under test according to the preset exposure time, gain parameters, and resolution parameters. To make brightness a primary variable, the camera's exposure, gain, white balance, and lens focal length remain constant throughout a single dimming process, unless recalibration is required due to a change in the detection task or workpiece type. Before triggering, the main control unit can receive position signals from production line sensors, fixture positioning mechanisms, or encoders to confirm that the object under test has entered the target shooting position. Once the position meets the requirements, image acquisition is performed to prevent incomparability of images at different brightness levels due to workpiece offset. For continuously conveying production line scenarios, the main control unit can also establish a synchronization relationship based on the conveyor belt speed and camera exposure sequence to ensure that the image acquisition areas corresponding to each brightness value combination remain consistent. For static shooting scenarios, the object under test can be fixed using a vacuum suction fixture, positioning pin, or clamping mechanism to avoid posture changes during traversal.
[0097] In one possible embodiment, the main control unit establishes a unique identifier for each combination of brightness values and binds and stores this identifier with the acquired image file or image cache address, thereby forming a one-to-one correspondence between brightness parameters and image results. If the system includes bright and dark field light sources, the camera is triggered only after the current bright and dark field combination takes effect; if the system also includes red, green, and blue three-color channels, the main control unit writes the current three-color brightness values along with the image timestamp, workpiece batch number, workstation number, and camera number into the detection record table. To reduce the impact of transient light source switching on the image, a stable delay of milliseconds to hundreds of milliseconds can be set after each switching, or image acquisition can be triggered after the drive current readback value reaches the target threshold. For highly reflective materials, the image acquisition can be performed after the highlight area is deviated from the key detection area by cooperating with the adjustable lamp holder angle of the second light source module; when a light shield is set on the adjustable lamp holder, the light shield can reduce stray light entering the imaging path, thereby enhancing the visibility of shallow defect edges.
[0098] Based on the above analysis, this step establishes a direct mapping relationship between lighting parameters and imaging results by making each combination of brightness values correspond to an independent, controlled, and traceable image acquisition process. This mapping relationship ensures that the input images used for subsequent model inference have a clear lighting source, reducing errors caused by missing parameter records, chaotic image correspondences, and workpiece position fluctuations that occur when manually switching lighting, thereby improving the reliability and repeatability of subsequent brightness optimization results.
[0099] S703. Use the deployed defect detection model to infer the collected images and obtain the evaluation index of defect detection.
[0100] The defect detection model is an image analysis model deployed in the main control unit, used to identify and quantify abnormal regions, defect categories, and their salience in the image of the object under test. This model can be a convolutional neural network model, an object detection model, a segmentation model, or a hybrid model combining traditional image processing with machine learning classifiers, as long as it can output data results reflecting the current image detection effect. Inference refers to using the trained model to perform forward computation on the input image to generate defect recognition results. The evaluation index refers to the data used to measure the defect detection effect under the current brightness value combination, which can be a single index or a combination of multiple indexes.
[0101] In practice, after acquiring the image, the main control unit first performs preprocessing, including size normalization, grayscale or color space conversion, distortion correction, noise suppression, region of interest cropping, and pixel value standardization, to ensure that the input data meets the format requirements of the defect detection model. Subsequently, the main control unit calls the model parameter file deployed in local memory, performs model inference on the processor, graphics processor, or dedicated inference acceleration unit, and outputs the category label, location coordinates, area information, and confidence score of each candidate defect in the current image.
[0102] Based on the above analysis, by performing model inference and quantifying the output evaluation index under each combination of brightness values, the response differences of different material surfaces to changes in illumination can be truly reflected in the detection results. This allows the system to no longer rely on fixed illumination parameters or human experience, but to evaluate imaging conditions based on actual defect identification capabilities, thus providing a data basis for the subsequent automatic selection of target brightness parameters.
[0103] S704. Based on the evaluation index, select the set of brightness values that optimizes the evaluation index from the traversed combinations of brightness values as the target brightness parameter.
[0104] Here, the target brightness parameter refers to the set of lighting parameters that, under the conditions of the current object under test, the current workstation, and the current detection model, is determined by comparing multiple combinations of brightness values to achieve the expected optimal state for defect detection. The optimal evaluation index refers to the result that, based on a preset comparison rule, has the highest evaluation value, is ranked highest, or meets priority conditions among all traversed combinations. This comparison rule can employ a single-index maximization approach or a multi-index hierarchical decision-making approach, such as first comparing the detection rate of key defects, and then comparing the overall confidence level and image quality penalty.
[0105] In practice, after completing image acquisition and model inference for all candidate brightness value combinations, the main control unit reads the evaluation indicators for each combination and establishes a mapping table between brightness value combinations and evaluation results. If the evaluation indicator is a single comprehensive score, the brightness value combination with the highest score is directly selected as the target brightness parameter. If the evaluation indicator consists of multiple sub-items, the main control unit sorts them according to a preset priority. For example, it first ensures that key defect categories are detected, then selects combinations with higher overall confidence, and then eliminates combinations with large overexposure or underexposure penalties. When the scores of multiple brightness value combinations are close or the same, the main control unit can continue to perform a fine neighborhood search, using the current optimal candidate combination as the center to reduce the step size and traverse again, or select a set with lower energy consumption, less heat generation, and more reasonable dynamic range occupation of the camera as the final result. After determining the target brightness parameter, the main control unit sends the parameter to the light source driving unit for output and writes it into the parameter cache of the current product model or current batch for subsequent continuous detection.
[0106] In one possible embodiment, the main control unit can also establish a parameter memory mechanism, storing the target brightness parameters corresponding to different materials, colors, surface processes, or historical batches in a database. When the same type of workpiece is brought online again, the main control unit first calls the historical target brightness parameters as the initial search center, and then performs a small-range traversal in its vicinity to shorten the dimming time. For multi-category co-production scenarios, the main control unit can automatically switch the target brightness parameter table after receiving a product model switching signal, and re-perform the traversal verification when inspecting the first piece to cope with imaging fluctuations caused by batch differences. If the system is equipped with a first light source module and a second light source module, the target brightness parameters can simultaneously include bright field brightness and dark field brightness; if the system has independent control capabilities for red, green, and blue colors, the target brightness parameters can also include independent level values for each color channel, thereby simultaneously adjusting the light intensity and spectral composition to adapt to the differences in the reflectivity of different materials at different wavelengths.
[0107] In this embodiment, the closed-loop linkage control of lighting adjustment, image acquisition and model evaluation by the main control unit transforms the traditional method of setting light source parameters based on manual experience into an automatic optimization method based on the feedback of detection results. This enables the imaging conditions under different materials, different process batches and different defect types to be dynamically optimized around the actual detection effect, thereby improving the adaptability, consistency and detection accuracy of automatic optical inspection in complex manufacturing environments, and providing a stable parameter basis for subsequent continuous batch inspection.
[0108] In some embodiments, the defect detection model is a deep learning-based instance segmentation model; the evaluation metrics include at least one of defect type, defect quantity, defect detection confidence, and grayscale contrast between defect area and background area.
[0109] The instance segmentation model is used to perform pixel-level defect recognition and region segmentation on the test object image captured by the camera and input to the main control unit. It can output the defect location while providing corresponding category information, instance boundaries, and probability values. In practical applications, the instance segmentation model can adopt the YOLOv11-seg model or a similar deep learning network, trained using pre-labeled defect samples. During training, multiple types of defect images on the surface of 3C exterior parts can be used as input, allowing the model to learn the defect boundary, texture, and grayscale variation features under different lighting conditions. In practical applications, other instance segmentation models can also be selected; this application embodiment does not limit this. In a specific implementation, the system loads a pre-trained instance segmentation model, such as the YOLOv11-seg model, into the video memory. This model can adopt a Feature Pyramid Network (FPN) and Path Aggregation Network (PAN) structure, enabling defect feature extraction at multiple scales. During initialization, the system needs to configure the model's inference thresholds, including the target confidence threshold and the intersection over union (IoU) threshold for non-maximum suppression (NMS), to ensure that the output flawed data has high statistical reliability.
[0110] Defect type is used to characterize the detected defect categories such as scratches, dirt, and oxidation spots; defect quantity is used to count the number of instances identified in the same image; defect detection confidence is used to reflect the model's reliability of the current recognition result; gray-level contrast between defect area and background area is used to characterize the significance of the defect relative to the background. Specifically, the defect detection confidence and gray-level contrast between defect area and background area are quantified in the following way: 1) Extract the confidence scores of all defect detection targets output by the defect detection model in the current round, denoted as {c1, c2, ..., c...}. k}, where k refers to the total number of defect detection targets, and the confidence evaluation function F conf Take its weighted average or maximum value, i.e., F conf =max(c i ) or F conf =average(c i ), where i refers to the i-th defect detection target. The higher the confidence level of defect detection, the stronger the ability of the current light source parameters to highlight the features of the defect. 2) Using the pixel-level mask generated by the instance segmentation model, calculate the absolute difference between the average gray level μdefect of the pixels in the defect area and the average gray level μbg of the background area within a radius of N pixels around the defect, i.e., F contrast=|μdefect-μbg|, this index quantifies the physical contrast intensity between the defect and the background, the larger the difference, the more obvious the defect.
[0111] For example, to handle the extremely high-dimensional parameter space, the system initializes the "scan step size" by discretizing the continuous brightness space of the R, G, and B channels of the light source module from level 0 to 255. For instance, setting the step size S=32 constructs a search grid containing discrete nodes {0, 32, 64, ..., 255}, which serves as the basic sampling points for adaptive iteration. After initialization, the system enters the core adaptive optimization loop. Specifically, based on the current parameter combination, the system sets the brightness of each channel of the light source module, such as the first and second light source modules. For example, for each group of modules, the brightness value R of the red channel needs to be independently distributed. val The brightness value G of the green channel val And the brightness value B of the blue channel val Three bytes of control information; if the system involves n light source sub-modules, the control command frame generated by the system will contain 3×(n+1) independent brightness adjustment commands; after receiving the command frame, the light source driving unit adjusts the duty cycle of the corresponding LED driving current through PWM technology to ensure that the light source brightness responds and reaches stability within microseconds.
[0112] Furthermore, after the light source stabilizes, the main control unit synchronously triggers the camera to perform exposure via an external hardware trigger signal, such as a Transistor-Transistor Logic (TTL) level signal. The physical light signal acquired by the camera is converted into a digital image signal and transmitted to the main control unit via Gigabit Ethernet (GigaE) or Universal Serial Bus 3.0 (USB3.0). The image is converted into a tensor format that conforms to the model input, with dimensions represented as [N, C, H, W], where N is the batch size, C is the number of color channels, H is the image height, and W is the image width. In this embodiment, N=1 and C=3 (corresponding to RGB three channels).
[0113] Furthermore, the acquired image tensors are input into the YOLOv11-seg model, which performs layer-by-layer convolution and downsampling through the backbone network to extract the deep semantic features of the defects. In the detection head part, the model outputs the defect classification result L, center point coordinates (x, y), bounding box size (w, h), and accurate instance segmentation mask M. The inference results under each set of lighting parameters are recorded in a structured manner, and each record contains a composite data structure, such as Entry={Parameters(A rgb Brgb ), DetectResult(Types, Counts, Indices), MetricValue(F conf F contrast )}, where A rgb This refers to the brightness values of the R, G, and B channels of the first light source module, where B... rgb This refers to the brightness values of the R, G, and B channels of the second light source module. Types refers to the set of defect types, Counts refers to the number of defects of each type, Indices refers to defect index / location information, and F... conf This refers to the confidence level of defect detection, F. contrast This refers to the grayscale contrast between the defective area and the background area. This data is stored in real time in the system's temporary buffer or database as raw material for decision comparison. Correspondingly, after each round, the comparison judgment logic is invoked to compare the evaluation index obtained in the current round with the historical best value, and decide whether to update the current optimal brightness value combination based on the comparison result.
[0114] In some embodiments, based on evaluation metrics, a set of brightness value combinations that optimizes the evaluation metrics is selected as the target brightness parameter from the traversed brightness value combinations. This includes: comparing the evaluation metrics of the current brightness value combination with those of the current optimal brightness value combination, according to a priority order of defect type first, defect quantity second, and overall evaluation score third. If the number of defect types detected under the current brightness value combination is greater than the number of defect types detected under the current optimal brightness value combination, then the current brightness value combination is updated to the current optimal brightness value combination; if the number of defect types detected under the current brightness value combination is equal to the number of defect types detected under the current optimal brightness value combination... If the number of defects detected under the current brightness value combination is greater than the total number of defects detected under the current optimal brightness value combination, then the current brightness value combination is updated to the current optimal brightness value combination. If the number of defect types and the total number of defects detected under the current brightness value combination are both equal to the number of defect types and the total number of defects detected under the current optimal brightness value combination, and the overall evaluation score of the current brightness value combination is higher than the overall evaluation score of the current optimal brightness value combination, then the current brightness value combination is updated to the current optimal brightness value combination. After the traversal is completed, the current optimal brightness value combination is used as the target brightness parameter.
[0115] Among them, the defect type refers to the different defect categories identified by the defect detection model, the total number of defects refers to the cumulative number of defects detected in each type, the comprehensive evaluation score is an evaluation value used to further characterize the image detectability and defect visibility under the same conditions as the aforementioned two; the current optimal brightness value combination is the candidate brightness parameter temporarily stored by the main control unit during the traversal process, and the target brightness parameter is the final dimming parameter output to the light source driving unit after the traversal is completed.
[0116] In this embodiment, the main control unit receives images captured by the camera and calls the defect detection model deployed within it to complete inference. The model outputs the defect category, quantity, and corresponding comprehensive evaluation score for images under different brightness value combinations. The main control unit compares the currently traversed brightness value combination with the recorded current optimal brightness value combination item by item. When more types of defects are detected, the optimal combination is directly updated; when the number of defect types is the same but the total number of defects is greater, the optimal combination is updated again; when both are the same but the comprehensive evaluation score is higher, the optimal combination is updated again, thereby making the final parameters more conducive to covering more defect types and enhancing detection capabilities.
[0117] For example, first compare the types of defects. If the current combination of brightness values detects defect type T... curr The number of defect types T detected under the current optimal brightness value combination best That is, T curr >T best If the current brightness value combination is updated to the current optimal brightness value combination, then if the defect types are equal, the total number of defects is further compared. If the total number of defects detected under the current brightness value combination is C... curr The total number of defects C detected under the current optimal brightness value combination best C curr >C best This indicates that the current lighting can expose more tiny imperfection instances, thus being considered superior. Furthermore, if the number and total number of imperfection types detected under the current brightness value combination are equal to those detected under the current optimal brightness value combination, a "comprehensive evaluation score" is introduced as the basis for refined judgment. If the comprehensive evaluation score of the current brightness value combination is higher than that of the current optimal brightness value combination, then the current brightness value combination is updated to the current optimal brightness value combination; otherwise, the current optimal brightness value combination is not updated.
[0118] Correspondingly, after each round of comparison, if the preset step size traversal space has not been completed (i.e., all discrete brightness node combinations have not been exhausted), a new brightness value combination instruction is issued to continue traversal and inference. If the search grid has been exhausted, or no better solution has been found after K consecutive iterations (satisfying the preset convergence criterion), the loop is exited. When the loop terminates, the set of brightness value combinations that exposes the defects most comprehensively (i.e., the largest number of defect types and the highest overall evaluation score) is extracted from the historical record library. This brightness value combination represents the "globally optimal optical response scheme" for the physical properties of the material of the current object being measured, and this scheme is output.
[0119] It should be noted that the solution in this application is also applicable to complex light source systems with n light source sub-modules. Specifically, when the system contains multiple light source sub-modules (e.g., multiple bright field modules, multiple dark field modules, or a combination of bright and dark field modules), the system defines the total search space as a hyperspace composed of (n+1) three-dimensional vectors. In the initialization and adaptive setting steps, discrete step size points are mapped to the control bus of each module through high-dimensional tensor mapping logic. Due to the introduction of a defect detection model, the system can automatically lock the optimal wavelength and intensity ratio that can excite specific optical physical characteristics of the defect surface (such as diffuse reflection edge enhancement, specular reflection elimination, etc.) within this huge combination space.
[0120] Furthermore, throughout the core dimming process, the defect detection model, such as YOLOv11-seg, not only performs basic visual classification tasks, but its output defect detection confidence and segmentation accuracy directly determine the convergence direction of the dimming search algorithm. This model sensitively captures pixel gradient changes in the image and evaluates the feature signal-to-noise ratio under current lighting conditions in real time in the background. Based on the clarity of features reported by the model, the density of the search grid can be dynamically adjusted. For example, the step size can be reduced in areas where confidence rises rapidly for refined scanning, while the step size can be increased in areas where confidence changes are gradual to improve search efficiency. Through this interactive mechanism of "algorithm guiding light source, light source feeding back to algorithm," deep collaboration and closed-loop optimization between light source parameters and the artificial intelligence detection model are achieved.
[0121] In this embodiment, the aforementioned comparison rules ensure the coverage of defect categories during brightness optimization, while also considering the number of detected defects. Finally, a comprehensive evaluation score is used for refined selection, avoiding localized optimization bias caused by relying solely on a single score. This approach directly correlates the target brightness parameter with the actual defect detection effect, improving the consistency of dimming and detection stability across different workpieces and surface conditions, and further reducing the influence of human experience on parameter selection.
[0122] In some embodiments, the comprehensive evaluation score is a weighted sum of the confidence level of defect detection and the grayscale contrast between the defect area and the background area.
[0123] The comprehensive evaluation score is a ranking parameter formed by the main control unit after performing defect detection and reasoning on the images captured by the camera. It is used to further compare the merits of different brightness combinations when the types and total number of defects are the same.
[0124] In practical implementation, after the main control unit performs inference on the image returned by the camera, it extracts the confidence score of defect detection for each defective target, and combines it with the grayscale contrast between the corresponding defective region and the background region, performing a weighted sum according to preset weight coefficients. For example, the comprehensive evaluation score F... score Satisfying the formula: Here, w1 and w2 are weighting coefficients, which can be configured according to the material of the object being tested, its surface reflectivity, and the characteristics of defect visibility. For example, when more emphasis is placed on detection reliability, the weighting coefficient w1 corresponding to confidence level is increased; when more emphasis is placed on defect salience, the weighting coefficient w2 corresponding to grayscale contrast level is increased. These weighting coefficients can be stored in the main control unit's memory and are retrieved for calculation when iterating through different combinations of brightness values. This comprehensive evaluation score is used to form a single, comparable evaluation metric for the current combination of brightness values. When the types and total number of defects are consistent, the main control unit selects the brightness parameters that are more conducive to defect identification based on this score. Because this score considers both the reliability of the model output and the degree of separability between defects and the background in the image, it enables the light source driving unit to obtain a more stable selection criterion when iterating through multiple combinations of brightness values.
[0125] Correspondingly, if the number of defect types and the total number of defects detected under the current brightness value combination are equal to the number of defect types and the total number of defects detected under the current optimal brightness value combination, then if the comprehensive evaluation score F of the current brightness value combination is... score If the overall evaluation score is higher than the current optimal brightness value combination, then the "historical best register" is refreshed, and the current brightness value combination is recorded as the best candidate, that is, the current brightness value combination is updated to the current optimal brightness value combination.
[0126] With this implementation method, the comprehensive evaluation score no longer depends solely on a single recognition result, but incorporates both detection confidence and grayscale contrast into the judgment. This enables the main control unit to select target brightness parameters more accurately under different materials, different reflective conditions, and different defect types, thereby improving the stability, adaptability, and defect detection consistency of the adaptive dimming of the light source.
[0127] Based on the above embodiments, in some embodiments, the adaptive dimming method for the light source further includes: fixing the target brightness parameters into the production configuration file as the basis for setting the light source during the online testing phase.
[0128] The production configuration file is a configuration data file used to store the target brightness parameters. Its function is to fix the finally selected brightness parameters so that the main control unit can directly call them during subsequent testing. This file can be stored in the main control unit's memory or written to the local directory of an external industrial control computer or edge computing box.
[0129] In this embodiment, after determining the target brightness parameters based on the defect detection model, the main control unit writes these parameters into the production configuration file and updates, saves, or overwrites the original parameter records to form a reusable set of production parameters. When the online detection phase begins, the main control unit reads the target brightness parameters from the production configuration file and sends a brightness setting command to the light source driver unit accordingly. This causes the light source module to output illumination according to the solidified parameters, thereby avoiding repeated debugging and maintaining consistent detection conditions across different batches.
[0130] In this embodiment, by fixing the target brightness parameters to the production configuration file, the optimized target brightness parameters can be stably reused in mass production scenarios. The main control unit can directly complete the light source setting without re-traversing the parameter combinations before each online inspection, thereby shortening the time for model changeover and production recovery. Since the production configuration file has a fixed saving function for parameters, it can reduce parameter drift caused by human intervention, thereby improving the consistency of images acquired by the camera and enabling the defect detection model to obtain more stable input conditions during the online inspection stage, thereby improving detection stability and batch consistency.
[0131] For example, Figure 8 This is a schematic diagram illustrating the adaptive light source detection results provided for an exemplary embodiment of this application. (See diagram below.) Figure 8 As shown, Figure 8 (a) Figure 8 (b) and Figure 8 (c) in the figure shows the images of the object under three different light source combinations. Figure 8 (d) Figure 8 (e) and Figure 8 (f) in the following order are Figure 8 (a) Figure 8 (b) and Figure 8 A magnified view of the area within the box (c) in the image.
[0132] The specific parameters for the combination of the three light sources are as follows:
[0133] Figure 8 (a) and Figure 8 (d) in the text corresponds to: the light source parameters of the first light source module are RGB=(255, 0, 0), and the light source parameters of the second light source module are RGB=0 (i.e., the second light source module is off).
[0134] Figure 8 (b) and Figure 8 (e) in the text corresponds to: the light source parameters of the first light source module are RGB=(87, 143, 168), and the light source parameters of the second light source module are RGB=0 (i.e., the second light source module is off).
[0135] Figure 8 (c) and Figure 8 (f) in the figure corresponds to: the light source parameters of the first light source module are RGB=(50, 50, 50), and the light source parameters of the second light source module are RGB=(80, 80, 80).
[0136] Accordingly, from Figure 8 (d) Figure 8 (e) and Figure 8 As shown in the magnified view (f), the appearance of defects varies significantly under different combinations of light sources. Figure 8 In the image corresponding to (e) (i.e., the light source parameters of the first light source module are RGB=(87, 143, 168), and the second light source module is off), the flaw features are quite obvious. Within the boxed area, the boundaries of flaws in both mirrored and non-mirrored objects exhibit clear contrast. Figure 8 (d) and Figure 8 In the image corresponding to (f), the clarity of the blemish is relatively low. The above comparison results show that the adaptive light source dimming system and method provided in this application can automatically optimize the most suitable light source parameters for different materials and blemish types, thereby significantly improving the imaging contrast and detection and recognition rate of blemishes, fully demonstrating the advantages of the adaptive light source design in this application.
[0137] Figure 9 This is a schematic diagram of a light source adaptive dimming device provided as an exemplary embodiment of this application. The light source adaptive dimming device provided in this embodiment is applied to the main control unit of a light source adaptive dimming system as described in any of the above embodiments. Figure 9 As shown, the adaptive dimming device 90 includes a control module 91, a trigger module 92, an inference module 93, and a processing module 94, wherein:
[0138] Control module 91 is used to control the light source driving unit in the light source adaptive dimming system to automatically traverse multiple sets of brightness value combinations with a preset step size;
[0139] Trigger module 92 is used to trigger the camera in the adaptive dimming system of the light source to acquire the image of the object under each combination of brightness values;
[0140] The inference module 93 is used to infer the acquired images using the deployed defect detection model to obtain the evaluation index of defect detection.
[0141] The processing module 94 is used to select the set of brightness values that optimizes the evaluation index from the traversed brightness value combinations as the target brightness parameter.
[0142] In one possible implementation, the defect detection model is a deep learning-based instance segmentation model; the evaluation metrics include at least one of defect type, defect quantity, defect detection confidence, and grayscale contrast between the defect area and the background area.
[0143] In one possible implementation, the processing module 94 can be specifically used to: compare the evaluation indicators of the current brightness value combination with the current optimal brightness value combination according to the priority order of defect type, defect quantity, and comprehensive evaluation score: if the number of defect types detected under the current brightness value combination is more than the number of defect types detected under the current optimal brightness value combination, then update the current brightness value combination to the current optimal brightness value combination; if the number of defect types detected under the current brightness value combination is equal to the number of defect types detected under the current optimal brightness value combination, and the total number of defect types detected under the current brightness value combination is greater than the total number of defect types detected under the current optimal brightness value combination, then update the current brightness value combination to the current optimal brightness value combination; if the number of defect types and the total number of defect types detected under the current brightness value combination are both equal to the number of defect types and the total number of defect types detected under the current optimal brightness value combination, and the comprehensive evaluation score of the current brightness value combination is higher than the comprehensive evaluation score of the current optimal brightness value combination, then update the current brightness value combination to the current optimal brightness value combination; after traversal, use the current optimal brightness value combination as the target brightness parameter.
[0144] In one possible implementation, the comprehensive evaluation score is a weighted sum of the confidence level of defect detection and the grayscale contrast between the defect area and the background area.
[0145] In one possible implementation, the processing module 94 may be specifically used to: solidify the target brightness parameters into the production configuration file as the basis for setting the light source during the online testing phase.
[0146] The adaptive dimming device for light sources provided in this application can execute the technical solution shown in the above-described adaptive dimming method for light sources. Its implementation principle and beneficial effects are similar, and will not be described again here.
[0147] It should be noted that the division of the various modules in the above device is merely a logical functional division. In actual implementation, they can be fully or partially integrated into a single physical entity, or they can be physically separated. Furthermore, these modules can be implemented entirely in software via processing element calls; they can be fully implemented in hardware; or some modules can be implemented by processing element calls to software, while others are implemented in hardware. For example, a processing module can be a separate processing element, or it can be integrated into a chip within the device. Alternatively, it can be stored as program code in the device's memory, and its functions can be called and executed by a processing element. The implementation of other modules is similar. Moreover, these modules can be fully or partially integrated together, or they can be implemented independently. The processing element here can be an integrated circuit with signal processing capabilities. During implementation, each step of the above method or each of the above modules can be completed through integrated logic circuits in the hardware of the processor element or through software instructions.
[0148] For example, these modules can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more Digital Signal Processors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs). As another example, when a module is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these modules can be integrated together as a System-On-a-Chip (SOC).
[0149] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., Digital Video Discs, DVDs), or semiconductor media (e.g., solid-state disks (SSDs)).
[0150] Figure 10 A schematic diagram of the main control unit provided for an exemplary embodiment of this application. (See diagram below.) Figure 10 As shown, the main control unit 15 in this embodiment includes:
[0151] At least one processor 151; and a memory 152 communicatively connected to the at least one processor;
[0152] The memory 152 stores instructions that can be executed by at least one processor 151 to cause the electronic device to perform the method as described in any of the above embodiments.
[0153] Alternatively, the memory 152 can be either standalone or integrated with the processor 151.
[0154] The memory 152 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device.
[0155] Processor 151 may be a Central Processing Unit (CPU), an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application. Specifically, when implementing the adaptive dimming method for light sources described in the foregoing method embodiments, the electronic device may be, for example, an electronic device with processing capabilities such as a server.
[0156] Optionally, the electronic device may also include a communication interface 153. In specific implementations, if the communication interface 153, memory 152, and processor 151 are implemented independently, they can be interconnected via a bus to complete communication. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc., but this does not imply that there is only one bus or one type of bus.
[0157] Optionally, in a specific implementation, if the communication interface 153, memory 152 and processor 151 are integrated on a single chip, then the communication interface 153, memory 152 and processor 151 can communicate through an internal interface.
[0158] The implementation principle and technical effects of the electronic device provided in this embodiment can be found in the foregoing embodiments, and will not be repeated here.
[0159] This application also provides a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are executed, they are used to implement the method steps as described in the above method embodiments. The specific implementation methods and technical effects are similar, and will not be repeated here.
[0160] The aforementioned computer-readable storage media can be implemented from any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0161] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an application-specific integrated circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in a light source adaptive dimming device.
[0162] This application also provides a computer program product, including a computer program, which, when executed, implements the method steps as described in the above method embodiments. The specific implementation and technical effects are similar and will not be repeated here.
[0163] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification.
[0164] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0165] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope.
Claims
1. A light source adaptive dimming system, characterized in that, include: case; A light source module, installed in the housing, is used to generate an illumination beam. The light source module includes at least a first light source module and a second light source module. The first light source module is arranged in the inner ring of the housing to provide bright field illumination, and the second light source module is arranged around the perimeter of the housing to provide dark field illumination. A light source driving unit, connected to the light source module, is used to adjust the brightness value of the light source module; A camera, mounted on the housing, is used to acquire images of the object being measured; The main control unit, connected to the light source driving unit and the camera, and equipped with a defect detection model, is configured as follows: The light source driving unit is controlled to automatically traverse multiple sets of brightness value combinations with a preset step size; the preset step size refers to the interval parameter between adjacent brightness values when performing discretization search within the adjustable brightness range, and the interval parameter is a fixed value or set to different values according to different brightness ranges. Under each combination of brightness values, the camera is triggered to acquire an image, and the defect detection model is used to infer the image to obtain the evaluation index of defect detection. Based on the evaluation index, select the set of brightness values that optimizes the evaluation index from the traversed sets of brightness values as the target brightness parameter; The target brightness parameter refers to the set of lighting parameters that can achieve the expected optimal state of defect detection effect after comparing multiple sets of brightness value combinations under the current test object, current workstation and current detection model conditions; the optimal evaluation index refers to the result that has the highest evaluation value, the highest ranking, or meets the priority condition among all traversed combinations based on preset comparison rules.
2. The adaptive dimming system for a light source according to claim 1, characterized in that, The second light source module includes an adjustable lamp holder, which is rotatably mounted on the housing to adjust the illumination angle.
3. The adaptive dimming system for a light source according to claim 2, characterized in that, The adjustable lamp holder is equipped with a light shield.
4. The adaptive dimming system for a light source according to any one of claims 1 to 3, characterized in that, The light source module includes independently controlled red, green, and blue light-emitting diode channels; the light source driving unit is used to adjust the brightness values of the red, green, and blue light-emitting diode channels respectively, and the brightness adjustment range of each channel is 0 to 255 levels.
5. A method for adaptive dimming of a light source, characterized in that, The main control unit applied in any one of the light source adaptive dimming systems as described in claims 1 to 4, wherein the light source adaptive dimming method comprises: The light source driving unit in the adaptive dimming system is controlled to automatically traverse multiple sets of brightness value combinations with a preset step size; the preset step size refers to the interval parameter between adjacent brightness values when performing discretization search within the adjustable brightness range, and the interval parameter is a fixed value or set to different values according to different brightness ranges. Under each combination of brightness values, the camera in the adaptive dimming system of the light source is triggered to acquire an image of the object under test; The deployed defect detection model is used to infer the collected images to obtain the evaluation index of defect detection; Based on the evaluation index, the set of brightness values that optimizes the evaluation index is selected from the traversed brightness value combinations as the target brightness parameter; the target brightness parameter refers to the set of lighting parameters that can achieve the expected optimal state of defect detection effect after comparing multiple sets of brightness value combinations under the current test object, current workstation and current detection model conditions; the optimal evaluation index refers to the result that has the highest evaluation value, the highest ranking, or meets the priority condition among all traversed combinations based on the preset comparison rules.
6. The adaptive dimming method for a light source according to claim 5, characterized in that, The defect detection model is a deep learning-based instance segmentation model; the evaluation metrics include at least one of defect type, defect quantity, defect detection confidence, and grayscale contrast between defect area and background area.
7. The adaptive dimming method for a light source according to claim 6, characterized in that, The step of selecting the optimal set of brightness values from the traversed combinations of brightness values as the target brightness parameter, based on the evaluation index, includes: The evaluation metrics are compared with the current combination of brightness values, following the priority order of defect type, defect quantity, and overall evaluation score: If the number of defect types detected under the current brightness value combination is greater than the number of defect types detected under the current optimal brightness value combination, then the current brightness value combination will be updated to the current optimal brightness value combination. If the number of defects detected under the current brightness value combination is equal to the number of defects detected under the current optimal brightness value combination, and the total number of defects detected under the current brightness value combination is greater than the total number of defects detected under the current optimal brightness value combination, then the current brightness value combination will be updated to the current optimal brightness value combination. If the number of defect types and the total number of defects detected under the current brightness value combination are equal to the number of defect types and the total number of defects detected under the current optimal brightness value combination, and the overall evaluation score of the current brightness value combination is higher than the overall evaluation score of the current optimal brightness value combination, then the current brightness value combination will be updated to the current optimal brightness value combination. After the traversal is complete, the current optimal brightness value combination is used as the target brightness parameter.
8. The adaptive dimming method for a light source according to claim 7, characterized in that, The comprehensive evaluation score is a weighted sum of the confidence level of the defect detection and the grayscale contrast between the defect area and the background area.
9. The adaptive dimming method for a light source according to any one of claims 5 to 8, characterized in that, Also includes: The target brightness parameters are fixed into the production configuration file to serve as the basis for setting the light source during the online testing phase.
10. A light source adaptive dimming device, characterized in that, The main control unit applied in the adaptive dimming system for light sources as described in any one of claims 1 to 4, wherein the adaptive dimming device for light sources comprises: The control module is used to control the light source driving unit in the light source adaptive dimming system to automatically traverse multiple sets of brightness value combinations with a preset step size; the preset step size refers to the interval parameter between adjacent brightness values when performing discretization search within the adjustable brightness range, and the interval parameter is a fixed value or set to different values according to different brightness ranges. The trigger module is used to trigger the camera in the adaptive dimming system of the light source to acquire the image of the object under each combination of brightness values. The inference module is used to infer the acquired images using the deployed defect detection model to obtain evaluation metrics for defect detection. The processing module is used to select, based on the evaluation index, a set of brightness value combinations that optimizes the evaluation index from the traversed combinations of brightness values as the target brightness parameter; the target brightness parameter refers to the set of lighting parameters that, under the conditions of the current object under test, the current workstation, and the current detection model, are determined by comparing multiple sets of brightness value combinations and can achieve the expected optimal state for defect detection. The optimal evaluation index refers to the result that has the highest evaluation value, the highest ranking, or meets the priority condition among all traversed combinations, based on preset comparison rules.
11. A main control unit, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory is used to store computer-executed instructions; The processor is configured to execute the computer execution instructions to implement the method as described in any one of claims 5-9.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed, are used to implement the method as described in any one of claims 5-9.
Citation Information
Patent Citations
Product defect detection light source compensation method and system
CN116008276A
Light source intensity adjusting method and system for surface defect detection
CN119603832A
Visual inspection system and method for tiny flaws of industrial products
CN120612327A
