Product detection method and system based on machine vision

By dynamically adjusting the light source parameters and selecting the appropriate wavelength range, combined with the deep learning model on edge devices, the problems of uneven light illumination and unreasonable wavelength selection in the existing technology are solved, and high-precision and high-efficiency product defect detection are achieved.

CN119323659AActive Publication Date: 2025-01-17NANAN BADUO BUILDING MATERIALS CO LTD

Patent Information

Application Number
CN202411866544.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-01-17
Estimated Expiration
2044-12-18

AI Technical Summary

Technical Problem

The existing machine vision detection system has shortcomings in lighting conditions adaptability, wavelength range selection and real-time processing capabilities, resulting in unstable and inaccurate detection results.

Method used

By initializing the ambient light sensor to evaluate the initial lighting conditions, dynamically adjust the light source parameters, select the appropriate wavelength range to configure the spectral imaging system, and deploy deep learning models on edge devices for preliminary defect detection and classification, and finally transmit the results to the cloud for integration.

Benefits of technology

It realizes stable high-quality image acquisition under different lighting conditions, improves detection accuracy and efficiency, enhances the accuracy of defect detection and the intelligence level of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119323659A_ABST
    Figure CN119323659A_ABST
Patent Text Reader

Abstract

The invention discloses a product detection method and system based on machine vision, and relates to the technical field of machine vision, and the method comprises the steps: initializing an ambient light sensor, evaluating an initial illumination condition, and dynamically adjusting a light source parameter to verify and lock an optimal setting; selecting a preset wavelength range to configure a spectral imaging system to collect image data according to the characteristics of the building material, performing primary processing and image synthesis to obtain a comprehensive spectral image, and performing feature extraction to obtain a high-quality image data set; preprocessing an image data set on edge equipment, deploying a deep learning model to carry out preliminary defect detection, identifying and marking defect types, and extracting local and frequency domain features; and refining defect types by using a classification algorithm according to the preliminary detection result, integrating a final classification result and image data, and transmitting to a cloud to complete detection. According to the invention, high-precision and high-efficiency product defect detection is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of machine vision, and in particular to a product detection method and system based on machine vision. Background Art

[0002] Machine vision technology has made significant progress in recent years in the fields of industrial inspection, quality control, and automated production. Traditional rule-based image processing methods have gradually been replaced by data-driven deep learning algorithms, which can more accurately identify complex patterns and subtle defects. In particular, in the detection of building materials, multispectral and hyperspectral imaging systems have attracted much attention due to their ability to capture material properties at different wavelengths. These systems not only provide rich spectral information, but also improve the ability to analyze the surface and internal structure of materials through high-resolution imaging. However, most of the early machine vision inspection methods rely on fixed light source settings and single-wavelength image acquisition, which leads to instability and inaccuracy in inspection results under different lighting conditions and material properties. With the advancement of ambient light sensors and tunable light source technology, it is possible to dynamically adjust light source parameters, thereby improving image quality and inspection accuracy. In addition, the application of edge computing devices enables real-time processing and preliminary classification to be completed efficiently in resource-constrained environments, further enhancing the response speed and practicality of the system.

[0003] Although the existing technology has made certain achievements in some aspects, there are still many deficiencies in practical applications. First, the existing machine vision inspection system usually fails to fully consider the changes in ambient lighting conditions, resulting in uneven or too strong / weak lighting during image acquisition. This fluctuation in lighting conditions directly affects the quality of the image, which in turn affects the accuracy of feature extraction and defect detection. To solve this problem, some systems use fixed light sources or simple lighting compensation mechanisms, but these methods cannot adapt to complex changes in the on-site environment, limiting their application scenarios. Secondly, the existing technology often lacks pertinence when selecting the wavelength range and fails to make full use of the spectral characteristics of the material for optimal configuration. Different building materials have significant differences in reflectivity and absorptivity at specific wavelengths, so choosing a suitable wavelength range is crucial to improving detection accuracy. However, many systems rely only on experience or preset wavelength ranges, ignoring individual differences in material properties, resulting in less than ideal detection results. In addition, the existing technology also has limitations in real-time processing and preliminary classification. Due to the limited resources of edge devices, traditional deep learning models are difficult to deploy directly and run efficiently, resulting in insufficient real-time processing capabilities. Even if some lightweight models can run on edge devices, their feature extraction and classification effects are often unsatisfactory and cannot meet the needs of high-precision detection.

