A Visual Detection Method for Small Targets on the Surface of Air Conditioner Outdoor Units Based on Mask-Guided Perspective Correction
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HEFEI UNIV OF TECH
- Filing Date
- 2026-04-20
- Publication Date
- 2026-06-30
AI Technical Summary
In existing technologies, perspective distortion caused by tilted camera shooting results in low detection accuracy for small targets on the surface of air conditioner outdoor units. Traditional manual inspection is inefficient and highly subjective, while machine vision inspection is limited by installation space, resulting in insufficient detection efficiency and accuracy.
A mask-guided perspective correction method is adopted, which segments the air conditioner outdoor unit casing area using an improved YOLOv11 instance segmentation model. The distortion is eliminated by combining contour analysis and perspective transformation matrix, and small target detection is performed by template matching algorithm.
It significantly improves the detection accuracy and efficiency of small targets on the surface of air conditioner outdoor units, realizes the integration of material picking, detection and loading, improves detection accuracy and recall rate, reduces inference time and improves system process continuity.
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention relates to the field of appearance quality inspection technology for air conditioner outdoor units, and in particular to a visual inspection method for small targets on the surface of air conditioner outdoor units based on mask-guided perspective correction. Background Technology
[0002] In the context of intelligent manufacturing, the appearance quality inspection of air conditioner outdoor units is crucial for ensuring product safety and performance. As the core power unit of the refrigeration cycle system, the manufacturing and assembly quality of the air conditioner outdoor unit directly determines the overall performance, stability, safety, and service life of the unit. On the production line of outdoor units, the assembly integrity of external components is the first and most critical checkpoint in quality control. Among them, missing, incorrect, or poorly assembled parts such as support legs, nameplates, screws, air grilles, and valves are the most common and serious quality defects in the production process. These defects can lead to product rework and increased production costs, or even cause abnormal operation, noise, refrigerant leakage, and safety hazards, seriously damaging brand reputation.
[0003] However, the tilted shooting angle of cameras on the production line causes perspective distortion in the images, resulting in irregular quadrilateral shapes on the outer casing. This severely affects the accuracy of precise inspection of small-sized components (such as screws) on its surface. While traditional instance segmentation methods can locate the target, they cannot eliminate geometric distortions, making direct inspection prone to misjudgment. Currently, the industry mainly uses two inspection methods: traditional manual inspection and machine vision technology inspection. Traditional manual inspection methods rely on the operator's visual judgment and experience. Although highly flexible, they suffer from low efficiency, strong subjectivity, and a high rate of missed detections. Especially in high-speed production line environments, manual inspection struggles to keep up with the production pace, making the quality inspection stage a bottleneck in production.
[0004] Machine vision inspection is an objective, automated analysis process. First, a high-resolution industrial camera captures multi-angle images of the air conditioner's outdoor unit. Second, a professional lighting system (such as ring light or backlight) ensures stable image quality. Then, image processing algorithms (such as deep learning, edge detection, and feature matching) automatically analyze anomalies in the images. Finally, the system outputs the inspection results and controls production line actions (such as rejecting defective products). However, in existing technologies, due to installation space limitations and inspection efficiency requirements, cameras typically shoot at a fixed tilt angle, resulting in significant perspective distortion in the acquired images. This distortion causes the rectangular structures on the surfaces (front, sides, and top) of the outdoor unit to appear as irregular quadrilaterals in the image, severely affecting the inspection accuracy of subsequent components. Summary of the Invention
[0005] This invention addresses the shortcomings of existing technologies by proposing a visual inspection method for small targets on the surface of air conditioner outdoor units based on mask-guided perspective correction. The method aims to eliminate perspective distortion caused by camera tilt during shooting through mask-guided perspective correction, significantly improving the detection accuracy of small targets on the surface of air conditioner outdoor units. It also integrates material handling, inspection, and loading, thereby enhancing efficiency and accuracy, and significantly improving the efficiency of appearance quality inspection of air conditioner outdoor units and the continuity of system operation.
[0006] To achieve the above-mentioned objectives, the present invention adopts the following technical solution: The present invention provides a visual detection method for small targets on the surface of an air conditioner outdoor unit based on mask-guided perspective correction, characterized by the following steps: Step 1: Acquire the original image of the air conditioner outdoor unit. And input it into the improved YOLOv11 instance segmentation model, thereby enabling... The outer casing area of the air conditioner outdoor unit is divided and outputs... Binary mask corresponding to the outer casing area of the air conditioner outdoor unit ; Step 2: Apply the binary mask Contour analysis is performed to obtain the boundary contour of the target surface. and extract The four corner points on the top are used as the source point set. ; Step 3: Based on the prior physical dimensions of the air conditioner outdoor unit, obtain the perspective transformation matrix, which is used for... Perform perspective correction to generate a standard front view. : Step 4: Obtain the information of the areas to be tested corresponding to the air conditioner outdoor unit model, including: the number of areas to be tested. The coordinates of the center point of each area to be detected, and the width and height of each area to be detected; Based on the information of the area to be detected, Extract the set of regions of interest to be detected. ,in, For the first A region of interest to be detected. ; This represents the total number of regions of interest. Step 5: Use template matching algorithm to... The assembly status is assessed to obtain the defect detection results on the surface of the air conditioner outdoor unit: Step 5.1, Obtain and Corresponding standard template image The NCC normalized correlation coefficient method was used to calculate... and similarity coefficient between ; Step 5.2, if Then determine Match successful. The small target at the corresponding position is assembled successfully; otherwise, it is judged as... Match failed. Small targets were missing or poorly assembled at the corresponding locations; among them... This indicates the preset matching threshold.
[0007] The characteristic of the visual detection method for small targets on the surface of an air conditioner outdoor unit based on mask-guided perspective correction described in this invention is that the improved YOLOv11 instance segmentation model in step 1 includes: a backbone network, a generalized feature pyramid network, and an instance segmentation head, and... Processing is performed to output a binary mask of the air conditioner outdoor unit casing area. : Step 1.1: The backbone network comprises: one initial convolutional block, n local feature extraction units, an SPPF module, and a C2PSA module, and is used for... Processing is performed to generate a coarse feature set. and enhanced features ;in, Indicates the first One coarse feature: Step 1.1.1, the initial convolutional block object Processing is performed to obtain initial convolutional features. ; Step 1.1.2, the first The local feature extraction unit obtains the first local feature extraction unit using equation (1). coarse features : In equation (1), Indicates the first The downsampling operation after spatial-to-channel rearrangement in each local feature extraction unit. Indicates the first Local residual extraction and enhancement operations in the local feature extraction unit; when u=1, let the th coarse features = ; Step 1.1.3, the first coarse features The input is processed in the SPPF module to obtain pooled enhanced features. ; Step 1.1.4, The input is processed in the C2PSA module to obtain enhanced features. ; Step 1.2: The generalized feature pyramid network includes five feature fusion units, and... And the second coarse feature The second coarse feature Perform cross-scale fusion processing to output enhanced small-scale features of the air conditioning image. Mesoscale features Large-scale features : Step 1.2.1: The first feature fusion unit uses equation (2) to... and Processing is performed to obtain the first intermediate feature. ,: (2) In equation (2), Indicates an upsampling operation. This indicates a channel splicing operation. This indicates a convolution operation with a stride of 1. This indicates a convolution operation with a stride of 3. This indicates a cross-stage local feature processing module; Step 1.2.2: The second feature fusion unit uses equation (3) to... , and Processing is performed to obtain the second intermediate feature. : (3) Steps 1, 2, and 3: The third feature fusion unit uses equation (4) to... and Processing is performed to obtain : (4) Step 1.2.4, the fourth feature fusion unit uses equation (5) to... and Processing is performed to obtain : (5) Step 1.2.5, the fifth feature fusion unit uses equation (6) to... , and Processing is performed to obtain : (6) Step 2.3, the instance segmentation head pair , , Processing is performed to output a binary mask of the air conditioner outdoor unit casing area. .
[0008] Furthermore, step 2 includes: Step 2.1: Use the contour search algorithm to process the binary mask. Process the data to obtain the contour set of all connected regions. and from the contour set The contour with the largest perimeter is selected as the boundary contour of the target surface. ; Step 2.2: Use the Douglas-Peucker algorithm to define the boundary contour of the target surface. Perform polygon approximation to extract the vertex set of the approximated polygon. ; Step 2.3, for the vertex set Make corrections: If vertex set If there are 4 corner points, then the corresponding 4 corner points are used as the source point set. ; like If the number of corner points is less than 4, then generate Find the minimum bounding rectangle, and use the four corner points of the minimum bounding rectangle as the source point set. ; like If the number of corner points is greater than 4, calculate first. The convex hull is then approximated and corrected using polygons following steps 2.2 and 2.3 until the point set is obtained. until.
[0009] Furthermore, in step 2.2, the Douglas-Peucker algorithm is used to define the boundary contour of the target surface. When performing polygon approximation, the initial approximation accuracy is set to... 5% of the perimeter; when the number of vertices is greater than 4, the approximation accuracy is adjusted to 5% when re-performing polygon approximation on the convex hull. 2% of the perimeter.
[0010] Furthermore, step 3 includes: Step 3.1: Based on the actual physical dimensions of the outdoor unit's surface, define the four corner points of the target rectangle corresponding to the standard front view and form a target point set. ; Step 3.2, according to and The homogeneous coordinate transformation relationship between them is satisfied by the least squares method. and Perspective transformation matrix under the mapping constraints of all corresponding corner points ; Step 3.3: Based on the perspective transformation matrix The bilinear interpolation algorithm is used to... Mapped to a standard rectangular area .
[0011] The present invention provides an electronic device, including a memory and a processor, characterized in that the memory is used to store a program supporting the processor in performing the method described therein, and the processor is configured to execute the program stored in the memory.
[0012] The present invention discloses a computer-readable storage medium storing a computer program, characterized in that the computer program is executed by a processor to perform the steps of the method described thereon.
[0013] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. The present invention significantly improves the detection accuracy: Existing technologies directly detect images with perspective distortion, resulting in low accuracy for small target detection due to geometric deformation. The present invention corrects the tilted view into a standard front view through mask-guided perspective correction, eliminating geometric distortion and thus significantly improving the detection accuracy of small targets on the surface of air conditioner outdoor units. Experimental results show that the method of the present invention is significantly better than the direct detection method (91.9% and 84.6%) in both accuracy (98.4%) and recall (92.9%).
[0014] 2. The present invention has a faster inference speed: Existing deep learning detection methods require large computing resources and have a long inference time; the present invention uses template matching technology for detection after perspective correction, and the inference time for a single image is only 15.7ms, which is faster than YOLOv11n's 21.8ms, saving about 28% of the time, and achieving a dual lead in accuracy and speed.
[0015] 3. Improved process continuity and efficiency of the invention: The invention integrates the pre-alignment function into the continuous process from material picking to material loading. The entire process does not require the introduction of an independent pre-alignment device, realizing the integrated operation of "material picking-image acquisition-deviation calculation-material loading alignment", thereby improving the single detection cycle and the detection efficiency of the air conditioner outdoor unit, and greatly improving the process continuity and operating efficiency of the system. Attached Figure Description
[0016] Figure 1 This is a schematic diagram of the structure of an air conditioner outdoor unit visual inspection system; Figure 2A framework diagram for the improved YOLOv11 instance segmentation model; Figure 3 A comparison diagram of the traditional FPN and GFPN structures; Figure 4 Here is a flowchart of mask contour analysis and vertex extraction. Figure 5 This is a comparison image before and after perspective correction; Figure 6 Obtain a schematic diagram of the ROI region; Figure 7 A comparison chart of detection results between template matching algorithm and deep learning detection algorithm; Numbering in the diagram: 1-Air conditioner outdoor unit, 2-Side camera (including lens), 3-Top camera (including lens), 4-Front camera (including lens), 5-Production line conveyor belt. Detailed Implementation
[0017] In this embodiment, a visual inspection method for small targets on the surface of an air conditioner outdoor unit based on mask-guided perspective correction is applied to a visual inspection system composed of an industrial camera, lens, light source system, and computer. In actual industrial production lines, due to the random placement of the air conditioner outdoor unit 1 on the production line conveyor belt 5, coupled with the limitations of the installation angle of the industrial camera, the acquired outdoor unit images usually exhibit translation, rotation, and a certain degree of perspective distortion. If the small targets (such as screws, signs, etc.) on the surface are directly inspected on the distorted image, not only is positioning difficult, but it is also easily affected by the cluttered background environment, resulting in a very high false detection and false negative rate. Therefore, this embodiment innovatively introduces a technical route of "first mask segmentation and extraction, then perspective correction and flattening, and then local ROI template matching," which can greatly improve the robustness and accuracy of assembly inspection. Specifically, the visual inspection method is performed according to the following steps: Step 1: Fix industrial cameras above and diagonally above the production line of air conditioner outdoor unit 1, including: side camera 2, top camera 3, and front camera 4. Adjust the lens focal length to ensure clear imaging of air conditioner outdoor unit 1. The light source system provides uniform illumination, such as... Figure 1 As shown. In this embodiment, the industrial camera is a Hikvision machine vision industrial-grade CMOS color area array camera with 1200W and 2500W pixels, and the light source system uses a customized strip LED light source to illuminate the surface of the air conditioner outdoor unit 1 at a 45-degree angle to ensure uniform lighting without shadows.
[0018] High-resolution RGB color raw images of air conditioner outdoor unit 1 will be acquired. And input it into the improved YOLOv11 instance segmentation model, thereby enabling... The outer casing area of the outdoor unit 1 of the central air conditioner is precisely divided and output. Binary mask corresponding to the outer casing area of the outdoor unit 1 of the central air conditioner ; Traditional edge extraction algorithms are easily affected by complex textures on the outer shell and background clutter on the conveyor belt, resulting in poor segmentation performance. However, this invention employs an improved YOLOv11 instance segmentation model, leveraging its powerful deep semantic understanding capabilities to accurately remove the background and extract pixels belonging to the "air conditioner outdoor unit front shell." It generates a binary mask with a background pixel value of 0 and an outdoor unit target pixel value of 255, achieving high extraction accuracy. Comparison results are shown below. Figure 2 As shown.
[0019] In this embodiment, the standard YOLOv11 model may lose subtle edge features when dealing with complex backgrounds. Therefore, this invention employs an improved YOLOv11 instance segmentation model, which specifically improves its backbone network and feature fusion network. It introduces spatial channel rearrangement technology and a generalized pyramid feature network, replacing the original PAN-FPN structure with a generalized feature pyramid network (GFPN) and replacing the standard convolutional module with a spatial depth transformation convolution (SPD-Conv) module. This allows the network to extract only the fine edge information of the air conditioner outdoor unit 1 and to recognize the semantic information of "outdoor unit" through deeper feature interactions. Thus, a model consisting of a backbone network, a generalized feature pyramid network, and an instance segmentation head is constructed. Figure 3 As shown, and for Processing is performed to output a binary mask of the air conditioner outdoor unit casing area. .
[0020] Step 1.1: The backbone network consists of one initial convolutional block, n local feature extraction units, an SPPF module (Fast Spatial Pyramid Pooling module), and a C2PSA module, and is used for... Processing is performed to generate a coarse feature set. and enhanced features ;in, Indicates the first A coarse feature.
[0021] Step 1.1.1: Initial Convolutional Block Objects Processing is performed to obtain initial convolutional features. ; Step 1.1.2, the first The local feature extraction unit obtains the first local feature extraction unit using equation (1). coarse features : In equation (1), Indicates the first The downsampling operation after spatial-to-channel rearrangement in each local feature extraction unit. Indicates the first Local residual extraction and enhancement operations in the local feature extraction unit; when u=1, let the th coarse features = Traditional convolutional pooling with a stride of 2 often leads to information loss. Here, we introduce spatial-channel transform convolution (SPDConv), which, during image downsampling, reshapes the feature map tensor, losslessly folding and transferring high-frequency spatial information to the channel dimension. Subsequently, after... The cross-stage local network further refines features, which is of crucial benefit in preserving the sharpness of the shell edges (so that high-precision boundary masks can be generated subsequently).
[0022] Step 1.1.3, the first coarse features The input is processed in the SPPF module to obtain pooled enhanced features. ; Step 1.1.4, The input is processed in the C2PSA module to obtain enhanced features. ; Step 1.2: The generalized feature pyramid network includes five feature fusion units, and... And the second coarse feature The second coarse feature Perform cross-scale fusion processing to output enhanced small-scale features of the air conditioning image. Mesoscale features Large-scale features. The purpose of multi-scale fusion is to comprehensively utilize shallow spatial detail information and deep semantic information. Since the outer shell area of the air conditioner outdoor unit 1 contains both large-scale overall planar structure and geometric details such as edge lines and corner inflection points, single-scale features often cannot take both into account. Through a generalized feature pyramid network, features at different levels can be effectively fused, so that the output features have both strong target localization ability and edge representation ability.
[0023] Step 1.2.1: The first feature fusion unit uses equation (2) to... and Processing is performed to obtain the first intermediate feature. ,: (2) In equation (2), Indicates an upsampling operation. This indicates a channel splicing operation. This indicates a convolution operation with a stride of 1. This indicates a convolution operation with a stride of 3. This indicates a cross-stage local feature processing module.
[0024] Step 1.2.2: The second feature fusion unit uses equation (3) to... , and Processing is performed to obtain the second intermediate feature. : (3) Steps 1, 2, and 3: The third feature fusion unit uses equation (4) to... and Processing is performed to obtain : (4) Step 1.2.4, the fourth feature fusion unit uses equation (5) to... and Processing is performed to obtain : (5) Step 1.2.5, the fifth feature fusion unit uses equation (6) to... , and Processing is performed to obtain : (6) Step 2.3, the final generated , , This represents a fused feature map at small, medium, and large scales. The decoupled network in the instance segmentation head... , , Perform pixel-by-pixel classification and regression processing to output a binary mask of the air conditioner outdoor unit casing area. Because it integrates multi-scale information, regardless of the distance between the air conditioner outdoor unit and the camera, or the phenomenon of objects appearing larger when closer and smaller when farther away due to tilt, the model can generate a mask with edges that closely follow the contours of the outer shell. .
[0025] Step 2: Obtain the mask Then, topological analysis algorithms from visual libraries such as OpenCV were used to analyze the binary mask. Contour analysis can quickly and resiliently obtain the clean outer edges of the shell, thus yielding the target surface boundary contour. Subsequently, the extraction was calculated using a geometric polygon fitting algorithm. The four corner points in the current distortion state are taken as the source point set. These corner points accurately reflect the distorted posture of the current outdoor unit in the image pixel coordinate system.
[0026] Step 2.1: The mask predicted by the actual deep learning segmentation model may contain isolated noise blocks (such as mistakenly including distant objects with a shell-like material). A contour-finding algorithm is used to refine the binary mask. Process the data to obtain the contour set of all connected regions. Considering that the outdoor unit 1 of the air conditioner is necessarily the largest subject in the image field of view, it can be directly determined from the contour set. Select the contour with the largest perimeter or area as the target surface boundary contour. ; Step 2.2: The original obtained contour L is an irregular curve composed of tens of thousands of consecutive adjacent pixels, which cannot be directly used to solve for the four mathematically meaningful corner points. This invention uses the Douglas-Peucker thinning algorithm to recursively find the vertex on the curve farthest from the starting point, thereby eliminating redundant points on the straight line segments. This allows the originally complex pixel curve to quickly converge into a polygon with a few key vertices, thus completing the contour of the target surface boundary. Perform polygon approximation to extract the vertex set of the approximated polygon. ; In specific implementation, in step 2.2, when using the Douglas-Peucker algorithm to perform polygon approximation on the boundary contour L of the target surface, the initial approximation accuracy is set to 5% of the perimeter of L; when the number of vertices is greater than 4, and polygon approximation is re-performed on the convex hull, the approximation accuracy is adjusted to 2% of the perimeter of L.
[0027] Step 2.3: In a perfect scenario, the rectangular air conditioner casing should produce exactly four perfect corner points upon approximation, allowing for seamless transition to subsequent perspective correction. However, in complex real-world conditions, the number of corner points may not be exactly four. Therefore, a fault-tolerant mechanism is needed to prevent program crashes. The specific algorithm flow is as follows: Figure 4 As shown, for the vertex set Make corrections: If vertex set If there are 4 corner points, then the corresponding 4 corner points are used as the source point set. ; If severe reflections cause the mask to be missing a corner, If the number of corner points is less than 4 (such as in a triangle), then calculate directly. The minimum bounding rectangle can be used to forcibly supplement a virtual optimal bounding box, preventing process crashes and deadlocks, and the four corner points of the minimum bounding rectangle are used as the source point set. ; If the edges of the casing are uneven (e.g., there are protruding mounting lugs or shock-absorbing pads), causing it to approach the surface... If the number of corner points is greater than 4, calculate first. The outer convex hull is used to smooth out local uneven structures. Then, following steps 2.2 and 2.3, the convex hull is approximated and corrected using polygons until the source point set consisting of the four corner points representing the main structure is stably extracted. This multi-level fault-tolerance mechanism enables the algorithm to have extremely high stability when dealing with uncontrollable environmental factors in the production environment.
[0028] Step 3: Based on the design drawings or prior knowledge of the outdoor unit 1, the actual length and width of the front casing of the outdoor unit produced by the factory can be known (i.e., prior physical dimensions, such as 800mm wide and 600mm high). Therefore, combining the prior physical dimensions of the outdoor unit 1, i.e., the aspect ratio, a perfect rectangular target area is virtualized in the image, and the source point set is calculated. Mapping the vertex set of a perfect rectangle yields the perspective transformation matrix. Perform perspective correction using inverse geometric stretching projection to generate a standard, distortion-free front view with accurate dimensions and perfectly aligned perspective. This is to eliminate 3D perspective distortion caused by camera shooting.
[0029] Step 3.1: Based on the actual physical dimensions of the outdoor unit's surface, define the four corner points of the target rectangle corresponding to the standard front view and form a target point set. ; Step 3.2, according to and The homogeneous coordinate transformation relationship between them is satisfied by the least squares method. and Perspective transformation matrix under the mapping constraints of all corresponding corner points ; Step 3.3: Based on the perspective transformation matrix The bilinear interpolation algorithm is used to... Mapped to a standard rectangular area The correction results are as follows: Figure 5 As shown, the left side is the original uncorrected image, and the right side is the image corrected using the same correction algorithm.
[0030] Step 4: Obtain the information of the areas to be tested corresponding to the air conditioner outdoor unit model, including: the number of areas to be tested. The coordinates of the center point of each area to be detected, and the width and height of each area to be detected; like Figure 6 As shown, based on the information of the area to be detected, in Extract the set of regions of interest to be detected. ,in, For the first A region of interest to be detected. ; This represents the total number of regions of interest. Figure 6 Part 'a' in the image represents the processed image. On the perspective-corrected image, the set of Regions of Interest (ROIs) to be detected is obtained according to the preset configuration file. Figure 6 As shown in section b, the configuration file stores information about the areas to be detected, including the number of areas to be detected, the coordinates of the center point, and the ROI range. For different models of air conditioner outdoor units, the corresponding ROI information can be saved in advance via the configuration file, enabling multi-model compatible detection.
[0031] Step 5: Use template matching algorithm to... The assembly status is assessed to obtain the defect detection results on the surface of the air conditioner outdoor unit: Step 5.1, Obtain and Corresponding standard template image The NCC normalized correlation coefficient method was used to calculate... and similarity coefficient between ; Step 5.2, if Then determine Match successful. The small target at the corresponding position is assembled successfully; otherwise, it is judged as... Match failed. Small targets were missing or poorly assembled at the corresponding locations; among them... This indicates the preset matching threshold.
[0032] In this implementation, the specific calculation process follows these steps: Let T be the template image and I be the detection region image, then the correlation coefficient r is calculated using equation (1): (1) In equation (1), and These represent the mean values of the detection area image and the template image, respectively. A matching threshold is set. If the similarity is greater than or equal to the threshold, the candidate area is considered to have matched successfully, and the screw is installed correctly. If the similarity is less than the threshold, the detection is considered to have failed, indicating that a screw is missing or improperly assembled. When all ROI areas match successfully, the outdoor unit of the air conditioner is considered to have passed the inspection. If any ROI area fails to match, the detection is considered to have failed, the defect location information is output, and an alarm signal is triggered.
[0033] like Figure 7As shown, the experimental results demonstrate that the method of this invention is significantly superior to the method of directly using YOLOv11n for detection (91.9% and 84.6%) in terms of accuracy (98.4%) and recall (92.9%), and the inference time (15.7ms) is faster than that of YOLOv11n (21.8ms), achieving a dual lead in accuracy and speed.
[0034] In this embodiment, an electronic device includes a memory and a processor. The memory stores a program that supports the processor in executing the above-described method, and the processor is configured to execute the program stored in the memory.
[0035] In this embodiment, a computer-readable storage medium stores a computer program, which is executed by a processor to perform the steps of the above method.
Claims
1. A visual detection method for small targets on the surface of an air conditioner outdoor unit based on mask-guided perspective correction, characterized in that, The steps are as follows: Step 1, collect the original image of the air conditioner outdoor unit And input into the improved YOLOv11 instance segmentation model, so as to segment the shell area of the air conditioner outdoor unit, and output The binary mask corresponding to the shell area of the air conditioner outdoor unit ; Step 2, performing contour analysis on the binary mask to obtain a target surface boundary contour ; Step 3, combine the priori physical size of the air conditioner outdoor unit to obtain a perspective transformation matrix, which is used to perform perspective correction on to generate a standard front view : Step 4, obtaining the to-be-detected area information corresponding to the air conditioner outdoor unit model, including: the number of to-be-detected areas, the center point coordinates of each to-be-detected area, the width and height of each to-be-detected area Based on the region to be detected information, the set of regions of interest to be detected is extracted on the image , wherein the first region of interest to be detected is extracted from the image based on the first region to be detected information ; the total number of regions of interest is represented Step 5, using a template matching algorithm to perform assembly state determination to obtain a defect detection result of the surface of the air conditioner outdoor unit. Step 5.1, obtaining the standard template image corresponding to the standard template image corresponding to and calculating the similarity coefficient between the standard template image and the image to be recognized by using the NCC normalization correlation coefficient method and ; Step 5.2, if then determine a match is successful, the small target at the corresponding position is assembled qualified; otherwise, determine a match is failed, there is a defect of missing or poor assembly of the small target at the corresponding position; wherein represents a preset matching threshold.
2. The method for visual detection of small targets on the surface of an air conditioner outdoor unit based on mask-guided perspective correction according to claim 1, characterized in that, The improved YOLOv11 instance segmentation model in step 1 includes: a backbone network, a generalized feature pyramid network, and an instance segmentation head, and... Processing is performed to output a binary mask of the air conditioner outdoor unit casing area. : Step 1.1: The backbone network comprises: one initial convolutional block, n local feature extraction units, an SPPF module, and a C2PSA module, and is used for... Processing is performed to generate a coarse feature set. and enhanced features ;in, Indicates the first One coarse feature: Step 1.1.1, the initial convolutional block object Processing is performed to obtain initial convolutional features. ; Step 1.1.2, the first The local feature extraction unit obtains the first local feature extraction unit using equation (1). coarse features : In equation (1), Indicates the first The downsampling operation after spatial-to-channel rearrangement in each local feature extraction unit. Indicates the first Local residual extraction and enhancement operations in the local feature extraction unit; when u=1, let the th coarse features = ; Step 1.1.3, the first coarse features The input is processed in the SPPF module to obtain pooled enhanced features. ; Step 1.1.4, The input is processed in the C2PSA module to obtain enhanced features. ; Step 1.2: The generalized feature pyramid network includes five feature fusion units, and... And the second coarse feature The second coarse feature Perform cross-scale fusion processing to output enhanced small-scale features of the air conditioning image. Mesoscale features Large-scale features : Step 1.2.1: The first feature fusion unit uses equation (2) to... and Processing is performed to obtain the first intermediate feature. ,: (2) In equation (2), Indicates an upsampling operation. This indicates a channel splicing operation. This indicates a convolution operation with a stride of 1. This indicates a convolution operation with a stride of 3. This indicates a cross-stage local feature processing module; Step 1.2.2: The second feature fusion unit uses equation (3) to... , and Processing is performed to obtain the second intermediate feature. : (3) Steps 1, 2, and 3: The third feature fusion unit uses equation (4) to... and Processing is performed to obtain : (4) Step 1.2.4, the fourth feature fusion unit uses equation (5) to... and Processing is performed to obtain : (5) Step 1.2.5, the fifth feature fusion unit uses equation (6) to... , and Processing is performed to obtain : (6) Step 2.3, the instance segmentation head pair , , Processing is performed to output a binary mask of the air conditioner outdoor unit casing area. .
3. The method for visual detection of small targets on the surface of an air conditioner outdoor unit based on mask-guided perspective correction according to claim 1, characterized in that, Step 2 includes: Step 2.1: Use the contour search algorithm to process the binary mask. Process the data to obtain the contour set of all connected regions. and from the contour set The contour with the largest perimeter is selected as the boundary contour of the target surface. ; Step 2.2: Use the Douglas-Peucker algorithm to define the boundary contour of the target surface. Perform polygon approximation to extract the vertex set of the approximated polygon. ; Step 2.3, for the vertex set Make corrections: If vertex set If there are 4 corner points, then the corresponding 4 corner points are used as the source point set. ; like If the number of corner points is less than 4, then generate Find the minimum bounding rectangle, and use the four corner points of the minimum bounding rectangle as the source point set. ; like If the number of corner points is greater than 4, calculate first. The convex hull is then approximated and corrected using polygons following steps 2.2 and 2.3 until the point set is obtained. until.
4. The method for visual detection of small targets on the surface of an air conditioner outdoor unit based on mask-guided perspective correction according to claim 3, characterized in that, In step 2.2, the Douglas-Peucker algorithm is used to define the boundary contour of the target surface. When performing polygon approximation, the initial approximation accuracy is set to... 5% of the perimeter; when the number of vertices is greater than 4, the approximation accuracy is adjusted to 5% when re-performing polygon approximation on the convex hull. 2% of the perimeter.
5. The method for visual detection of small targets on the surface of an air conditioner outdoor unit based on mask-guided perspective correction according to claim 3, characterized in that, Step 3 includes: Step 3.1: Based on the actual physical dimensions of the outdoor unit's surface, define the four corner points of the target rectangle corresponding to the standard front view and form a target point set. ; Step 3.2, according to and The homogeneous coordinate transformation relationship between them is satisfied by the least squares method. and Perspective transformation matrix under the mapping constraints of all corresponding corner points ; Step 3.3: Based on the perspective transformation matrix The bilinear interpolation algorithm is used to... Mapped to a standard rectangular area .
6. An electronic device, comprising a memory and a processor, characterized in that, The memory is used to store a program that supports a processor in executing the method of any one of claims 1-5, the processor being configured to execute the program stored in the memory.
7. A computer-readable storage medium storing a computer program thereon, characterized in that, The computer program is executed by the processor to perform the steps of the method according to any one of claims 1-5.