A method and device for inspecting surface treatment effect of injection molded parts based on machine vision

CN122597299APending Publication Date: 2026-08-18KUNSHAN DI XIANG MOLDING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610707302.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-21
Publication Date
2026-08-18

AI Technical Summary

Technical Problem

[0003]现有注塑件外观质检多采用单一光源图像、固定阈值分割或通用缺陷识别模型,对不同表面处理区域通常采用统一判断标准,难以准确区分真实处理异常与曲面反光、纹理显影、载具背景干扰之间的差异;同时,传统方法缺少与产品型号、工艺模板和返修分流记录之间的连续绑定,检测结果多停留在缺陷框输出层面,难以支撑分区质检判定、边界污染识别和产线返修追溯

Benefits of technology

本发明通过在质检传送段引入载具定位触发的多光态采集方式,使同一注塑件在同轴光、低角度条纹光和交叉偏振光下形成绑定图像,能够同时覆盖颜色覆盖、微纹理显影、光泽异常和边界污染等处理效果特征,避免单一光源下高光误报和暗纹漏检。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122597299A_ABST
    Figure CN122597299A_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on machine vision's injection molding piece surface treatment effect quality inspection method and device, including the following steps: step one: trigger multi-light state image acquisition, obtain multi-light state quality inspection image set.Step two: correct and standardize image, obtain pose correction mapping relationship and standardization surface area image.Step three: align process template, obtain surface treatment partition map and partition quality inspection rule.Step four: extract difference, polarization and texture features, obtain cross-light state consistency feature tensor.Step five: input improved MaxViT model, obtain surface treatment defect identification map.Step six: screening, remapping and checking, obtain candidate defect event.Step seven: generate partition quality inspection determination result.Step eight: generate quality inspection result and send to sorting end and repair end.The application uses cross-light state gloss countermechanism and improved MaxViT model, realizes injection molding piece surface treatment effect stable identification and quality inspection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of surface treatment effect quality inspection technology for injection molded parts, and in particular to a method and apparatus for surface treatment effect quality inspection of injection molded parts based on machine vision. Background Technology

[0002] Injection molded parts are widely used in automotive interiors, electronic housings, home appliance panels, and precision structural components. After molding, they typically require spraying, polishing, laser engraving, film coating, plasma activation, matte or gloss treatment to improve appearance consistency, surface adhesion, and assembly compatibility. Quality defects after surface treatment not only manifest as scratches, orange peel, runs, missed treatments, over-treatment, and boundary contamination, but are also affected by curved surface highlights, occluded boundary reflections, material texture, and local posture deviations, resulting in defects exhibiting optical dependence and regional differences.

[0003] Current quality inspection methods for injection molded parts often employ single-light source images, fixed threshold segmentation, or general defect recognition models. These methods typically use uniform judgment standards for different surface treatment areas, making it difficult to accurately distinguish between genuine treatment anomalies and surface reflections, texture development, and carrier background interference. Furthermore, traditional methods lack continuous binding with product models, process templates, and rework diversion records. As a result, inspection results often remain at the defect box output level, making it difficult to support zonal quality inspection judgment, boundary contamination identification, and production line rework traceability.

[0004] Therefore, how to provide a machine vision-based method and device for quality inspection of the surface treatment effect of injection molded parts is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0005] One objective of this invention is to propose a machine vision-based method and device for quality inspection of the surface treatment effect of injection molded parts. This invention combines multi-light state image acquisition with an improved MaxViT model, binds the surface images of the same injection molded part under different light states through quality retrieval index, and introduces a surface treatment process template to achieve coordinate alignment between the inspection area and the partitioned quality inspection rules. Simultaneously, cross-optical state difference, polarization response, and texture gradient information are integrated to construct a cross-optical state consistent feature tensor. During machine vision recognition, a cross-optical state gloss counter-evidence mechanism is used to gate and suppress surface highlights, occlusion boundary reflections, and background texture interference, and to enhance the real defect region with consistent cross-optical state response. This enables quality inspection results to accurately reflect the surface effects of injection molded parts after spraying, polishing, laser engraving, coating, or plasma treatment, thereby improving the stability of defect identification, the accuracy of zoning judgment, and the adaptability of production line sorting and rework.

[0006] A machine vision-based method for quality inspection of the surface treatment effect of injection molded parts according to an embodiment of the present invention includes the following steps: Step 1: After the surface treatment of the injection molded part is completed, determine the surface inspection window in the quality inspection transfer section, start multi-light image acquisition according to the carrier positioning trigger signal, generate quality retrieval index, and use the quality retrieval index to bind the acquired image to obtain a multi-light quality inspection image set; Step 2: Perform pose correction, contour cropping, and brightness normalization on the multi-light quality inspection image set to obtain the pose correction mapping relationship and the normalized surface region image; Step 3: Using the quality retrieval index, retrieve the surface treatment process template, align the surface treatment process template with the standardized surface area image to obtain the surface treatment zoning map and zoning quality inspection rules; Step 4: Perform cross-optical state difference, polarization response extraction, and texture gradient encoding on the standardized surface region image and surface processing partition map to obtain the cross-optical state consistency feature tensor; Step 5: Input the cross-light state consistency feature tensor into the improved MaxViT model to obtain the surface processing defect recognition map. The improved MaxViT model includes a multi-light state embedding layer, a texture window encoding layer, a gloss counter-evidence gating layer, and a partition decoding layer. The gloss counter-evidence gating layer embeds a cross-light state gloss counter-evidence mechanism. Step 6: Based on the attitude correction mapping relationship and the surface treatment partition map, perform connected region filtering, boundary back mapping and consistency verification on the surface treatment defect identification map to obtain candidate defect events; Step 7: Based on the location, area, and response intensity of the candidate defect events, and in conjunction with the zoning quality inspection rules, generate the zoning quality inspection judgment results; Step 8: Generate the surface treatment effect quality inspection result of the injection molded parts based on the zoning quality inspection judgment result, and send it to the sorting execution end and the rework record end.

[0007] Optionally, step one specifically includes: After the injection molded parts have undergone spraying, polishing, laser engraving, film coating or plasma surface treatment, the injection molded parts are transported to the quality inspection transfer section with the carrier. A surface inspection window with a camera field of view covering the surface of the injection molded parts to be inspected is set above the quality inspection transfer section. Read the positioning trigger signal generated when the carrier enters the surface inspection window, use the trigger edge time of the positioning trigger signal as the acquisition reference time, and read the carrier number, product model number and surface treatment process number; Based on the acquisition reference time, coaxial light, low-angle stripe light and cross-polarized light are triggered sequentially, and the industrial camera is controlled to acquire the surface image of the injection molded part under the corresponding light state during the illumination of each light source. The acquisition time of each injection molded part surface image is determined based on the camera hardware timestamp, and the workpiece posture information is determined based on the carrier number and the reference positioning point in the surface inspection window. The product model number, surface treatment process number, carrier number, workpiece posture information and acquisition time are combined to generate a quality retrieval index. The quality retrieval index is then used to bind the surface images of the same injection molded part under different light states to obtain a multi-light state quality inspection image set.

[0008] Optionally, step two specifically involves: Read the images of each optical state under the same quality retrieval index from the multi-optical quality inspection image set, and use the coaxial light image as the attitude correction reference image; Grayscale conversion and Canny edge detection are performed on the attitude correction reference image to obtain the outer contour edge of the injection molded part. Template matching is then performed on the outer contour edge of the injection molded part based on the reference positioning points in the surface detection window to obtain the workpiece contour corner points. The workpiece contour corner points are registered with the standard corner points in the preset standard posture template, the perspective transformation matrix is ​​calculated, and the posture correction is performed on each light state image in the multi-light state quality inspection image set according to the perspective transformation matrix to obtain the posture correction image. The pose correction mapping relationship is generated based on the perspective transformation matrix. The pose correction mapping relationship includes the forward transformation relationship from the original image coordinates to the normalized image coordinates and the reverse transformation relationship from the normalized image coordinates to the original image coordinates. A surface region mask is generated based on the outer contour edge of the injection molded part. The surface region mask is multiplied pixel by pixel with the pose correction image, and the carrier background area is cropped to obtain the surface region cropped image. The surface region cropped image is subjected to maximum and minimum brightness normalization processing to unify the pixel brightness of each light state image to a preset brightness range, thus obtaining a standardized surface region image.

[0009] Optionally, step three specifically includes: The product model number and surface treatment process number in the quality retrieval index are parsed, and the matching surface treatment process template is retrieved from the process template library. The surface treatment process template includes a standard contour coordinate set, a processing area polygon set, an area category label, and a quality inspection threshold configuration. Read the image size and outer contour edge of the standardized surface region image, perform corner point matching between the standard contour coordinate set and the outer contour edge of the standardized surface region image, and calculate the scale transformation parameters and translation transformation parameters from template coordinates to standardized image coordinates. Based on the scaling and translation parameters, the polygon set of the processing region is transformed to the standardized image coordinate system to obtain the image coordinate processing region. Then, based on the scaling parameters, the actual surface area corresponding to a single pixel in the standardized image coordinate system is determined to obtain the pixel scale coefficient. The standardized surface region image is rasterized and labeled at the pixel level according to the region boundary of the image coordinate processing area. Pixels located in the same image coordinate processing area are assigned the same region category label to obtain the surface processing partition map. When there is boundary overlap between different image coordinate processing areas, the region category label of the overlapping pixels is determined according to the priority order of occluded boundary area, decorative processing area, and normal processing area. Based on the region category markers in the surface treatment zoning map, the corresponding noise pixel threshold, response retention threshold, area threshold, response intensity threshold, cross-zoning boundary threshold, zoning consistency threshold, and grade judgment condition are extracted from the quality inspection threshold configuration of the surface treatment process template. The pixel scale coefficient is then associated with the corresponding region category marker to obtain the zoning quality inspection rules.