[0004] In summary, the existing machine vision detection technology has obvious deficiencies in terms of adaptability to lighting conditions, wavelength range selection, and real-time processing capabilities. In response to these problems, the present invention proposes a product detection method based on machine vision, which aims to initialize the ambient light sensor and evaluate the initial lighting conditions, dynamically adjust the light source parameters, verify and lock the optimal lighting settings, thereby ensuring stable high-quality image acquisition. At the same time, a preset wavelength range is selected according to the characteristics of the building material, and a high-resolution multi-spectral or hyper-spectral camera and a tunable filter or a linear variable filter are used to obtain the best material characterization and comprehensive spectral image. On this basis, the present invention also pre-processes the high-quality image data set on the edge device, deploys a deep learning model for preliminary defect detection, and combines the classification algorithm to refine the defect type, and finally integrates the classification results and their corresponding image data and transmits them to the cloud to achieve a complete detection process. The present invention belongs to the field of machine vision and intelligent detection technology, and is particularly suitable for high-precision defect detection of complex materials such as building materials. Summary of the invention

[0005] The purpose of this section is to summarize some aspects of embodiments of the present invention and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section and the specification abstract and the invention title of this application to avoid blurring the purpose of this section, the specification abstract and the invention title, and such simplifications or omissions cannot be used to limit the scope of the present invention.

[0006] In view of the above existing problems, the present invention is proposed.

[0007] Therefore, the present invention provides a product inspection method and system based on machine vision, which can solve the problems mentioned in the background technology.

[0008] In order to solve the above technical problems, the present invention provides the following technical solutions: In a first aspect, the present invention provides a method for product inspection based on machine vision, which includes initializing an ambient light sensor and evaluating initial lighting conditions, dynamically adjusting light source parameters, and verifying and locking optimal lighting settings; Selecting a preset wavelength range according to the characteristics of the building materials, configuring a spectral imaging system and collecting image data of the building materials to obtain material representations, performing preliminary processing and image synthesis on the material representations to obtain a comprehensive spectral image, performing feature extraction on the comprehensive spectral image to obtain a high-quality image data set; Preprocessing the high-quality image data set on the edge device, deploying a deep learning model, using the deep learning model to perform preliminary defect detection on the preprocessed image data, identifying and marking various types of defects, and extracting local features and frequency domain features to obtain preliminary detection results; According to the preliminary detection results, a classification algorithm is applied to refine the defect type to obtain a final classification result, and the final classification result and its corresponding image data are integrated and transmitted to the cloud to complete the detection.

[0009] As a preferred solution of the product inspection method based on machine vision of the present invention, the evaluating initial lighting conditions includes: Deploy and initialize the integrated ambient light sensor, set the ambient light sensor measurement frequency and range, and perform an initial assessment of the light intensity and color temperature of the current environment before starting image acquisition to obtain the initial lighting condition assessment results and record the initial lighting conditions.

[0010] As a preferred solution of the product detection method based on machine vision of the present invention, the dynamic adjustment of light source parameters includes: According to the initial lighting condition evaluation result, the basic parameters of the light source are set, and the basic parameters of the light source include brightness, angle and color temperature. The changes of ambient light are continuously monitored through the real-time monitoring mode, and the light source parameters are compensated. The calculation formula of the lighting compensation function is as follows: ; in, is the illumination compensation function, is the target light intensity, is the ambient light intensity at wavelength The measured value below is the color temperature, It is a correction function, which is set by considering the influence of different color temperatures on different wavelengths. The calculation formula of this function is as follows: ; in, is an empirical constant, determined experimentally, is the reference wave.

[0011] As a preferred solution of the product inspection method based on machine vision of the present invention, the verifying and locking the optimal lighting setting includes: After completing the light source parameter adjustment, verify whether the lighting quality meets the expected standards through the preset standard test program or reference image, and lock the current light source parameter settings.

[0012] As a preferred solution of the product detection method based on machine vision of the present invention, the step of selecting a preset wavelength range according to the characteristics of the building material includes: Select a preset wavelength range based on the characteristics of the building material, and set a high-resolution multispectral or hyperspectral camera and a tunable filter or a linear variable filter. The wavelength range selection calculation formula is as follows: ; in, is the weight coefficient for each wavelength, is the wavelength of the material The reflectivity under is the average reflectance at all wavelengths, is the standard deviation of reflectivity; At the same time, a weighted synthesis function is introduced , used to synthesize image data from different wavelengths, the calculation formula is as follows: ; in, is the weighted synthesis function, is at wavelength The intensity of the image captured below, is the weight coefficient for each wavelength, is a tuning factor used to control the degree of nonlinear response. is the reference image intensity and N is the number of wavelengths.

