Bolt appearance size defect detection method based on machine vision

By introducing a real-time calculation and dynamic judgment mechanism for feature space entropy, combined with generative AI models and deterministic geometric morphology filtering operators, the problem of missed detection caused by high-frequency optical artifacts in machine vision inspection is solved, achieving 100% defect interception and high throughput under extreme working conditions.

CN121962136AActive Publication Date: 2026-05-01SHAANXI FULAN AUTOMOBILE STANDARD PARTS CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHAANXI FULAN AUTOMOBILE STANDARD PARTS CO LTD
Filing Date
2026-03-30
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

In aerospace-grade fastener automated production lines, existing machine vision inspection solutions are prone to fatal missed detections due to over-reliance on AI models when faced with strong, irregular mechanical vibrations, extremely fast cycles, and high-frequency optical artifact interference, and are unable to effectively identify fatal cracks in bolts.

Method used

A real-time calculation and dynamic judgment mechanism for feature space entropy is introduced. Through a feature failure probability mapping model and a deterministic geometric morphology filtering operator, the image processing process is actively managed to avoid non-physical feature inference and ensure the accuracy of defect detection.

Benefits of technology

It achieved 100% defect interception under extreme operating conditions, avoiding missed detections caused by high-frequency optical artifacts, ensuring the robustness and stability of the system, and maintaining high throughput and detection accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121962136A_ABST
    Figure CN121962136A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of machine vision and automatic detection, in particular to a bolt appearance size defect detection method based on machine vision, which comprises the following steps of: 1, receiving a trigger signal, and extracting a bottom layer pixel distribution characteristic and a hidden space vector of a target object image sequence; step 2, mapping the image feature spatial entropy to a feature failure probability between 0 and 1 based on a feature failure probability mapping model; 3, comparing the feature failure probability with a preset danger threshold value between 0 and 1; if yes, generating a first fused image feature; if yes, generating a second basic geometric feature; step 4, calculating actual external dimension parameters based on the extracted edge contour parameters of the bolt; outputting defect marking data according to the classification confidence; according to the method, the image input source is effectively purified, and the defect recall rate and throughput balance under the high-speed production line is maintained to the maximum extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of machine vision and automated inspection technology, specifically to a method for detecting bolt appearance and dimensional defects based on machine vision. Background Technology

[0002] Machine vision is widely used in high-speed appearance defect detection scenarios in automated production lines for aerospace-grade fasteners, and belongs to the field of image processing and analysis technology. Existing visual defect detection methods usually introduce generative artificial intelligence models to extract and detect features from the acquired bolt image data in order to make up for the lack of long-tail defect sample data. However, in actual production line operation, there are often strong and irregular mechanical vibrations, extremely fast cycle times, and dynamic physical conditions such as the replacement of anti-rust oil coatings. As a result, the images acquired by the vision hardware are often accompanied by severe motion blur and unpredictable high-frequency optical artifacts. Faced with such complex dynamic interference, if we continue to rely solely on generative artificial intelligence models for processing, the models will often amplify the artifacts incorrectly and smooth out real fatal cracks as normal reflections, thus triggering fatal missed detection problems. Most traditional machine vision solutions only make a simple trade-off between detection rate and processing speed, lacking keen perception of the drift of the underlying data distribution of the image and active intervention methods. Therefore, under extreme operating conditions and high-frequency optical artifact interference, how to proactively manage and suppress the risk of representation collapse in the image processing process, and effectively avoid fatal missed detection problems caused by over-reliance on artificial intelligence models for non-physical feature inference, has become a technical problem to be solved. Summary of the Invention

[0003] The purpose of this invention is to provide a machine vision-based method for detecting bolt dimensional defects, thereby solving the following technical problems: By introducing a real-time calculation and dynamic judgment mechanism for feature space entropy, the risk of representation collapse during image processing is proactively managed and suppressed. This method effectively avoids the fatal missed detection problem caused by over-reliance on AI models for non-physical feature inference when facing high-frequency optical artifact interference, thereby ensuring 100% interception of aerospace-grade fastener defects under extreme conditions.

[0004] The objective of this invention can be achieved through the following technical solutions: A machine vision-based method for detecting bolt appearance and dimensional defects includes the following steps: Step 1: Receive the trigger signal and acquire the target object image sequence of the bolts on the production line through the vision acquisition device; acquire the pixel equivalent calibration parameters that characterize the conversion relationship between pixels and physical size; extract the underlying pixel distribution features and latent space vector of the target object image sequence.

[0005] Step 2: Calculate the image feature space entropy based on the underlying pixel distribution features and the latent space vector; use the feature failure probability mapping model to map the image feature space entropy to a feature failure probability between 0 and 1.

[0006] Step 3: Compare the failure probability of the feature with a preset danger threshold between 0 and 1; if it is less than the threshold, call the generative feature extraction network to enhance the features of the target object image sequence and generate the first fused image feature; if it is greater than or equal to the threshold, trigger the image processing degradation mechanism, disable the network and call the deterministic geometric morphology filtering operator to process the target object image sequence and generate the second basic geometric feature.

[0007] Step 4: Based on the pixel equivalent calibration parameters and the first fused image features or the second basic geometric features, extract the bolt edge contour parameters and calculate the actual appearance size parameters; compare the size parameters with the standard size threshold range, and calculate the classification confidence of the target appearance size defect between 0 and 1 using the defect classification model; output defect labeling data based on the classification confidence.

[0008] Preferably, the step of calculating the image feature space entropy includes: extracting dynamic high-frequency spot noise from the target object image sequence; calculating the distribution difference metric between the underlying pixel distribution features and the preset baseline noise-free distribution features; and linearly weighting and fusing the distribution difference metric with the energy value of the dynamic high-frequency spot noise according to a preset weight to generate the image feature space entropy.