[0010] Optionally, step four specifically includes: Read the coaxial light normalized image, low-angle stripe light normalized image, and cross-polarized light normalized image corresponding to the same pixel position in the normalized surface region image, and determine the region category label corresponding to the same pixel position according to the surface processing partition map; The brightness values ​​at the same pixel position are subtracted from the brightness values ​​at the same pixel position in the coaxial light normalized image and the low-angle stripe light normalized image, and the absolute value is taken to obtain the texture development difference map. The brightness values ​​at the same pixel position are subtracted from the brightness values ​​at the same pixel position in the coaxial light normalized image and the cross-polarized light normalized image, and the absolute value is taken to obtain the gloss suppression difference map. The polarization response map is obtained by dividing the luminance value of the cross-polarized light normalized image as the numerator and the sum of the luminance value of the coaxial light normalized image and the numerical stability term as the denominator. The numerical stability term is used to prevent the denominator from approaching zero. Sobel gradient extraction is performed on the low-angle striped light normalized image to obtain the horizontal texture gradient map and the vertical texture gradient map. The absolute values ​​of the horizontal texture gradient map and the vertical texture gradient map are added together to obtain the texture gradient response map. Max-min normalization is performed on the texture development difference map, gloss suppression difference map, polarization response map, and texture gradient response map. Additional partition coding channels are labeled according to the region category in the surface treatment partition map to obtain the trans-optical consistency feature tensor.

[0011] Optionally, step five specifically includes: The multi-light-state embedding layer reads the cross-light-state consistency feature tensor, and concatenates the difference channel, polarization channel, texture channel and partition coding channel in the cross-light-state consistency feature tensor into a multi-light-state pixel vector according to the pixel position. The multi-light-state pixel vector is then subjected to linear projection, GELU activation and LayerNorm layer normalization to obtain the multi-light-state surface embedding features. The texture window coding layer divides the multi-light surface embedding features into local window feature blocks, performs window self-attention calculation on each local window feature block to obtain local texture attention features, rearranges the local texture attention features according to a fixed grid interval, and performs grid self-attention calculation on the rearranged features to obtain texture grid coding features. The gloss counter-evidence gating layer splits the encoded components of texture development difference, gloss suppression difference, polarization response and texture gradient in the texture mesh encoding features into channels. The cross-optical gloss counter-evidence mechanism generates gloss counter-evidence components based on the encoded components corresponding to gloss suppression difference and polarization response, and generates texture counter-evidence components based on the encoded components corresponding to texture development difference and texture gradient. The gloss counter-evidence components, texture counter-evidence components and partitioned encoding channels are concatenated and input into the Sigmoid function to obtain the counter-evidence gating weights. The glossy counter-evidence gating layer performs gating weighting on the texture mesh encoding features according to the counter-evidence gating weight, reduces the counter-evidence region response formed by surface specular highlights, occlusion boundary reflections and background texture interference, and enhances the defect region response with consistent cross-optical response, thus obtaining glossy counter-evidence gating features. The partition decoding layer concatenates the gloss counter-evidence gating features with the partition encoding channels in the cross-optical state consistency feature tensor, and performs convolutional decoding, Softmax classification and partition boundary smoothing on the concatenated features to obtain a surface processing defect recognition map.

[0012] Optionally, step six specifically includes: Read the defect category probability and defect response value corresponding to each pixel position in the surface treatment defect identification image, compare the defect response value with the preset initial screening threshold, and mark the pixels that reach the preset initial screening threshold as defect candidate pixels; The candidate pixels of the defect are labeled with connected components according to the eight-neighbor connectivity rule to obtain the defect connected regions. The number of pixels, the bounding rectangle boundary and the average defect response value of each defect connected region are counted. Based on the surface treatment partition map, determine the region category label covered by each defect connected region, and read the corresponding region noise pixel threshold and corresponding region response retention threshold from the partition quality inspection rules. Remove connected regions in the defect connected region where the number of pixels is lower than the corresponding region noise pixel threshold and the average defect response value is lower than the corresponding region response retention threshold to obtain the effective defect connected regions. Based on the inverse transformation relationship in the attitude correction mapping relationship, the outer rectangular boundary and pixel coordinates of the effective defect connected region are back-mapped from the standardized image coordinate system to the original acquired image coordinate system to obtain the original image defect boundary; The overlap ratio between the effective defect connected region and the surface treatment partition map is calculated. When the overlap ratio of the effective defect connected region in a single partition reaches the partition consistency threshold, the single partition is taken as the partition to which the defect belongs. When the effective defect connected region spans multiple partitions, the primary partition is determined according to the partition with the largest overlapping area, and the ratio of the cross-partition boundary length to the perimeter of the effective defect connected region is calculated to obtain the cross-partition boundary ratio. Candidate defect events are generated based on the effective defect connectivity region, the original image defect boundary, the defect's partition, the primary partition, and the cross-partition boundary ratio.

[0013] Optionally, step seven specifically includes: Read the effective defect connected regions, original image defect boundaries, defect partitions, primary partitions, and cross-partition boundary ratios from candidate defect events; When a candidate defect event is located within a single partition, the partition to which the defect belongs is determined as the target decision partition; when a candidate defect event spans multiple partitions, the primary partition is determined as the target decision partition. Based on the target determination partition, the corresponding area threshold, response intensity threshold, cross-partition boundary threshold, level determination condition and pixel scale coefficient are read from the partition quality inspection rules; The number of pixels in the effective defect connected region is counted, and the number of pixels is multiplied by the pixel scale coefficient to obtain the candidate defect area; The average response intensity of the candidate defect is obtained by summing the defect response values ​​of all pixels within the effective defect connected region and dividing by the number of pixels. Based on the defect boundary of the original image, the location markers of the candidate defect events in the original acquired image of the injection molded part are determined, and the location markers are mapped to the quality inspection coordinate range corresponding to the target judgment partition. When the area of ​​a candidate defect is less than the area threshold and the average response intensity of the candidate defect is less than the response intensity threshold, the candidate defect event is marked as a minor defect event. When the area of ​​a candidate defect reaches the area threshold or the average response intensity of a candidate defect reaches the response intensity threshold, the candidate defect event is marked as a rework defect event or a scrap defect event according to the level determination criteria. When the proportion of cross-partition boundaries reaches the cross-partition boundary threshold, the level of the candidate defect event is increased by one level, and the boundary pollution mark is written into the candidate defect event. The zoning quality inspection results are generated based on the location label of the candidate defect event, the area of ​​the candidate defect, the average response intensity of the candidate defect, the target judgment zone, and the defect level.

[0014] Optionally, step eight specifically includes: Read the target judgment zone, location label, candidate defect area, average response intensity of candidate defects, and defect level from the partition quality inspection judgment results; According to the quality retrieval index, the partition quality inspection judgment results are bound to the corresponding injection molded parts to generate a single-piece quality inspection record; When there are no rework or scrap defects in the single-piece quality inspection record, a qualified status mark is generated and written into the surface treatment effect quality inspection result of the injection molded part. When there is a rework defect event but no scrap defect event in the single-piece quality inspection record, a rework status identifier is generated, and a rework location record is generated based on the target judgment partition and location label of the rework defect event. When a scrap defect event exists in a single-item quality inspection record, a scrap status identifier is generated, and a scrap reason record is generated according to the defect level and target judgment partition of the scrap defect event; Based on the location markings within the quality inspection coordinate range corresponding to the target determination zone, the defect boundary box and zone number are superimposed on the standardized surface area image to generate a defect annotation map. Convert the qualified status identifier, repair status identifier, or scrap status identifier into the corresponding sorting instruction, and send the sorting instruction to the sorting execution terminal; The single-piece quality inspection record and defect annotation diagram are written to the rework record terminal. When there is a rework defect event in the single-piece quality inspection record, the rework location record is written to the rework record terminal at the same time. When there is a scrap defect event in the single-piece quality inspection record, the scrap reason record is written to the rework record terminal at the same time, generating the surface treatment effect quality inspection result of the injection molded part.

