Automobile wire harness quality inspection method based on visual inspection
By using a vision-based inspection method for automotive wiring harnesses, an adaptive preprocessing and visual attention network are used to construct a feature library. The feature library and judgment threshold are dynamically updated, which solves the problems of low detection efficiency and poor adaptability in existing technologies. This method achieves efficient and robust wiring harness inspection that can adapt to dynamic changes in the production line.
Patent Information
- Application Number
- CN202511845847.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-09
- Publication Date
- 2026-02-06
AI Technical Summary
Existing automotive wiring harness inspection technologies suffer from problems such as low efficiency of manual inspection, reliance on large amounts of labeled data for traditional machine vision inspection, weak environmental robustness, poor batch adaptability, and limited inspection range. There is an urgent need for a quality inspection method that is highly robust, can cover appearance and assembly precision defects, and can adapt to dynamic changes in the production line.
A vision-based inspection method for automotive wiring harnesses is adopted. Key visual features are extracted through adaptive preprocessing and visual attention network to construct a normal feature library. The feature library and judgment threshold are dynamically updated. Defect areas are located by combining visual attention heatmap, matching the preset defect feature template library, and outputting the quality inspection conclusion.
It enables online full inspection of the appearance and assembly precision of automotive wiring harnesses, adapts to dynamic changes in the production line, eliminates the need for manual parameter adjustments, lowers the operational threshold, expands the inspection scope to cover core quality inspection items, and improves inspection efficiency and robustness.
Smart Images