[0009] Preferably, the generative feature extraction network includes a diffusion generation module, which is pre-trained using preset low-frequency defect data samples; the step of calling the generative feature extraction network to enhance the features of the target object image sequence includes: identifying motion-blurred regions in the target object image sequence; reconstructing the texture of the motion-blurred regions through the diffusion generation module, and outputting the first fused image features.

[0010] Preferably, the deterministic geometric morphology filtering operator employs an edge extraction algorithm with fixed parameters; the step of triggering the image processing degradation mechanism further includes: synchronously increasing the image downsampling step size to reduce the amount of image processing data per unit time; The decision threshold of the feature failure probability mapping model is lowered to improve the recall rate of defective image features, thereby suppressing the classification boundary shift caused by asymmetric optical interference.

[0011] Preferably, the step of calculating the classification confidence of the target appearance size defect includes: obtaining the current production line operating speed parameter from the production line controller or speed encoder; combining the feature failure probability with the current production line operating speed parameter, and assigning attention channel weights to the first fused image feature or the second basic geometric feature according to a preset weight allocation rule, wherein the attention channel weights are normalized weight values; and calculating the classification confidence based on the attention channel weights using the defect classification model.

[0012] Preferably, the target object image sequence contains dynamic high-frequency light spot noise caused by changes in the anti-rust oil coating on the bolt surface; the target appearance dimensional defects include at least fatigue cracks.

[0013] Preferably, during the acquisition of the target object image sequence, the original visual data is processed by an adaptive downsampling module; wherein, the adaptive downsampling module dynamically adjusts the image downsampling rate and the feature extraction window size according to preset mechanical vibration frequency and pipeline running speed parameters.

[0014] Preferably, the step of extracting the latent space vector from the target object image sequence includes: inputting the target object image sequence into a pre-trained variational autoencoder; mapping pixel space data to a continuous feature distribution space through the encoder network of the variational autoencoder; and sampling from the feature distribution space to generate the latent space vector.

[0015] Preferably, the step of outputting the defect labeling data based on the classification confidence level includes: comparing the classification confidence level with a preset safety judgment threshold; if the classification confidence level is less than the safety judgment threshold, then outputting qualified labeling data; If the classification confidence level is greater than or equal to the safety judgment threshold, then the defect marking data is output to the pipeline control system interface.

[0016] Preferably, the method further includes a feature space parameter self-tuning step: using a preset reinforcement learning algorithm, with the goal of minimizing the feature failure probability and maximizing the preset image processing throughput, the online dynamic adjustment of the danger threshold is automatically completed within a preset period, and the adjusted danger threshold is still between 0 and 1.

[0017] The beneficial effects of this invention are: 1. By introducing a real-time calculation mechanism for feature space entropy, this invention enables the system to quantitatively measure the stability of feature extraction of visual models under complex lighting and noise conditions. This mechanism goes beyond the simple trade-off between speed and accuracy in traditional detection. By predicting the distance between the feature space and the classification boundary, it can detect the risk of data distribution drift in advance, actively manage and suppress the representation collapse caused by non-physical feature inference, and avoid the risk of misjudging fatal cracks as normal reflections from the source. 2. This invention designs a non-optimal but highly robust active degradation strategy; when environmental interference exceeds the controllable range of the AI ​​model, the system decisively blocks the advanced feature channels of the generative network and forces the use of deterministic geometric morphology filtering operators; this mode of sacrificing local accuracy to ensure global security uses physical rigid boundary extraction to ensure hard interception of fatigue cracks under extreme working conditions, providing physical redundancy security. 3. By setting warning thresholds and introducing a dynamic risk hedging mechanism, the system has the ability to flexibly adjust when faced with interference. By using the dynamic change rate of entropy, the channel attention and multi-view image fusion weights inside the model are adaptively adjusted, which can accurately suppress artifact-sensitive channels and enhance robust features. This enables the system to effectively purify the image input source without triggering line stoppage and degradation, and maximize the balance between defect recall and throughput on high-speed production lines. 4. This invention introduces an adaptive control strategy for the information density of input data; when the interference is detected to be aggravated, the high-definition pixels are retained by reducing the downsampling rate and the feature extraction window is reduced to lock the core areas such as the root of the thread; this strategy of local high-definition + small window effectively removes the aliasing interference of global high-frequency artifacts without significantly increasing the total amount of computation, and solves the recognition problem caused by the superposition of motion blur and optical noise under ultra-high speed beats. 5. This invention constructs a global risk management closed loop from software algorithms to hardware control; by statistically analyzing the frequency of high-risk triggers to link physical deceleration of the production line, a time window is gained for visual processing, ensuring absolute physical safety; at the same time, by collecting abnormal samples through a difficult example database for adversarial offline fine-tuning, the model can learn and decouple the reflective characteristics of the new coating, realizing the system's environmental adaptation and dynamic evolution capabilities from risk warning and proactive degradation to adaptive evolution, solving the persistent threat of long-tail data distribution drift. Attached Figure Description

[0018] The invention will now be further described with reference to the accompanying drawings.

[0019] Figure 1 This is a schematic flowchart of the bolt appearance dimensional defect detection method based on machine vision provided in the embodiments of this application. Detailed Implementation

[0020] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0021] Please see Figure 1 A method for detecting bolt appearance and size defects based on machine vision includes: acquiring bolt image data on an assembly line; extracting the underlying pixel distribution or latent space vector based on the bolt image data, calculating the feature space entropy corresponding to the current image features, and mapping the image feature space entropy to a feature failure probability between 0 and 1 using a feature failure probability mapping model. If the probability of feature failure does not reach the preset danger threshold, the bolt image data is input into the preset generative AI model for defect feature extraction and detection; if the probability of feature failure reaches the preset danger threshold, the image processing degradation mechanism is triggered.