[0015] A method and apparatus for quality inspection of surface treatment effects of injection molded parts based on machine vision according to an embodiment of the present invention includes the following modules: The multi-light state acquisition module is used to determine the surface inspection window in the quality inspection transfer section after the surface treatment of the injection molded part is completed. It starts multi-light state image acquisition according to the carrier positioning trigger signal, generates quality retrieval index, and uses the quality retrieval index to bind the acquired image to obtain a multi-light state quality inspection image set. The image normalization module is used to perform pose correction, contour cropping and brightness normalization on multi-light quality inspection image sets to obtain pose correction mapping relationships and normalized surface region images. The process template partitioning module is used to retrieve surface treatment process templates based on quality retrieval indexes, align the surface treatment process templates with the standardized surface area images to obtain surface treatment partitioning maps and partitioning quality inspection rules; The consistency feature construction module is used to perform cross-optical state difference, polarization response extraction, and texture gradient encoding on standardized surface region images and surface processing partition maps to obtain cross-optical state consistency feature tensors. The defect identification module is used to input the cross-optical consistency feature tensor into the improved MaxViT model to obtain the surface processing defect identification map. The improved MaxViT model includes a multi-optical embedding layer, a texture window encoding layer, a gloss counter-evidence gating layer and a partition decoding layer. The gloss counter-evidence gating layer embeds a cross-optical gloss counter-evidence mechanism. The defect event generation module is used to perform connected region filtering, boundary back mapping, and consistency verification on the surface treatment defect identification map based on the attitude correction mapping relationship and the surface treatment partition map to obtain candidate defect events. The partition quality inspection judgment module is used to generate partition quality inspection judgment results based on the location, area, and response intensity of candidate defect events, combined with partition quality inspection rules. The quality inspection result output module is used to generate the surface treatment effect quality inspection result of injection molded parts based on the zoning quality inspection judgment result, and send it to the sorting execution end and the rework record end.

[0016] The beneficial effects of this invention are: This invention introduces a multi-light acquisition method triggered by carrier positioning in the quality inspection conveyor section, enabling the same injection molded part to form a bound image under coaxial light, low-angle stripe light, and cross-polarized light. This method can simultaneously cover processing effect characteristics such as color coverage, micro-texture development, gloss abnormality, and boundary contamination, avoiding false alarms of high brightness and missed detection of dark textures under a single light source.

[0017] By retrieving surface treatment process templates and aligning them with standardized surface area image coordinates, the spraying area, decoration area, masking boundary area, and ordinary treatment area can be included in the zoning quality inspection rules, avoiding misjudgments caused by using a uniform threshold for different areas and improving the adaptability of surface treatment quality inspection for complex injection molded parts.

[0018] By using the cross-optical state consistency feature tensor and the improved MaxViT model in synergistic processing, the cross-optical state gloss counter-evidence mechanism is used to gate and suppress surface specular highlights, occluded boundary reflections and background texture interference, and enhance the real defect region with consistent cross-optical state response, making the surface treatment defect identification map more stable.

[0019] By back-mapping the defect boundary through the attitude correction mapping relationship and generating candidate defect events by combining the partition consistency check, the system can output partition quality inspection judgment results, sorting instructions and rework records, thereby improving the application efficiency of quality inspection results in production line diversion, rework location and quality traceability. Attached Figure Description

[0020] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1This is an overall flowchart of a machine vision-based quality inspection method for the surface treatment effect of injection molded parts proposed in this invention. Figure 2 This is a flowchart illustrating the working principle of the improved MaxViT model for a machine vision-based quality inspection method for surface treatment of injection molded parts, as proposed in this invention. Figure 3 This is a schematic diagram of the structure of a machine vision-based surface treatment quality inspection device for injection molded parts proposed in this invention. Detailed Implementation

[0021] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.

[0022] refer to Figure 1 and Figure 2 A machine vision-based method for quality inspection of surface treatment effects of injection molded parts includes the following steps: Step 1: After the surface treatment of the injection molded part is completed, determine the surface inspection window in the quality inspection transfer section, start multi-light image acquisition according to the carrier positioning trigger signal, generate quality retrieval index, and use the quality retrieval index to bind the acquired image to obtain a multi-light quality inspection image set; Step 2: Perform pose correction, contour cropping, and brightness normalization on the multi-light quality inspection image set to obtain the pose correction mapping relationship and the normalized surface region image; Step 3: Using the quality retrieval index, retrieve the surface treatment process template, align the surface treatment process template with the standardized surface area image to obtain the surface treatment zoning map and zoning quality inspection rules; Step 4: Perform cross-optical state difference, polarization response extraction, and texture gradient encoding on the standardized surface region image and surface processing partition map to obtain the cross-optical state consistency feature tensor; Step 5: Input the cross-light state consistency feature tensor into the improved MaxViT model to obtain the surface processing defect recognition map. The improved MaxViT model includes a multi-light state embedding layer, a texture window encoding layer, a gloss counter-evidence gating layer, and a partition decoding layer. The gloss counter-evidence gating layer embeds a cross-light state gloss counter-evidence mechanism. Step 6: Based on the attitude correction mapping relationship and the surface treatment partition map, perform connected region filtering, boundary back mapping and consistency verification on the surface treatment defect identification map to obtain candidate defect events; Step 7: Based on the location, area, and response intensity of the candidate defect events, and in conjunction with the zoning quality inspection rules, generate the zoning quality inspection judgment results; Step 8: Generate the surface treatment effect quality inspection result of the injection molded parts based on the zoning quality inspection judgment result, and send it to the sorting execution end and the rework record end.

[0023] In this embodiment, step one specifically includes: After the injection molded parts have undergone spraying, polishing, laser engraving, film coating or plasma surface treatment, the injection molded parts are transported to the quality inspection transfer section with the carrier. A surface inspection window with a camera field of view covering the surface of the injection molded parts to be inspected is set above the quality inspection transfer section. Read the positioning trigger signal generated when the carrier enters the surface inspection window, use the trigger edge time of the positioning trigger signal as the acquisition reference time, and read the carrier number, product model number and surface treatment process number; Based on the acquisition reference time, coaxial light, low-angle stripe light and cross-polarized light are triggered sequentially, and the industrial camera is controlled to acquire the surface image of the injection molded part under the corresponding light state during the illumination of each light source. The acquisition time of each injection molded part surface image is determined based on the camera hardware timestamp, and the workpiece posture information is determined based on the carrier number and the reference positioning point in the surface inspection window. The product model number, surface treatment process number, carrier number, workpiece posture information and acquisition time are combined to generate a quality retrieval index. The quality retrieval index is then used to bind the surface images of the same injection molded part under different light states to obtain a multi-light state quality inspection image set. In the specific implementation process, the quality inspection conveyor section is set between the surface treatment station exit and the sorting execution end. The industrial camera is installed 450mm above the conveyor belt, and the lens field of view covers the entire surface of the injection molded part to be inspected. The length of the surface inspection window is set to 320mm. When the carrier enters the surface inspection window, the photoelectric sensor outputs a positioning trigger signal. The controller reads the trigger edge time and writes it into the acquisition buffer. If the carrier speed exceeds 0.35m / s, the encoder pulse compensation is used to compensate for the center position of the workpiece corresponding to the trigger time. Coaxial light, low-angle stripe light, and cross-polarized light are sequentially illuminated at 30ms intervals. After each light source stabilizes for 10ms, the industrial camera is triggered to expose the image, with the exposure time set to 8ms and the image resolution set to 2448×2048. The camera hardware timestamp, carrier number, product model number, surface treatment process number, and workpiece posture information determined by the reference positioning point are jointly written into the quality retrieval index. The three light-state images under the same quality retrieval index are stored as a multi-light-state quality inspection image set in the order of coaxial light image, low-angle stripe light image, and cross-polarized light image. If any light-state image is missing, the corresponding quality retrieval index is marked as a re-acquisition state. This processing ensures that different light-state images of the same injection molded part remain consistent in terms of time, carrier, and process dimensions, providing stable input for image standardization and cross-light-state feature construction.

[0024] In this embodiment, step two specifically involves: Read the images of each optical state under the same quality retrieval index from the multi-optical quality inspection image set, and use the coaxial light image as the attitude correction reference image; Grayscale conversion and Canny edge detection are performed on the attitude correction reference image to obtain the outer contour edge of the injection molded part. Template matching is then performed on the outer contour edge of the injection molded part based on the reference positioning points in the surface detection window to obtain the workpiece contour corner points. The workpiece contour corner points are registered with the standard corner points in the preset standard posture template, the perspective transformation matrix is ​​calculated, and the posture correction is performed on each light state image in the multi-light state quality inspection image set according to the perspective transformation matrix to obtain the posture correction image. The pose correction mapping relationship is generated based on the perspective transformation matrix. The pose correction mapping relationship includes the forward transformation relationship from the original image coordinates to the normalized image coordinates and the reverse transformation relationship from the normalized image coordinates to the original image coordinates. A surface region mask is generated based on the outer contour edge of the injection molded part. The surface region mask is multiplied pixel by pixel with the pose correction image, and the carrier background area is cropped to obtain the surface region cropped image. The surface region cropped image is subjected to maximum and minimum brightness normalization processing to unify the pixel brightness of each light state image to a preset brightness range, thus obtaining a standardized surface region image. In the specific implementation process, the coaxial light image, low-angle stripe light image and cross-polarized light image under the same quality retrieval index are read, and the coaxial light image is set as the attitude correction reference image; grayscale conversion is performed on the attitude correction reference image, and the outer contour edge of the injection molded part is extracted by Canny edge detection with a low threshold of 60 and a high threshold of 150. Then, the broken edge is filled by 3×3 closing operation to obtain a continuous outer contour. The continuous outer contour is matched with the reference positioning points in the standard posture template. When the matching score is lower than 0.82, the current quality retrieval is written into the manual review queue. When the matching score is greater than or equal to 0.82, four workpiece contour corner points are extracted. The four workpiece contour corner points are registered with the standard corner points in the standard posture template, the perspective transformation matrix is ​​calculated, and the three light state images are uniformly transformed to the standardized image coordinate system using bilinear interpolation to obtain the posture correction image. A forward transformation relationship from the original image coordinates to the standardized image coordinates is generated based on the perspective transformation matrix, and a reverse transformation relationship from the standardized image coordinates to the original image coordinates is generated by matrix inversion. These are then combined to obtain the pose correction mapping relationship. A surface region mask is generated based on the continuous outer contour. The surface region mask is multiplied pixel by pixel with the pose correction image, and the vehicle background and the area outside the window are deleted to obtain a cropped surface region image. The brightness values ​​of the effective mask area in the cropped surface region image are normalized by maximum and minimum brightness, unifying the brightness range to 0 to 1, resulting in a standardized surface region image. This processing ensures that images of different light states remain consistent in coordinate scale, inspection range, and brightness scale, providing a stable foundation for template alignment and cross-light state feature construction in surface processing technology.

