Stamping part surface defect detection method
By monitoring ambient light in real time and adjusting the lighting system intelligently, and detecting the surface defects of stamped parts in combination with deep learning models, the problems of low detection efficiency and poor accuracy in traditional methods are solved, and efficient and reliable defect identification is achieved.
Patent Information
- Application Number
- CN202510641472.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-19
- Publication Date
- 2025-08-08
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing method for detecting surface defects of stamped parts relies on manual inspection with low efficiency and strong subjectivity. Computer vision-based methods are sensitive to light conditions, resulting in poor detection accuracy and consistency, especially when ambient light changes, false alarms and missed alarm rates are high.
The time queue of ambient light intensity is collected in real time using the light sensor, and the recommended values of the lighting system parameters are generated through the timing feature extraction and gated writing technology based on the LSTM model, the lighting conditions are optimized, and image processing is combined with the deep learning model to identify defects.
It ensures consistency and stability of image quality, improves the accuracy and reliability of defect detection, and reduces the impact of ambient light changes on detection.
Smart Images

Figure CN120451131A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing detection technology, and in particular, to a method for detecting surface defects of stamping parts. Background Art
[0002] In modern manufacturing, stamped parts are widely used in a variety of fields, including automotive, aerospace, and electronics. As a critical component, their surface quality directly impacts the overall performance, aesthetics, and service life of the product. However, during the stamping process, due to factors such as die wear, material problems, and improper stamping parameters, various surface defects such as scratches, cracks, dents, oxidation, and stains often appear on stamped parts. These defects not only affect the product's appearance but can also reduce its mechanical properties and corrosion resistance. In severe cases, they can even lead to product failure, resulting in economic losses and safety risks for manufacturers and end users.
[0003] Traditional methods for detecting surface defects in stamped parts rely primarily on manual visual inspection. While intuitive and capable of handling complex situations, manual inspection suffers from low efficiency, strong subjectivity, and fatigue, making it difficult to ensure consistent and accurate detection. Existing computer vision-based defect detection methods, while improving efficiency and accuracy to a certain extent, are extremely sensitive to lighting conditions. Changes in ambient light (such as changes in workshop lighting or natural light conditions) can severely impact image quality, compromising defect detection accuracy and leading to high rates of false positives and missed detections.
[0004] Therefore, an optimized method for detecting surface defects of stamping parts is needed. Summary of the Invention
[0005] This summary is provided to briefly introduce concepts that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0006] In a first aspect, the present application provides a method for detecting surface defects of stamped parts, the method comprising:
[0007] Use light sensors to collect the time queue of ambient light intensity;
[0008] Based on the time sequence of the ambient light intensity, adjusting parameters of a lighting system to optimize lighting conditions, the parameters of the lighting system including angle and brightness;
[0009] Under the optimized lighting conditions, using a camera to collect images of the stamping part surface;
[0010] Determining whether there are defects on the surface of the stamping part based on the stamping part surface state characteristics of the stamping part surface image;
[0011] Among them, based on the time queue of the ambient light intensity, the parameters of the lighting system are adjusted to optimize the lighting conditions, including: performing local scale-based temporal feature extraction on the time queue of the ambient light intensity to obtain a sequence of local temporal implicit correlation feature vectors of the ambient light intensity; performing gated write-based temporal dynamic propagation aggregation on the sequence of local temporal implicit correlation feature vectors of the ambient light intensity to obtain an ambient light intensity temporal dynamic propagation coding vector; and generating recommended parameter values of the lighting system based on the ambient light intensity temporal dynamic propagation coding vector.
[0012] Optionally, local-scale-based temporal feature extraction is performed on the time queue of the ambient light intensity to obtain a sequence of local temporal implicit correlation feature vectors of the ambient light intensity, including: dividing the time queue of the ambient light intensity into equal parts to obtain a sequence of ambient light intensity subsequences; and inputting each ambient light intensity subsequence in the sequence of the ambient light intensity subsequences into an ambient light intensity sequence encoder based on an LSTM model to obtain a sequence of local temporal implicit correlation feature vectors of the ambient light intensity.
[0013] Optionally, the sequence of the local temporal implicit correlation feature vectors of the ambient light intensity is subjected to temporal dynamic propagation aggregation based on gated writing to obtain the ambient light intensity temporal dynamic propagation coding vector, including: performing temporal propagation coding on the sequence of the local temporal implicit correlation feature vectors of the ambient light intensity to obtain the ambient light intensity initial temporal propagation coding vector; based on the private characteristics of each local temporal implicit correlation feature vector of the ambient light intensity in the sequence of the local temporal implicit correlation feature vectors of the ambient light intensity relative to the ambient light intensity initial temporal propagation coding vector, compensating and optimizing the ambient light intensity initial temporal propagation coding vector to obtain the ambient light intensity temporal dynamic propagation coding vector.
[0014] Optionally, the sequence of the local temporal implicit correlation feature vectors of the ambient light intensity is subjected to temporal propagation coding to obtain an initial temporal propagation coding vector of the ambient light intensity, including: inputting the sequence of the local temporal implicit correlation feature vectors of the ambient light intensity into a sequence reasoning module based on a forward LSTM model to obtain the initial temporal propagation coding vector of the ambient light intensity.
[0015] Optionally, based on the private characteristics of each ambient light intensity local temporal implicit association feature vector in the sequence of ambient light intensity local temporal implicit association feature vectors relative to the ambient light intensity initial temporal propagation coding vector, the ambient light intensity initial temporal propagation coding vector is compensated and optimized to obtain the ambient light intensity temporal dynamic propagation coding vector, including: calculating the private characteristics of each ambient light intensity local temporal implicit association feature vector in the sequence of ambient light intensity local temporal implicit association feature vectors relative to the ambient light intensity initial temporal propagation coding vector to obtain a sequence of ambient light intensity local temporal private feature coding vectors; inputting each ambient light intensity local temporal private feature coding vector in the sequence of ambient light intensity local temporal private feature coding vectors into a gated write unit based on a Softmax function to obtain a sequence of gated write ambient light intensity local temporal private feature coding vectors; and fusing the sequence of gated write ambient light intensity local temporal private feature coding vectors and the ambient light intensity initial temporal propagation coding vector to obtain the ambient light intensity temporal dynamic propagation coding vector.
[0016] Optionally, generating parameter recommendation values for the lighting system based on the ambient light intensity temporal dynamic propagation coding vector includes: inputting the ambient light intensity temporal dynamic propagation coding vector into a decoder-based lighting system parameter optimizer to obtain the parameter recommendation values.
[0017] Optionally, based on the stamping part surface state characteristics of the stamping part surface image, determining whether there are defects on the stamping part surface includes: performing image denoising and contrast enhancement on the stamping part surface image to obtain an enhanced stamping part surface image; inputting the enhanced stamping part surface image into a stamping part surface state feature extractor to obtain stamping part surface state characteristics; and determining whether there are defects on the stamping part surface based on the stamping part surface state characteristics.
[0018] Optionally, the stamping part surface state feature extractor is a feature pyramid network based on a multi-scale dilated convolutional layer.
[0019] Optionally, based on the surface state characteristics of the stamping part, determining whether there are defects on the surface of the stamping part includes: inputting the surface state characteristics of the stamping part into a defect detector based on a support vector machine to obtain a defect detection result, and the defect detection result is used to indicate whether there are defects on the surface of the stamping part.
[0020] This application has at least the following technical effects:
[0021] Using the above technical solution, first, a light sensor is used to collect the time queue of ambient light intensity in real time to ensure comprehensive monitoring of illumination changes in the detection area; then, based on the time queue, a local-scale temporal feature extraction technology is used to generate a sequence of local temporal implicit correlation feature vectors of ambient light intensity; then, through temporal dynamic propagation aggregation based on gated writing, further processing is performed to obtain the ambient light intensity temporal dynamic propagation coding vector, and based on the vector, the parameter recommendation value of the lighting system is generated to optimize the lighting conditions; then, a camera is used to collect high-quality images of the stamping surface, and after preprocessing, the images are input into the deep learning model for feature extraction, and finally it is determined whether there are defects on the stamping surface. This application ensures the consistency and stability of image quality and improves the accuracy and reliability of defect detection by intelligently adjusting the illumination parameters.
[0022] Other features and advantages of the present application will be described in detail in the subsequent detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The above and other features, advantages and aspects of the embodiments of the present application will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale. In the drawings:
[0024] Figure 1 The figure is a flow chart of a method for detecting surface defects of stamping parts according to an exemplary embodiment.
[0025] Figure 2 FIG. 1 is a flowchart of step S120 of a method for detecting surface defects of stamping parts according to an exemplary embodiment.
[0026] Figure 3 FIG. 1 is a flowchart of step S122 of a method for detecting surface defects of stamping parts according to an exemplary embodiment.
[0027] Figure 4 FIG1 is a flowchart of step S1222 of a method for detecting surface defects of stamping parts according to an exemplary embodiment.
[0028] Figure 5 The figure is a block diagram of a stamping part surface defect detection system according to an exemplary embodiment. DETAILED DESCRIPTION
[0029] The following describes embodiments of the present application in more detail with reference to the accompanying drawings. Although certain embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be construed as limited to the embodiments described herein. Instead, these embodiments are provided to provide a more thorough and complete understanding of the present application. It should be understood that the drawings and embodiments of the present application are for illustrative purposes only and are not intended to limit the scope of protection of the present application.
[0030] It should be understood that the various steps described in the method embodiments of the present application can be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present application is not limited in this respect.
[0031] As used herein, the term "including" and its variations are open-ended, i.e., "including but not limited to." The term "based on" means "based, at least in part, on." The term "one embodiment" means "at least one embodiment," the term "another embodiment" means "at least one additional embodiment," and the term "some embodiments" means "at least some embodiments." Other terms are defined in the following description.
[0032] It should be noted that the concepts of "first" and "second" mentioned in this application are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0033] It should be noted that the modifications of "one" and "multiple" mentioned in this application are illustrative rather than restrictive. Those skilled in the art should understand that unless otherwise clearly indicated in the context, they should be understood as "one or more".
[0034] The names of the messages or information exchanged between multiple devices in the embodiments of the present application are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0035] In response to the above technical problems, the technical concept of this application is: using light sensors to monitor the ambient light conditions in real time, and introducing deep learning algorithms to perform fine-grained time series analysis on the ambient light intensity data collected by the light sensors, so as to adaptively adjust the angle and brightness of the lighting system based on the time series change pattern of the ambient light intensity to ensure the stability of the lighting conditions. Next, a camera is used to capture the surface image of the stamping part, and after image preprocessing, the surface state features of the stamping part are extracted through a neural network model based on deep learning to identify whether there are defects on the surface of the stamping part. In this way, by real-time monitoring and adjustment of the lighting system, the fluctuation of image quality caused by changes in ambient light can be significantly reduced, thereby improving the accuracy and reliability of defect detection.
[0036] The specific implementation of this application is described in detail below with reference to the accompanying drawings.
[0037] Figure 1 FIG. 1 is a flow chart of a method for detecting surface defects of stamping parts according to an exemplary embodiment. Figure 1 As shown, the method for detecting surface defects of stamping parts according to an embodiment of the present application includes:
[0038] Step S110, using a light sensor to collect a time queue of ambient light intensity;
[0039] Step S120: adjusting parameters of a lighting system to optimize lighting conditions based on the time queue of the ambient light intensity, wherein the parameters of the lighting system include angle and brightness;
[0040] Step S130: Under the optimized lighting conditions, using a camera to capture an image of the stamping part surface;
[0041] Step S140: Determine whether there are defects on the stamping part surface based on the stamping part surface state characteristics in the stamping part surface image.
[0042] In the above-mentioned stamping part surface defect detection method, step S110 uses a light sensor to collect a time queue of ambient light intensity. It should be understood that during the image processing-based defect detection process for stamping parts, changes in ambient light intensity directly affect the color, brightness, and contrast of the image, thereby affecting the effectiveness of subsequent image processing algorithms. Therefore, in order to reduce the impact of ambient light conditions on image quality, the present application hopes to dynamically adjust the lighting parameters of the lighting system according to the current lighting conditions by collecting ambient light intensity data in real time, so that it can adapt to changes in ambient light and ensure the quality of the image captured by the camera.
[0043] Specifically, this application dynamically adjusts the lighting system's illumination parameters by collecting ambient light intensity data in real time, ensuring that the quality of images captured by the camera is unaffected by external lighting conditions. This technology utilizes a highly sensitive, wide-dynamic-range optical sensor to accurately measure ambient light intensity and arranges this data in chronological order to form a continuous time series. This time series is then intelligently analyzed to predict future lighting trends, enabling advance adjustments to lighting system parameters such as angle and brightness to maintain optimal imaging.
[0044] In one specific embodiment, the first step is to select appropriate light sensors and arrange them appropriately. Considering the movement paths of stamped parts on the production line, it's crucial to evenly distribute multiple light sensors at key locations within the inspection area. For example, digital ambient light sensors (such as the TSL2591 or BH1750) can be installed above, on both sides, and in front of the inspection area. These sensors provide linear outputs for easy processing. This not only comprehensively monitors lighting conditions but also provides accurate data support for each inspection point.
[0045] Then, it is crucial to determine the appropriate sampling frequency based on the speed at which the stamping passes through the inspection area and the rate of change of the lighting conditions. For fast-moving stampings or situations where the lighting conditions change rapidly, a higher sampling rate (for example, 10 to 100 times per second) helps capture subtle changes in lighting and provides more detailed data support for subsequent analysis. At the same time, in order to ensure that the timestamps between data from different sensors are consistent, a hardware-level time synchronization mechanism (such as a real-time clock RTC) or a software algorithm (such as the NTP protocol) is used to ensure that each acquisition is performed at the same time, obtaining a more consistent data set.
[0046] Furthermore, consideration must be given to how to efficiently transmit and store this data. Each optical sensor module is equipped with a certain amount of memory for temporary storage of collected data, ensuring data protection even in unstable network conditions. Data is uploaded to a central server via wired (such as RS485, Ethernet) or wireless communication technologies (such as Wi-Fi, LoRaWAN). The communication method chosen is appropriate for the site environment and technical requirements to ensure reliable and timely data transmission. After receiving the data, the central server first performs simple denoising, such as applying a sliding window averaging method to smooth the curve and reduce interference caused by random fluctuations. Data points that significantly deviate from the normal range are then identified and removed to prevent extreme values from affecting subsequent analysis results. This improves data quality by establishing a reasonable threshold range, where values outside this range are considered abnormal and removed.
[0047] After preprocessing, the light intensity data is arranged in chronological order, forming a continuous time series. This not only records the trend of light intensity changes over time, but also reflects potential periodic patterns or other characteristics. Using a time series database (such as InfluxDB) to store this data facilitates fast queries while supporting complex calculations. It is worth noting that instant access to the latest light data provides a basis for subsequent lighting parameter adjustments. Based on the collected time series data, combined with machine learning models (such as LSTM networks), intelligent analysis can predict future lighting trends. Based on the predicted results, lighting system parameters such as angle and brightness can be adjusted in advance to ensure optimal imaging under all lighting conditions.
[0048] Finally, a closed-loop control system is established to continuously monitor lighting conditions and adjust lighting parameters as appropriate. Whenever a significant change in lighting conditions is detected, a new parameter adjustment process is immediately initiated, ensuring that the entire system is always in optimal working condition. For example, in an automobile manufacturing plant, the lighting environment around the surface defect inspection station for stamped parts is monitored. When a new batch of stamped parts is about to enter the inspection area, relevant data is extracted from the light intensity time series over the last few minutes, and a pre-trained LSTM model is used to predict lighting changes over the next few seconds. Based on the prediction results, the angle and brightness of the LED lamps located above and around the inspection area are adjusted accordingly to ensure that the camera can obtain high-quality images when shooting.
[0049] The above steps not only provide a solid data foundation for surface defect detection of stamping parts, but also ensure that clear and stable images can be captured regardless of changes in external lighting conditions, thereby improving the accuracy and efficiency of defect detection.
[0050] In the above-mentioned stamping part surface defect detection method, the step S120 is to adjust the parameters of the lighting system to optimize the lighting conditions based on the time queue of the ambient light intensity. The parameters of the lighting system include angle and brightness. Figure 2 FIG. 1 is a flow chart showing step S120 of a method for detecting surface defects of stamping parts according to an exemplary embodiment. Figure 2 As shown, the step S120 includes: step S121, performing local scale-based temporal feature extraction on the time queue of the ambient light intensity to obtain a sequence of local temporal implicit correlation feature vectors of the ambient light intensity; step S122, performing gated write-based temporal dynamic propagation aggregation on the sequence of local temporal implicit correlation feature vectors of the ambient light intensity to obtain an ambient light intensity temporal dynamic propagation coding vector; step S123, generating parameter recommendation values of the lighting system based on the ambient light intensity temporal dynamic propagation coding vector.
[0051] Specifically, the step S121 includes: dividing the time queue of the ambient light intensity into equal parts to obtain a sequence of ambient light intensity subsequences; and inputting each ambient light intensity subsequence in the sequence of the ambient light intensity subsequences into an ambient light intensity sequence encoder based on the LSTM model to obtain a sequence of the ambient light intensity local temporal implicit correlation feature vectors.
[0052] Considering that when analyzing a long time series of ambient light intensity, directly processing the entire time series data will not only lead to high computational complexity and slow response speed, but also cause the loss of local detail information. Therefore, in order to more carefully capture the local characteristics of the change of ambient light intensity over time, the present application divides the time queue of the ambient light intensity into a series of equal parts to decompose it into multiple shorter ambient light intensity subsequences, wherein each subsequence represents the lighting conditions over a period of time. In this way, it helps to more accurately identify the rapid changes or periodic patterns of ambient light intensity in a short period of time, and can achieve a rapid response to changes in ambient light intensity.
[0053] Then, in order to capture the temporal variation trend of ambient light intensity in each local time domain, this application adopts the LSTM model with excellent performance in time series analysis tasks to construct an ambient light intensity sequence encoder, and performs time series encoding on each ambient light intensity subsequence in the sequence of the ambient light intensity subsequences to obtain a sequence of implicit correlation feature vectors of the local time series of ambient light intensity.
[0054] Specifically, LSTM effectively solves the vanishing or exploding gradient problem in traditional recurrent neural networks (RNNs) by introducing a gating mechanism, and is able to learn long-term dependencies, which is crucial for understanding how lighting conditions change over time. The core of LSTM lies in its inclusion of three types of gates: input gate, forget gate, and output gate. These gates allow the model to selectively remember or forget information, thereby better capturing patterns over long time spans. For ambient light intensity, using an LSTM model to temporally encode each ambient light intensity subsequence helps to screen out lighting changes that have a significant impact on imaging quality, ignore unimportant historical data, and focus on key ambient light intensity features that may affect image acquisition in the present and future. Ultimately, the information that best reflects the changing trend of lighting conditions is selected to form a local temporal implicit correlation feature vector for ambient light intensity.
[0055] In the specific implementation, after the time series of ambient light intensity is divided into several subsequences, each subsequence represents the change of light intensity in a short period of time. Next, the LSTM model is used to perform temporal encoding on these subsequences. First, the state variables of the LSTM unit are initialized, including the hidden state h t and cell state c t, which will be continuously updated during the entire sequence processing to carry information about lighting changes. Then the elements in each subsequence are sequentially input into the LSTM unit. At each time step t, LSTM t And the state h at the previous moment t-1 and c t-1 Calculate the new state h t and c t .
[0056] During this process, LSTM performs a series of gating operations to regulate the flow of information. For example, the input gate determines which new information should be saved; the forget gate evaluates the importance of existing information and decides whether to keep it; and finally, the output gate selects the information fragment to be passed to the next time step. After the above processing, LSTM generates a series of hidden states h t These states contain important features about illumination variations. These hidden states are considered implicitly correlated feature vectors of the local temporal series of ambient light intensity, describing the illumination conditions and their potential impact within a specific time period. Ultimately, the feature vectors corresponding to all subsequences are integrated to form a complete sequence of implicitly correlated feature vectors of the local temporal series of ambient light intensity. This sequence not only records the temporal variation of illumination intensity but also reveals its periodic and non-periodic components, providing valuable data support for subsequent analysis.
[0057] It should be understood that once a sequence of implicitly correlated feature vectors of the local temporal sequence of ambient light intensity is obtained, these feature vectors can be used to dynamically adjust the parameters of the lighting system. For example, another decoder model can be trained that receives the above feature vectors as input and outputs recommendations for optimal lighting angle and brightness settings. This ensures that ideal imaging results are maintained regardless of changes in external lighting conditions, improving the accuracy and reliability of stamping part surface defect detection.
[0058] Considering that lighting conditions in real-world production environments can change dramatically and suddenly, a closed-loop feedback control system can be established. Whenever an unusual fluctuation in lighting conditions is detected, a new parameter adjustment process is immediately initiated, ensuring that the entire system is always operating at its optimal state. This real-time response mechanism not only enhances the system's adaptability but also significantly improves the overall efficiency of the production line.
[0059] By using an LSTM model to construct an ambient light intensity sequence encoder, we can accurately capture lighting trends in complex and ever-changing industrial environments and implement intelligent lighting control accordingly. This not only improves image acquisition quality but also provides more stable and reliable assurance for stamping part surface defect detection. Furthermore, this not only resolves key issues in existing technologies but also provides a more intelligent and efficient means of stamping part surface defect detection for the modern manufacturing industry, helping to drive the industry to a higher level of development.
[0060] Specifically, Figure 3 FIG. 1 is a flow chart showing step S122 of a method for detecting surface defects of stamping parts according to an exemplary embodiment. Figure 3 As shown, the step S122 includes: step S1221, performing time propagation coding on the sequence of the local time series implicit correlation feature vectors of the ambient light intensity to obtain the initial time series propagation coding vector of the ambient light intensity; step S1222, based on the private characteristics of each local time series implicit correlation feature vector of the ambient light intensity in the sequence of the local time series implicit correlation feature vectors of the ambient light intensity relative to the initial time series propagation coding vector of the ambient light intensity, performing compensation optimization on the initial time series propagation coding vector of the ambient light intensity to obtain the ambient light intensity time series dynamic propagation coding vector.
[0061] More specifically, the step S1221 includes: inputting the sequence of the local temporal implicit correlation feature vectors of the ambient light intensity into a sequence reasoning module based on a forward LSTM model to obtain the initial temporal propagation coding vector of the ambient light intensity.
[0062] It should be understood that since the sequence of the local temporal implicit correlation feature vectors of the ambient light intensity respectively represents the dynamic information of the ambient light changes in different time periods, in order to achieve a global understanding of the ambient light intensity change pattern, the present application further performs feature temporal propagation aggregation processing on the sequence of the local temporal implicit correlation feature vectors of the ambient light intensity, so as to comprehensively characterize the overall trend of the ambient light intensity changes in the global time domain.
[0063] Therefore, in this application, a forward LSTM model is used to forward propagate the sequence of the local temporal implicit correlation feature vectors of the ambient light intensity, so as to utilize the long-term memory capability of the LSTM model to capture the long-range dependency between the ambient light intensity features of each local time domain, and generate a hidden state representation that integrates all previous local time domain ambient light intensity change information, that is, the initial temporal propagation encoding vector of the ambient light intensity.
[0064] The process can be expressed as follows:
[0065] X={x1,x2,...,x i ,...,xn}
[0066] v h =LSTM({x1,x2,...,x i ,...,x n})
[0067] Wherein, X represents the sequence of the local temporal implicit correlation feature vectors of the ambient light intensity, x1, x2, x i and x n denote the first, second, i-th and n-th local temporal sequence implicit correlation feature vectors of the ambient light intensity in the set of local temporal sequence implicit correlation feature vectors of the ambient light intensity, respectively. n is the number of feature vectors in the set of local temporal sequence implicit correlation feature vectors of the ambient light intensity. LSTM(·) denotes the forward LSTM model. v h Represents the initial temporal propagation coding vector of the ambient light intensity.
[0068] More specifically, Figure 4 FIG. 1 is a flow chart showing step S1222 of a method for detecting surface defects of stamping parts according to an exemplary embodiment. Figure 4 As shown, the step S1222 includes: step S12221, calculating the private characteristics of each ambient light intensity local temporal implicit associated feature vector in the sequence of ambient light intensity local temporal implicit associated feature vectors relative to the ambient light intensity initial temporal propagation coding vector to obtain a sequence of ambient light intensity local temporal private feature coding vectors; step S12222, inputting each ambient light intensity local temporal private feature coding vector in the sequence of ambient light intensity local temporal private feature coding vectors into a gated write unit based on a Softmax function to obtain a sequence of gated write ambient light intensity local temporal private feature coding vectors; step S12223, fusing the sequence of gated write ambient light intensity local temporal private feature coding vectors and the ambient light intensity initial temporal propagation coding vector to obtain the ambient light intensity temporal dynamic propagation coding vector.
[0069] Specifically, in step S12221, considering that the LSTM model controls the flow of information through a gating mechanism, the original feature information may be lost or incorrectly filtered during the feature propagation process. In this regard, the present application further calculates the private features of the original local temporal implicit correlation feature vectors of each ambient light intensity relative to the ambient light intensity initial temporal propagation coding vector, and generates a series of ambient light intensity local temporal private feature coding vectors that emphasize individual differences, so as to reflect the loss of information during the feature propagation process.
[0070] The process can be expressed as follows:
[0071]
[0072] Among them, g(·,·) represents a private feature extraction function, Indicates position difference, |·| indicates taking the absolute value, conv 1×1 (·) represents point convolution, Sigmoid(·) represents sigmoid activation function, W d is the weight parameter matrix, p i Indicates the x i The corresponding local temporal difference eigenvector of ambient light intensity, xb i Indicates the x i The corresponding ambient light intensity local temporal private feature encoding vector.
[0073] Specifically, in step S12222, a gated writing unit based on a Softmax function is further introduced to perform feature selection and filtering on each of the ambient light intensity local temporal private feature encoding vectors through a gating mechanism. The Softmax function is used to convert the ambient light intensity local temporal private feature encoding vectors into a probability distribution, which can be intuitively understood as the importance scores of different parts of the private feature.
[0074] In a specific embodiment of the present application, the ambient light intensity local temporal private feature coding vector is fed into a gated write unit based on a Softmax function. The gating mechanism is an important component for controlling information flow in deep learning, and its design is inspired by the principle of synaptic plasticity in biology, that is, the connection strength between neurons can change according to the activity level. In this framework, the Softmax function is used to convert the ambient light intensity local temporal private feature coding vector into a probability distribution, which is intuitively understood as the importance score of different features. The gated write unit decides which features should be retained more and which should be weakened or even ignored based on this score, simulating the process of information screening in the brain to ensure that only the most representative and relevant information is retained. That is, a gated write unit based on a Softmax function is used to determine whether each ambient light intensity local temporal private feature coding vector needs to be written into the initial propagation inference information of the sequence of the ambient light intensity local temporal private feature coding vector.
[0075] The process can be expressed as follows:
[0076]
[0077] Among them, a i Indicates the xb i The corresponding probabilistic ambient light intensity local temporal private feature encoding vector,
[0078] Represents matrix multiplication operation, W i and b i Respectively represent the weight matrix and bias term of the gated write unit, xb i Indicates the x i The corresponding ambient light intensity local temporal private feature encoding vector, softmax(·) is the normalized exponential function, is the inverse temperature coefficient of the Softmax function.
[0079] Next, gated mask processing is performed on the probability distribution obtained above to generate corresponding mask weights to guide the selection and filtering of private features and determine whether they need to be written into the initial temporal propagation coding vector of the ambient light intensity.
[0080] In a specific embodiment of the present application, a gating threshold is set, the probabilistic ambient light intensity local temporal private feature encoding vector is input into a control mask function, and each position in the probabilistic ambient light intensity local temporal private feature encoding vector is compared with the gating threshold using a binary sequence to obtain a weight matrix for the gated write unit. Based on the generated weight matrix for the gated write unit, it is determined which ambient light intensity local temporal private feature encoding vectors should be retained and which should be filtered out. This ensures that the final encoding vector contains only those features that are most representative and influential under the current lighting conditions, thereby improving the quality of image acquisition and the accuracy of defect detection.
[0081] The process can be expressed as follows:
[0082]
[0083] Among them, mask(·) is the gated mask function, a i Indicates the xb i The corresponding probabilistic ambient light intensity local temporal private feature encoding vector, τ is the gate threshold, w i Indicates the xb i The corresponding ambient light intensity local temporal private feature mask weight vector.
[0084] Next, the generated mask weights are used to weight the corresponding ambient light intensity local temporal private feature encoding vectors to obtain a sequence of gated-write ambient light intensity local temporal private feature encoding vectors, thereby ensuring that only the most representative and relevant private information is retained and transmitted.
[0085] In a specific embodiment of the present application, each ambient light intensity local temporal private feature mask weight vector is multiplied by the corresponding ambient light intensity local temporal private feature encoding vector and then combined to form a sequence of gated write ambient light intensity local temporal private feature encoding vectors. This ensures that only the most representative and relevant private information is retained and transmitted, which not only optimizes the effect of feature selection but also improves the accuracy and reliability of subsequent analysis and processing.
[0086] The process can be expressed as follows:
[0087] Y={xb1·w1,xb2·w2,...,xb i w i ,...,xb n w n}
[0088] Among them, w1, w2, w i and w n They are respectively xb1, xb2, xb i and the xb n The corresponding ambient light intensity local temporal private feature mask weight vector, Y is the sequence of the gated write ambient light intensity local temporal private feature encoding vector, xb1, xb2, xb i and xb n Respectively represent the x1, the x2, the x i and the x n The corresponding ambient light intensity local temporal private feature encoding vector.
[0089] Specifically, in step S12223, the sequence of the local temporal private feature coding vector of the ambient light intensity written by the gate and the ambient light intensity initial temporal propagation coding vector are spliced and fused to simultaneously retain the overall change trend and local detail information of the ambient light intensity, and obtain the ambient light intensity temporal dynamic propagation coding vector, thereby ensuring the integrity and accuracy of the information during the feature propagation process.
[0090] Finally, to create a comprehensive feature representation that reflects the dynamic interactions between nodes while maintaining their uniqueness, it is necessary to fuse the gated-written ambient light intensity local temporal private feature encoding vector and the initial ambient light intensity temporal propagation encoding vector. Specifically, a gating mechanism is used to control the sequence of gated-written ambient light intensity local temporal private feature encoding vectors, orderly and selectively writing the initial propagation inference information of the sequence of the ambient light intensity local temporal implicit correlation feature vectors to obtain the ambient light intensity temporal dynamic propagation encoding vector. This resulting ambient light intensity temporal dynamic propagation encoding vector can reflect the dynamic interaction patterns between nodes and accurately capture the unique attributes of each node.
[0091] The process can be expressed as follows:
[0092] v f =Concat{v h ; Y}
[0093] Among them, v h represents the initial temporal propagation coding vector of the ambient light intensity, Y is the sequence of the gated writing of the local temporal private feature coding vector of the ambient light intensity, Concat(·;·} represents the cascade operation, v f A coding vector representing the temporal dynamic propagation of the ambient light intensity.
[0094] Specifically, step S123 includes inputting the ambient light intensity time-series dynamic propagation coding vector into a decoder-based lighting system parameter optimizer to obtain the parameter recommended values. Specifically, the decoder employs a recursive neural network structure to perform feature analysis on the ambient light intensity time-series dynamic propagation coding vector through layer-by-layer decoding, thereby gradually decoding the encoded ambient light intensity features back into the recommended values of the lighting system parameters. During the decoding process, each layer further refines and optimizes the output of the previous layer to ensure that the resulting recommended lighting system parameter values (brightness and angle) accurately match the current changes in ambient light intensity and guide the lighting system to make corresponding adjustments to achieve optimal lighting conditions for surface defect detection of stamped parts.
[0095] Preferably, the step of inputting the ambient light intensity temporal dynamic propagation coding vector into a decoder-based lighting system parameter optimizer to obtain parameter recommendation values comprises:
[0096] Calculating a low-order coupling correlation metric value and a high-order coupling correlation metric value between feature information of any two positions in the ambient light intensity temporal dynamic propagation coding vector to construct a first ambient light intensity temporal dynamic propagation modulation analytical matrix and a second ambient light intensity temporal dynamic propagation modulation analytical matrix;
[0097] M1(i,j)==w1vi +w2v j
[0098]
[0099] Among them, v i and v j Respectively represent the eigenvalues of any two positions in the ambient light intensity temporal dynamic propagation coding vector, w1 represents the first weight hyperparameter, w2 represents the second weight hyperparameter, M1(i, j) represents the value of the (i, j) position of the first ambient light intensity temporal dynamic propagation modulation analysis matrix, and M2(i, j) represents the value of the (i, j) position of the second ambient light intensity temporal dynamic propagation modulation analysis matrix;
[0100] The low-order component of the ambient light intensity temporal dynamic propagation coding vector is modulated based on the first ambient light intensity temporal dynamic propagation modulation analytical matrix to obtain an ambient light intensity temporal dynamic propagation low-order modulation coding vector, which is expressed as:
[0101]
[0102] in, represents matrix multiplication, V1 represents the low-order modulation coding vector of the dynamic propagation of the ambient light intensity temporal sequence;
[0103] performing high-order component modulation on the conjugate information of the ambient light intensity time series dynamic propagation coding vector based on the second ambient light intensity time series dynamic propagation modulation analytical matrix to obtain an ambient light intensity time series dynamic propagation high-order analytical modulation coding vector;
[0104]
[0105] Among them, V2 represents the high-order analytical modulation coding vector of the time series dynamic propagation of the ambient light intensity;
[0106] Based on the first ambient light intensity time series dynamic propagation modulation analytical matrix and the second ambient light intensity time series dynamic propagation modulation analytical matrix, constructing an ambient light intensity time series dynamic propagation multi-order nonlinear fusion modulation analytical matrix;
[0107] M s =Sigmoid(M1☉M2)
[0108] Among them, ⊙ represents the multiplication by position, Sigmoid represents the activation function, M s Represents the multi-order nonlinear fusion modulation analytical matrix of the dynamic propagation of the ambient light intensity time series;
[0109] Based on the multi-order nonlinear fusion modulation analytical matrix of the ambient light intensity time series dynamic propagation, the hidden correction information of the ambient light intensity time series dynamic propagation coding vector is mined to obtain the ambient light intensity time series dynamic propagation compensation correction vector;
[0110]
[0111] Among them, V3 represents the compensation correction vector of the dynamic propagation of the ambient light intensity time series;
[0112] Multi-dimensional feature aggregation is performed on the low-order modulation code vector of the ambient light intensity temporal dynamic propagation, the high-order analytical modulation code vector of the ambient light intensity temporal dynamic propagation, and the compensation correction vector of the ambient light intensity temporal dynamic propagation to form an optimized ambient light intensity temporal dynamic propagation code vector, which is expressed as:
[0113]
[0114] Among them, α represents the third weight hyperparameter, β represents the fourth weight hyperparameter, γ represents the fifth weight hyperparameter, and V′ represents the optimized ambient light intensity temporal dynamic propagation coding vector.
[0115] The optimized ambient light intensity temporal dynamic propagation coding vector is input into the decoder-based lighting system parameter optimizer to obtain the parameter recommendation value.
[0116] Accordingly, in this technical solution, a probabilistic reference distribution analysis architecture is constructed based on the internal correlation low-order and high-order similarity metrics of the ambient light intensity time series dynamic propagation coding vector. That is, a probabilistic benchmark distribution analysis framework is constructed based on the multi-level correlation similarity evaluation of the ambient light intensity time series dynamic propagation coding vector. Furthermore, the repetitiveness of feature distribution is avoided through a query-triggered reverse correction mechanism, and the drawbacks of explicit splicing mapping are eliminated by means of the causal chain conversion rules of the retrieval response association context. In this way, while maintaining the heuristic association response characteristics, the precise mapping of the ambient light intensity time series dynamic propagation coding vector to the generated target domain is achieved, thereby improving the accuracy of the parameter recommendation value obtained by the ambient light intensity time series dynamic propagation coding vector by inputting it into the decoder-based lighting system parameter optimizer.
[0117] In the above-mentioned stamping part surface defect detection method, in step S130, a camera is used to capture a stamping part surface image under the optimized lighting conditions. Then, in step S140, based on the stamping part surface state characteristics of the stamping part surface image, it is determined whether there are defects on the stamping part surface. Wherein, step S140 includes: step S141, performing image noise reduction and contrast enhancement on the stamping part surface image to obtain an enhanced stamping part surface image; step S142, inputting the enhanced stamping part surface image into a stamping part surface state feature extractor to obtain stamping part surface state characteristics; step S143, determining whether there are defects on the stamping part surface based on the stamping part surface state characteristics.
[0118] Specifically, in step S141, in order to further optimize the image quality, unnecessary interference information introduced by factors such as sensor noise and mechanical vibration in the stamping part surface image is reduced. The present application further performs image noise reduction and contrast enhancement processing on the stamping part surface image to remove random noise in the stamping part surface image, improve the image contrast, and obtain an enhanced stamping part surface image. In a specific embodiment of the present application, bilateral filter and histogram equalization technology are used to perform noise reduction and contrast adjustment on the stamping part surface image. The bilateral filter can effectively remove noise in the image while retaining edge information, while the histogram equalization enhances the image contrast by adjusting the brightness distribution of the image, making the differences between different areas more obvious, helping to highlight the potential defect locations, thereby significantly improving the accuracy of subsequent image analysis and defect detection.
[0119] Specifically, in step S142, the stamping part surface state feature extractor is a feature pyramid network based on a multi-scale dilated convolution layer. Taking into account that the surface defects of stamping parts may have different sizes and shapes, in order to fully perceive the surface defects of stamping parts of various sizes and shapes, the present application uses a multi-scale dilated convolution layer to construct a feature pyramid network, and processes the enhanced stamping part surface image to extract the surface feature information of the stamping part at different scales. Those skilled in the art should know that the multi-scale dilated convolution layer can expand the receptive field without increasing the number of parameters by introducing a dilation rate in the convolution operation, thereby effectively extracting contextual information in a larger range. In addition, the feature pyramid network aggregates features of different scales layer by layer, so that the network can fully capture surface defects of different scales, thereby achieving comprehensive detection of surface defects of stamping parts.
[0120] Specifically, in step S143, the surface state features of the stamped part are input into a defect detector based on a support vector machine to obtain a defect detection result, which is used to indicate whether there are defects on the surface of the stamped part. It should be understood that a support vector machine is an effective classifier that distinguishes different categories of data by finding an optimal hyperplane in the feature space. In this application, the model parameters obtained by the support vector machine through training can effectively map the surface state features of the stamped part to the corresponding category space, thereby determining whether there are defects on the surface of the stamped part.
[0121] In summary, the above solution uses a light sensor to monitor ambient light conditions in real time, and introduces a deep learning algorithm to perform fine-grained time-series analysis on the ambient light intensity data collected by the light sensor. This allows the lighting system's angle and brightness to be adaptively adjusted based on the temporal variation pattern of the ambient light intensity to ensure the stability of the lighting conditions. Next, a camera is used to capture images of the stamping part surface. After image preprocessing, a deep learning-based neural network model is used to extract surface state features of the stamping part to identify defects on the stamping part surface. By monitoring and adjusting the lighting system in real time, image quality fluctuations caused by changes in ambient light can be significantly reduced, thereby improving the accuracy and reliability of defect detection.
[0122] Figure 5 FIG. 1 is a block diagram of a stamping part surface defect detection system according to an exemplary embodiment. Figure 5 As shown, according to the embodiment of the present application, the stamping part surface defect detection system 200 includes: an ambient light intensity acquisition module 210, which is used to use a light sensor to collect a time queue of ambient light intensity; a lighting system parameter adjustment module 220, which is used to adjust the parameters of the lighting system based on the time queue of the ambient light intensity to optimize the lighting conditions, and the parameters of the lighting system include angle and brightness; a stamping part surface image acquisition module 230, which is used to use a camera to collect the stamping part surface image under the optimized lighting conditions; a stamping part surface defect judgment module 240, which is used to determine the stamping part surface state characteristics based on the stamping part surface image. Whether there are defects; wherein, the lighting system parameter adjustment module 220 includes: a local-scale temporal feature extraction unit 221, used to perform a local-scale temporal feature extraction on the time queue of the ambient light intensity to obtain a sequence of local temporal implicit correlation feature vectors of the ambient light intensity; a temporal dynamic propagation aggregation unit 222, used to perform a gated-write-based temporal dynamic propagation aggregation on the sequence of local temporal implicit correlation feature vectors of the ambient light intensity to obtain an ambient light intensity temporal dynamic propagation coding vector; a parameter recommendation value generation unit 223, based on the ambient light intensity temporal dynamic propagation coding vector, generates a parameter recommendation value of the lighting system.
[0123] Here, those skilled in the art will appreciate that the specific operations of each module in the above-mentioned stamping part surface defect detection system have been described in detail above. Figures 1 to 4 The description of the stamping part surface defect detection method has been introduced in detail, and therefore, its repeated description will be omitted.
[0124] The above description is merely a preferred embodiment of the present application and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure in this application is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but also encompasses other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this application.
[0125] In addition, although adopting specific order to describe each operation, this should not be interpreted as requiring these operations to be executed in the specific order shown or in sequential order.Under certain environment, multitasking and parallel processing may be advantageous.Similarly, although comprising some specific implementation details in the above discussion, these should not be interpreted as limiting the scope of the application.Some features described in the context of separate embodiment can also be implemented in a single embodiment in combination.On the contrary, the various features described in the context of a single embodiment also can be implemented in multiple embodiments individually or in the mode of any suitable subcombination.
[0126] Although the subject matter has been described using language specific to structural features and / or method logic, it should be understood that the subject matter as defined is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely exemplary implementations. Regarding the apparatus in the above-described embodiments, the specific manner in which each module performs operations has been described in detail in the embodiments related to the method and will not be further elaborated here.
Claims
1. A method for detecting surface defects of stamping parts, characterized in that: include: Use light sensors to collect the time queue of ambient light intensity; Based on the time sequence of the ambient light intensity, adjusting parameters of a lighting system to optimize lighting conditions, the parameters of the lighting system including angle and brightness; Under the optimized lighting conditions, using a camera to collect images of the stamping part surface; Determining whether there are defects on the surface of the stamping part based on the stamping part surface state characteristics of the stamping part surface image; The method of adjusting the parameters of the lighting system to optimize the lighting conditions based on the time sequence of the ambient light intensity comprises: extracting the temporal features based on the local scale on the time sequence of the ambient light intensity to obtain a sequence of implicit correlation feature vectors of the local temporal sequence of the ambient light intensity; Performing gated write-based temporal dynamic propagation aggregation on the sequence of the local temporal implicit correlation feature vectors of the ambient light intensity to obtain an ambient light intensity temporal dynamic propagation coding vector; Based on the time series dynamic propagation of the coded vector of the ambient light intensity, the recommended parameter values of the lighting system are generated.
2. The method for detecting surface defects of stamping parts according to claim 1, characterized in that: Extracting local-scale temporal features from the time queue of the ambient light intensity to obtain a sequence of implicit correlation feature vectors of the local temporal sequence of the ambient light intensity includes: Sequentially dividing the time queue of the ambient light intensity into equal parts to obtain a sequence of ambient light intensity subsequences; Each ambient light intensity subsequence in the sequence of ambient light intensity subsequences is input into an ambient light intensity sequence encoder based on an LSTM model to obtain a sequence of the ambient light intensity local temporal implicit correlation feature vectors.
3. The method for detecting surface defects of stamping parts according to claim 2, characterized in that: Performing a gated write-based temporal dynamic propagation aggregation on the sequence of the local temporal implicit correlation feature vectors of the ambient light intensity to obtain an ambient light intensity temporal dynamic propagation coding vector, including: Performing time series propagation coding on the sequence of the local time series implicit correlation feature vectors of the ambient light intensity to obtain an initial time series propagation coding vector of the ambient light intensity; Based on the private characteristics of each ambient light intensity local time series implicit correlation feature vector in the sequence of ambient light intensity local time series implicit correlation feature vectors relative to the ambient light intensity initial time series propagation coding vector, the ambient light intensity initial time series propagation coding vector is compensated and optimized to obtain the ambient light intensity time series dynamic propagation coding vector.
4. The method for detecting surface defects of stamping parts according to claim 3, characterized in that: Performing time series propagation coding on the sequence of the local time series implicit correlation feature vectors of the ambient light intensity to obtain an initial time series propagation coding vector of the ambient light intensity includes: The sequence of the local temporal implicit correlation feature vectors of the ambient light intensity is input into a sequence reasoning module based on a forward LSTM model to obtain the initial temporal propagation coding vector of the ambient light intensity.
5. The method for detecting surface defects of stamping parts according to claim 4, characterized in that: Based on the private characteristics of each local temporal implicit correlation feature vector of the ambient light intensity in the sequence of the local temporal implicit correlation feature vectors of the ambient light intensity relative to the initial temporal propagation coding vector of the ambient light intensity, compensating and optimizing the initial temporal propagation coding vector of the ambient light intensity to obtain the temporal dynamic propagation coding vector of the ambient light intensity, including: Calculating the private features of each of the local temporal implicit correlation feature vectors of ambient light intensity in the sequence of the local temporal implicit correlation feature vectors of ambient light intensity relative to the initial temporal propagation coding vector of ambient light intensity to obtain a sequence of the local temporal private feature coding vectors of ambient light intensity; Inputting each ambient light intensity local temporal sequence private feature coding vector in the sequence of ambient light intensity local temporal sequence private feature coding vectors into a gated writing unit based on a Softmax function to obtain a sequence of gated written ambient light intensity local temporal sequence private feature coding vectors; The sequence of the gated-written ambient light intensity local temporal private feature coding vector and the ambient light intensity initial temporal propagation coding vector are fused to obtain the ambient light intensity temporal dynamic propagation coding vector.
6. The method for detecting surface defects of stamping parts according to claim 5, characterized in that: Based on the dynamic propagation of the coded vector in the time series of the ambient light intensity, the recommended parameter values of the lighting system are generated, including: The ambient light intensity temporal dynamic propagation coding vector is input into a decoder-based lighting system parameter optimizer to obtain the parameter recommendation value.
7. The method for detecting surface defects of stamping parts according to claim 6, characterized in that: Determining whether there are defects on the surface of the stamping part based on the stamping part surface state characteristics in the stamping part surface image includes: performing image noise reduction and contrast enhancement on the stamping part surface image to obtain an enhanced stamping part surface image; Inputting the enhanced stamping part surface image into a stamping part surface state feature extractor to obtain stamping part surface state features; Based on the surface state characteristics of the stamping part, it is determined whether there are defects on the surface of the stamping part.
8. The method for detecting surface defects of stamping parts according to claim 7, characterized in that: The stamping part surface state feature extractor is a feature pyramid network based on a multi-scale hole convolution layer.
9. The method for detecting surface defects of stamping parts according to claim 8, characterized in that: Determining whether there are defects on the surface of the stamping part based on the surface state characteristics of the stamping part includes: The surface state features of the stamping part are input into a defect detector based on a support vector machine to obtain a defect detection result, and the defect detection result is used to indicate whether there is a defect on the surface of the stamping part.