[0022] Specifically, the method provided in this embodiment is applied to the high-speed visual inspection scenario of a fully automated production line for aerospace-grade fasteners; it acquires bolt image data on the production line. Due to the strong and irregular mechanical vibrations and extremely fast cycle time of the production line, the acquired image data usually has severe motion blur and high-frequency noise. Subsequently, the system extracts the underlying pixel distribution or latent space vector of the image in real time, and uses this to quantify and calculate the feature space entropy. The feature space entropy is used to measure the distance between the image features extracted by the visual model under the current lighting and noise and the classification boundary collapse, i.e., the image representation fragility. When the feature space entropy does not reach the danger threshold, it means that the current image data quality is within the controllable range of the AI ​​model. At this time, the generative AI model is called to extract defect features to make up for the lack of long-tail defect data. When the feature space entropy reaches the danger threshold, it means that the image has been severely interfered with, such as high-frequency optical artifacts. At this time, the image processing degradation mechanism is triggered, and the image is forced to switch to a deterministic edge detection algorithm, such as the classic geometric topology feature extraction algorithm, for detection. For example, suppose a new batch of rust-preventive oil is suddenly replaced upstream of the production line. This rust-preventive oil changes the bidirectional reflection distribution function (BRDF) of the bolt surface, producing a large number of unpredictable high-frequency optical artifacts with periodic light-dark interference characteristics under visual light source illumination. This artifact causes a drastic shift in the underlying pixel distribution of the image. If the generative AI model continues to be used, the model will mistakenly amplify the artifact and smooth the real fatal cracks into normal reflections, thus triggering a fatal missed detection. At this point, the feature space entropy calculated by the system will increase sharply and reach a dangerous threshold. The system will immediately trigger a degradation mechanism, abandon the AI ​​model, and switch to a deterministic edge detection algorithm to ensure the recognition of basic geometric features. This embodiment introduces a real-time calculation and dynamic judgment mechanism for feature space entropy. When faced with high-frequency optical artifact interference that aims to destroy the stability of image features, it can actively manage and suppress the risk of representation collapse in the image processing process. This surpasses the simple trade-off between detection rate and processing speed in traditional machine vision and effectively avoids the fatal missed detection problem caused by over-reliance on AI models for non-physical feature inference.

[0023] In a preferred embodiment of the present invention, the method of extracting the underlying pixel distribution or latent space vector based on bolt image data and calculating the feature space entropy corresponding to the current image features includes: obtaining the feature vector of bolt image data in the latent space through a preset feature extraction network; calculating the distribution dispersion of the feature vector under the current light and shadow noise; obtaining the feature space entropy based on the distribution dispersion quantification, and predicting the risk probability of triggering a fatal missed detection based on the feature space entropy.

[0024] Specifically, in the step of calculating the feature space entropy, the obtained bolt image data is input into a preset feature extraction network to obtain its feature vector representation in the latent space; Calculate the distribution dispersion of these feature vectors under the current lighting and noise interference; the total number of feature vectors in the current image latent space feature vector set obtained through calculation is... Local feature vectors Mean vector of the standard qualified product feature vector library The average of the squared Euclidean distances between them gives the distribution dispersion. Distribution dispersion This reflects the model's confidence level in the current image features. Higher dispersion indicates a greater likelihood that the model will misclassify normal lighting and texture as defects or smooth out real cracks. The calculation formula is:

[0025] Simultaneously, dynamic high-frequency spot noise is extracted from the target object image sequence, and its energy value is calculated. ; the dispersion of this distribution Energy value of dynamic high-frequency spot noise Linear weighted fusion is performed according to preset weights to generate the basic fusion value of feature space entropy. The formula is:

[0026] in, and These are preset weighting coefficients. The basic fusion value is then non-linearly mapped using a preset exponential mapping function, specifically through, for example, the feature space entropy formula:

[0027] This includes introducing a sensitivity adjustment coefficient set based on experience. Used to control the base fusion value Regarding entropy The severity of the impact is determined by normalizing the fusion value to the range of 0 to 1 to obtain the feature space entropy. It also outputs the probability of triggering a fatal missed detection in the current state.

[0028] For example, the system can set up a lightweight entropy evaluation module in parallel in the image processing pipeline; when the bolt image is input, the module extracts the high-frequency texture feature vector of the image and calculates the distance variance between it and the standard qualified product feature vector library, i.e., the distribution dispersion. If the bolt surface produces a large number of false edges due to changes in the anti-rust oil coating, the distance variance will increase significantly, and the entropy value of the quantized feature space will increase accordingly. When the probability of missed detection corresponding to the entropy value approaches the high-risk steady-state critical point of 9 / 10, the system can issue an early warning and prepare to adjust the subsequent image fusion weights or feature channel attention mechanisms. This embodiment constructs a quantization and early warning module in the image processing pipeline, accurately calculates the feature space entropy using latent space vectors, and predicts the risk of missed detection. This enables the visual detection system to have a keen perception of data distribution drift, providing reliable data and probabilistic support for subsequent survival-level degradation decisions.

[0029] In a preferred embodiment of the present invention, if the feature space entropy reaches a preset danger threshold, an image processing degradation mechanism is triggered, and a preset deterministic edge detection algorithm is called to perform defect detection on the bolt image data, including: when the feature space entropy reaches the preset danger threshold, actively blocking the advanced feature extraction channel of the generative AI model. Force the use of edge operators based on fixed thresholds or geometric morphological filtering as a deterministic edge detection algorithm; extract standard geometric topological features from bolt image data using the deterministic edge detection algorithm to identify bolt appearance and dimensional defects.