[0025] In this embodiment, step three specifically includes: The product model number and surface treatment process number in the quality retrieval index are parsed, and the matching surface treatment process template is retrieved from the process template library. The surface treatment process template includes a standard contour coordinate set, a processing area polygon set, an area category label, and a quality inspection threshold configuration. Read the image size and outer contour edge of the standardized surface region image, perform corner point matching between the standard contour coordinate set and the outer contour edge of the standardized surface region image, and calculate the scale transformation parameters and translation transformation parameters from template coordinates to standardized image coordinates. Based on the scaling and translation parameters, the polygon set of the processing region is transformed to the standardized image coordinate system to obtain the image coordinate processing region. Then, based on the scaling parameters, the actual surface area corresponding to a single pixel in the standardized image coordinate system is determined to obtain the pixel scale coefficient. The standardized surface region image is rasterized and labeled at the pixel level according to the region boundary of the image coordinate processing area. Pixels located in the same image coordinate processing area are assigned the same region category label to obtain the surface processing partition map. When there is boundary overlap between different image coordinate processing areas, the region category label of the overlapping pixels is determined according to the priority order of occluded boundary area, decorative processing area, and normal processing area. Based on the region category labels in the surface treatment partition map, the corresponding noise pixel threshold, response retention threshold, area threshold, response intensity threshold, cross-partition boundary threshold, partition consistency threshold, and grade judgment condition are extracted from the quality inspection threshold configuration of the surface treatment process template. The pixel scale coefficient is then associated with the corresponding region category label to obtain the partition quality inspection rules. In the specific implementation process, the process template library uses the product model number and surface treatment process number as search keys. The template content includes a standard contour coordinate set, a processing area polygon set, an area category mark, and a quality inspection threshold configuration. After parsing the quality retrieval index, the surface treatment process template that matches the collection time is read. If the template does not exist, the quality retrieval index is written into the template missing review queue. Read the image size and outer contour edge of the standardized surface region image, perform corner point matching between the standard contour coordinate set and the outer contour edge, and set the matching distance threshold to 6 pixels; if there are fewer than four matching corner points, write them into the alignment verification queue; if there are more than four matching corner points, calculate the scale transformation parameters and translation transformation parameters; convert the polygon set of the processing region into the image coordinate processing region according to the scale transformation parameters and translation transformation parameters, and calculate the pixel scale coefficient. The standardized surface region image is rasterized and marked at the pixel level according to the image coordinate processing area. The boundary overlapping pixels are classified into regions according to the order of occlusion boundary region, decorative processing region, and ordinary processing region to obtain the surface processing partition map. Then, the corresponding threshold and grade judgment conditions are read from the quality inspection threshold configuration, and the pixel scale coefficient is associated with the region category label to obtain the partition quality inspection rules. By making the process processing area correspond stably with the image coordinate, a rule basis is provided for subsequent cross-light state feature construction and partition quality inspection judgment.

[0026] In this embodiment, step four specifically includes: Read the coaxial light normalized image, low-angle stripe light normalized image, and cross-polarized light normalized image corresponding to the same pixel position in the normalized surface region image, and determine the region category label corresponding to the same pixel position according to the surface processing partition map; The brightness values ​​at the same pixel position are subtracted from the brightness values ​​at the same pixel position in the coaxial light normalized image and the low-angle stripe light normalized image, and the absolute value is taken to obtain the texture development difference map. The brightness values ​​at the same pixel position are subtracted from the brightness values ​​at the same pixel position in the coaxial light normalized image and the cross-polarized light normalized image, and the absolute value is taken to obtain the gloss suppression difference map. The polarization response map is obtained by dividing the luminance value of the cross-polarized light normalized image as the numerator and the sum of the luminance value of the coaxial light normalized image and the numerical stability term as the denominator. The numerical stability term is used to prevent the denominator from approaching zero. Sobel gradient extraction is performed on the low-angle striped light normalized image to obtain the horizontal texture gradient map and the vertical texture gradient map. The absolute values ​​of the horizontal texture gradient map and the vertical texture gradient map are added together to obtain the texture gradient response map. Max-min normalization is performed on the texture development difference map, gloss suppression difference map, polarization response map and texture gradient response map, and additional partition coding channels are labeled according to the region category in the surface processing partition map to obtain the trans-optical consistency feature tensor; In the specific implementation process, the standardized surface region images under the same quality retrieval index are read. The standardized surface region images include coaxial light standardized images, low-angle stripe light standardized images, and cross-polarized light standardized images. The three types of images are already in the same standardized image coordinate system. The region category markers in the surface processing partition map are read pixel by pixel. The region category markers are written into the partition coding channel using one-hot encoding. The texture development difference map is obtained by subtracting the brightness values ​​at the same pixel position from the coaxial light normalized image and the low-angle stripe light normalized image and taking the absolute value; the gloss suppression difference map is obtained by subtracting the brightness values ​​at the same pixel position from the coaxial light normalized image and the cross-polarized light normalized image and taking the absolute value; the polarization response map is obtained by dividing the brightness value of the cross-polarized light normalized image by the sum of the brightness value of the coaxial light normalized image and the numerical stability term. The numerical stability term is set to 10^-5 to avoid the denominator approaching zero. Sobel gradient extraction is performed on the low-angle stripe light normalized image to obtain the horizontal texture gradient map and the vertical texture gradient map respectively. The absolute value of the horizontal texture gradient map is added to the absolute value of the vertical texture gradient map to obtain the texture gradient response map. Max-min normalization is performed on the texture development difference map, gloss suppression difference map, polarization response map and texture gradient response map respectively. The normalization interval is set to 0 to 1. When the maximum value and minimum value of a single response map are equal, all pixels of the response map are set to 0 and a low response mark is written. Channels are stitched together in the order of texture development difference map, gloss suppression difference map, polarization response map, texture gradient response map, and partitioned encoding channel to obtain a trans-optical consistency feature tensor. By unifying the color coverage difference, gloss suppression difference, polarization reflection difference, and fine texture gradient difference after surface treatment into model input features, the improved MaxViT model can identify real surface treatment anomalies under partition constraints.