[0013] As a preferred solution of the product inspection method based on machine vision of the present invention, the material characterization includes multi-dimensional information reflecting the material characteristics; Preliminary processing and image synthesis for the material characterization includes: Capture image data of building materials within a preset wavelength range, perform preliminary data cleaning and formatting, and store them in a local or cloud database; Image synthesis and feature extraction include: Combining image data from different wavelengths into a full-color image; Apply signal processing techniques to extract key parameters reflecting material properties from full-color images, including absorptivity, reflectivity, and texture features; The texture features include contrast, correlation, energy and entropy, and the calculation formula is as follows: ; Among them, C1 is contrast, C2 is correlation, E1 is energy, E2 is entropy, is an element in the gray-level co-occurrence matrix, indicating the probability of occurrence of pixel pairs with pixel values ​​i and j. is the average gray value, is the standard deviation.

[0014] As a preferred solution of the product inspection method based on machine vision of the present invention, the identifying and marking of various types of defects includes: Use the deployed lightweight deep learning model to perform real-time feature extraction on pre-processed image data; Identify and mark various types of defects. The specific formula is as follows: ; in, is the probability of defect existence, W is the model weight matrix, T is the transpose of the weight matrix W, F is the extracted feature vector, b is the bias term, is the sigmoid function, which is used to convert the output into a probability value.

[0015] In a second aspect, the present invention provides a product inspection system based on machine vision, which includes: an illumination compensation module, an image extraction module, a defect classification module and a final inspection module; The illumination compensation module is used to initialize the ambient light sensor and evaluate the initial illumination conditions, dynamically adjust the light source parameters, and verify and lock the optimal illumination settings; The image extraction module is used to select a preset wavelength range according to the characteristics of the building materials, configure the spectral imaging system and collect image data of the building materials to obtain material representation, perform preliminary processing and image synthesis on the material representation to obtain a comprehensive spectral image, perform feature extraction on the comprehensive spectral image to obtain a high-quality image data set; The defect classification module is used to preprocess the high-quality image data set on the edge device, deploy a deep learning model, use the deep learning model to perform preliminary defect detection on the preprocessed image data, identify and mark various types of defects, and extract local features and frequency domain features to obtain preliminary detection results; The final detection module is used to apply a classification algorithm to refine the defect type according to the preliminary detection result to obtain a final classification result, integrate the final classification result and its corresponding image data and transmit them to the cloud to complete the detection.

[0016] In a third aspect, the present invention provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, wherein the processor implements the steps of a product inspection method based on machine vision when executing the computer program.

[0017] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of a product inspection method based on machine vision.

[0018] Compared with the prior art, the beneficial effect of the present invention is that by initializing the ambient light sensor and evaluating the initial lighting conditions, the present invention realizes the initial evaluation of the light intensity and color temperature of the current environment, records the initial lighting conditions, and compensates by dynamically adjusting the light source parameters (including brightness, angle and color temperature) and real-time monitoring of ambient light changes, and finally verifies and locks the optimal lighting settings, optimizes the image quality and improves the detection accuracy. Then, according to the characteristics of the building materials, a preset wavelength range is selected, a spectral imaging system is configured, and image data of the building materials are collected to obtain detailed material characterization, and then the material characterization is preliminarily processed and image synthesized to obtain a comprehensive spectral image, and signal processing technology is applied to extract key parameters such as absorptivity, reflectivity and texture features, generate a high-quality image data set, and provide reliable data support for defect detection. Subsequently, the high-quality image data set is preprocessed on the edge device, and a lightweight deep learning model is deployed to realize real-time feature extraction and preliminary defect detection, identify and mark various types of defects, and further extract local features and frequency domain features, thereby enhancing the accuracy and efficiency of defect detection. Finally, based on the preliminary detection results, the classification algorithm is applied to refine the defect type, and the final classification results and their corresponding image data are integrated and transmitted to the cloud through a low-latency communication protocol to complete the entire detection process, thereby improving the intelligence level and reliability of the overall detection system. In summary, the present invention solves the problems of uneven illumination, unreasonable wavelength selection, and insufficient real-time processing capabilities existing in the prior art through a series of carefully designed steps, and realizes high-precision and high-efficiency product defect detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0020] Figure 1 A method flow chart of a product detection method and system based on machine vision provided by one embodiment of the present invention; Figure 2 An internal structural diagram of a computer device of a machine vision-based product inspection method and system provided in accordance with an embodiment of the present invention. DETAILED DESCRIPTION