[0030] Specifically, when the feature space entropy is detected to reach a dangerous threshold, the system will execute a non-optimal but extremely robust active degradation strategy; the system will immediately cut off or actively block the advanced feature extraction channel of the generative AI model to prevent it from generating uncontrollable feature enhancement and misjudgment under severe optical noise. Subsequently, the system forcibly invokes edge operators based on fixed thresholds or basic geometric morphological filtering as alternatives; relying on these classic deterministic algorithms, the physical rigid boundaries and standard geometric topological features of the bolts are directly extracted on the two-dimensional plane of the image to complete the identification of fatal appearance size defects. For example, when faced with extreme interference from high-frequency optical artifacts, the system determines that the current feature space entropy has exceeded the limit. At this time, the system automatically abandons the diffusion generative model, which has high computational complexity and is easily misled by artifacts, and instead activates deterministic filtering tools such as the Canny edge detection operator or the Sobel operator with fixed parameters. This refers to the vulnerability of the image representation. When the feature space entropy does not reach the danger threshold, it means that the current image data quality is within the controllable range of the AI ​​model. At this time, the generative AI model is called to extract defect features to make up for the lack of long-tail defect data. When the feature space entropy reaches the danger threshold, it means that the image has been severely disturbed, such as high-frequency optical artifacts. At this time, the image processing degradation mechanism is triggered, and the deterministic edge detection algorithm, such as the classic geometric topology feature extraction algorithm, is forcibly called to detect it, ensuring that small fatigue cracks can still be rigidly intercepted by the basic geometric shape. This embodiment designs an active degradation and feature reconstruction mechanism. When faced with complex dynamic interference, it dares to sacrifice some computational efficiency and false alarm rate, decisively cuts off high-risk AI enhancement paths and reverts to deterministic physical feature extraction, thereby constructing a dynamic risk hedging framework with minimizing the probability of image representation collapse as its core, ensuring 100% interception of aerospace-grade fastener defects under extreme working conditions.

[0031] In a preferred embodiment of the present invention, the method further includes: triggering a dynamic risk hedging mechanism when the feature space entropy does not reach a preset danger threshold but is greater than a preset warning threshold; the dynamic risk hedging mechanism includes: adaptively adjusting the feature channel attention mechanism and image fusion weight in the generative AI model according to the dynamic change rate of the feature space entropy, so as to suppress the amplification of high-frequency optical artifacts in the feature space.

[0032] Specifically, in this embodiment, a gray-scale warning interval is introduced into the judgment logic of feature space entropy. That is, a warning threshold below the danger threshold is set. Both the warning threshold and the danger threshold are calibrated by injecting simulated light and shadow noise of different intensities into historical qualified product images and recording the empirical inflection point when the model classification performance drops sharply. When the feature space entropy calculated by the system is between the warning threshold and the danger threshold, it indicates that the current image input, such as optical artifacts caused by anti-rust oil coating, has begun to have a negative impact on the stability of the visual model, but has not yet exceeded the error threshold that would cause the classification boundary to collapse. At this time, the system will not directly trigger an extreme image processing degradation mechanism, that is, directly abandon the AI ​​model, but will instead trigger a dynamic risk hedging mechanism. This mechanism intervenes and adaptively adjusts the feature channel attention mechanism and the fusion weights of multi-source image inputs within the generative AI model by monitoring the dynamic rate of change of feature space entropy in real time. The core purpose of the adjustment is to actively intervene in the feature transmission process within the network, suppress feature responses that are easily misled by artifacts, and thus correct the deviation before the image representation truly collapses. For example, on an ultra-high-speed production line, when the new anti-rust oil on the surface of the bolts begins to produce high-frequency optical artifacts with periodic bright and dark interference characteristics, the system detects that the entropy of the feature space starts to rise from the normal low value and exceeds the preset warning threshold; at this time, the system calculates the slope of the entropy value, i.e. the dynamic change rate, and sends adjustment instructions to the generative AI model accordingly. After receiving instructions, the model automatically reduces the attention weights of network layers sensitive to high-frequency textures, while adjusting the fusion ratio of images acquired from multiple light sources to reduce the image weights from viewpoints severely affected by artifacts. The specific mapping logic is implemented by setting a step-wise adjustment rule: the slope of the change in the current feature space entropy compared to the previous sampling time is calculated as the dynamic change rate. By calculating the feature space entropy at the current sampling time Feature space entropy compared to the previous sampling time The difference, divided by the sampling time interval. The dynamic rate of change is obtained. :

[0033] When the rate of dynamic change When the signal is within the first preset interval, a decay coefficient of the first step length is applied to the attention weights of the sensitive feature channels; For example, the attenuation is 10%; when the dynamic change rate is in a higher second preset interval, the attenuation coefficient of the second step size is applied, for example, the attenuation is 30%. The first preset interval and the second preset interval are pre-divided based on the statistical distribution law of the historical optical artifact diffusion rate. Thus, through clear conditional branches and step-like weight adjustment rules, the adaptive flexible control of model parameters is realized. This embodiment provides a flexible buffer strategy when facing complex dynamic interference by setting a warning threshold and introducing a dynamic risk hedging mechanism. Compared with directly triggering the degradation mechanism, which would force the production line to slow down or cause a surge in false alarm rate, this embodiment can effectively suppress the negative impact of high-frequency artifacts and maximize the recall rate of defect features by finely adjusting the attention and fusion weights within the model while ensuring high throughput.

[0034] In a preferred embodiment of the present invention, the adaptive adjustment of the feature channel attention mechanism in the generative AI model includes: extracting the response gradient of each feature channel in the generative AI model to high-frequency optical artifacts; marking feature channels with response gradients greater than a preset gradient threshold as sensitive channels, and marking feature channels with response gradients less than or equal to the preset gradient threshold as robust channels; reducing the attention weight of sensitive channels and simultaneously increasing the attention weight of robust channels to reconstruct the feature representation of the image.