[0027] In this embodiment, step five specifically includes: The multi-light-state embedding layer reads the cross-light-state consistency feature tensor, and concatenates the difference channel, polarization channel, texture channel and partition coding channel in the cross-light-state consistency feature tensor into a multi-light-state pixel vector according to the pixel position. The multi-light-state pixel vector is then subjected to linear projection, GELU activation and LayerNorm layer normalization to obtain the multi-light-state surface embedding features. The texture window coding layer divides the multi-light surface embedding features into local window feature blocks, performs window self-attention calculation on each local window feature block to obtain local texture attention features, rearranges the local texture attention features according to a fixed grid interval, and performs grid self-attention calculation on the rearranged features to obtain texture grid coding features. The gloss counter-evidence gating layer splits the encoded components of texture development difference, gloss suppression difference, polarization response and texture gradient in the texture mesh encoding features into channels. The cross-optical gloss counter-evidence mechanism generates gloss counter-evidence components based on the encoded components corresponding to gloss suppression difference and polarization response, and generates texture counter-evidence components based on the encoded components corresponding to texture development difference and texture gradient. The gloss counter-evidence components, texture counter-evidence components and partitioned encoding channels are concatenated and input into the Sigmoid function to obtain the counter-evidence gating weights. The glossy counter-evidence gating layer performs gating weighting on the texture mesh encoding features according to the counter-evidence gating weight, reduces the counter-evidence region response formed by surface specular highlights, occlusion boundary reflections and background texture interference, and enhances the defect region response with consistent cross-optical response, thus obtaining glossy counter-evidence gating features. The partition decoding layer concatenates the gloss counter-evidence gating features with the partition encoding channels in the cross-optical state consistency feature tensor, and performs convolutional decoding, Softmax classification and partition boundary smoothing on the concatenated features to obtain a surface processing defect recognition map. In the specific implementation process, the cross-optical consistency feature tensor is uniformly adjusted to a 512×512 pixel scale. The tensor channels are arranged in the order of texture development difference, gloss suppression difference, polarization response, texture gradient response, and partition coding channel. The multi-optical embedding layer uses 4×4 pixel blocks as embedding units. The channel values ​​in each embedding unit are flattened into multi-optical pixel vectors, and matrix multiplication is performed with a 64-dimensional projection weight matrix, followed by the addition of bias to obtain the projection features. The projection features are activated by the GELU activation function to retain the nonlinear optical state combination relationship, and then normalized by the LayerNorm layer. The numerical stability term is set to 10^-5 to avoid the normalization denominator approaching zero, thus obtaining the multi-optical surface embedding features. The texture window encoding layer divides the multi-light surface embedding features into 8×8 local window feature blocks. Within each local window, a query vector, a key vector, and a value vector are generated. The texture association weights within the window are calculated by scaling dot product attention, and the attention weights are multiplied by the value vectors to obtain the local texture attention features. The local texture attention features are then rearranged according to a fixed grid with an interval of 4 embedding units, so that the texture responses of adjacent and non-adjacent windows enter the same grid sequence. The grid self-attention calculation is then performed on the grid sequence to obtain the texture grid encoding features. The gloss counter-evidence gating layer extracts the encoded components corresponding to texture development difference, gloss suppression difference, polarization response, and texture gradient from the texture mesh encoding features. The cross-optical gloss counter-evidence mechanism concatenates the encoded components corresponding to gloss suppression difference and polarization response through channels and generates gloss counter-evidence components through linear mapping. It also concatenates the encoded components corresponding to texture development difference and texture gradient through channels and generates texture counter-evidence components through linear mapping. Finally, the gloss counter-evidence components, texture counter-evidence components, and partitioned encoding channels are concatenated and input into the Sigmoid function to obtain counter-evidence gating weights with values ​​ranging from 0 to 1. Regions with a counter-evidence gating weight less than 0.35 are marked as high counter-evidence regions, and the corresponding texture mesh coding features are multiplied by a suppression coefficient of 0.45; regions with a counter-evidence gating weight greater than or equal to 0.35 are marked as consistent response regions, and the corresponding texture mesh coding features are multiplied by an enhancement coefficient of 1.20; after gating weighting, residual summation and LayerNorm normalization are performed to obtain gloss counter-evidence gating features; this processing can reduce false responses caused by surface specular highlights, occluded boundary reflections and background texture interference, and retain the true abnormal responses that occur stably under multiple light states simultaneously; The partition decoding layer concatenates the gloss counter-evidence gating features with the partition coding channels in the cross-optical consistency feature tensor. First, it extracts the neighborhood features of the partition boundary through 3×3 convolution, and then maps the number of channels to the number of defect categories through 1×1 convolution. Softmax classification outputs the probability that each pixel belongs to the normal region, the region with slight surface anomalies, the region requiring repair, and the region that is scrapped. The category corresponding to the highest category probability is used as the pixel-level recognition category. Mean smoothing is performed on the category probabilities within a 3-pixel range on both sides of the partition boundary to reduce category jumps at the region edge, resulting in a surface processing defect recognition map. By improving the MaxViT model and the cross-optical gloss counter-evidence mechanism, the differences in multiple optical states, texture response, polarization reflection, and partition constraints are transformed into stable pixel-level defect recognition results, providing a direct basis for candidate defect event screening and partition quality inspection judgment.

[0028] In this embodiment, step six specifically includes: Read the defect category probability and defect response value corresponding to each pixel position in the surface treatment defect identification image, compare the defect response value with the preset initial screening threshold, and mark the pixels that reach the preset initial screening threshold as defect candidate pixels; The candidate pixels of the defect are labeled with connected components according to the eight-neighbor connectivity rule to obtain the defect connected regions. The number of pixels, the bounding rectangle boundary and the average defect response value of each defect connected region are counted. Based on the surface treatment partition map, determine the region category label covered by each defect connected region, and read the corresponding region noise pixel threshold and corresponding region response retention threshold from the partition quality inspection rules. Remove connected regions in the defect connected region where the number of pixels is lower than the corresponding region noise pixel threshold and the average defect response value is lower than the corresponding region response retention threshold to obtain the effective defect connected regions. Based on the inverse transformation relationship in the attitude correction mapping relationship, the outer rectangular boundary and pixel coordinates of the effective defect connected region are back-mapped from the standardized image coordinate system to the original acquired image coordinate system to obtain the original image defect boundary; The overlap ratio between the effective defect connected region and the surface treatment partition map is calculated. When the overlap ratio of the effective defect connected region in a single partition reaches the partition consistency threshold, the single partition is taken as the partition to which the defect belongs. When the effective defect connected region spans multiple partitions, the primary partition is determined according to the partition with the largest overlapping area, and the ratio of the cross-partition boundary length to the perimeter of the effective defect connected region is calculated to obtain the cross-partition boundary ratio. Candidate defect events are generated based on the effective defect connectivity region, the original image defect boundary, the defect to which the partition belongs, the primary partition, and the cross-partition boundary ratio. In the specific implementation process, the defect category probability and defect response value corresponding to each pixel in the surface treatment defect identification image are read, and the larger value between the rework defect category probability and the scrap defect category probability is taken as the defect response value; the initial screening threshold is set to 0.55, and pixels with defect response values ​​greater than or equal to 0.55 are marked as defect candidate pixels, and pixels with values ​​lower than 0.55 are marked as normal pixels; Defect candidate pixels are labeled with connected components according to the eight-neighbor connectivity rule. The number of pixels, the bounding rectangle boundary, and the average defect response value of each defect connected region are counted. The region category label covered by the defect connected region is read from the surface processing partition map, and the corresponding region noise pixel threshold and the corresponding region response retention threshold are read from the partition quality inspection rule. When the number of pixels in the defect connected region is lower than the corresponding region noise pixel threshold and the average defect response value is lower than the corresponding region response retention threshold, the defect connected region is deleted, and the remaining defect connected regions are retained as valid defect connected regions. Based on the inverse transformation relationship in the attitude correction mapping relationship, the four vertices of the outer rectangle boundary of the effective defect connected region and the pixel coordinates within the region are transformed from the standardized image coordinate system to the original acquired image coordinate system to obtain the original image defect boundary; when the boundary coordinates exceed the range of the original acquired image, they are truncated according to the original acquired image boundary to avoid rework annotations going out of bounds; Perform pixel overlap statistics on the effective defect connected region and the surface treatment partition map, and calculate the overlap ratio of the effective defect connected region in each partition; the partition consistency threshold is read from the partition quality inspection rules and is set to 0.80 by default; when the maximum overlap ratio is greater than or equal to the partition consistency threshold, the corresponding single partition is taken as the partition to which the defect belongs; when the maximum overlap ratio is less than the partition consistency threshold, the partition with the largest overlap area is determined as the primary partition, and the cross-partition boundary length is divided by the perimeter of the effective defect connected region to obtain the cross-partition boundary ratio. The effective defect connectivity region, the original image defect boundary, the defect partition, the primary partition, and the cross-partition boundary ratio are written into the same candidate defect event. Through region filtering, coordinate back mapping, and partition consistency verification, false detections caused by isolated noise and boundary reflection are reduced, and the location, area, and partition attribution are provided for partition quality inspection.