[0021] In order to make the above-mentioned purposes, features and advantages of the present invention more understandable, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.

[0022] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0023] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.

[0024] Example 1, reference Figure 1-Figure 2 , which is the first embodiment of the present invention, provides a product detection method based on machine vision, comprising: This application provides a method that can effectively solve the above-mentioned problems. Next, we will combine multiple embodiments to explain in detail how to implement the product inspection method based on machine vision; Figure 1 A method flow chart of a product detection method and system based on machine vision is shown, including: S1: Initialize the ambient light sensor and evaluate the initial lighting conditions, dynamically adjust the light source parameters, verify and lock the optimal lighting settings; Further, initializing the ambient light sensor and evaluating the initial lighting conditions includes: Deploy and initialize the integrated ambient light sensor, set the ambient light sensor measurement frequency and range, and perform an initial assessment of the current ambient light intensity and color temperature before starting image acquisition to record the initial lighting conditions.

[0025] Furthermore, dynamically adjusting light source parameters includes: According to the initial lighting condition evaluation results, the basic parameters of the light source are set. The basic parameters include brightness, angle and color temperature. The changes in ambient light are continuously monitored through the real-time monitoring mode, and the light source parameters are compensated to maintain consistent lighting conditions. The calculation formula of the lighting compensation function is as follows: ; in, is the illumination compensation function, is the target light intensity in lux, is the ambient light intensity at wavelength The measurement value under the condition of lux is: is the color temperature; is a correction function that takes into account the effect of different color temperatures on different wavelengths. The function can be expressed as: ; in, is an empirical constant that can be determined experimentally. is the reference wavelength, usually 555nm (the wavelength to which the human eye is most sensitive); when When >0, it means that the brightness of the light source needs to be increased to compensate for the insufficient ambient light; when When <0, it means that the brightness of the light source needs to be reduced to avoid interference from excessive ambient light; when =0, it means that the current lighting conditions are already optimal and no adjustment is required.

[0026] Further verification and locking of optimal lighting settings include: After completing the light source parameter adjustment, verify whether the lighting quality meets the expected standards through preset standard test procedures or reference images, and lock the current light source parameter settings to ensure a stable and optimal lighting environment throughout the image acquisition process.

[0027] S2: Select a preset wavelength range according to the characteristics of the building materials, configure the spectral imaging system and collect image data of the building materials to obtain material representation, perform preliminary processing and image synthesis on the material representation to obtain a comprehensive spectral image, perform feature extraction on the comprehensive spectral image to obtain a high-quality image data set; Furthermore, the preset wavelength range is selected according to the characteristics of the building materials, including: A preset wavelength range is selected according to the characteristics of the building material, and a high-resolution multispectral or hyperspectral camera and a tunable filter or a linear variable filter are set to select light within a specific wavelength range to enter the camera. The wavelength range selection calculation formula is as follows: ; in, is the weight coefficient for each wavelength, is the wavelength of the material The reflectivity under is the average reflectance at all wavelengths, is the standard deviation of reflectivity; The value range of is [-1, 1], which indicates the priority of wavelength selection. A positive value indicates that the reflection characteristics at this wavelength are stronger and suitable for selection; a negative value indicates that the reflection characteristics at this wavelength are weaker and are not selected.

[0028] At the same time, a weighted synthesis function is introduced , which is used to synthesize image data from different wavelengths. The specific formula is as follows: ; in, is the weighted synthesis function, is at wavelength The intensity of the image captured under the is the weight coefficient for each wavelength, is a tuning factor used to control the degree of nonlinear response. is the reference image intensity, usually the middle gray value, and N is the number of wavelengths; The value range of is [0, 1], which represents the final grayscale value of each pixel in the composite image. The closer the value is to 1, the higher the importance of the pixel in the composite image.