[0035] Specifically, when performing adaptive adjustments to the feature channel attention mechanism, it is necessary to quantify the sensitivity of each feature channel to interference noise. Since the current image has not yet completed the final defect detection process, the system will first input the current bolt image data into the generative AI model for a trial forward pre-inference before formal detection to obtain the initial feature map output. Based on this pre-inference result, the system extracts the response gradient of each feature channel in the generative AI model to high-frequency optical artifacts in the current input image through backpropagation or feature map variance analysis. The specific extraction method is as follows: the dispersion of the feature vector distribution obtained by the current detection is used as a virtual loss function. Under the premise of keeping the network parameters of the generative AI model frozen, the partial derivative of the virtual loss function with respect to the feature map activation matrix output by each feature channel is calculated using the backpropagation algorithm. The absolute values ​​of all elements in the partial derivative matrix are averaged, and the average value is used as the response gradient of the corresponding channel. The response gradient reflects the intensity of the channel being activated by artifacts. The system classifies these channels. If the response gradient of a certain channel is greater than the preset gradient threshold, which is obtained by statistically analyzing the maximum confidence upper bound of the response gradient of each channel in the same network layer of the standard interference-free qualified product image, it indicates that the channel is very likely to misjudge artifacts as real edges and is marked as a sensitive channel. Conversely, if the response gradient is less than or equal to the preset gradient threshold, it indicates that the channel focuses more on the physical rigidity boundary and low-frequency stability characteristics of the bolt, and is marked as a robust channel. The system reassigns attention weights to artificially suppress the output contribution of the sensitive channel while amplifying the feature signal of the robust channel, thereby reconstructing the image feature representation of the bolt in the latent space. For example, suppose a layer of a generative AI model contains 256 feature channels; under the interference of artifacts caused by anti-rust oil, the system calculation found that the response gradients of channels 10 to 50 are abnormally high, exceeding the preset gradient threshold. These channels are over-extracting false reflective features such as periodic interference artifacts. The system immediately marked these 40 channels as sensitive channels and reduced their attention weights from the default 1.0 to 0.2; at the same time, the system identified that the response gradients of channels 100 to 150 were stable, mainly focusing on the thread profile of the bolt and the potential fatigue crack morphology, marked them as robust channels, and increased their attention weights to 1.8; through this reweighting, the feature map output by the model successfully filtered out false textures on the surface; This embodiment achieves precise fine-tuning of the feature flow within the generative AI model through channel-level attention dynamic reallocation based on response gradients. This mechanism enables the visual model to actively suppress easily deceived feature channels when faced with asymmetric interference designed to destroy the stability of image features, and to rely on the most robust geometric features for judgment, thereby reducing the probability of triggering fatal missed detections due to over-enhancing false textures.

[0036] In a preferred embodiment of the present invention, adaptively adjusting the image fusion weights includes: acquiring multiple consecutive images of the same bolt under different illumination angles; calculating the local feature space entropy of each image frame; assigning higher fusion weights to image frames with lower local feature space entropy and lower fusion weights to image frames with higher local feature space entropy; and performing weighted fusion of the multiple consecutive images according to the fusion weights to obtain an enhanced image input for defect detection.

[0037] Specifically, in ultra-high-speed production lines, vision systems are typically equipped with multi-frequency flash source arrays, which can acquire multiple consecutive images of the same bolt under different lighting angles within an extremely short cycle time. When the dynamic risk hedging mechanism is triggered, the system will perform a quality assessment on this sequence of images, that is, calculate the local feature space entropy corresponding to each frame of single-view image. Because high-frequency optical artifacts, such as the reflection of rust-preventive oil, are highly sensitive to the angle of illumination, the degree of artifact contamination on the same bolt varies significantly in images viewed from different angles. The system assigns fusion weights in reverse based on the calculated local feature space entropy: the lower the entropy value, the less the image frame is affected by light and shadow noise and the clearer the physical features, so it is given a higher fusion weight; the higher the entropy value, the more fragile the image frame is, so it is given a lower fusion weight. The specific weight allocation rule is implemented through the inverse normalization method: for the acquired multi-frame image sequence, the weight allocation is performed on the first... For frame images, a minimum constant is first introduced to prevent the denominator from being zero. Utilizing its corresponding local feature space entropy Calculate initial weights The calculation formula is as follows:

[0038] For all frame indices in this multi-frame continuous image sequence ,in The value is To the total number of frames in the sequence initial weights Perform summation and normalization to obtain the first... Final fusion weights of frame images :

[0039] The system will combine these images according to the assigned final fusion weights. Perform pixel-level or feature-level weighted fusion; generate a high signal-to-noise ratio enhanced image, and then input it into subsequent network layers for defect detection; For example, the camera on the production line instantly captured three consecutive images of the bolt: front light, side low-angle light, and coaxial light. Due to the surface reflective properties of the new rust-preventive oil, a large area of ​​strong reflection and periodic interference artifacts appeared in the front light image, and the system calculated that its local feature spatial entropy was as high as 0.85. The side low-angle light image, avoiding direct reflection, has fewer artifacts and highlights the subtle fatigue crack features more clearly, with a local feature spatial entropy of only 0.30; the local feature spatial entropy of the coaxial light image is 0.50. At this point, the system adaptively adjusts the fusion weight of the side low-angle light image to 0.6, the coaxial light to 0.3, and the front light to 0.1. Through weighted fusion, the system synthesizes an enhanced image input that effectively suppresses strong reflections and preserves the true crack details. This embodiment utilizes the differences in local feature space entropy of multi-source image sequences for dynamic weighted fusion, cleverly leveraging multi-view information from the hardware dimension to combat random noise from a single viewpoint. This entropy-based adaptive image fusion strategy eliminates the need for additional complex denoising algorithms in the image processing pipeline, effectively purifying the image input source within extremely short computational latency and significantly improving the system's robustness under extreme lighting and unknown coating interference.

[0040] In a preferred embodiment of the present invention, after adaptively adjusting the feature channel attention mechanism and image fusion weights in the generative AI model according to the dynamic change rate of the feature space entropy, the method further includes: dynamically adjusting the image downsampling rate and feature extraction window size before the bolt image data is input into the generative AI model according to the dynamic change rate of the feature space entropy; wherein, when the dynamic change rate of the feature space entropy is increasing, the image downsampling rate is reduced and the feature extraction window is reduced to increase the physical resolution of the local image and reduce the global interference of high-frequency optical artifacts.