[0029] In this embodiment, step seven specifically includes: Read the effective defect connected regions, original image defect boundaries, defect partitions, primary partitions, and cross-partition boundary ratios from candidate defect events; When a candidate defect event is located within a single partition, the partition to which the defect belongs is determined as the target decision partition; when a candidate defect event spans multiple partitions, the primary partition is determined as the target decision partition. Based on the target determination partition, the corresponding area threshold, response intensity threshold, cross-partition boundary threshold, level determination condition and pixel scale coefficient are read from the partition quality inspection rules; The number of pixels in the effective defect connected region is counted, and the number of pixels is multiplied by the pixel scale coefficient to obtain the candidate defect area; The average response intensity of the candidate defect is obtained by summing the defect response values ​​of all pixels within the effective defect connected region and dividing by the number of pixels. Based on the defect boundary of the original image, the location markers of the candidate defect events in the original acquired image of the injection molded part are determined, and the location markers are mapped to the quality inspection coordinate range corresponding to the target judgment partition. When the area of ​​a candidate defect is less than the area threshold and the average response intensity of the candidate defect is less than the response intensity threshold, the candidate defect event is marked as a minor defect event. When the area of ​​a candidate defect reaches the area threshold or the average response intensity of a candidate defect reaches the response intensity threshold, the candidate defect event is marked as a rework defect event or a scrap defect event according to the level determination criteria. When the proportion of cross-partition boundaries reaches the cross-partition boundary threshold, the level of the candidate defect event is increased by one level, and the boundary pollution mark is written into the candidate defect event. The partitioned quality inspection results are generated based on the location labeling of candidate defect events, the area of ​​candidate defects, the average response intensity of candidate defects, the target judgment partition, and the defect level. In the specific implementation process, the effective defect connected region, original image defect boundary, defect partition, primary partition and cross-partition boundary ratio in the candidate defect event are read; when the candidate defect event is located in a single partition, the partition to which the defect belongs is used as the target determination partition; when the candidate defect event spans multiple partitions, the primary partition is used as the target determination partition. The area threshold, response intensity threshold, cross-zone boundary threshold, grade determination condition, and pixel scale coefficient corresponding to the target determination zone are read from the zone quality inspection rules; the area threshold for the normal processing area is set to 0.80 mm², and the response intensity threshold is set to 0.60; the area threshold for the decorative processing area is set to 0.35 mm², and the response intensity threshold is set to 0.55; the area threshold for the occlusion boundary area is set to 0.20 mm², and the response intensity threshold is set to 0.50. The number of pixels in the effective defect connected region is counted, and the number of pixels is multiplied by the pixel scale coefficient to obtain the candidate defect area; the defect response values ​​of all pixels in the effective defect connected region are summed and divided by the number of pixels to obtain the average response intensity of the candidate defect; the location labels are generated based on the defect boundaries of the original image, and the location labels are mapped to the quality inspection coordinate range corresponding to the target judgment partition. When the area of ​​a candidate defect is less than the area threshold and the average response intensity of the candidate defect is less than the response intensity threshold, the candidate defect event is marked as a minor defect event; when the area of ​​a candidate defect reaches the area threshold or the average response intensity of the candidate defect reaches the response intensity threshold, the candidate defect event is marked as a rework defect event or a scrap defect event according to the level determination criteria; when the cross-zone boundary ratio reaches the cross-zone boundary threshold, the defect level is upgraded by one level and written into the boundary contamination mark. By combining location markings, candidate defect areas, average response intensity of candidate defects, target judgment zones, defect levels, and boundary contamination markers, a zoned quality inspection judgment result is generated. Through the linkage judgment of zone thresholds and defect levels, different surface treatment areas complete the quality inspection judgment according to the corresponding process standards, providing a judgment basis for quality inspection result output and rework diversion.

[0030] In this embodiment, step eight specifically includes: Read the target judgment zone, location label, candidate defect area, average response intensity of candidate defects, and defect level from the partition quality inspection judgment results; According to the quality retrieval index, the partition quality inspection judgment results are bound to the corresponding injection molded parts to generate a single-piece quality inspection record; When there are no rework or scrap defects in the single-piece quality inspection record, a qualified status mark is generated and written into the surface treatment effect quality inspection result of the injection molded part. When there is a rework defect event but no scrap defect event in the single-piece quality inspection record, a rework status identifier is generated, and a rework location record is generated based on the target judgment partition and location label of the rework defect event. When a scrap defect event exists in a single-item quality inspection record, a scrap status identifier is generated, and a scrap reason record is generated according to the defect level and target judgment partition of the scrap defect event; Based on the location markings within the quality inspection coordinate range corresponding to the target determination zone, the defect boundary box and zone number are superimposed on the standardized surface area image to generate a defect annotation map. Convert the qualified status identifier, repair status identifier, or scrap status identifier into the corresponding sorting instruction, and send the sorting instruction to the sorting execution terminal; Write the single-piece quality inspection record and defect annotation diagram into the rework record terminal. When there is a rework defect event in the single-piece quality inspection record, the rework location record is written into the rework record terminal at the same time. When there is a scrap defect event in the single-piece quality inspection record, the scrap reason record is written into the rework record terminal at the same time, and the surface treatment effect quality inspection result of the injection molded part is generated. In the specific implementation process, the partition quality inspection judgment results under the same quality retrieval index are read, and the target judgment partition, location label, candidate defect area, candidate defect average response intensity, defect level, and boundary contamination mark are written into the single-piece quality inspection record; when the defect levels are all minor defect events, a qualified status identifier is generated; when there is a rework defect event and no scrap defect event, a rework status identifier is generated, and the location label and target judgment partition corresponding to the rework defect event are written into the rework location record; when there is a scrap defect event, a scrap status identifier is generated, and the defect level, target judgment partition, and boundary contamination mark corresponding to the scrap defect event are written into the scrap reason record; Based on the location markings within the quality inspection coordinate range corresponding to the target determination zone, a defect boundary box and zone number are superimposed on the standardized surface area image. The line width of the defect boundary box is set to 3 pixels, and the zone number is written in the upper left corner of the boundary box to generate a defect annotation map. The qualified status mark is converted into a qualified release instruction, the rework status mark is converted into a rework diversion instruction, and the scrap status mark is converted into a scrap rejection instruction, and then sent to the sorting execution end. Individual quality inspection records and defect annotation diagrams are written to the rework record terminal; when a rework defect event exists in the individual quality inspection record, the rework location record is written simultaneously; when a scrap defect event exists in the individual quality inspection record, the scrap reason record is written simultaneously; the individual quality inspection record, defect annotation diagram, sorting instructions, and rework record together form the surface treatment effect quality inspection result of the injection molded part; by converting the zoning judgment result into executable production line diversion information and traceable rework record, output basis is provided for the closed-loop management of surface treatment quality of injection molded parts.

[0031] refer to Figure 3 A machine vision-based quality inspection device for the surface treatment effect of injection molded parts includes the following modules: The multi-light state acquisition module is used to determine the surface inspection window in the quality inspection transfer section after the surface treatment of the injection molded part is completed. It starts multi-light state image acquisition according to the carrier positioning trigger signal, generates quality retrieval index, and uses the quality retrieval index to bind the acquired image to obtain a multi-light state quality inspection image set. The image normalization module is used to perform pose correction, contour cropping and brightness normalization on multi-light quality inspection image sets to obtain pose correction mapping relationships and normalized surface region images. The process template partitioning module is used to retrieve surface treatment process templates based on quality retrieval indexes, align the surface treatment process templates with the standardized surface area images to obtain surface treatment partitioning maps and partitioning quality inspection rules; The consistency feature construction module is used to perform cross-optical state difference, polarization response extraction, and texture gradient encoding on standardized surface region images and surface processing partition maps to obtain cross-optical state consistency feature tensors. The defect identification module is used to input the cross-optical consistency feature tensor into the improved MaxViT model to obtain the surface processing defect identification map. The improved MaxViT model includes a multi-optical embedding layer, a texture window encoding layer, a gloss counter-evidence gating layer and a partition decoding layer. The gloss counter-evidence gating layer embeds a cross-optical gloss counter-evidence mechanism. The defect event generation module is used to perform connected region filtering, boundary back mapping, and consistency verification on the surface treatment defect identification map based on the attitude correction mapping relationship and the surface treatment partition map to obtain candidate defect events. The partition quality inspection judgment module is used to generate partition quality inspection judgment results based on the location, area, and response intensity of candidate defect events, combined with partition quality inspection rules. The quality inspection result output module is used to generate the surface treatment effect quality inspection result of injection molded parts based on the zoning quality inspection judgment result, and send it to the sorting execution end and the rework record end.

[0032] Example 1: To verify the feasibility of the present invention in practice, the present invention was applied to the surface treatment effect quality inspection scenario of automotive center console trim injection molding parts. The injection molding parts to be inspected were ABS material injection molded parts, and the surface treatment process included matte spraying, partial laser engraving and masking boundary protection. Traditional manual visual inspection is prone to misjudging reflective textures as drips or missed spraying in the high-gloss curved surface and masking boundary areas, and it is also easy to miss slight over-processing traces at the laser engraving edge, resulting in unstable rework positioning.

[0033] The inspection production line has a quality inspection conveyor section at the exit of the surface treatment station. After the injection molded part enters the surface inspection window with the carrier, it triggers the acquisition of coaxial light, low-angle stripe light and cross-polarized light to generate a multi-light quality inspection image set. The system performs posture correction, contour cropping and brightness standardization on the images, and calls the surface treatment process template according to the product model number and surface treatment process number to obtain the surface treatment partition map and partition quality inspection rules. Then, a cross-light consistency feature tensor is constructed and input into the improved MaxViT model to output the surface treatment defect recognition map. After connected component filtering, boundary back mapping and partition consistency verification, the partition quality inspection judgment result and the surface treatment effect quality inspection result of the injection molded part are generated.

[0034] A total of 1200 injection molded parts produced continuously from the same production line were selected as test samples. Among them, 760 parts were qualified, while 440 parts were defective, exhibiting issues such as uneven coating, localized runs, laser engraving edge contamination, over-processing of masked boundaries, and minor scratches. The actual defect results were jointly confirmed by two quality control engineers and one process engineer based on the rework and inspection records. The comparison methods included the traditional single-light source threshold detection method and the ordinary Vision Transformer detection method. The statistical objects were the final quality inspection conclusion and defect location markings for each injection molded part. The results are shown in Table 1 below.

[0035] Table 1 Comparison of Quality Inspection Results for Surface Treatment Effects of Injection Molded Parts