[0029] Furthermore, material characterization includes multi-dimensional information reflecting material properties; Preliminary processing and image synthesis for the material characterization includes: Image data of building materials are captured within the preset wavelength range, preliminary data cleaning and formatting are performed, and stored in a local or cloud database in preparation for subsequent processing.

[0030] Furthermore, image synthesis and feature extraction include: The image data from different wavelengths are synthesized into a full-color image. The synthesis method is a prior art and will not be described in detail here. Signal processing technology is used to extract key parameters reflecting material properties, including absorptivity, reflectivity and texture characteristics, from full-color images.

[0031] Texture features include contrast, correlation, energy and entropy, and the calculation formula is as follows: ; Among them, C1 is contrast, C2 is correlation, E1 is energy, E2 is entropy, is an element in the gray-level co-occurrence matrix, indicating the probability of occurrence of pixel pairs with pixel values ​​i and j. is the average gray value, is the standard deviation.

[0032] S3: preprocessing the high-quality image data set on the edge device, deploying a deep learning model, using the deep learning model to perform preliminary defect detection on the preprocessed image data, identifying and marking various types of defects, and extracting local features and frequency domain features; Furthermore, the preprocessing includes: Receive high-quality image datasets from multispectral / hyperspectral cameras; Perform necessary preprocessing on edge devices, such as noise filtering, resizing, etc., to optimize subsequent analysis; Deploy lightweight deep learning models (such as MobileNet, Tiny-YOLO), which can run efficiently in resource-constrained environments and quickly complete image preprocessing tasks.

[0033] Furthermore, the deployed lightweight deep learning model is used to perform real-time feature extraction on the preprocessed image data; various types of defects are identified and marked. The specific formula is as follows: ; in, is the probability of defect existence, W is the model weight matrix, T is the transpose of the weight matrix W, F is the extracted feature vector, b is the bias term, is the sigmoid function, which is used to convert the output into a probability value.

[0034] Specifically, the sigmoid function calculation formula is as follows: ; Among them, x represents the input parameter; Further extract local features and frequency domain features, including but not limited to edge information, and the extraction method includes but is not limited to using the Canny edge detection algorithm and fast Fourier transform FFT to enhance the accuracy of defect detection.

[0035] S4: Based on the preliminary inspection results, the classification algorithm is applied to refine the defect types, and the final classification results and their corresponding image data are integrated and transmitted to the cloud to complete the inspection.

[0036] Furthermore, based on the preliminary detection results, a classification algorithm is applied to further refine the defect type; the classification algorithm includes but is not limited to a support vector machine, a random forest or a convolutional neural network, which is not specifically limited in the present invention; Integrate the final classification results and their corresponding image data; The data is transmitted to the cloud via a low-latency communication protocol (such as MQTT or CoAP) for further analysis and decision-making to complete the detection.

[0037] Furthermore, the present embodiment also provides a product inspection system based on machine vision, comprising: an illumination compensation module, an image extraction module, a defect classification module and a final inspection module; The light compensation module is used to initialize the ambient light sensor and evaluate the initial light conditions, dynamically adjust the light source parameters, and verify and lock the optimal light settings; The image extraction module is used to select a preset wavelength range according to the characteristics of the building materials, configure the spectral imaging system and collect image data of the building materials to obtain material representation, perform preliminary processing and image synthesis on the material representation to obtain a comprehensive spectral image, perform feature extraction on the comprehensive spectral image to obtain a high-quality image data set; The defect classification module is used to preprocess the high-quality image data set on the edge device, deploy a deep learning model, use the deep learning model to perform preliminary defect detection on the preprocessed image data, identify and mark various types of defects, and extract local features and frequency domain features to obtain preliminary detection results; The final detection module is used to apply a classification algorithm to refine the defect type according to the preliminary detection results, obtain a final classification result, integrate the final classification result and its corresponding image data, and transmit them to the cloud to complete the detection.

[0038] This embodiment also provides a computer device, which may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 2 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a product detection method based on machine vision is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0039] This embodiment also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the following steps: initializing an ambient light sensor and evaluating initial lighting conditions, dynamically adjusting light source parameters, and verifying and locking optimal lighting settings; Selecting a preset wavelength range according to the characteristics of the building materials, configuring a spectral imaging system and collecting image data of the building materials to obtain material representations, performing preliminary processing and image synthesis on the material representations to obtain a comprehensive spectral image, performing feature extraction on the comprehensive spectral image to obtain a high-quality image data set; Preprocessing the high-quality image data set on the edge device, deploying a deep learning model, using the deep learning model to perform preliminary defect detection on the preprocessed image data, identifying and marking various types of defects, and extracting local features and frequency domain features to obtain preliminary detection results; According to the preliminary detection results, a classification algorithm is applied to refine the defect type to obtain a final classification result, and the final classification result and its corresponding image data are integrated and transmitted to the cloud to complete the detection.

