A building surface defect detection method and system based on multi-view structure constraint generation
By generating a defect-free reference image under a unified building surface coordinate system and combining it with multi-view consistency, the problems of model rewriting of normal areas and unstable viewpoints in building surface defect detection are solved, thus achieving accurate defect detection and size calculation.
Patent Information
- Application Number
- CN202611421165.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-14
- Publication Date
- 2026-11-27
AI Technical Summary
Existing methods for detecting defects on building surfaces suffer from several problems: normal areas are easily rewritten by the generated model, single generation results are unstable, multi-view images lack unified geometric correspondence, and single-view pseudo-differences are difficult to eliminate.
By acquiring images of the same building surface area from at least two perspectives and their imaging pose parameters, mapping them to a unified building surface coordinate system, extracting structural condition maps, and using a conditional generation network to generate defect-free reference images within candidate anomaly masks, defect scores are calculated by combining generation uncertainty and cross-view consistency.
It reduces false differences caused by rewriting normal building textures, achieves unified fusion of multi-view detection results and accurate calculation of defect location and size, and reduces the impact of shadows, reflections and occlusions on detection results.
Smart Images

Figure CN123181385A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of building structure appearance inspection, computer vision and generative artificial intelligence, and in particular to a method and system for detecting defects on building surfaces based on multi-view structural constraints. It can be used to detect cracks, peeling, holes, water seepage marks and weathering areas on the surfaces of walls, curtain walls, bridges, tunnel linings and other engineering structures. Background Technology
[0002] Buildings and engineering structures may develop surface defects such as cracks, spalling, holes, water seepage, and weathering during service. The efficiency of manual inspection is limited by working height, structural scope, and personnel experience; detection methods based on fixed sensors have limited coverage; and directly using supervised inspection or segmentation networks usually requires a large number of defect images with pixel-level annotations. Existing unsupervised or weakly supervised surface defect detection methods train a reconstruction network using normal images to reconstruct a defect-free image from the image to be detected, and then determine the abnormal region based on the difference between the image to be detected and the reconstructed image. However, building surfaces contain complex structures such as brick joints, window frames, decorative lines, rough concrete textures, shadows, and reflections. Generative models may simultaneously alter defective and normal regions, causing normal texture changes to be misjudged as defects; single random generation may also produce unstable reference content. Furthermore, when drones or mobile devices capture images of building surfaces from different locations, perspective, scale, lighting, and occlusion all change. If reference images are directly generated from each viewpoint and pixel differencing is performed, it becomes difficult to correlate the same physical location, and the detection results are difficult to translate into the actual location and size of the building surface. Shadows, reflections, occlusion, and generated spurious differences from a single viewpoint can also lead to false alarms. Therefore, a technical solution is needed that can utilize multiple perspectives under a unified building surface coordinate system, constrain the generative model to only repair candidate abnormal regions, and combine generation uncertainty with cross-perspective consistency to determine the true defects. Summary of the Invention Technical problems to be solved
[0003] The present invention aims to solve the problems in existing image reconstruction-based defect detection methods, such as normal regions being easily rewritten by the generation model, unstable single generation results, lack of unified geometric correspondence in multi-view images, and difficulty in eliminating single-view pseudo-differences. Technical solution To address the above problems, this invention provides a method for detecting surface defects in buildings based on multi-view structural constraints, comprising the following steps. S101, acquire surface images of the same building surface area from at least two viewing angles, and the imaging pose parameters corresponding to each surface image. The imaging pose parameters may include at least one of camera intrinsic parameters, camera position, camera attitude, shooting distance, and timestamp. S102, based on the imaging pose parameters and the building surface model, maps each surface image to a unified building surface coordinate system, resulting in multiple geometrically normalized image blocks. The building surface model can be obtained from motion recovery structures, multi-view stereo reconstruction, depth sensors, or building information models. S103, extract the building surface structure condition map from the geometrically normalized image patch, and determine the candidate anomaly mask based on the degree of deviation of the target image patch from the normal feature distribution and the consistency between image patches corresponding to multiple viewpoints. S104: Input the target image patch, the building surface structure condition map, the corresponding image patches from other perspectives, and the candidate anomaly mask into the conditional generation network. Generate defect-free candidate content within the mask-defined area and hard copy the original content of the target image patch outside the mask to obtain a defect-free reference image. Perform multiple generation operations on the same input and obtain a generation uncertainty map based on the degree of dispersion between the candidate reference images. S105, calculate at least two of the pixel differences, structural differences, and deep feature differences between the target image patch and the defect-free reference image, and weight them according to the generation uncertainty, reprojection error, and cross-view consistency to obtain the defect score map for each view. S106, the defect score maps from each viewpoint are back-projected onto a unified building surface coordinate system, and fused based on the reliability of the viewpoints and the degree of support from multiple viewpoints to determine the defect areas, coordinates, and actual dimensions of the building surface. The present invention also provides a building surface defect detection system, electronic device, and non-transient computer-readable storage medium corresponding to the above method. Beneficial effects Compared to generating the entire reference image without constraints, this invention uses candidate anomaly masks to limit the generation area and retains the original content outside the mask, which can reduce the false differences caused by the rewriting of normal building textures in the processing flow. This invention maps multi-view images to a unified building surface coordinate system, enabling the detection results from multiple perspectives to be fused at the same physical location, and allowing the spatial scale of the building surface model to be used to calculate the location and size of defects. This invention generates an uncertainty map through multiple generation processes and weights the discrepancies by incorporating reprojection error, viewpoint reliability, and cross-viewpoint support, thereby reducing the impact of random generation, shadows, reflections, and occlusions on the detection results. The above effects represent the expected outcomes of the technical solution; the specific degree of improvement depends on the training data, model parameters, and on-site imaging conditions. Attached Figure Description
[0004] Figure 1 This is a schematic diagram of the building surface defect detection system according to an embodiment of the present invention; Figure 2 This is a flowchart of a building surface defect detection method according to an embodiment of the present invention; Figure 3 This is a schematic diagram of the multi-view geometric normalization process in an embodiment of the present invention; Figure 4 This is a schematic diagram of the structural constraint reference image generation process according to an embodiment of the present invention; Figure 5 This is a schematic diagram of the multi-scale difference and uncertainty weighting process according to an embodiment of the present invention; Figure 6 This is a schematic diagram of the cross-view surface coordinate fusion process according to an embodiment of the present invention. Figure reference numerals: 100, Multi-view acquisition module; 200, Geometric normalization module; 300, Structural constraint reference diagram generation module; 400, Difference calculation and uncertainty module; 500, Surface coordinate fusion and output module. Detailed Implementation
[0005] The following description, in conjunction with the accompanying drawings, illustrates various embodiments of the present invention. These embodiments are intended to explain the invention and not to limit its scope. Where there is no contradiction, the technical features of the various embodiments can be combined. I. Terminology and Data Representation Building surface areas refer to the surfaces of walls, curtain walls, bridge components, tunnel linings, or similar engineering structures whose appearance information can be obtained through visible light, depth, or other imaging methods. A unified building surface coordinate system refers to two-dimensional parametric coordinates or three-dimensional spatial coordinates defined on a building surface model, used to represent the same physical location corresponding to pixels in multiple viewpoint images. The target image patch is the geometrically normalized image patch currently involved in defect assessment; the corresponding image patch is an image patch from other perspectives that covers the same or partially the same building surface area as the target image patch. The defect-free reference image is not a necessary copy of a historical photograph, but rather a reference result provided by the conditional generation network within the candidate anomaly region, satisfying the normal building surface feature distribution and structural condition constraints. The candidate anomaly mask can be represented as M, where This indicates that position x is allowed to be updated by the conditionally generated network. This indicates that position x retains the original content of the target image patch. Let G be the initial generated image output by the conditional generation network, and I be the target image patch. Then, the final reference image R can be represented as: , where ⊙ represents element-wise multiplication. II. System Structure like Figure 1 As shown, the system includes a multi-view acquisition module 100, a geometry normalization module 200, a structural constraint reference map generation module 300, a difference calculation and uncertainty module 400, and a surface coordinate fusion and output module 500. Each module can be deployed on a UAV, an edge computing device, a backend server, or a combination of the above devices. The multi-view acquisition module 100 can be installed on drones, inspection robots, or handheld devices, including visible light cameras, and may include depth cameras, laser rangefinders, inertial measurement units, and positioning units. The acquisition carrier is not limited as long as it can obtain multiple view images of the same building surface area and the corresponding geometric relationships. III. Multi-view geometric normalization like Figure 3 As shown, the camera is first calibrated to obtain the intrinsic parameter matrix. For acquisition devices with positioning and inertial measurement information, the camera's extrinsic parameters can be obtained based on the positioning and attitude information; alternatively, the relative pose can be calculated through image feature matching and motion reconstruction structures. The building surface model can be represented as a triangular mesh, point cloud, patched plane, or building information model. For wall areas that are approximately planar, the homography transformation matrix can be calculated based on the camera's intrinsic and extrinsic parameters and planar parameters, mapping images from different viewpoints into orthophoto blocks with uniform resolution. For curved or irregular surfaces, the imaging rays corresponding to image pixels can be intersected with the 3D surface, and texture projection can be completed based on the surface coordinates of the intersection points. After mapping, the source viewpoint, visibility, reprojection error, view angle, and spatial scale of each normalized pixel are recorded. Illumination normalization can be performed based on the mean brightness, color histogram, or feature statistics of the corresponding non-obstructive region. Viewpoint reliability q can be obtained by a weighted combination of sharpness, reprojection error, view angle, and occlusion status. IV. Candidate Anomaly Mask Normal feature modeling can utilize only image patches of defect-free building surfaces. The feature extraction network outputs multi-scale feature vectors, which are then used to construct a set of normal feature prototypes, a normal feature codebook, or a probability distribution. For each location of the target image patch, the distance between its feature vector and its nearest normal feature prototype is calculated, resulting in the normal distribution deviation map D. n . Align image patches corresponding to other viewpoints to the target image patch using the unified building surface coordinates, calculate robust median maps or weighted reference features, and obtain the cross-viewpoint initial difference map Dᵥ. Based on D... n The coarse mask is formed by combining Dᵥ and viewpoint reliability, for example, by normalizing D. n After weighted summation of Dᵥ, the threshold is determined using the quantiles of the normal validation set, followed by closing, opening, and connected component filtering. This coarse mask is only used to limit the generated region and is not directly used as the final defect conclusion. When the defect occurs simultaneously in all current viewpoints, causing Dᵥ to be inconspicuous, D n Candidate regions can still be generated based on normal feature distribution; when the surface texture deviates from the normal distribution but presents a consistent normal structure from different perspectives, false alarms can be reduced by generating uncertainty and cross-view fusion. V. Generation of Structural Constraint Reference Images like Figure 4 As shown, at least one of the following is extracted from the target image patch: edge, line segment, depth, surface normal, or semantic boundary, to form a structural condition map C. Taking a conditional diffusion network as an example, noisy latent variables, candidate anomaly masks M, structural condition maps C, the out-of-mask content of the target image patch, and features of image patches corresponding to other viewpoints can be jointly input into the denoising network. Structural conditions can participate in each step of denoising through feature concatenation, cross-attention, or conditional control branches. Conditional generative networks can be trained using images of defect-free building surfaces. Linear, blocky, branching, or textured synthetic anomalous masks are randomly generated from normal image patches. Noise, color perturbations, texture patches, or synthetic defects are added to these masks to form the training input; the original defect-free image patches serve as the supervised targets. The training loss can be expressed as… Where Lmask is the mask region reconstruction loss, Lid is the identity preservation loss outside the mask, Lstr is the edge or structure consistency loss, Lper is the perceptual feature loss, and λ1 to λ4 are non-negative weights. During inference, the conditional generation network generates candidate defect-free content within a candidate anomaly mask. Regardless of the network's initial output, it uses... A final reference image is generated to ensure that the area outside the mask is completely consistent with the target image patch. For boundary regions, a narrow transition band can be set at the mask edge and soft weights obtained from distance transformation can be used for fusion. For the same input, K generation operations can be performed using different random noises to obtain R1 to R2. k The generation uncertainty U(x) at position x can be determined by the pixel variance, deep feature variance, or a weighted sum of both for each candidate image at that position. K can be set to an integer greater than 1 depending on computational resources. VI. Multi-scale differences and single-view defect scores like Figure 5 As shown, pixel differences Dp, gradient differences Dg, structural similarity differences Ds, and deep feature differences Df obtained from a pre-trained feature network are calculated for the target image patch I and the reference image R. To accommodate cracks and spalling at different scales, the differences can be calculated at at least two resolution levels and upsampled to a uniform size. The single-view basic difference A0 can be expressed as Where αp, αg, αs, and αf are non-negative weights. An uncertainty suppression factor wu is obtained based on the generation uncertainty U, for example, wu = exp(-βU), where β is a positive number; then, combined with the viewpoint reliability q, the single-viewpoint defect score A = q·wu·A0 is obtained. Weights and thresholds can be determined using a normal validation set; fixed manual thresholds are not required. In another embodiment, Dp, Dg, Ds, Df, U, and q can be fed as multi-channel inputs into a lightweight fusion network, which outputs a defect score map. The fusion network can be trained using normal images and synthesized anomalous images. VII. Cross-view fusion and actual size calculation like Figure 6 As shown, the defect score map of each viewpoint is back-projected onto the building surface model according to the mapping relationship between image coordinates and building surface coordinates. For the same building surface location, defect scores from all visible viewpoints are collected, and fusion weights are calculated based on sharpness, reprojection error, viewpoint angle, occlusion status, and generation uncertainty. The fusion score can be obtained using weighted average, weighted median, or robust statistics. To suppress shadows, reflections, occlusions, or spurious differences that occur only from a single viewpoint, candidate regions can be required to be supported by at least a preset number of viewpoints. When a surface location has only one valid viewpoint, a low-confidence marker can be output instead of directly deleting that location. The final defect region is obtained by adaptive thresholding and connected component processing of the fused fractional image. Based on the spatial scale in the building surface model, the surface coordinates on the defect region boundary are converted into actual length and area. The defect type can be determined by a separate classification network, a rule-based classifier, or manual verification. Outputs include the defect image, building surface coordinates, actual dimensions, fusion confidence score, and associated viewpoint. VIII. Training Examples In one alternative embodiment, fixed-size image patches are first cropped from images of wall and bridge surfaces without obvious defects to establish a normal training set. Synthetic anomalous masks are generated using random line segments, branching curves, irregular regions, and external textures, respectively. Color attenuation, texture replacement, noise, or blurring are added to the masks to form the training input. When training the conditional generation network, the structural condition map of the training images and the synthetic anomaly mask are input simultaneously. The mask region reconstruction loss, mask exterior identity preservation loss, structural consistency loss, and perceptual feature loss are optimized. When training the normal feature model, only original normal image patches are used, allowing the normal feature prototypes to describe normal patterns such as building materials, brick joints, and component boundaries. Parameter selection can be accomplished using a normal validation set. For example, the candidate mask threshold and the final detection threshold can be determined based on the statistical quantiles of the deviation score and fusion defect score in the normal validation image, avoiding the need to specify a unique value in the specification. This embodiment illustrates one implementation path and does not imply that a specific level of accuracy has been achieved. IX. Inspection Examples In one embodiment of unmanned aerial vehicle (UAV) building exterior wall inspection, the UAV plans a flight path along the exterior wall, captures visible light images from multiple locations with overlapping fields of view, and simultaneously records the camera's attitude and position. The backend server then builds a model of the exterior wall surface based on the image features and pose information, mapping each image into a uniform resolution orthophoto image block of the exterior wall. For each target image patch, the server calculates a normal feature deviation map and a cross-view initial difference map to form a candidate anomaly mask. The conditional generation network generates defect-free reference content within the mask and retains the original pixels outside the mask. The server calculates multi-scale differences and generation uncertainties, backprojects the results from each viewpoint onto the exterior wall surface model and fuses them, outputting candidate crack or peeling areas. Staff can view the original viewpoint, reference image, difference map, and fusion confidence score for each defect candidate region in the backend interface and perform manual verification. The verified results can be used for subsequent model training or repair task generation. 10. Alternative Implementation Methods Conditional generative networks are not limited to diffusion networks; generative adversarial networks, masked autoencoders, or other networks capable of generating reference content based on normal feature distributions can also be used. Building surface models are not limited to complete 3D models; for local planar structures, planar homography can be used to construct unified 2D surface coordinates. Multi-view images can be obtained during a single inspection or can include reference images from previous inspections or the construction phase. If reliable historical defect-free images exist, they can be used as additional input, but the existence of historical images is not a necessary condition for this invention. The data acquisition platform can be a drone, inspection robot, fixed camera, or handheld device. The modules in the above embodiments can be implemented by software, hardware, or a combination of both. The execution order of the method steps can be adjusted or they can be executed in parallel without disrupting data dependencies.
Claims
1. A method for detecting surface defects in buildings based on multi-view structural constraints, characterized in that, include: Acquire surface images of the same building surface area from at least two viewpoints and the imaging pose parameters corresponding to each surface image; Based on the imaging pose parameters and the building surface model, each surface image is mapped to a unified building surface coordinate system to obtain multiple geometrically normalized image blocks. A building surface structure condition map is extracted from the geometrically normalized image blocks, and a candidate anomaly mask is determined based on the deviation of the target image block from the normal feature distribution and the consistency between image blocks corresponding to different viewpoints. The target image block, the building surface structure condition map, at least one corresponding image block from another viewpoint, and the candidate anomaly mask are input into a conditional generation network to generate defect-free candidate content within the area defined by the candidate anomaly mask. The original content of the target image block is retained outside the candidate anomaly mask to obtain a defect-free reference image and a generation uncertainty map. Multi-scale difference features between the target image block and the defect-free reference image are calculated, and the multi-scale difference features are weighted according to the generation uncertainty map and the consistency between different viewpoints to obtain a defect score map corresponding to each viewpoint. Each defect score map is back-projected onto the unified building surface coordinate system and fused across viewpoints to determine the building surface defect region and its location and size.
2. The method according to claim 1, characterized in that, The building surface model is obtained by performing motion recovery structure reconstruction or multi-view stereo reconstruction on surface images from multiple perspectives, or by obtaining it based on a building information model; the mapping includes establishing a mapping relationship between image coordinates and building surface coordinates based on camera intrinsic parameters, the imaging pose parameters, and the building surface model.
3. The method according to claim 1, characterized in that, After obtaining the geometrically normalized image block, the method further includes: performing illumination normalization on the geometrically normalized image block based on the brightness statistics, color statistics, and sharpness of the corresponding regions at different viewing angles, and recording at least one of the reprojection error, viewing angle, occlusion state, and image sharpness as a viewing angle reliability parameter.
4. The method according to claim 1, characterized in that, The normal feature distribution is established by the feature vectors of the image block of the defect-free building surface; the deviation degree is the distance between the feature vectors at each position in the target image block and the normal feature prototype, normal feature codebook or normal feature probability distribution.
5. The method according to claim 1, characterized in that, The candidate anomaly mask is determined based on the degree of deviation, the initial difference between the target image patch and other viewpoint corresponding image patches, and the viewpoint reliability parameter, and forms one or more regions to be generated through morphological processing or connected component processing.
6. The method according to claim 1, characterized in that, The building surface structure condition map includes at least one of edge map, line segment map, depth map, surface normal map and semantic boundary map; the condition generation network is a conditional diffusion network, generative adversarial network or encoder-decoder network, and the condition generation network constrains the outline and spatial position of the generated content according to the building surface structure condition map.
7. The method according to claim 1, characterized in that, The training samples of the conditional generation network include defect-free building surface image patches and synthetic anomaly masks generated on the defect-free building surface image patches; the training loss includes at least the mask region reconstruction loss, the mask-outside region identity preservation loss and the structural consistency loss, wherein the mask-outside region identity preservation loss is used to constrain the generation result to be consistent with the corresponding defect-free building surface image patch outside the synthetic anomaly mask.
8. The method according to claim 1, characterized in that, Multiple conditional generation processes are performed on the same target image block to obtain multiple defect-free candidate images; the generation uncertainty map is determined based on the pixel dispersion or feature dispersion of the multiple defect-free candidate images at corresponding positions.
9. The method according to claim 1, characterized in that, The multi-scale difference features include at least two of the following: pixel difference, gradient difference, structural similarity difference, and deep feature difference; the defect score map is obtained by multiplying the weighted sum of each difference feature with the uncertainty suppression factor, and the higher the generation uncertainty, the smaller the uncertainty suppression factor.
10. The method according to claim 1, characterized in that, The cross-view fusion includes: determining the fusion weight of each viewpoint in the unified building surface coordinate system based on at least two of the reprojection error, viewpoint angle, occlusion state, image sharpness, and generation uncertainty; performing weighted fusion on the defect scores projected to the same building surface location; and identifying the area supported by no less than a preset number of views and whose fused defect score reaches an adaptive threshold as the building surface defect area.
11. The method according to claim 1, characterized in that, Based on the spatial scale provided by the building surface model, the pixel length and pixel area of the defect area on the building surface are converted into actual length and actual area, respectively, and the actual length, actual area, building surface coordinates and defect type are written into the inspection report.
12. A building surface defect detection system based on multi-view structural constraints, characterized in that, include: The multi-view acquisition module is used to acquire surface images of the same building surface area from at least two viewpoints and the corresponding imaging pose parameters. A geometric normalization module is used to map each of the surface images to a unified building surface coordinate system based on the imaging pose parameters and the building surface model. The structural constraint reference map generation module is used to form a structural condition map of building surface and a candidate anomaly mask. It generates defect-free candidate content within the candidate anomaly mask and retains the original content outside the candidate anomaly mask to obtain a defect-free reference image and generate an uncertainty map. The difference calculation module is used to calculate the multi-scale difference features between the target image patch and the defect-free reference image, and to obtain the defect score map based on the generated uncertainty map and cross-view consistency. And a surface coordinate fusion module, used to project defect fraction maps from different perspectives onto the unified building surface coordinate system and fuse them, outputting the location and size of the defect area on the building surface.
13. The system according to claim 12, characterized in that, The multi-view acquisition module is installed on a drone, inspection robot, or handheld imaging device; the multi-view acquisition module includes a visible light camera, and optionally includes at least one of a depth camera, a laser rangefinder, an inertial measurement unit, and a satellite positioning unit.
14. The system according to claim 12, characterized in that, The structural constraint reference map generation module includes a normal feature modeling unit, a candidate anomaly masking unit, a condition generation unit, and an uncertainty estimation unit; the surface coordinate fusion module is also configured to filter shadows, reflections, occlusions, or generate pseudo-differences that only appear in a single viewpoint based on the common support results of at least two viewpoints.
15. An electronic device, comprising a processor, a memory, and a communication interface, characterized in that, The memory stores a computer program, which, when executed by the processor, causes the electronic device to perform the method according to any one of claims 1 to 11.
16. A non-transient computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 11.