[0036] As shown in Table 1, the defect identification accuracy of the method of the present invention reaches 97.08%, which is 10.83 percentage points higher than the single-light source threshold detection method and 4.91 percentage points higher than the ordinary Vision Transformer detection method; the defect recall rate reaches 95.68%, indicating that uneven spraying, laser engraving edge contamination, and abnormal masking boundaries can be detected more fully; the false alarm rate is reduced to 2.17%, indicating that false responses caused by curved surface highlights and background textures are effectively suppressed; the zoning judgment accuracy reaches 96.33%, indicating that different processing areas can complete differentiated quality inspection judgments according to the corresponding process standards.

[0037] Defect identification accuracy is used to indicate the correctness of the system's overall judgment of qualified and abnormal parts; defect recall rate is used to indicate the proportion of truly abnormal parts that are successfully detected; false alarm rate is used to indicate the proportion of qualified parts that are incorrectly judged as abnormal parts; zone judgment accuracy is used to indicate whether the defect belongs to the sprayed area, laser engraving area, masking boundary area or ordinary processing area is correctly judged; average single-part inspection time is used to indicate the time taken for a single injection molded part from image acquisition to quality inspection result output.

[0038] The above results show that the multi-light-state quality inspection image set can reflect the surface treatment status of injection molded parts from three dimensions: color coverage, low-angle texture development, and polarization gloss response; the surface treatment process template enables the sprayed area, laser engraving area, and occlusion boundary area to have independent judgment rules; the improved cross-light-state gloss verification mechanism in the MaxViT model can weaken the surface highlights, occlusion boundary reflections, and material texture interference, and enhance the real defect area with consistent cross-light-state response.

[0039] In engineering applications, the quality inspection results of injection molded parts surface treatment can be directly converted into qualified release instructions, rework diversion instructions, and scrap rejection instructions. The rework record terminal simultaneously saves defect annotation diagrams, target judgment zones, and defect levels, so that the quality inspection results can not only be used for immediate sorting, but also for tracing surface treatment process parameters and locating rework positions, thereby improving the quality inspection stability and closed-loop management capabilities of the injection molded parts surface treatment production line.

[0040] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.

Claims

1. A machine vision-based method for quality inspection of surface treatment effects of injection molded parts, characterized in that, Includes the following steps: Step 1: After the surface treatment of the injection molded part is completed, determine the surface inspection window in the quality inspection transfer section, start multi-light image acquisition according to the carrier positioning trigger signal, generate quality retrieval index, and use the quality retrieval index to bind the acquired image to obtain a multi-light quality inspection image set; Step 2: Perform pose correction, contour cropping, and brightness normalization on the multi-light quality inspection image set to obtain the pose correction mapping relationship and the normalized surface region image; Step 3: Using the quality retrieval index, retrieve the surface treatment process template, align the surface treatment process template with the standardized surface area image to obtain the surface treatment zoning map and zoning quality inspection rules; Step 4: Perform cross-optical state difference, polarization response extraction, and texture gradient encoding on the standardized surface region image and surface processing partition map to obtain the cross-optical state consistency feature tensor; Step 5: Input the cross-light state consistency feature tensor into the improved MaxViT model to obtain the surface processing defect recognition map. The improved MaxViT model includes a multi-light state embedding layer, a texture window encoding layer, a gloss counter-evidence gating layer, and a partition decoding layer. The gloss counter-evidence gating layer embeds a cross-light state gloss counter-evidence mechanism. Step 6: Based on the attitude correction mapping relationship and the surface treatment partition map, perform connected region filtering, boundary back mapping and consistency verification on the surface treatment defect identification map to obtain candidate defect events; Step 7: Based on the location, area, and response intensity of the candidate defect events, and in conjunction with the zoning quality inspection rules, generate the zoning quality inspection judgment results; Step 8: Generate the surface treatment effect quality inspection result of the injection molded parts based on the zoning quality inspection judgment result, and send it to the sorting execution end and the rework record end.

2. The method for quality inspection of surface treatment effect of injection molded parts based on machine vision according to claim 1, characterized in that, Step one specifically involves: After the injection molded parts have undergone spraying, polishing, laser engraving, film coating or plasma surface treatment, the injection molded parts are transported to the quality inspection transfer section with the carrier. A surface inspection window with a camera field of view covering the surface of the injection molded parts to be inspected is set above the quality inspection transfer section. Read the positioning trigger signal generated when the carrier enters the surface inspection window, use the trigger edge time of the positioning trigger signal as the acquisition reference time, and read the carrier number, product model number and surface treatment process number; Based on the acquisition reference time, coaxial light, low-angle stripe light and cross-polarized light are triggered sequentially, and the industrial camera is controlled to acquire the surface image of the injection molded part under the corresponding light state during the illumination of each light source. The acquisition time of each injection molded part surface image is determined based on the camera hardware timestamp, and the workpiece posture information is determined based on the carrier number and the reference positioning point in the surface inspection window. The product model number, surface treatment process number, carrier number, workpiece posture information and acquisition time are combined to generate a quality retrieval index. The quality retrieval index is then used to bind the surface images of the same injection molded part under different light states to obtain a multi-light state quality inspection image set.

3. The machine vision-based method for quality inspection of surface treatment effects of injection molded parts according to claim 1, characterized in that, Step two specifically involves: Read the images of each optical state under the same quality retrieval index from the multi-optical quality inspection image set, and use the coaxial light image as the attitude correction reference image; Grayscale conversion and Canny edge detection are performed on the attitude correction reference image to obtain the outer contour edge of the injection molded part. Template matching is then performed on the outer contour edge of the injection molded part based on the reference positioning points in the surface detection window to obtain the workpiece contour corner points. The workpiece contour corner points are registered with the standard corner points in the preset standard posture template, the perspective transformation matrix is ​​calculated, and the posture correction is performed on each light state image in the multi-light state quality inspection image set according to the perspective transformation matrix to obtain the posture correction image. The pose correction mapping relationship is generated based on the perspective transformation matrix. The pose correction mapping relationship includes the forward transformation relationship from the original image coordinates to the normalized image coordinates and the reverse transformation relationship from the normalized image coordinates to the original image coordinates. A surface region mask is generated based on the outer contour edge of the injection molded part. The surface region mask is multiplied pixel by pixel with the pose correction image, and the carrier background area is cropped to obtain the surface region cropped image. The surface region cropped image is subjected to maximum and minimum brightness normalization processing to unify the pixel brightness of each light state image to a preset brightness range, thus obtaining a standardized surface region image.

4. The machine vision-based method for quality inspection of surface treatment effects of injection molded parts according to claim 1, characterized in that, Step three specifically involves: The product model number and surface treatment process number in the quality retrieval index are parsed, and the matching surface treatment process template is retrieved from the process template library. The surface treatment process template includes a standard contour coordinate set, a processing area polygon set, an area category label, and a quality inspection threshold configuration. Read the image size and outer contour edge of the standardized surface region image, perform corner point matching between the standard contour coordinate set and the outer contour edge of the standardized surface region image, and calculate the scale transformation parameters and translation transformation parameters from template coordinates to standardized image coordinates. Based on the scaling and translation parameters, the polygon set of the processing region is transformed to the standardized image coordinate system to obtain the image coordinate processing region. Then, based on the scaling parameters, the actual surface area corresponding to a single pixel in the standardized image coordinate system is determined to obtain the pixel scale coefficient. The standardized surface region image is rasterized and labeled at the pixel level according to the region boundary of the image coordinate processing area. Pixels located in the same image coordinate processing area are assigned the same region category label to obtain the surface processing partition map. When there is boundary overlap between different image coordinate processing areas, the region category label of the overlapping pixels is determined according to the priority order of occluded boundary area, decorative processing area, and normal processing area. Based on the region category markers in the surface treatment zoning map, the corresponding noise pixel threshold, response retention threshold, area threshold, response intensity threshold, cross-zoning boundary threshold, zoning consistency threshold, and grade judgment condition are extracted from the quality inspection threshold configuration of the surface treatment process template. The pixel scale coefficient is then associated with the corresponding region category marker to obtain the zoning quality inspection rules.

5. The method for quality inspection of surface treatment effect of injection molded parts based on machine vision according to claim 1, characterized in that, Step four specifically involves: Read the coaxial light normalized image, low-angle stripe light normalized image, and cross-polarized light normalized image corresponding to the same pixel position in the normalized surface region image, and determine the region category label corresponding to the same pixel position according to the surface processing partition map; The brightness values ​​at the same pixel position are subtracted from the brightness values ​​at the same pixel position in the coaxial light normalized image and the low-angle stripe light normalized image, and the absolute value is taken to obtain the texture development difference map. The brightness values ​​at the same pixel position are subtracted from the brightness values ​​at the same pixel position in the coaxial light normalized image and the cross-polarized light normalized image, and the absolute value is taken to obtain the gloss suppression difference map. The polarization response map is obtained by dividing the luminance value of the cross-polarized light normalized image as the numerator and the sum of the luminance value of the coaxial light normalized image and the numerical stability term as the denominator. The numerical stability term is used to prevent the denominator from approaching zero. Sobel gradient extraction is performed on the low-angle striped light normalized image to obtain the horizontal texture gradient map and the vertical texture gradient map. The absolute values ​​of the horizontal texture gradient map and the vertical texture gradient map are added together to obtain the texture gradient response map. Max-min normalization is performed on the texture development difference map, gloss suppression difference map, polarization response map, and texture gradient response map. Additional partition coding channels are labeled according to the region category in the surface treatment partition map to obtain the trans-optical consistency feature tensor.