[0040] Example 2, reference Figure 1 - Figure 2 , which is the second embodiment of the present invention, and this embodiment provides a product detection method based on machine vision. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through economic benefit calculation and simulation experiments.

[0041] In order to verify the effectiveness and superiority of the product inspection method based on machine vision proposed in this invention, a large construction company was selected as the test site to conduct defect detection experiments on several commonly used building materials (concrete, steel, and glass). The experimental equipment includes a high-resolution multispectral camera, a tunable filter, an ambient light sensor, an edge computing device, and a cloud server.

[0042] First, the integrated ambient light sensor is deployed and initialized in a laboratory environment, with a measurement frequency of once per second and a measurement range of 300 to 800 nanometers. Before image acquisition, the light intensity and color temperature of the current environment are initially evaluated and the initial lighting conditions are recorded. The experimental results show that the average light intensity under the initial lighting conditions is 500 lux and the color temperature is 4500 K.

[0043] According to the initial lighting condition evaluation results, the basic parameters of the light source are set, including brightness, angle, and color temperature. The changes in ambient light are continuously monitored through real-time monitoring mode, and the light source parameters are dynamically adjusted using the lighting compensation function. Specifically, the target light intensity is set to 750 lux and the color temperature is adjusted to 6000 K to ensure consistent lighting quality in different environments. After multiple iterations of optimization, a stable lighting setting was finally achieved.

[0044] After adjusting the light source parameters, the preset standard test procedures or reference images are used to verify whether the lighting quality meets the expected standards. A series of standard test images are used in the experiment to compare the image quality under different lighting settings. Finally, a set of optimal parameters is selected and locked to ensure the consistency and stability of subsequent image acquisition.

[0045] Next, a preset wavelength range is selected based on the characteristics of the building materials. For concrete, the visible light band of 400-700 nm is selected; for steel, the near-infrared band of 800-1100 nm is selected; and for glass, the UV-visible light band of 300-500 nm is selected. High-resolution multispectral cameras and tunable filters are configured to capture image data within these specific wavelength ranges to ensure that the spectral information that best reflects the characteristics of the materials is obtained.

[0046] Image data of building materials are captured within a preset wavelength range, and preliminary data cleaning and formatting are performed and stored in a local database. Subsequently, image data from different wavelengths are synthesized into a full-color image, and signal processing techniques are applied to extract key parameters such as absorptivity, reflectivity, and texture features. During the experiment, a total of 100 concrete images, 80 steel images, and 60 glass images were collected, and each image went through rigorous preprocessing and feature extraction steps.

[0047] Preprocess high-quality image datasets on edge devices to remove noise and resize to ensure data quality for input into deep learning models. Deploy a lightweight deep learning model, MobileNetV2, and use its efficient operation to quickly complete image preprocessing, feature extraction, and preliminary classification tasks in a resource-constrained environment. In the experiment, the model successfully identified and marked various types of defects, including cracks, voids, and surface unevenness, and further extracted local features and frequency domain features to enhance the accuracy of defect detection.

[0048] Based on the preliminary inspection results, the classification algorithm was applied to refine the defect types, and the final classification results and their corresponding image data were integrated and transmitted to the cloud through a low-latency communication protocol. In the experiment, the classification algorithm successfully distinguished the different types and degrees of defects and provided a detailed classification report. All data was securely transmitted to the cloud for remote monitoring and data analysis.

[0049] Table 1: Image quality comparison before and after optimization of lighting conditions

[0050] Table 2: Comparison of defect detection effects of different materials