[0041] Specifically, when implementing the dynamic risk hedging mechanism, in addition to adjusting the attention mechanism and the fusion weights of multiple frames within the model, this embodiment also introduces adaptive control of the information density of the input data during the image preprocessing stage. Under normal steady-state conditions, in order to match the extremely fast pace of the ultra-high-speed pipeline, the image downsampling rate and feature extraction window of the vision system are often set near extreme values, that is, a high downsampling rate for image compression and a large window for global fast scanning are used to ensure throughput. When the dynamic change rate of the feature space entropy is detected to be increasing, it indicates that the interference of the current image with similar high-frequency optical artifacts is intensifying. If the high downsampling rate is maintained, these high-frequency artifacts are very likely to alias during the image compression process and be incorrectly inferred by the AI ​​model as low-frequency crack features through non-physical features. Therefore, the system will immediately reduce the image downsampling rate, that is, retain high-definition pixels that are closer to the original resolution, and simultaneously shrink the feature extraction window, so as to accurately focus computing power on the core physical area where bolts are most prone to fatal defects, and avoid interference from large-area artifacts. For example, under normal production line high-speed cycle, the system defaults to using a 4x downsampling rate and a 256×256 global feature extraction window to quickly scan the bolts; when the upstream replaces the new anti-rust oil, causing a large number of water ripple-like high-frequency optical artifacts to appear on the surface, the system detects that the dynamic change rate of the feature space entropy rises sharply, approaching the warning threshold; at this time, the system automatically adjusts the downsampling rate to no downsampling, i.e., 1x the original resolution, and significantly reduces the feature extraction window from 256×256 to 64×64, specifically targeting the thread root and head chamfer where the bolt stress is most concentrated for local high-definition scanning; While this operation preserves the extremely high resolution of the local image to see the real tiny fatigue cracks, the overall pixel computation does not increase significantly due to the large reduction in the scanning window, thus ensuring that the image processing process will not experience serious delays. This embodiment dynamically adjusts the downsampling rate and feature extraction window based on the dynamic change rate of the feature space entropy, breaking the rigid constraints imposed by fixed resolution and fixed field of view in traditional machine vision. Without significantly sacrificing image processing throughput, i.e. without causing processing delay, the strategy of using local high-definition small windows effectively removes the global interference of high-frequency optical artifacts, further suppressing the deterioration of feature space entropy and ensuring efficient interception of fatal appearance size defects under extreme lighting interference.

[0042] In a preferred embodiment of the present invention, the method further includes: statistically analyzing the triggering frequency of feature space entropy reaching a preset danger threshold within a preset time window; determining whether the triggering frequency exceeds a preset limit; if the triggering frequency exceeds the preset limit, sending a physical deceleration command to the automated production line, and storing the bolt image data that triggers the danger threshold into a difficult case database for offline fine-tuning and updating of the generative AI model.

[0043] Specifically, in order to construct a complete survival-level decision-making model closed loop, the system not only focuses on algorithm degradation during single bolt image detection, but also monitors the steady-state safety of the entire production line from a global macro perspective. The system will count in real time the frequency at which the feature space entropy reaches the danger threshold within a preset time window, i.e., the triggering frequency of the degradation mechanism that forces the invocation of the deterministic edge detection algorithm. It will then determine whether the triggering frequency exceeds the preset limit. The preset time window and the limit are benchmark parameters set by system-level planning based on the physical buffer capacity of the workstations in the automated production line and the tolerance time of downstream assembly workstations for single batch anomalies. If the preset limit is exceeded, it means that the current dynamic interference, such as the large-area and continuous change of the anti-rust oil coating, has exceeded the limit of the pure algorithm level of the vision system to offset and degrade, and the system is in an extremely high-risk operating state for a long time. At this point, the system must cross the software boundary and send physical deceleration commands directly to the underlying control unit of the automated production line. By reducing the mechanical operation cycle of the production line, more image processing time can be gained for the vision system. At the same time, the system automatically packages these abnormal bolt image data that cause high entropy collapse, labels them and stores them in the difficult case database as samples for subsequent retraining and offline fine-tuning of generative AI models. For example, the system sets a preset time window of 1 minute, with the limit being that the degradation mechanism is triggered more than 50 times; when the upstream production line is fully switched to the new anti-rust oil, due to the drastic change in surface reflectivity, the system finds that within 1 minute, the images of 120 bolts have reached the dangerous threshold due to severe high-frequency optical artifacts. At this point, the system determined that the degradation of the pure vision algorithm could no longer maintain a safe defense line under the current high-speed cycle. It then sent a physical deceleration command to the PLC controller of the production line, forcibly reducing the speed of the production line conveyor belt from 10 bolts per second to 5 bolts per second. After deceleration, the vision system obtained twice the single-frame processing time, and was able to call more complex morphological filtering and denoising algorithms at will. Meanwhile, these 120 images full of periodic interference artifacts were automatically stored in the difficult case database. When the production line was shut down for maintenance on weekends, algorithm engineers used these real extreme artifact data to fine-tune the generative AI model offline, so that it could learn and adapt to the reflection distribution characteristics of the new rust-preventive oil. As a result, after the model was updated and deployed, the production line was able to resume high-speed operation. This embodiment constructs a global risk management mechanism based on software algorithm adaptation and hardware control by statistically analyzing the frequency of high-risk triggers and linking them to physical deceleration of the production line. It not only ensures the absolute physical safety of aerospace-grade fastener assembly (i.e., zero missed detection) by actively sacrificing production line speed under extreme and continuous interference, but also achieves adaptive evolution of the vision system through difficult case collection and offline model fine-tuning. This solves the persistent threat caused by long-tail data distribution drift, giving the system high robustness and self-learning evolution capabilities.