6. The method for quality inspection of surface treatment effect of injection molded parts based on machine vision according to claim 1, characterized in that, Step five specifically involves: The multi-light-state embedding layer reads the cross-light-state consistency feature tensor, and concatenates the difference channel, polarization channel, texture channel and partition coding channel in the cross-light-state consistency feature tensor into a multi-light-state pixel vector according to the pixel position. The multi-light-state pixel vector is then subjected to linear projection, GELU activation and LayerNorm layer normalization to obtain the multi-light-state surface embedding features. The texture window coding layer divides the multi-light surface embedding features into local window feature blocks, performs window self-attention calculation on each local window feature block to obtain local texture attention features, rearranges the local texture attention features according to a fixed grid interval, and performs grid self-attention calculation on the rearranged features to obtain texture grid coding features. The gloss counter-evidence gating layer splits the encoded components of texture development difference, gloss suppression difference, polarization response and texture gradient in the texture mesh encoding features into channels. The cross-optical gloss counter-evidence mechanism generates gloss counter-evidence components based on the encoded components corresponding to gloss suppression difference and polarization response, and generates texture counter-evidence components based on the encoded components corresponding to texture development difference and texture gradient. The gloss counter-evidence components, texture counter-evidence components and partitioned encoding channels are concatenated and input into the Sigmoid function to obtain the counter-evidence gating weights. The glossy counter-evidence gating layer performs gating weighting on the texture mesh encoding features according to the counter-evidence gating weight, reduces the counter-evidence region response formed by surface specular highlights, occlusion boundary reflections and background texture interference, and enhances the defect region response with consistent cross-optical response, thus obtaining glossy counter-evidence gating features. The partition decoding layer concatenates the gloss counter-evidence gating features with the partition encoding channels in the cross-optical state consistency feature tensor, and performs convolutional decoding, Softmax classification and partition boundary smoothing on the concatenated features to obtain a surface processing defect recognition map.

7. The method for quality inspection of surface treatment effect of injection molded parts based on machine vision according to claim 1, characterized in that, Step six specifically involves: Read the defect category probability and defect response value corresponding to each pixel position in the surface treatment defect identification image, compare the defect response value with the preset initial screening threshold, and mark the pixels that reach the preset initial screening threshold as defect candidate pixels; The candidate pixels of the defect are labeled with connected components according to the eight-neighbor connectivity rule to obtain the defect connected regions. The number of pixels, the bounding rectangle boundary and the average defect response value of each defect connected region are counted. Based on the surface treatment partition map, determine the region category label covered by each defect connected region, and read the corresponding region noise pixel threshold and corresponding region response retention threshold from the partition quality inspection rules. Remove connected regions in the defect connected region where the number of pixels is lower than the corresponding region noise pixel threshold and the average defect response value is lower than the corresponding region response retention threshold to obtain the effective defect connected regions. Based on the inverse transformation relationship in the attitude correction mapping relationship, the outer rectangular boundary and pixel coordinates of the effective defect connected region are back-mapped from the standardized image coordinate system to the original acquired image coordinate system to obtain the original image defect boundary; The overlap ratio between the effective defect connected region and the surface treatment partition map is calculated. When the overlap ratio of the effective defect connected region in a single partition reaches the partition consistency threshold, the single partition is taken as the partition to which the defect belongs. When the effective defect connected region spans multiple partitions, the primary partition is determined according to the partition with the largest overlapping area, and the ratio of the cross-partition boundary length to the perimeter of the effective defect connected region is calculated to obtain the cross-partition boundary ratio. Candidate defect events are generated based on the effective defect connectivity region, the original image defect boundary, the defect's partition, the primary partition, and the cross-partition boundary ratio.

8. The machine vision-based method for quality inspection of surface treatment effects of injection molded parts according to claim 1, characterized in that, Step seven specifically involves: Read the effective defect connected regions, original image defect boundaries, defect partitions, primary partitions, and cross-partition boundary ratios from candidate defect events; When a candidate defect event is located within a single partition, the partition to which the defect belongs is determined as the target decision partition; when a candidate defect event spans multiple partitions, the primary partition is determined as the target decision partition. Based on the target determination partition, the corresponding area threshold, response intensity threshold, cross-partition boundary threshold, level determination condition and pixel scale coefficient are read from the partition quality inspection rules; The number of pixels in the effective defect connected region is counted, and the number of pixels is multiplied by the pixel scale coefficient to obtain the candidate defect area; The average response intensity of the candidate defect is obtained by summing the defect response values ​​of all pixels within the effective defect connected region and dividing by the number of pixels. Based on the defect boundary of the original image, the location markers of the candidate defect events in the original acquired image of the injection molded part are determined, and the location markers are mapped to the quality inspection coordinate range corresponding to the target judgment partition. When the area of ​​a candidate defect is less than the area threshold and the average response intensity of the candidate defect is less than the response intensity threshold, the candidate defect event is marked as a minor defect event. When the area of ​​a candidate defect reaches the area threshold or the average response intensity of a candidate defect reaches the response intensity threshold, the candidate defect event is marked as a rework defect event or a scrap defect event according to the level determination criteria. When the proportion of cross-partition boundaries reaches the cross-partition boundary threshold, the level of the candidate defect event is increased by one level, and the boundary pollution mark is written into the candidate defect event. The zoning quality inspection results are generated based on the location label of the candidate defect event, the area of ​​the candidate defect, the average response intensity of the candidate defect, the target judgment zone, and the defect level.

9. A machine vision-based method for quality inspection of surface treatment effects of injection molded parts according to claim 1, characterized in that, Step eight specifically involves: Read the target judgment zone, location label, candidate defect area, average response intensity of candidate defects, and defect level from the partition quality inspection judgment results; According to the quality retrieval index, the partition quality inspection judgment results are bound to the corresponding injection molded parts to generate a single-piece quality inspection record; When there are no rework or scrap defects in the single-piece quality inspection record, a qualified status mark is generated and written into the surface treatment effect quality inspection result of the injection molded part. When there is a rework defect event but no scrap defect event in the single-piece quality inspection record, a rework status identifier is generated, and a rework location record is generated based on the target judgment partition and location label of the rework defect event. When a scrap defect event exists in a single-item quality inspection record, a scrap status identifier is generated, and a scrap reason record is generated according to the defect level and target judgment partition of the scrap defect event; Based on the location markings within the quality inspection coordinate range corresponding to the target determination zone, the defect boundary box and zone number are superimposed on the standardized surface area image to generate a defect annotation map. Convert the qualified status identifier, repair status identifier, or scrap status identifier into the corresponding sorting instruction, and send the sorting instruction to the sorting execution terminal; The single-piece quality inspection record and defect annotation diagram are written to the rework record terminal. When there is a rework defect event in the single-piece quality inspection record, the rework location record is written to the rework record terminal at the same time. When there is a scrap defect event in the single-piece quality inspection record, the scrap reason record is written to the rework record terminal at the same time, generating the surface treatment effect quality inspection result of the injection molded part.

10. A machine vision-based surface treatment effect inspection device for injection molded parts, comprising performing the machine vision-based surface treatment effect inspection method for injection molded parts according to any one of claims 1 to 9, characterized in that, Includes the following modules: The multi-light state acquisition module is used to determine the surface inspection window in the quality inspection transfer section after the surface treatment of the injection molded part is completed. It starts multi-light state image acquisition according to the carrier positioning trigger signal, generates quality retrieval index, and uses the quality retrieval index to bind the acquired image to obtain a multi-light state quality inspection image set. The image normalization module is used to perform pose correction, contour cropping and brightness normalization on multi-light quality inspection image sets to obtain pose correction mapping relationships and normalized surface region images. The process template partitioning module is used to retrieve surface treatment process templates based on quality retrieval indexes, align the surface treatment process templates with the standardized surface area images to obtain surface treatment partitioning maps and partitioning quality inspection rules; The consistency feature construction module is used to perform cross-optical state difference, polarization response extraction, and texture gradient encoding on standardized surface region images and surface processing partition maps to obtain cross-optical state consistency feature tensors. The defect identification module is used to input the cross-optical consistency feature tensor into the improved MaxViT model to obtain the surface processing defect identification map. The improved MaxViT model includes a multi-optical embedding layer, a texture window encoding layer, a gloss counter-evidence gating layer and a partition decoding layer. The gloss counter-evidence gating layer embeds a cross-optical gloss counter-evidence mechanism. The defect event generation module is used to perform connected region filtering, boundary back mapping, and consistency verification on the surface treatment defect identification map based on the attitude correction mapping relationship and the surface treatment partition map to obtain candidate defect events. The partition quality inspection judgment module is used to generate partition quality inspection judgment results based on the location, area, and response intensity of candidate defect events, combined with partition quality inspection rules. The quality inspection result output module is used to generate the surface treatment effect quality inspection result of injection molded parts based on the zoning quality inspection judgment result, and send it to the sorting execution end and the rework record end.