[0051] Through the data analysis of the above two tables, it can be clearly seen that the content of the present invention has significant advantages and innovations in many aspects; Table 1 shows the image quality comparison before and after the lighting conditions are optimized. The optimized lighting conditions significantly improved the contrast and clarity scores of the images, especially for concrete, steel, and glass, where the contrast was increased by 25%, 25%, and 25%, respectively, and the clarity score was increased from 6 to 9. This not only improved the overall quality of the image, but also greatly improved the accuracy of defect recognition from 70%-80% to 90%-95%. In addition, the processing time was also reduced, indicating that the optimized lighting conditions helped to improve the response speed and efficiency of the system; Table 2 compares the defect detection effects of different materials in the preset wavelength range and the full band. The results show that selecting the appropriate wavelength range can more accurately reflect the material characteristics, thereby improving the accuracy of defect identification. For example, the absorption rate of concrete in the 400-700 nm band is 30%, and the reflectivity is 70%, while the absorption rate and reflectivity of the full band are 25% and 75%, respectively. Correspondingly, the defect identification accuracy rate is increased from 85% to 90%, and the processing time is shortened from 140 ms to 120 ms. This shows that selecting a preset wavelength range according to material characteristics is one of the key factors to improve detection accuracy.

[0052] By deploying lightweight deep learning models on edge devices, efficient real-time processing capabilities are achieved. Experimental data show that the MobileNetV2 model can quickly complete image preprocessing, feature extraction, and preliminary classification tasks in a resource-constrained environment, and identify and mark various types of defects. Compared with traditional detection methods, this model not only improves the speed of defect detection, but also enhances the accuracy of detection, especially in complex scenarios.

[0053] The classification algorithm was applied to refine the defect types, further improving the accuracy and detail of the classification results. In the experiment, the classification algorithm successfully distinguished defects of different types and degrees and provided a detailed classification report. The data was transmitted to the cloud through a low-latency communication protocol, ensuring the secure transmission and centralized management of data, facilitating remote monitoring and data analysis. This not only improves the overall intelligence level of the inspection system, but also provides a reliable basis for subsequent quality control and repair work.

[0054] In summary, the present invention solves the problems of uneven illumination, unreasonable wavelength selection and insufficient real-time processing capability existing in the prior art through a series of carefully designed steps, and realizes high-precision and high-efficiency product defect detection. The experimental data fully proves the role and beneficial effects of the content of the present invention, and demonstrates its innovation and advantages in practical applications.

[0055] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

[0056] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. The schemes in the embodiments of the present application may be implemented in various computer languages, for example, object-oriented programming language Java and literal scripting language JavaScript, etc.

[0057] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0058] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0059] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1The steps for the functions specified in one or more boxes.

[0060] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0061] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A product detection method based on machine vision, characterized in that: include: Initialize the ambient light sensor and evaluate the initial lighting conditions, dynamically adjust the light source parameters, and verify and lock the optimal lighting settings; Selecting a preset wavelength range according to the characteristics of the building materials, configuring a spectral imaging system and collecting image data of the building materials to obtain material representations, performing preliminary processing and image synthesis on the material representations to obtain a comprehensive spectral image, performing feature extraction on the comprehensive spectral image to obtain a high-quality image data set; Preprocessing the high-quality image data set on the edge device, deploying a deep learning model, using the deep learning model to perform preliminary defect detection on the preprocessed image data, identifying and marking various types of defects, and extracting local features and frequency domain features to obtain preliminary detection results; According to the preliminary detection results, a classification algorithm is applied to refine the defect type to obtain a final classification result, and the final classification result and its corresponding image data are integrated and transmitted to the cloud to complete the detection.

2. The product detection method based on machine vision according to claim 1, characterized in that: The evaluating initial lighting conditions comprises: Deploy and initialize the integrated ambient light sensor, set the ambient light sensor measurement frequency and range, and perform an initial assessment of the light intensity and color temperature of the current environment before starting image acquisition to obtain the initial lighting condition assessment results and record the initial lighting conditions.

3. The product detection method based on machine vision according to claim 2, characterized in that: The dynamically adjusting light source parameters comprises: According to the initial lighting condition evaluation result, the basic parameters of the light source are set, and the basic parameters of the light source include brightness, angle and color temperature. The changes of ambient light are continuously monitored through the real-time monitoring mode, and the light source parameters are compensated. The calculation formula of the lighting compensation function is as follows: ; in, is the illumination compensation function, is the target light intensity, is the ambient light intensity at wavelength The measured value below is the color temperature, It is a correction function, which is set by considering the influence of different color temperatures on different wavelengths. The calculation formula of this function is as follows: ; in, is an empirical constant, determined experimentally, is the reference wave.