[0044] In a preferred embodiment of the present invention, offline fine-tuning and updating of a generative AI model includes: acquiring bolt image data that triggers a dangerous threshold in a difficult example database and labeling their corresponding real physical defects to construct an extreme training sample set containing high-frequency optical artifacts; and based on the extreme training sample set, performing adversarial fine-tuning training on the generative AI model with the joint optimization objective of minimizing feature space entropy and maximizing the recall rate of defect features to obtain an updated generative AI model.

[0045] Specifically, this embodiment provides an offline fine-tuning and updating mechanism for generative AI models based on abnormal data collected from the difficult case database, so as to enable the visual inspection system to adaptively evolve in response to unknown interference. Bolt image data from the difficult case database that have reached the dangerous threshold of feature space entropy due to high frequency optical artifacts are obtained and verified by manual or high-precision offline 3D scanning equipment to accurately mark the real physical defects that may be hidden in the images, such as micro fatigue cracks or dimensional deviations. This is used to construct an extreme training sample set containing high frequency optical artifact interference. Then, this extreme training sample set is input into the original generative AI model for retraining. During training, a joint optimization objective is adopted, which not only requires the model to accurately output the mask or bounding box of the defect to maximize the recall rate of the defect features, but also forces the introduction of a penalty term for the dispersion of the latent space feature distribution to minimize the feature space entropy. Finally, through this adversarial fine-tuning training, the model is forced to learn how to decouple the real physical rigid boundary from false reflections such as periodic interference textures, and obtain an updated generative AI model. For example, during a weekend production line shutdown for maintenance, algorithm engineers retrieved 5,000 high-risk bolt images stored in the difficult case database that week due to the replacement of a new type of rust-preventive oil. These images were covered with high-frequency optical artifacts exhibiting periodic light and dark interference characteristics. The engineers precisely annotated the cracks in these images. During fine-tuning training, the loss function... Set as:

[0046] The generative AI model includes a diffusion-generative backbone network and a cascaded defect prediction head network. The defect prediction head network receives the latent space feature map extracted by the diffusion-generative backbone network and outputs the prediction probability. Binary cross-entropy loss The difference between the defect probability distribution predicted by the model and the actual physical defect labels is calculated by iterating through a total of... The sample pixels or anchor boxes, using the first The true label of a sample pixel or anchor frame and the predicted probability output by the defect prediction head network According to the formula:

[0047] This forces the model to accurately fit the real crack boundary, ensuring 100% recall of real fatigue cracks; the regularization penalty term Specifically, the value is taken as the dispersion of the current input image in the latent space. or feature space entropy To achieve, that is, to define or As a regularization penalty term built on the feature space entropy, it is used to suppress the model's excessive response to high-frequency artifacts. The preferred value range for the balance coefficient is 0.1 to 0.5. After multiple iterations, the updated generative AI model, when faced with bolt images coated with the same new anti-rust oil, no longer misjudges artifacts as defects due to reconstruction bias. The dispersion of its output feature vector distribution has been greatly reduced, and the feature space entropy has been effectively converged to a safe range. This embodiment introduces an offline fine-tuning mechanism with the core objective of minimizing feature space entropy, enabling generative AI models to quickly learn and adapt from extreme long-tail data distribution drift. Compared to conventional supervised learning that relies solely on defect labels, this scheme constrains the model from the source of latent space feature stability, eliminating the model's sensitivity to noise interference from novel coatings and laying a solid algorithmic foundation for the production line to resume high-speed operation.

[0048] In a preferred embodiment of the present invention, the method further includes: after deploying the updated generative AI model to the visual inspection system of the automated production line, sending a cycle recovery command to the automated production line so that the automated production line can gradually increase its operating cycle within a preset transition time window; during the gradual increase of the operating cycle, monitoring the feature space entropy corresponding to the current image features in real time; if the feature space entropy remains below a preset warning threshold under the target extreme cycle, confirming that the system has returned to normal operation.

[0049] Specifically, after completing the offline fine-tuning and redeployment of the generative AI model, the system needs to execute a closed-loop recovery process to verify the reliability of the model and restore the production line to its high-speed operation state. The updated generative AI model is loaded into the edge computing node or vision inspection system of the automated production line. After that, the system will not immediately require the production line to run at full capacity. Instead, it will send a cycle recovery command to the underlying programmable logic controller (PLC) of the production line to control the automated production line to gradually increase the mechanical operation cycle in a step-by-step manner within a preset transition time window, that is, gradually increase the throughput requirements of image processing. During each cycle increase, the increased conveyor belt speed causes motion blur to be superimposed on the optical artifacts. The system must continuously extract bolt image data and calculate the current feature space entropy in real time. Finally, when the production line reaches the target maximum speed, i.e. the highest speed before the degradation is triggered, and the feature space entropy remains below the preset warning threshold in multiple consecutive inspection batches, the system confirms that the updated model has completely overcome the dynamic interference, and the production line safely returns to a normal operating state that balances high throughput and zero missed detections. For example, when the updated generative AI model was deployed on Monday, the system sent instructions to the production line, requiring the production line to increase the conveyor belt speed from 5 bolts per second when it was physically decelerated to 2 bolts per second every 10 minutes, then to 7 bolts per second, then to 9 bolts per second, and finally to the target speed of 10 bolts per second within the first 30 minutes, i.e. the transition time window. When the speed was increased to 9 bolts / second, the increased mechanical vibration caused more motion blur in the image, and the system detected a slight fluctuation in the feature space entropy, but the highest value was only 0.40, which was far below the preset warning threshold of 0.60. When the system continuously detected 10,000 bolts coated with the new anti-rust oil at the maximum speed of 10 bolts per second, and the feature space entropy stabilized within the safe range, the system output a steady-state recovery confirmation signal on the control panel and ended the closed-loop verification process. This embodiment avoids the risk of sudden missed detections that may be caused by running at full load directly after model updates by designing a recovery strategy that combines step-by-step cycle time improvement with real-time monitoring of feature space entropy. This mechanism of deep linkage between physical hardware control and visual algorithm status ensures that the production line can smoothly and safely cross the performance recovery period after experiencing severe optical interference and completing adaptive evolution, perfectly closing the entire risk hedging process from risk warning, proactive degradation, offline fine-tuning to normalized recovery.