Figure CN121482017A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of visual inspection and automotive wiring harness inspection technology, and particularly to a visual inspection-based method for automotive wiring harness quality inspection. Background Technology
[0002] Automotive wiring harnesses are the core connection components of automotive electrical systems. They consist of components such as core wires, insulation layers, terminals, and sheaths. They are responsible for transmitting electrical energy and control signals, and connecting various electrical components such as the engine, sensors, and instrument panel. Their quality directly determines the safety, reliability, and operational stability of a vehicle.
[0003] Existing automotive wiring harness inspection technologies are mainly divided into manual visual inspection, traditional machine vision inspection, and electrical / mechanical inspection. Manual visual inspection relies on operators' naked eye observation to judge appearance defects and assembly accuracy; traditional machine vision inspection uses industrial cameras to acquire images and combines supervised deep learning models or simple image processing algorithms to identify appearance defects; electrical / mechanical inspection uses equipment such as continuity testers and pull-out testers to randomly inspect electrical and mechanical performance.
[0004] However, existing technologies suffer from problems such as low efficiency of manual inspection, reliance on large amounts of labeled data for traditional machine vision inspection, weak environmental robustness, poor batch adaptability, and limited inspection range. Therefore, there is an urgent need for a highly robust automotive wiring harness quality inspection method that can cover appearance and assembly precision defects and adapt to dynamic changes in the production line. Summary of the Invention
[0005] This invention aims to at least solve one of the technical problems existing in the prior art. To this end, this invention proposes a vision-based inspection method for automotive wiring harnesses, which can cover appearance and assembly precision defects and is adaptable to dynamic changes in the production line.
[0006] This invention provides a vision-based method for quality inspection of automotive wiring harnesses, comprising the following steps: acquiring visual images of qualified automotive wiring harnesses to construct a normal sample image set; performing adaptive preprocessing on the normal sample image set to obtain standardized normal images, the adaptive preprocessing including image denoising and adaptive illumination compensation; inputting the standardized normal images into a pre-trained visual attention network to extract key visual features of qualified wiring harnesses and construct a normal feature library; acquiring visual images of wiring harnesses to be inspected, performing the adaptive preprocessing to obtain standardized images to be inspected, and extracting key visual features from the images to be inspected; calculating the feature deviation between the key visual features of the images to be inspected and the features in the normal feature library, and if the feature deviation exceeds an initial judgment threshold, determining that the wiring harness to be inspected has a defect; dynamically updating the normal feature library and the judgment threshold through an online self-calibration module, the online self-calibration module adjusting the feature distribution of the normal feature library and the corresponding judgment threshold based on qualified images to be inspected within a preset period; for images to be inspected that are determined to have defects, locating the defect area through a visual attention heatmap, matching it with a preset defect feature template library, determining the defect type, and outputting a quality inspection conclusion.
[0007] According to some embodiments of the present invention, the normal feature library further includes assembly accuracy features, which include terminal arrangement features, core wire color sequence features, and terminal insertion position features; the extraction of key visual features of qualified wire harnesses further includes: strengthening terminal area features through the spatial attention module of a visual attention network, screening key points on the terminal edge, calculating the spacing between key points and the overall arrangement width to obtain terminal arrangement features; segmenting according to the order from the terminal end to the wire harness body end, extracting the mean features of HSV color components for each segment to form an ordered sequence to obtain core wire color sequence features; separating the terminal and connector areas through threshold segmentation, calculating the pixel length of the terminal exceeding the connector edge and the percentage of overlapping pixels between the two areas to obtain terminal insertion position features; when calculating the feature deviation, the assembly accuracy features are compared simultaneously, and if there is a deviation, it is determined to be a corresponding assembly defect, which includes abnormal terminal quantity, incorrect wire sequence, and improper insertion.
[0008] According to some embodiments of the present invention, the determination of abnormal terminal quantity includes: extracting the terminal arrangement features of the image to be detected and comparing them with the distribution range of the normal feature library; if the number of feature points deviates from the normal range by ±1, or the arrangement width deviates from the normal range by ±10%, it is determined that the terminal quantity is abnormal and clearly marked in the quality inspection conclusion; the determination of incorrect line sequence includes: splitting the core line region of the standardized image to be detected according to a preset segmentation rule, extracting the HSV color features of each core line segment to form a color sequence to be detected; calculating the edit distance between the color sequence to be detected and the color sequence template in the normal feature library, the edit distance calculation formula is:
[0009] ;
[0010] in, Let be the edit distance between sequence a and sequence b, where a is the core wire color sequence of the wire bundle to be detected, n is the sequence length, b is the core wire color sequence template from the normal feature library, and m is the sequence length. This is an indicator function, taking the value 0 or 1, where 0 indicates consistent color and 1 indicates inconsistent color. If the edit distance is greater than or equal to 2, the feature deviation is deemed excessive, and the corresponding defect type is line sequence error. The determination of improper insertion includes: extracting the protruding length of the terminal and the pixel ratio of the mating area in the image to be inspected, and comparing it with the insertion position feature range in the normal feature library. If the pixel ratio of the mating area is lower than the minimum threshold of the normal feature library, or the protruding length exceeds the normal range of ±0.5mm, the feature deviation is deemed excessive, and the corresponding defect type is improper terminal insertion.
[0011] According to some embodiments of the present invention, the adaptive preprocessing includes: using Gaussian filtering to denoise the acquired visual image and eliminate high-frequency noise in the image; performing adaptive illumination compensation using the Retinex algorithm to calculate the reflection component and illumination component of the image, eliminate brightness differences caused by uneven illumination, and obtain a preprocessed image with uniform brightness; and performing size normalization on the preprocessed image to adjust the image to a preset input size to ensure consistency of feature extraction.
[0012] According to some embodiments of the present invention, the visual attention network includes a basic feature extraction network and an attention enhancement module. Specifically, the basic feature extraction network adopts EfficientNet, which extracts basic visual features of the wire harness through depthwise separable convolution, including color distribution features, edge contour features, and crimping area texture features. The attention enhancement module adopts a CBAM channel-spatial attention module, which performs channel weight allocation and spatial weight allocation on the basic visual features to enhance the key area features of qualified wire harnesses. The attention-enhanced feature map is converted into fixed-dimensional key visual features through a global average pooling layer for constructing a normal feature library. The key areas include wire harness terminals and crimping connectors.
[0013] According to some embodiments of the present invention, the construction of the normal feature library includes: clustering key visual features of standardized normal images, using density clustering algorithm to identify the distribution pattern of normal features, and determining the center vector and feature variance of normal features; storing the center vector and feature variance in association to form a normal feature library, which contains the feature distribution range of different batches of qualified wire harnesses for subsequent feature deviation calculation; the construction of the preset defect feature template library includes: acquiring images of typical wire harness defects, extracting local visual features of each defect type, and forming defect feature templates; the typical wire harness defects include cracks. The defects include crimping oxidation and exposed core wires. Each defect feature template is categorized and stored according to type to construct a defect feature template library. This library does not require annotating the overall image of the wire harness corresponding to the defect; only local defect features are needed. Determining the defect type by matching the preset defect feature template library includes: extracting local visual features of the suspected defect area and calculating the similarity with the features of each type of template in the defect feature template library; if the similarity of a certain type of template exceeds a preset matching threshold, the defect type of the wire harness to be detected is determined to be the defect type corresponding to that template; if the similarity of all templates is below the matching threshold, it is determined to be an unknown defect and marked as requiring manual review.
[0014] According to some embodiments of the present invention, the feature deviation is calculated using Mahalanobis distance, specifically including: obtaining the feature center vector and covariance matrix of the corresponding beam type in the normal feature library; calculating the Mahalanobis distance between the key visual features of the image to be detected and the feature center vector, the formula being: Where x is the key visual feature vector of the image to be detected. Let be the normal eigencenter vector, and T denote the matrix transpose operation. The inverse of the covariance matrix of the normal features is used; the Mahalanobis distance is used as the feature deviation and compared with the initial judgment threshold to determine whether there is a defect.
[0015] According to some embodiments of the present invention, the update process of the online self-calibration module includes: setting a self-calibration period, wherein the period is a preset number of consecutive qualified images to be detected; the qualified images to be detected are images whose feature deviation is lower than a judgment threshold; when the number of detected qualified images to be detected reaches the period threshold, extracting the key visual features of the batch of qualified images; updating the feature center vector of the normal feature library using a weighted average method, wherein the weight of the weighted average is a preset ratio of the weight of historical features to the weight of new features, preserving the stability of historical features while incorporating the changes in features of the new batch; and recalculating the judgment threshold based on the feature variance corresponding to the updated feature center vector to ensure that the threshold matches the normal feature distribution of the current batch of harnesses.
[0016] According to some embodiments of the present invention, the method of locating defect regions by visual attention heatmap includes: extracting the output weights of the attention module in the visual attention network of the image to be detected, generating an attention heatmap, wherein the region with higher weight in the heatmap corresponds to the key region of the bundle; superimposing the attention heatmap with the standardized image to be detected, locating the region with abnormally high weight, which is the suspected defect region; and extracting the contour of the suspected defect region to determine the specific location and range of the defect.
[0017] According to some embodiments of the present invention, the quality inspection conclusion includes whether it is qualified; if the quality inspection is unqualified, the quality inspection conclusion also includes the defect type, defect location and feature deviation value, and the quality inspection conclusion is stored in association with the inspection timestamp and the harness batch number for subsequent quality traceability.
[0018] The embodiments of the present invention achieve at least the following beneficial effects: The embodiments of the present invention improve environmental robustness through adaptive preprocessing; the online self-calibration module dynamically updates the feature library and judgment threshold according to a preset cycle, automatically adapts to production line drift such as material batch changes and equipment aging, without the need for manual shutdown to adjust parameters, thus reducing the operation threshold; it expands the assembly precision defect detection function, covering assembly problems such as abnormal terminal quantity, incorrect wiring sequence, and improper insertion, and the detection scope covers the core quality inspection items of appearance and assembly precision, realizing the online full inspection requirements of automotive wiring harnesses.
[0019] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0020] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:
[0021] Figure 1 This is a flowchart illustrating the method according to an embodiment of the present invention. Detailed Implementation
[0022] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0023] In the description of this invention, "several" means one or more, "multiple" means two or more, "greater than," "less than," and "exceeding" are understood to exclude the stated number, while "above," "below," and "within" are understood to include the stated number. The use of "first" and "second" in the description is merely for distinguishing technical features and should not be construed as indicating or implying relative importance, or implicitly indicating the number of indicated technical features, or implicitly indicating the order of the indicated technical features.
[0024] Reference Figure 1 This invention proposes a vision-based inspection method for automotive wiring harnesses, comprising the following steps:
[0025] Visual images of qualified automotive wiring harnesses are collected to construct a normal sample image set; adaptive preprocessing is performed on the normal sample image set to obtain standardized normal images. The adaptive preprocessing includes image denoising and adaptive illumination compensation.
[0026] Standardized normal images are input into a pre-trained visual attention network to extract key visual features of qualified line bundles and construct a normal feature library.
[0027] The visual image of the wire harness to be detected is acquired, and adaptive preprocessing is performed to obtain a standardized image to be detected. The key visual features of the image to be detected are then extracted.
[0028] Calculate the deviation between the key visual features of the image to be detected and the features of the normal feature library. If the feature deviation exceeds the initial judgment threshold, it is determined that the wire bundle to be detected has a defect.
[0029] The online self-calibration module dynamically updates the normal feature library and the judgment threshold. Based on qualified images to be detected within a preset period, the online self-calibration module adjusts the feature distribution of the normal feature library and the corresponding judgment threshold.
[0030] For images identified as having defects, the defect area is located using a visual attention heatmap, matched against a pre-defined defect feature template library, the defect type is determined, and a quality inspection conclusion is output.
[0031] In some embodiments, the normal feature library also includes assembly accuracy features, which include terminal arrangement features, core wire color sequence features, and terminal insertion position features. Extracting key visual features of qualified wire harnesses also includes: strengthening terminal area features through the spatial attention module of a visual attention network, filtering key points on the terminal edge, calculating the spacing between key points and the overall arrangement width to obtain terminal arrangement features; segmenting the wire harness in the order from the terminal end to the wire harness body end, extracting the mean features of HSV color components from each segment to form an ordered sequence to obtain core wire color sequence features; separating the terminal and connector areas through threshold segmentation, calculating the pixel length of the terminal exceeding the connector edge and the percentage of overlapping pixels between the two areas to obtain terminal insertion position features; when calculating feature deviation, the assembly accuracy features are compared simultaneously, and if there is a deviation, it is determined to be a corresponding assembly defect, including abnormal terminal quantity, incorrect wire sequence, and improper insertion.
[0032] In some embodiments, the determination of abnormal terminal quantity includes: extracting the terminal arrangement features of the image to be detected and comparing them with the distribution range of the normal feature library; if the number of feature points deviates from the normal range by ±1, or the arrangement width deviates from the normal range by ±10%, it is determined that the terminal quantity is abnormal and clearly marked in the quality inspection conclusion.
[0033] In some embodiments, the determination of line sequence errors includes: splitting the core line region of the standardized image to be detected according to a preset segmentation rule, extracting the HSV color features of each core line segment to form a color sequence to be detected; calculating the edit distance between the color sequence to be detected and the color sequence template in the normal feature library, wherein the edit distance calculation formula is:
[0034] ;
[0035] in, Let be the edit distance between sequence a and sequence b, where a is the core wire color sequence of the wire bundle to be detected, n is the sequence length, b is the core wire color sequence template from the normal feature library, and m is the sequence length. This is an indicator function, taking the value 0 or 1, where 0 indicates consistent colors and 1 indicates inconsistent colors. If the edit distance is greater than or equal to 2, the feature deviation is determined to be excessive, and the corresponding defect type is line sequence error.
[0036] In some embodiments, the determination of improper insertion includes: extracting the protruding length of the terminal and the pixel ratio of the mating area in the image to be detected, and comparing it with the insertion position feature range in the normal feature library; if the pixel ratio of the mating area is lower than the minimum threshold of the normal feature library, or the protruding length exceeds the normal range of ±0.5mm, the feature deviation is determined to be excessive, and the corresponding defect type is improper insertion of the terminal.
[0037] In some embodiments, adaptive preprocessing includes: applying Gaussian filtering to denoise the acquired visual image to eliminate high-frequency noise in the image; performing adaptive illumination compensation using the Retinex algorithm to calculate the reflection component and illumination component of the image, eliminating brightness differences caused by uneven illumination, and obtaining a preprocessed image with uniform brightness; and normalizing the size of the preprocessed image to adjust the image to a preset input size to ensure consistency of feature extraction.
[0038] In some embodiments, the visual attention network includes a basic feature extraction network and an attention enhancement module. Specifically, the basic feature extraction network uses EfficientNet to extract basic visual features of the wire harness through depthwise separable convolutions, including color distribution features, edge contour features, and crimping region texture features. The attention enhancement module uses a CBAM channel-spatial attention module to perform channel weight allocation and spatial weight allocation on the basic visual features, enhancing the key region features of qualified wire harnesses. The attention-enhanced feature map is converted into fixed-dimensional key visual features through a global average pooling layer for constructing a normal feature library. The key regions include wire harness terminals and crimping connectors.
[0039] In some embodiments, constructing a normal feature library includes: performing clustering processing on key visual features of standardized normal images, using density clustering algorithm to identify the distribution pattern of normal features, and determining the center vector and feature variance of normal features; storing the center vector and feature variance together to form a normal feature library, which contains the feature distribution range of different batches of qualified wire harnesses for subsequent feature deviation calculation.
[0040] In some embodiments, the construction of a preset defect feature template library includes: acquiring images of typical wire harness defects, extracting local visual features of each defect type, and forming defect feature templates; typical wire harness defects include cracks, crimp oxidation, and exposed core wires; classifying and storing each defect feature template by type to construct a defect feature template library; the template library does not need to label the overall wire harness image corresponding to the defect, only the local defect features are required.
[0041] In some embodiments, determining the defect type by matching a preset defect feature template library includes: extracting local visual features of the suspected defect area and calculating the similarity between the features and the features of each type of template in the defect feature template library; if the similarity of a certain type of template exceeds a preset matching threshold, the defect type of the wire harness to be detected is determined to be the defect type corresponding to that template; if the similarity of all templates is lower than the matching threshold, it is determined to be an unknown defect and marked as requiring manual review.
[0042] In some embodiments, the feature deviation is calculated using Mahalanobis distance, specifically including: obtaining the feature center vector and covariance matrix of the corresponding beam type in the normal feature library; calculating the Mahalanobis distance between the key visual features of the image to be detected and the feature center vector, using the formula:
[0043] ;
[0044] Where x is the key visual feature vector of the image to be detected. Let be the normal eigencenter vector, and T denote the matrix transpose operation. The inverse of the covariance matrix of the normal features is used; the Mahalanobis distance is used as the feature deviation and compared with the initial judgment threshold to determine whether there is a defect.
[0045] In one specific embodiment, a certain model of automotive wiring harness to be tested includes 5 core wires and 5 terminals. Its qualification standards are: terminal spacing of 8±0.5mm, wire sequence of [red-yellow-blue-green-black], and terminal insertion protrusion length ≤1mm.
[0046] When only assembly precision defects exist (abnormal terminal quantity: 5 qualified, 4 actual), feature extraction is performed on the wire harness to be inspected, and the key visual feature vector of the wire harness to be inspected is obtained as "basic visual features (no cracks / oxidation, normal color), assembly precision features (average terminal spacing 8.1mm, number of feature points 4, wire sequence [red-yellow-blue-green-black], insertion protrusion length 0.8mm)". Feature deviation is calculated: the normal feature library contains the distribution range of the number of 5 terminal feature points. The 4 feature points to be inspected belong to the assembly precision feature deviation. This deviation, together with the basic visual features, participates in the Mahalanobis distance calculation, and finally obtains a feature deviation of 3.0, which exceeds the threshold of 2.7. The judgment logic is: because the deviation of the assembly precision features directly increases the total feature deviation, it is uniformly judged as having a defect. Subsequently, the source of feature deviation is located, and the defect type is clarified as abnormal terminal quantity.
[0047] When only basic visual defects (terminal crimping cracks) exist, feature extraction is performed on the wiring harness to be inspected, and the key visual feature vector is obtained as "basic visual features (0.3mm crack at the terminal crimping, normal color), assembly precision features (terminal spacing 8.0mm, number of feature points 5, line sequence [red-yellow-blue-green-black], insertion protrusion length 0.9mm)". Feature deviation is calculated: the assembly precision features are completely in line with the normal distribution and there is no deviation, but the crack in the basic visual features causes the feature vector to deviate from the normal range. The Mahalanobis distance calculation shows that the feature deviation is 2.9, which exceeds the threshold of 2.7. The judgment logic is: the total feature deviation exceeds the standard, and it is uniformly judged as a defect. Subsequently, the defect type is identified as a terminal crimping crack by using attention heatmap.
[0048] When both assembly precision defects and basic visual defects (incorrect wiring sequence and terminal oxidation) exist simultaneously, feature extraction is performed on the wiring harness to be inspected, resulting in the key visual feature vector as "basic visual features (terminal surface oxidation area 1mm², no cracks), assembly precision features (terminal spacing 8.2mm, number of feature points 5, wiring sequence [red-blue-yellow-green-black], insertion protrusion length 1.1mm)". Feature deviation is calculated: the wiring sequence edit distance in the assembly precision features is 2, and the insertion protrusion length exceeds the threshold. Oxidation in the basic visual features, together, causes the feature vector to deviate significantly from the normal distribution, with a Mahalanobis distance of 3.5, far exceeding the threshold of 2.7. The judgment logic is: if the total feature deviation exceeds the standard, it is uniformly judged as having defects. Subsequently, feature matching is used to clarify the dual defects of wiring sequence error and terminal oxidation.
[0049] In some embodiments, the update process of the online self-calibration module includes: setting a self-calibration period, the period being a preset number of consecutive qualified images to be detected; qualified images to be detected are images whose feature deviation is lower than a judgment threshold; when the number of detected qualified images to be detected reaches the period threshold, extracting the key visual features of the batch of qualified images; updating the feature center vector of the normal feature library using a weighted average method, the weight of the weighted average being a preset ratio of the weight of historical features to the weight of new features, preserving the stability of historical features while incorporating the changes in features of the new batch; recalculating the judgment threshold based on the feature variance corresponding to the updated feature center vector, ensuring that the threshold matches the normal feature distribution of the current batch of harnesses.
[0050] The adaptive calibration in this embodiment is based on a unified qualification standard for products of the same specification. The core principle is to filter out random noise by setting a reasonable periodic threshold to ensure sample representativeness. By continuously accumulating qualified samples in the production process, once the sample size reaches the threshold, a weighted average method with 70% weight for historical features and 30% weight for newly accumulated features is used to dynamically update the center vector and covariance matrix of the normal feature library. The Mahalanobis distance judgment threshold is adjusted synchronously, allowing the detection standard to slowly absorb the small differences between batches under the same qualification standard (such as material and process fine-tuning) and the slow drift in the production process (such as equipment aging and environmental changes). At the same time, through the dual constraints of only qualified samples participating in the update and a fixed qualification hard threshold as a fallback, the feature center is strictly limited to fine-tuning only within the qualification range to avoid bottomless drift. This embodiment eliminates the need for manual intervention in database construction or parameter adjustment. It solves the pain points of traditional fixed standards, which are difficult to adapt to differences between multiple batches and are prone to misjudgment due to long-term drift. It also eliminates the risk of unqualified products passing through feature drift, ensuring that the testing standard always dynamically matches the actual production, maintains high accuracy and robustness in the long term, adapts to the needs of high-speed, multi-batch production lines, and significantly reduces the operating threshold and quality inspection costs for small and medium-sized enterprises.
[0051] In some embodiments, locating defect regions using a visual attention heatmap includes: extracting the output weights of the attention modules in the visual attention network of the image to be detected, generating an attention heatmap, where regions with higher weights in the heatmap correspond to key regions of the wire bundle; overlaying the attention heatmap with the standardized image to be detected to locate regions with abnormally high weights, which are suspected defect regions; and extracting the contours of the suspected defect regions to determine the specific location and extent of the defect.
[0052] In some embodiments, the quality inspection conclusion includes whether it is qualified; if the quality inspection is unqualified, the quality inspection conclusion also includes the defect type, defect location and feature deviation value. The quality inspection conclusion is stored in association with the inspection timestamp and the harness batch number for subsequent quality traceability.
[0053] Although specific embodiments are described herein, those skilled in the art will recognize that many other modifications or alternative embodiments are also within the scope of this disclosure. For example, any of the functions and / or processing capabilities described in connection with a particular device or component can be performed by any other device or component. Furthermore, while various exemplary embodiments and architectures have been described according to embodiments of this disclosure, those skilled in the art will recognize that many other modifications to the exemplary embodiments and architectures described herein are also within the scope of this disclosure.
[0054] The foregoing description, with reference to block diagrams and flowcharts of systems, methods, systems, and / or computer program products according to exemplary embodiments, has described certain aspects of this disclosure. It should be understood that one or more blocks in the block diagrams and flowcharts, as well as combinations of blocks in the block diagrams and flowcharts, can be implemented by executing computer-executable program instructions, respectively. Similarly, according to some embodiments, some blocks in the block diagrams and flowcharts may not need to be executed in the order shown, or may not all need to be executed. Furthermore, additional components and / or operations beyond those shown in the blocks in the block diagrams and flowcharts may exist in some embodiments.
[0055] Therefore, blocks in block diagrams and flowcharts support combinations of means for performing a specified function, combinations of elements or steps for performing a specified function, and program instruction means for performing a specified function. It should also be understood that each block in a block diagram and flowchart, and combinations of blocks in block diagrams and flowcharts, can be implemented by a dedicated hardware computer system or a combination of dedicated hardware and computer instructions that performs a specific function, element, or step.
[0056] The program modules, applications, etc., described herein may include one or more software components, including, for example, software objects, methods, data structures, etc. Each such software component may include computer-executable instructions that, in response to execution, cause at least a portion of the functionality described herein (e.g., one or more operations of the exemplary methods described herein) to be performed.
[0057] Software components can be coded using any of a variety of programming languages. An exemplary programming language could be a low-level programming language, such as assembly language associated with a specific hardware architecture and / or operating system platform. Software components including assembly language instructions may need to be converted into executable machine code by an assembler before being executed by the hardware architecture and / or platform. Another exemplary programming language could be a higher-level programming language that is portable across multiple architectures. Software components including higher-level programming languages may need to be converted into an intermediate representation by an interpreter or compiler before execution. Other examples of programming languages include, but are not limited to, macro languages, shell or command languages, job control languages, scripting languages, database query or search languages, or report writing languages. In one or more exemplary embodiments, a software component containing instructions from one of the above-described programming language examples can be executed directly by the operating system or other software components without first being converted into another form.
[0058] Software components can be stored as files or other data storage structures. Software components of similar type or related function can be stored together in a specific directory, folder, or library. Software components can be static (e.g., pre-defined or fixed) or dynamic (e.g., created or modified at runtime).
[0059] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of the present invention.
Claims
1. A visual inspection-based method for automotive wiring harness quality inspection, characterized in that, Includes the following steps: Collect visual images of qualified automotive wiring harnesses to construct a normal sample image set; The normal sample image set is subjected to adaptive preprocessing to obtain standardized normal images. The adaptive preprocessing includes image denoising and adaptive illumination compensation. The standardized normal image is input into a pre-trained visual attention network to extract key visual features of qualified line bundles and construct a normal feature library. A visual image of the wire harness to be detected is acquired, and the adaptive preprocessing is performed to obtain a standardized image to be detected. The key visual features of the image to be detected are then extracted. Calculate the deviation between the key visual features of the image to be detected and the features of the normal feature library. If the feature deviation exceeds the initial judgment threshold, it is determined that the wire harness to be detected has a defect. The normal feature library and the judgment threshold are dynamically updated by the online self-calibration module. The online self-calibration module adjusts the feature distribution of the normal feature library and the corresponding judgment threshold based on qualified images to be detected within a preset period. For images identified as having defects, the defect area is located using a visual attention heatmap, matched against a pre-defined defect feature template library, the defect type is determined, and a quality inspection conclusion is output.
2. The automotive wiring harness quality inspection method based on vision inspection according to claim 1, characterized in that, The normal feature library also includes assembly accuracy features, which include terminal arrangement features, core wire color sequence features, and terminal insertion position features. The key visual features for extracting qualified wire harnesses also include: By using the spatial attention module of the visual attention network, the terminal area features are enhanced, key points on the terminal edge are filtered, and the spacing between key points and the overall arrangement width are calculated to obtain the terminal arrangement features. The wire harness is segmented in order from the terminal end to the main body end. The mean value feature of the HSV color component is extracted from each segment to form an ordered sequence, thus obtaining the core wire color sequence feature. By separating the terminal and connector areas through threshold segmentation, the pixel length of the terminal extending beyond the connector edge and the percentage of overlapping pixels in the two areas are calculated to obtain the terminal insertion position characteristics. When calculating the deviation of the features, the assembly accuracy features are compared simultaneously. If there is a deviation, it is determined to be a corresponding assembly defect. The assembly defects include abnormal number of terminals, incorrect wiring sequence, and improper insertion.
3. The automotive wiring harness quality inspection method based on vision inspection according to claim 2, characterized in that, The determination of abnormal terminal quantity includes: Extract the terminal arrangement features of the image to be detected and compare them with the distribution range of the normal feature library; If the number of feature points deviates from the normal range by ±1, or the arrangement width deviates from the normal range by ±10%, it is determined that the number of terminals is abnormal and this is clearly marked in the quality inspection conclusion. The determination of incorrect thread sequence includes: The core line region of the standardized image to be detected is divided according to a preset segmentation rule, and the HSV color features of each core line segment are extracted to form a color sequence to be detected. Calculate the edit distance between the color sequence to be detected and the color sequence template in the normal feature library. The formula for calculating the edit distance is: ; in, Let be the edit distance between sequence a and sequence b, where a is the core wire color sequence of the wire bundle to be detected, n is the sequence length, b is the core wire color sequence template from the normal feature library, and m is the sequence length. This is an indicator function, taking the value 0 or 1, where 0 indicates consistent colors and 1 indicates inconsistent colors. If the edit distance is greater than or equal to 2, the feature deviation is deemed excessive, and the corresponding defect type is line sequence error. The determination of improper insertion includes: Extract the protruding length of the terminal and the pixel ratio of the mating area in the image to be detected, and compare them with the insertion position feature range in the normal feature library; If the pixel ratio of the bonding area is lower than the minimum threshold of the normal feature library, or the protrusion length exceeds the normal range of ±0.5mm, the feature deviation is judged to be excessive, and the corresponding defect type is terminal insertion failure.
4. The automotive wiring harness quality inspection method based on vision inspection according to claim 1, characterized in that, The adaptive preprocessing includes: Gaussian filtering is used to denoise the acquired visual images to eliminate high-frequency noise in the images; The Retinex algorithm is used for adaptive illumination compensation. The reflection component and illumination component of the image are calculated to eliminate the brightness difference caused by uneven illumination and obtain a preprocessed image with uniform brightness. The preprocessed image is normalized to adjust it to the preset input size, ensuring consistency in feature extraction.
5. The automotive wiring harness quality inspection method based on vision inspection according to claim 1, characterized in that, The visual attention network includes a basic feature extraction network and an attention enhancement module, specifically: The basic feature extraction network adopts EfficientNet, which extracts the basic visual features of the wire bundle through depthwise separable convolution, including color distribution features, edge contour features and crimping area texture features. The attention enhancement module uses the CBAM channel-spatial attention module to perform channel weight allocation and spatial weight allocation on basic visual features, thereby enhancing the key regional features of qualified wire harnesses. The attention-enhanced feature map is converted into fixed-dimensional key visual features through a global average pooling layer, which is used to construct a normal feature library; among them, key regions include wire harness terminals and crimp connectors.
6. The automotive wiring harness quality inspection method based on vision inspection according to claim 1, characterized in that, The construction of the normal feature library includes: Clustering is performed on the key visual features of standardized normal images. Density clustering algorithm is used to identify the distribution pattern of normal features and determine the center vector and feature variance of normal features. The center vector is associated with and stored with the feature variance to form a normal feature library. The normal feature library contains the feature distribution range of different batches of qualified wire harnesses, which is used for subsequent feature deviation calculation. The construction of the preset defect feature template library includes: Images of typical wire harness defects are acquired, and local visual features of each defect type are extracted to form a defect feature template; the typical wire harness defects include cracks, crimping oxidation, and exposed core wires. Each defect feature template is classified and stored according to type to construct a defect feature template library. The template library does not require labeling of the overall image of the wire harness corresponding to the defect, but only local defect features. The determination of defect types by matching the preset defect feature template library includes: Extract local visual features of suspected defect areas and calculate similarity with features of various types of templates in the defect feature template library; If the similarity of a certain type of template exceeds the preset matching threshold, the defect type of the wire harness to be detected is determined to be the defect type corresponding to that template. If the similarity of all templates is lower than the matching threshold, it is judged as an unknown defect and marked as requiring manual review.
7. The automotive wiring harness quality inspection method based on vision inspection according to claim 1, characterized in that, The feature deviation is calculated using Mahalanobis distance, specifically including: Obtain the feature center vector and covariance matrix of the corresponding wire harness type from the normal feature library; The Mahalanobis distance between the key visual features of the image to be detected and the feature center vector is calculated using the following formula: ; Where x is the key visual feature vector of the image to be detected. Let be the normal eigencenter vector, and T denote the matrix transpose operation. It is the inverse matrix of the covariance matrix of the normal features; The Mahalanobis distance is used as the feature deviation and compared with the initial judgment threshold to determine whether there is a defect.
8. The automotive wiring harness quality inspection method based on vision inspection according to claim 1, characterized in that, The update process of the online self-calibration module includes: A self-calibration cycle is set, wherein the cycle is a preset number of consecutive qualified images to be detected; the qualified images to be detected are images whose feature deviation is lower than the judgment threshold. When the number of qualified images detected reaches the periodic threshold, the key visual features of the qualified images in that batch are extracted. The feature center vector of the normal feature library is updated using a weighted average method, where the weight of the weighted average is a preset ratio of the weight of historical features to the weight of new features. Based on the feature variance corresponding to the updated feature center vector, the judgment threshold is recalculated to ensure that the threshold matches the normal feature distribution of the current batch of harnesses.
9. The automotive wiring harness quality inspection method based on vision inspection according to claim 1, characterized in that, The method of locating defect areas using visual attention heatmaps includes: Extract the output weights of the attention module in the visual attention network of the image to be detected, and generate an attention heatmap. The regions with higher weights in the heatmap correspond to the key regions of the line bundle. By overlaying the attention heatmap onto the standardized image to be detected, regions with abnormally high weights are located, and these regions are suspected defective areas. The contours of suspected defective areas are extracted to determine the specific location and extent of the defects.
10. The automotive wiring harness quality inspection method based on vision inspection according to claim 1, characterized in that, The quality inspection conclusion includes whether it is qualified; if the quality inspection is unqualified, the quality inspection conclusion also includes the defect type, defect location and characteristic deviation value. The quality inspection conclusion is stored in association with the inspection timestamp and the harness batch number for subsequent quality traceability.
Citation Information
Cited By
Cable surface defect detection method
CN121962153A