4. The product detection method based on machine vision according to claim 3, characterized in that: Verifying and locking the optimal lighting settings includes: After completing the light source parameter adjustment, verify whether the lighting quality meets the expected standards through the preset standard test program or reference image, and lock the current light source parameter settings.

5. The product detection method based on machine vision according to claim 4, characterized in that: The selecting of a preset wavelength range according to the characteristics of the building material comprises: Select a preset wavelength range based on the characteristics of the building material, and set a high-resolution multispectral or hyperspectral camera and a tunable filter or a linear variable filter. The wavelength range selection calculation formula is as follows: ; in, is the weight coefficient for each wavelength, is the wavelength of the material The reflectivity under is the average reflectance at all wavelengths, is the standard deviation of reflectivity; At the same time, a weighted synthesis function is introduced , used to synthesize image data from different wavelengths, the calculation formula is as follows: ; in, is the weighted synthesis function, is at wavelength The intensity of the image captured below, is the weight coefficient for each wavelength, is a tuning factor used to control the degree of nonlinear response. is the reference image intensity and N is the number of wavelengths.

6. The product detection method based on machine vision according to claim 5, characterized in that: The material characterization includes multi-dimensional information reflecting material properties; Preliminary processing and image synthesis for the material characterization includes: Capture image data of building materials within a preset wavelength range, perform preliminary data cleaning and formatting, and store them in a local or cloud database; Image synthesis and feature extraction include: Combining image data from different wavelengths into a full-color image; Apply signal processing techniques to extract key parameters reflecting material properties from full-color images, including absorptivity, reflectivity, and texture features; The texture features include contrast, correlation, energy and entropy, and the calculation formula is as follows: ; Among them, C1 is contrast, C2 is correlation, E1 is energy, E2 is entropy, is an element in the gray-level co-occurrence matrix, indicating the probability of occurrence of pixel pairs with pixel values ​​i and j. is the average gray value, is the standard deviation.

7. The product detection method based on machine vision according to claim 6, characterized in that: The various types of defects identified and marked include: Use the deployed lightweight deep learning model to perform real-time feature extraction on pre-processed image data; Identify and mark various types of defects. The specific formula is as follows: ; in, is the probability of defect existence, W is the model weight matrix, T is the transpose of the weight matrix W, F is the extracted feature vector, b is the bias term, is the sigmoid function, which is used to convert the output into a probability value.

8. A product inspection system based on machine vision, based on the product inspection method based on machine vision according to any one of claims 1 to 7, characterized in that: include: Lighting compensation module, image extraction module, defect classification module and final detection module; The illumination compensation module is used to initialize the ambient light sensor and evaluate the initial illumination conditions, dynamically adjust the light source parameters, and verify and lock the optimal illumination settings; The image extraction module is used to select a preset wavelength range according to the characteristics of the building materials, configure the spectral imaging system and collect image data of the building materials to obtain material representation, perform preliminary processing and image synthesis on the material representation to obtain a comprehensive spectral image, perform feature extraction on the comprehensive spectral image to obtain a high-quality image data set; The defect classification module is used to preprocess the high-quality image data set on the edge device, deploy a deep learning model, use the deep learning model to perform preliminary defect detection on the preprocessed image data, identify and mark various types of defects, and extract local features and frequency domain features to obtain preliminary detection results; The final detection module is used to apply a classification algorithm to refine the defect type according to the preliminary detection result to obtain a final classification result, integrate the final classification result and its corresponding image data and transmit them to the cloud to complete the detection.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the product inspection method based on machine vision in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the product inspection method based on machine vision according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Workpiece surface defect detection method based on visual identification

    CN118898620A

  • Pavement defect detection method and system based on infrared thermal imaging

    CN118967573A

  • Automatic product detection system based on machine vision

    CN118976708A

  • Automatic substrate glass surface defect detection method and system based on machine vision

    CN119006469A

  • Liquid crystal screen defect detection method and system based on machine vision and storage medium

    CN119086020A

Cited By

  • Screw quality detection method and system based on artificial intelligence

    CN119554978A

  • Digital image target detection method and system based on medical microbiological examination

    CN119693945A

  • Aluminum ingot surface defect detection method and system based on visual acquisition

    CN119880916A

  • Aluminum ingot surface defect detection method and system based on visual acquisition

    CN119880916B

  • Automobile coating defect detection method and system based on machine vision

    CN120142303A