[0050] The foregoing has provided a detailed description of one embodiment of the present invention, but this description is merely a preferred embodiment and should not be construed as limiting the scope of the invention. All equivalent variations and modifications made within the scope of the claims of this invention should still fall within the patent coverage of this invention.

Claims

1. A method for detecting bolt appearance and dimensional defects based on machine vision, characterized in that, Includes the following steps: Step 1: Receive a trigger signal and acquire a sequence of target object images of bolts on the production line through a vision acquisition device; acquire pixel equivalent calibration parameters that characterize the conversion relationship between pixels and physical dimensions; extract the underlying pixel distribution features and latent space vector of the target object image sequence. Step 2: Calculate the image feature space entropy based on the underlying pixel distribution features and the latent space vector; The image feature space entropy is mapped to a feature failure probability between 0 and 1 using a feature failure probability mapping model. Step 3: Compare the failure probability of the feature with a preset danger threshold between 0 and 1; if it is less than the threshold, call the generative feature extraction network to enhance the features of the target object image sequence and generate the first fused image feature; if it is greater than or equal to the threshold, trigger the image processing degradation mechanism, disable the network and call the deterministic geometric morphology filtering operator to process the target object image sequence and generate the second basic geometric feature. Step 4: Based on the pixel equivalent calibration parameters and the first fused image features or the second basic geometric features, extract the bolt edge contour parameters and calculate the actual appearance size parameters. The size parameters are compared with the standard size threshold range, and the classification confidence of the target appearance size defect between 0 and 1 is calculated by combining the defect classification model; the defect labeling data is output based on the classification confidence.

2. The method for detecting bolt appearance and dimensional defects based on machine vision according to claim 1, characterized in that, The steps for calculating the image feature space entropy include: extracting dynamic high-frequency spot noise from the target object image sequence; calculating the distribution difference metric between the underlying pixel distribution features and the preset baseline noise-free distribution features; and linearly weighting and fusing the distribution difference metric with the energy value of the dynamic high-frequency spot noise according to preset weights to generate the image feature space entropy.

3. The method for detecting bolt appearance and dimensional defects based on machine vision according to claim 1, characterized in that, The generative feature extraction network includes a diffusion generation module, which is pre-trained using preset low-frequency defect data samples. The step of calling the generative feature extraction network to enhance the features of the target object image sequence includes: identifying motion-blurred regions in the target object image sequence; reconstructing the texture of the motion-blurred regions through the diffusion generation module; and outputting the first fused image features.

4. The method for detecting bolt appearance and dimensional defects based on machine vision according to claim 1, characterized in that, The deterministic geometric morphology filtering operator employs a fixed-parameter edge extraction algorithm; the step of triggering the image processing degradation mechanism further includes: synchronously increasing the image downsampling step size to reduce the amount of image processing data per unit time; and lowering the judgment threshold of the feature failure probability mapping model to improve the recall rate of defective image features, thereby suppressing the classification boundary shift caused by asymmetric optical interference.

5. The method for detecting bolt appearance and dimensional defects based on machine vision according to claim 1, characterized in that, The steps for calculating the classification confidence of the target appearance size defect include: obtaining the current pipeline operating speed parameter from the pipeline controller or speed encoder; combining the feature failure probability with the current pipeline operating speed parameter, and assigning attention channel weights to the first fused image feature or the second basic geometric feature according to a preset weight allocation rule, wherein the attention channel weights are normalized weight values; and calculating the classification confidence based on the attention channel weights using the defect classification model.

6. The method for detecting bolt appearance and dimensional defects based on machine vision according to claim 1, characterized in that, The target object image sequence contains dynamic high-frequency light spot noise caused by changes in the anti-rust oil coating on the bolt surface; the target appearance dimensional defects include at least fatigue cracks.

7. The method for detecting bolt appearance and dimensional defects based on machine vision according to claim 6, characterized in that, During the acquisition of the target object image sequence, the original visual data is processed by an adaptive downsampling module; wherein, the adaptive downsampling module dynamically adjusts the image downsampling rate and the feature extraction window size according to preset mechanical vibration frequency and pipeline running speed parameters.

8. The method for detecting bolt appearance and dimensional defects based on machine vision according to claim 1, characterized in that, The step of extracting the latent space vector of the target object image sequence includes: inputting the target object image sequence into a pre-trained variational autoencoder; mapping pixel space data to a continuous feature distribution space through the encoder network of the variational autoencoder; and sampling from the feature distribution space to generate the latent space vector.

9. The method for detecting bolt appearance and dimensional defects based on machine vision according to claim 1, characterized in that, The step of outputting the defect labeling data based on the classification confidence level includes: comparing the classification confidence level with a preset safety judgment threshold; if the classification confidence level is less than the safety judgment threshold, then outputting qualified labeling data; if the classification confidence level is greater than or equal to the safety judgment threshold, then outputting defect labeling data to the production line control system interface.

10. The method for detecting bolt appearance and dimensional defects based on machine vision according to claim 1, characterized in that, The method further includes a feature space parameter self-tuning step: using a preset reinforcement learning algorithm, with the goal of minimizing the feature failure probability and maximizing the preset image processing throughput, the online dynamic adjustment of the danger threshold is automatically completed within a preset period, and the adjusted danger threshold is still between 0 and 1.

Citation Information

Patent Citations

  • Surface defect detection method and device based on machine vision

    CN119600026A

  • Track bolt detection method and system

    CN120765531A

  • Bearing defect detection method and system based on machine vision and ultrasonic detection

    CN120997165A

  • Loudspeaker mask defect identification method and system based on visual inspection

    CN121504846A

  • Systems and methods for estimating robustness of a machine learning model

    US20240135689A1