Container appearance inspection method, system, device and medium based on AI
The container appearance inspection method using multi-view image fusion and mask protection solves the problems of high false detection rate and blurred defects, achieving efficient and accurate container appearance inspection and providing detailed 3D defect information to facilitate subsequent maintenance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANGHAI MARITIME UNIVERSITY
- Filing Date
- 2026-03-18
- Publication Date
- 2026-07-31
AI Technical Summary
Existing container appearance inspection technologies suffer from high false detection rates, the tendency to obscure minor defects, a lack of multi-perspective information verification, and difficulties in spatial defect location, making it difficult to meet the needs of automated warehousing and intelligent operation and maintenance.
By acquiring multi-view images of containers, establishing a mapping between pixel coordinates and world coordinates, generating a mask to protect suspected damaged areas, using a multi-scale attention network for fine detection, and combining 3D models to fuse defect information, multi-view verification and accurate positioning are achieved.
It significantly reduces the false detection rate, preserves details of minute defects, provides accurate 3D coordinates and physical dimensions, facilitates automated maintenance positioning, and improves detection accuracy and efficiency.
Smart Images

Figure CN122492548A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence technology, specifically relating to an AI-based method, system, equipment, and medium for inspecting the appearance of containers. Background Technology
[0002] As a core carrier in global logistics, the appearance of shipping containers directly affects transportation safety and service life. Currently, container appearance inspection mainly relies on manual inspection or simple machine vision assistance. However, due to the large size of containers (typically 6 to 12 meters long) and their huge surface area, manual inspection suffers from low efficiency, strong subjectivity, and difficulty in quantification, failing to meet the needs of automated warehousing and intelligent operation and maintenance.
[0003] To address the aforementioned issues, machine vision-based inspection solutions have emerged in recent years. These solutions typically acquire images of containers or laser point clouds, and then utilize deep learning models to identify defects within the images. However, in practical applications, these solutions still face the following technical bottlenecks: First, the surface of a container is complex and contains a lot of interfering information (such as rust, stains, welds, reflections, etc.). Conventional inspection models are prone to false detections when processing this information, making it difficult to accurately locate the real defects.
[0004] Secondly, and more importantly, to ensure image quality, existing technologies typically preprocess the acquired images, such as denoising, illumination normalization, and smoothing filters. While these preprocessing operations can improve the overall image quality, they inevitably blur or weaken the edge details of minute defects (such as dents less than 5mm deep or minor scratches), causing small defects to be missed in subsequent detection. Early damage to containers often manifests in the form of these minute defects, and if not detected in time, it can deteriorate rapidly.
[0005] Third, existing solutions mostly involve single-view independent detection, lacking comprehensive verification of multi-view information, making it difficult to distinguish between surface interference and actual damage, and failing to provide three-dimensional spatial information of defects, which is not conducive to accurate repair and positioning.
[0006] Therefore, how to ensure detection efficiency while avoiding damage to the details of minute defects in the preprocessing stage, and how to integrate multi-perspective information to improve detection accuracy, are technical problems that urgently need to be solved in this field. Summary of the Invention
[0007] To address the aforementioned shortcomings of existing technologies, this invention provides an AI-based method, system, equipment, and medium for inspecting the appearance of containers, thereby resolving the aforementioned technical problems.
[0008] In a first aspect, the present invention provides an AI-based method for inspecting the appearance of containers, comprising: Acquire multi-view images of the container and establish a mapping relationship between image pixel coordinates and world coordinates; Obtain the defect coordinates of each image, project the defect coordinates onto the 3D model to align the defect coordinates from different viewpoints, and mark the suspected damaged areas based on the number of times the same location appears in multiple viewpoints. A mask is generated for the suspected damaged area. During image preprocessing, no processing is performed on the area covered by the mask to preserve the original pixels. Only the non-masked area is preprocessed. The preprocessed image and mask are input into the AI model, and the AI model outputs pixel-level defect segmentation results. The multi-view segmentation results are mapped back to the 3D model, defects are merged, and physical properties are calculated.
[0009] In one optional implementation, acquiring multi-view images of the container includes: By using a drone equipped with a camera with a resolution of ≥4K, and following a preset orbital flight path, the overlap rate between adjacent images is ensured to be ≥60%.
[0010] In an optional implementation, establishing the mapping relationship between image pixel coordinates and world coordinates includes: The camera's intrinsic parameters were calibrated using Zhang Zhengyou's calibration method to obtain the intrinsic parameter matrix K and distortion coefficients. For each image, the preset corner points of the container are detected, and the camera extrinsic parameters are solved using the PnP algorithm; Based on the calibrated camera intrinsic parameters and the solved camera extrinsic parameters, determine the position of the camera optical center in the world coordinate system; Calculate the direction vector of the ray corresponding to the pixel in the world coordinate system based on the pixel coordinates, camera intrinsic parameters, and camera extrinsic parameters. Based on the camera optical center position and the direction vector, construct a ray equation that originates from the camera optical center and passes through the pixel. The ray equation is substituted into the pre-constructed plane equation of the container surface to solve for the coordinates of the intersection point between the ray and the container surface. These intersection point coordinates are the world coordinates corresponding to the pixel.
[0011] In an optional implementation, obtaining the defect coordinates for each image and projecting these coordinates onto a 3D model includes: Each image is input into a pre-trained lightweight object detection model, which outputs defect bounding boxes with a confidence threshold lower than the conventional detection threshold, in order to prioritize the recall rate of defects. Using the center pixel coordinates of each defect's bounding box as the defect's pixel coordinates, and based on the defect's pixel coordinates and the mapping relationship between the image pixel coordinates and world coordinates, the 3D coordinates of the defect on the container surface model are calculated.
[0012] In one optional implementation, suspected damaged areas are marked based on the number of times the same location appears from multiple viewpoints, including: The 3D coordinates of defects from different perspectives are unified to the same reference coordinate system for spatial alignment using a point cloud registration algorithm. The registered 3D model space is divided into multiple solid mesh units according to the preset voxel size; Count the number of different viewpoints corresponding to the 3D coordinates of defects contained in each 3D grid cell; The spatial locations corresponding to the number of three-dimensional grid units that are greater than or equal to a preset threshold are marked as suspected damaged areas.
[0013] In one optional implementation, a mask is generated for the suspected damaged area. During image preprocessing, no processing is performed on the area covered by the mask to preserve the original pixels; only the non-masked areas are preprocessed, including: Based on the pixel positions of the suspected damaged areas in each image, a binary mask image is generated for each original image, where pixels with a mask value of 1 correspond to suspected damaged areas and pixels with a mask value of 0 correspond to non-suspected damaged areas. When performing preprocessing operations on the image, the binary mask image is read. For pixels with a mask value of 1, all preprocessing steps are skipped, and the pixel values of the original image are directly retained. For pixels with a mask value of 0, image processing is performed according to a preset preprocessing procedure. The preprocessing process includes: The image after selective preprocessing is transformed to the frequency domain using Fourier transform; Applying a high-pass filter in the frequency domain suppresses low-frequency background information in the image while preserving and enhancing high-frequency components that represent defect edges. The filtered frequency domain image is restored to the spatial domain through inverse Fourier transform to obtain a high-frequency enhanced image; The high-frequency enhanced image is weighted and fused with the original image to obtain the final input image used for fine detection.
[0014] In an optional implementation, the preprocessed image and mask are input into an AI model, which outputs pixel-level defect segmentation results, including: The preprocessed RGB image and the corresponding binary mask image are concatenated along the channel dimension to form multi-channel input data; The multi-channel input data is input into a multi-scale attention network, which includes an encoder, a context aggregation module, and a decoder. The encoder performs multi-level feature extraction on multi-channel input data and uses a mask-guided attention mechanism on each level feature map to perform weighted fusion of the upsampled binary mask and the feature map to enhance the feature response of suspected damaged areas. The context aggregation module adopts a dilated spatial pyramid pooling structure and processes the feature map output by the encoder through dilated convolution with different dilation rates to aggregate multi-scale context information. The decoder progressively upsamples the aggregated feature map and makes skip connections with the feature map of the corresponding level in the encoder, finally restoring the original image resolution and outputting a probability map of each pixel belonging to the defect category, i.e., the pixel-level defect segmentation result.
[0015] Secondly, the present invention provides an AI-based container appearance inspection system, comprising: The image acquisition module is used to acquire multi-view images of the container and establish a mapping relationship between image pixel coordinates and world coordinates; The defect marking module is used to obtain the defect coordinates of each image, project the defect coordinates onto the 3D model to align the defect coordinates from different viewpoints, and mark suspected damaged areas based on the number of times the same location appears in multiple viewpoints. The preprocessing module is used to generate a mask for suspected damaged areas. When performing image preprocessing, no processing is done on the areas covered by the mask to preserve the original pixels, and only the non-masked areas are preprocessed. The defect segmentation module is used to input the preprocessed image and mask into the AI model, and the AI model outputs pixel-level defect segmentation results; The results fusion module is used to map multi-view segmentation results back to the 3D model, merge defects, and calculate physical properties.
[0016] Thirdly, a device is provided, comprising: Memory for storing AI-based container appearance inspection procedures; A processor is used to implement the steps of the AI-based container appearance inspection method as provided in the first aspect when executing the AI-based container appearance inspection program.
[0017] Fourthly, a computer-readable medium is provided, on which an AI-based container appearance inspection program is stored, wherein when the AI-based container appearance inspection program is executed by a processor, it implements the steps of the AI-based container appearance inspection method provided in the first aspect.
[0018] The AI-based container appearance inspection method, system, equipment, and medium provided by this invention have the following beneficial effects: First, it solves the problem of high false detection rate in single-view applications.
[0019] Container surfaces often contain numerous interfering elements such as rust, stains, and weld seams, making single-view image detection highly susceptible to false positives. This invention projects defect coordinates from multiple viewpoints onto the same 3D model and counts the frequency of occurrence of the same location across multiple views. Only when the same location is detected in all multiple views is it marked as a suspected defect area. This feature leverages the physical principle that genuine defects should exhibit consistency across different viewpoints, effectively filtering out false detections caused by lighting, shadows, and stains, significantly improving the confidence level of genuine defects and reducing the false positive rate.
[0020] Second, it solved the problem of minor fuzzy defects in the preprocessing stage.
[0021] While conventional image preprocessing (such as smoothing and denoising) can improve image quality, it inevitably blurs the edge details of minute defects, leading to missed detection of small-sized defects. This invention generates a mask to identify suspected damaged areas and, during preprocessing, leaves the masked areas unprocessed, directly preserving the original pixels, while only performing conventional preprocessing on the non-masked areas. This feature ensures that the original high-frequency details of minute defect areas are fully preserved during preprocessing, providing undistorted defect features for subsequent fine detection, thereby significantly improving the detection capability of small-sized, low-contrast defects.
[0022] Third, it solved the problem of connecting coarse positioning results with fine detection.
[0023] This invention inputs a preprocessed image and a protection mask into a fine-grained detection network and introduces an attention mechanism. The protection mask serves as prior information, guiding the network to focus on suspected damaged areas; the attention mechanism further enhances the feature responses of these areas. This feature combination allows suspicious areas selected in the coarse localization stage to be analyzed in detail during fine-grained detection. This avoids computationally intensive indiscriminate reasoning across the entire image while ensuring the accuracy of analysis in key areas, achieving both efficient allocation of computational resources and a dual improvement in detection accuracy.
[0024] Fourth, it solved the problem of difficulty in locating defects in space.
[0025] This invention constructs a complete information transfer process from 2D images to 3D space, from front-end multi-view image acquisition and coordinate mapping to back-end defect segmentation results mapped back to a 3D model and merged. This combination of features ensures that the final output defect not only contains type information but also has precise 3D coordinates and physical dimensions, facilitating subsequent automated maintenance positioning and quantitative evaluation, overcoming the limitation of traditional solutions that can only provide 2D image markings.
[0026] In summary, this invention, through a cascaded architecture of "multi-view fusion verification - difference preprocessing protection - mask-guided fine detection," forms a complete technical closed loop from coarse screening to fine inspection, and from single-view to multi-view fusion, thus collaboratively solving multiple technical problems in existing technologies, such as the easy loss of minor defects, high false detection rate, and lack of spatial information. Attached Figure Description
[0027] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1 This is a schematic flowchart of a method according to an embodiment of the present invention.
[0029] Figure 2 This is a schematic architecture diagram of an AI model of a method according to an embodiment of the present invention.
[0030] Figure 3 This is a schematic block diagram of a system according to an embodiment of the present invention.
[0031] Figure 4 This is a schematic diagram of the structure of a device provided in an embodiment of the present invention. Detailed Implementation
[0032] To enable those skilled in the art to better understand the technical solutions of this invention, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this invention.
[0033] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.
[0034] The AI-based container appearance inspection method provided in this embodiment of the invention is executed by a computer device, and correspondingly, the AI-based container appearance inspection system runs on the computer device.
[0035] Figure 1 This is a schematic flowchart illustrating a method according to an embodiment of the present invention. Wherein, Figure 1The implementing entity can be an AI-based container appearance inspection system. Depending on different requirements, the order of steps in this flowchart can be changed, and some steps can be omitted.
[0036] like Figure 1 As shown, the method includes: S1. Acquire multi-view images of the container and establish a mapping relationship between image pixel coordinates and world coordinates; S2. Obtain the defect coordinates of each image, project the defect coordinates onto the 3D model to align the defect coordinates from different viewpoints, and mark the suspected damaged areas based on the number of times the same location appears in multiple viewpoints. S3. Generate a mask for the suspected damaged area. When performing image preprocessing, do not process the area covered by the mask to preserve the original pixels, and only perform preprocessing on the non-masked area. S4. Input the preprocessed image and mask into the AI model, and the AI model outputs pixel-level defect segmentation results; S5. Map the multi-view segmentation results back to the 3D model, merge defects and calculate physical properties.
[0037] In one embodiment of the present invention, based on step S1, the following will provide a possible embodiment and describe its specific implementation in a non-limiting manner.
[0038] S101. Acquire multi-view images of the container, including: The DJI M400 series drone was selected, equipped with a Sony A7RIV high-resolution camera (≥61MP, ≥4K resolution). The drone automatically cruised along a preset circular flight path, designed as a multi-layered ring track around the container to ensure coverage of the front, sides, top, and ends. During flight, the camera's optical axis always pointed towards the center of the container, and the shooting interval was dynamically adjusted according to the flight speed to ensure an overlap rate of no less than 60% between adjacent images. This high overlap design ensures that every physical area of the container surface appears in images from at least two different perspectives, laying the foundation for subsequent multi-view fusion and stereo matching.
[0039] S102. Establish the mapping relationship between image pixel coordinates and world coordinates, including: First, camera intrinsic parameter calibration is performed. Before drone takeoff, 15-20 images of the calibration board are taken from different positions and angles using a standard black and white checkerboard calibration board. The Zhang Zhengyou calibration method is employed, and the images are processed using OpenCV or the MATLAB calibration toolbox to solve for the camera's intrinsic parameter matrix K and distortion coefficients D. The intrinsic parameter matrix K is expressed as:
[0040] in, , These are the focal lengths in the x and y directions, respectively (in pixels). , The principal point coordinates (usually the image center) are used. The distortion coefficients D=[k1,k2,p1,p2,k3] include radial and tangential distortion parameters, which are used for subsequent image distortion correction.
[0041] Next, camera extrinsic parameter estimation is performed. For each container image captured in step S101, the following operations are performed: Corner Detection: Due to the regular rectangular structure of shipping containers, their eight vertices are natural marker points. Visible container corners in the image are detected using image processing algorithms (such as Harris corner detection combined with manual correction) or pre-defined QR code markers. These corners have precise world coordinates (X, Y, Z) in a pre-built 3D model of the container.
[0042] PnP Solution: After obtaining the pixel coordinates (u, v) and their corresponding world coordinates (X, Y, Z) of at least four corner points in the image, the Perspective-n-Point (PnP) algorithm is used to solve for the camera extrinsic parameters. The goal of the PnP algorithm is to find the rotation matrix R and translation vector t that minimizes the reprojection error. Its mathematical model is as follows:
[0043] Where s is the scale factor. By solving the above equation, the camera extrinsic parameters R and t corresponding to the image can be obtained. R represents the rotation relationship from the world coordinate system to the camera coordinate system, and t represents the position of the camera optical center in the world coordinate system.
[0044] Then, the back projection relationship from the pixels to 3D space is constructed. To convert any pixel coordinates (u,v) in the image into its world coordinates P=(X,Y,Z) on the container surface, this embodiment uses the ray-plane intersection method. The specific steps are as follows: Determine the position of the camera optical center: Based on the solved extrinsic parameters, the position O of the camera optical center in the world coordinate system can be directly obtained by the translation vector t, i.e., O=t.
[0045] Calculating the ray direction: For a given pixel coordinate (u,v), first convert it to normalized coordinates in the camera coordinate system using camera intrinsics. The direction vector D of the ray corresponding to this pixel in the world coordinate system can be obtained as follows: rotate the ray direction in the camera coordinate system (usually a vector from the optical center to the pixel) to the world coordinate system using the inverse transformation of the rotation matrix R.
[0046] Constructing the ray equation: Based on the optical center position O and the direction vector D, construct the ray equation passing through the pixel: P(λ)=O+λD, where λ is the distance parameter along the ray, λ>0.
[0047] Establish a container surface model: A 3D model of the container surface is pre-built. For a regular container, its surface can be simplified to six planes. Each plane can be represented by the plane equation ax + by + cz + d = 0. For example, the plane containing the front of the container can be obtained by fitting the world coordinates of its four corner points.
[0048] Solving for the intersection point: Substitute the ray equation P(λ) = O + λD into the plane equation a(O) x +λD x )+b(O y +λD y )+c(O z +λD z Solve for λ by adding d and finding 0. Since the ray points towards the container, the λ should be a positive real number. Substituting λ back into the ray equation, we can calculate the coordinates of the intersection point P=(X,Y,Z) between the ray and the container surface. These intersection point coordinates are the world coordinates corresponding to pixel (u,v).
[0049] Through the above steps, the physical position of any pixel on any image on the surface of the container can be accurately calculated, thereby establishing a precise image-world coordinate mapping relationship.
[0050] In one embodiment of the present invention, based on step S2, the following will provide a possible embodiment and describe its specific implementation in a non-limiting manner.
[0051] S201. Obtain the defect coordinates for each image and project the defect coordinates onto the 3D model, including: Each image is input into a pre-trained lightweight object detection model, which outputs defect bounding boxes with a confidence threshold lower than the conventional detection threshold to prioritize defect recall. Specifically, YOLO-Nano or SSD-MobileNet is used, with an input size of 640×640. Output: bounding box B=(x,y,w,h) and confidence c. Threshold setting: c>0.3 (low threshold ensures high recall, allowing for false positives).
[0052] The center pixel coordinates of each defect's bounding box are used as the pixel coordinates of the defect: Calculate the center pixel coordinates of the bounding box:
[0053]
[0054] Record the set of defective pixel coordinates Si ={(u,v)} (the i-th image).
[0055] Based on the pixel coordinates of the defect and the mapping relationship between the image pixel coordinates and world coordinates, the 3D coordinates of the defect on the container surface model are calculated: Data preparation: For the i-th image, obtain the set S of corresponding defect pixel coordinates. i ={(u c1 ,v c1 ),(u c2 ,v c2 ...}, and the camera extrinsic parameters (rotation matrix R) obtained by solving the image in step S102. i Translation vector t i ) and camera intrinsic parameter K.
[0056] Back projection calculation: for set S i Each defective pixel in the image (u c ,v c ), and perform the "ray-plane intersection method" described in step S102 of Example 1: Determine the camera optical center: the position of the camera optical center in the world coordinate system O i =t i .
[0057] Calculate the ray direction: based on pixel coordinates (u c ,v c Internal reference K and external reference R i Calculate from the optical center O i The direction vector D of the ray originating from and passing through this pixel in the world coordinate system i .
[0058] Construct the ray equation: P(λ) = O i +λD i .
[0059] Solving for the plane intersection point: Substitute the ray equation into the pre-constructed container surface plane equation ax + by + cz + d = 0 from step S102. Solve for the parameter λ, and then obtain the intersection point coordinates P = (X, Y, Z).
[0060] Output: Finally, for each defect point, its precise 3D coordinates P are obtained. These coordinates represent the actual location of the defect on the physical surface of the container. The 3D coordinates of the defects in all images together form a sparse "suspected defect point cloud".
[0061] S202. Mark suspected damaged areas based on the frequency of the same location appearing from multiple viewpoints, including: (1) Point cloud registration is performed using the iterative nearest point algorithm, and the specific implementation is as follows: Selecting a reference point cloud: From all images, select the defect point set corresponding to the image with the lowest corner detection error, which is taken directly from the container, as the target point cloud Q. The defect point sets from all other images are used as the source point clouds P. i .
[0062] Iterative nearest point matching: for each source point cloud P i Perform the following iterative process: Closest point search: For source point cloud P i Each point p in j Find the nearest Euclidean distance point q in the target point cloud Q. j This forms a set of corresponding point pairs (p j ,q j ).
[0063] Transformation Solution: Based on all corresponding point pairs, solve for a rigid body transformation (rotation matrix R and translation vector t) that minimizes the root mean square distance between all point pairs. The objective function is:
[0064] Application transformation: Apply the obtained R and t to the current source point cloud P. i Update the coordinates of all points.
[0065] Iterative convergence: Repeat the above three sub-steps until the root mean square error change between two consecutive iterations is less than a preset threshold (e.g., 1 mm), or the maximum number of iterations is reached (e.g., 50 times).
[0066] Output alignment results: After ICP registration, the 3D coordinates of defects in all viewpoints are finely adjusted to a unified spatial reference, so that point clouds representing the same physical defect can be more closely clustered together.
[0067] (2) In order to transform the continuous set of spatial points into statistically discrete units, this embodiment introduces a voxel grid to divide the registered 3D space.
[0068] Determining the voxel size: The choice of voxel size is a key parameter determining the effectiveness of this step. If the size is too large, adjacent defects will be merged together; if the size is too small, residual errors after ICP registration cannot be offset, resulting in the same defect not falling into the same voxel at different viewpoints. In this embodiment, based on the statistical regularity of typical container defects, the voxel size is set to 5cm × 5cm × 5mm (length × width × height). The reason for using a smaller size (5mm) in the height direction is that changes in the depth direction of container surface defects (such as dents) are generally more sensitive than changes in the planar direction. This approach effectively addresses registration errors in the planar direction while retaining depth sensitivity.
[0069] Voxel meshing: Determine the minimum bounding box of the container 3D model, i.e., the minimum and maximum values in the X, Y, and Z directions. Then, divide the entire bounding box space into a series of 3D mesh units at 5cm intervals. Each mesh unit can be represented by a unique 3D index (i,j,k).
[0070] Point cloud assignment and view statistics: Traverse all defective 3D points after registration, for each point P=(X,Y,Z): Calculate the voxel: Calculate the voxel grid index (i,j,k) that the point falls into based on its coordinates.
[0071] Record the source viewpoint: This point itself carries source information, that is, from which image's flaw it was projected. Record the ID of this source viewpoint in the data structure corresponding to voxel (i,j,k).
[0072] After traversing all points, each hit voxel maintains a set of "source view IDs".
[0073] (3) After the statistics are completed, the judgment can be made based on the principle of consistency of multiple perspectives.
[0074] Threshold setting: In this embodiment, the judgment threshold is set to 2. The physical basis for this threshold setting is that as long as a real physical defect (such as a dent or breakage) exists, it should be able to be detected by the detection model as long as it can be observed from multiple different angles. Therefore, a real defect will be captured in at least two or more viewpoints. Conversely, false detections caused by illumination reflections and random noise in a single image are random in location and are almost impossible to appear simultaneously in the same spatial location (i.e., the same voxel) from more than two different viewpoints.
[0075] Execution judgment: For each hit voxel, check the number of elements in its "Source View ID" set.
[0076] If the number of elements is greater than or equal to 2, the spatial area covered by the voxel is determined to be a suspected damaged area.
[0077] If the number of elements is 1, the defect within the voxel is determined to be a false detection from a single viewpoint and is removed, and will not proceed to the next step.
[0078] Record the results: For each voxel suspected of being damaged, record the following key information: 3D coordinate range: The spatial position of the voxel, such as its center point coordinates or corner point coordinates.
[0079] Corresponding image pixel location: Review all source viewpoints for the defect within this voxel, recording the pixel coordinates of which image it originally originated from. By summarizing this information, the precise 2D projection location of the suspected damaged area in all relevant images can be obtained.
[0080] In one embodiment of the present invention, based on step S3, the following will provide a possible embodiment and describe its specific implementation in a non-limiting manner.
[0081] S301. Based on the pixel positions of the marked suspected damaged areas in each image, generate a binary mask image for each original image, where pixels with a mask value of 1 correspond to suspected damaged areas, and pixels with a mask value of 0 correspond to non-suspected damaged areas.
[0082] Binary mask M(u,v):
[0083] S302. When performing preprocessing operations on the image, the binary mask image is read. For pixels with a mask value of 1, all preprocessing steps are skipped, and the pixel values of the original image are directly retained. For pixels with a mask value of 0, image processing is performed according to a preset preprocessing procedure.
[0084] The preprocessing process includes: (1) The image after selective preprocessing is transformed to the frequency domain by Fourier transform; Gaussian smoothing: Applied only to non-masked areas to avoid blurring defect details.
[0085]
[0086] G σ The kernel function is Gaussian, with σ=1.5 (controlling the smoothing degree, an empirical value). The masked region retains the original high-frequency information, while the non-masked region is denoised.
[0087] For each image I after damage protection preprocessing pre(Selective smoothing results are already included), first transforming it from the spatial domain to the frequency domain. This embodiment uses Fast Fourier Transform to achieve this transformation.
[0088] Image grayscale conversion: To simplify calculations, the preprocessed RGB color image is first converted into a grayscale image. gray .
[0089] Fourier transform: for grayscale image I gray Applying the two-dimensional discrete Fourier transform, we obtain the frequency domain representation F(u,v):
[0090] To facilitate filtering operations, the zero-frequency component of the spectrum is moved to the center position (using the fftshift operation).
[0091] (2) Apply a high-pass filter in the frequency domain to suppress low-frequency background information of the image and retain and enhance the high-frequency components that represent the edge of the defect.
[0092] Constructing a filter: The transfer function H(u,v) of a Butterworth high-pass filter is defined as follows:
[0093] Where D(u,v) is the distance from the frequency point (u,v) to the center of the spectrum. The cutoff frequency determines the high-frequency range retained by the filter. This embodiment, based on the surface texture characteristics and defect size distribution of the container, will... Set to 30 pixels (corresponding to the frequency domain distance after downsampling the original image to 640×640). This value was experimentally calibrated: too small a value will retain too much low-frequency noise, while too large a value will excessively weaken the background, leading to isolated defects. n is the filter order, controlling the steepness of the transition band. In this embodiment, n=2 is used to obtain moderate transition characteristics, balancing the enhancement effect and ringing suppression.
[0094] Frequency domain filtering: Filtering the shifted spectrum Element-wise multiplication with the filter H(u,v) yields the filtered spectrum G(u,v):
[0095] Since H(u,v) takes a value close to 0 at low frequencies and a value close to 1 at high frequencies, the low-frequency components are significantly suppressed after multiplication, while the high-frequency components are preserved.
[0096] (3) The filtered frequency domain image is restored to the spatial domain by inverse Fourier transform to obtain the high-frequency enhanced image.
[0097] Perform an inverse spectrum shift operation (ifftshift) on the filtered spectrum G(u,v) to shift the zero-frequency component back to its original position, resulting in G.original (u,v).
[0098] Inverse Fourier Transform: For G original Applying the two-dimensional discrete Fourier inverse transform (u,v) yields the high-frequency component image I in the spatial domain. high The obtained I high It mainly contains high-frequency information such as edges and textures in the image, while uniform background areas are represented by gray values close to zero.
[0099] (4) The high-frequency enhanced image and the original image are weighted and fused to obtain the final input image for fine detection.
[0100] Simple high-frequency image I high While highlighting defect edges, the loss of background color and structural information may lead to insufficient semantic information if used directly in subsequent networks. Therefore, this embodiment performs weighted fusion of the high-frequency enhanced image and the original preprocessed image to obtain the final input image I for fine detection. enh .
[0101] Fusion formula:
[0102] Here, λ is the enhancement intensity coefficient, used to control the degree of superposition of high-frequency components. An excessively large value of λ can easily lead to image distortion, while a value that is too small will result in an insignificant enhancement effect. This embodiment, through experimental comparison, sets λ=0.3. This value can effectively highlight defect edges while preserving the original image's main structure.
[0103] Result processing: Fuded image I enh There may be cases where pixel values exceed the original grayscale range (0-255), so truncation is required to map the excess part to the boundary value to ensure that the image data is valid.
[0104] In one embodiment of the present invention, based on step S4, the following will provide a possible embodiment and describe its specific implementation in a non-limiting manner.
[0105] Please refer to Figure 2 This step uses a protection mask as an additional input channel and introduces a mask-guided attention mechanism, enabling the network to focus on suspected areas that have been verified from multiple perspectives, thus achieving accurate segmentation.
[0106] S401. Multi-channel input construction This step first fuses the preprocessed RGB image with the corresponding binary mask image to construct an input tensor containing prior information.
[0107] Data preparation: Obtain the binary mask image M generated in step S202 (same size as the original image, with pixel values of 1 in the masked area and 0 in the non-masked area), and the high-frequency enhanced image I output in step S203. enh (RGB three-channel).
[0108] Channel stitching: combining high-frequency enhanced images I enh The three color channels of the image are concatenated with a binary mask image M along the channel dimension. Specifically, for each pixel position (x, y) in the image, a four-dimensional vector [R, G, B, M] is constructed, where R, G, and B are the pixel values of the high-frequency enhanced image at that position, and M is the mask value. This operation expands the original 3-channel RGB image into 4-channel input data with a size of H×W×4, where H and W are the height and width of the image, respectively.
[0109] Using a mask as the fourth channel input to the network essentially injects the multi-view fusion results from the coarse localization stage into the fine detection network as prior information. During feature extraction, the network can directly identify which regions are suspected damage locations verified from multiple perspectives, thus naturally allocating computational resources to these regions.
[0110] S402. Overall Network Architecture This embodiment employs a multi-scale attention network with an encoder-decoder structure and introduces a context aggregation module between the encoder and decoder. The design goal of this network structure is to fully extract multi-scale features and enhance the response of suspected regions during the encoding stage, capture semantic information from different receptive fields during the context aggregation stage, and gradually restore spatial resolution and generate fine-grained segmentation results during the decoding stage.
[0111] (1) Multi-scale feature extraction: ResNet-101 is used as the backbone network because its deep structure can extract rich multi-level features. Its pre-trained weights (based on the ImageNet dataset) are retained to accelerate convergence and improve generalization ability. The network outputs feature maps at four levels, from shallow to deep, containing detailed texture, local structure, and global semantic information, respectively.
[0112] The ASPP module's function is to apply the Spatial Pyramid Pooling (ASPP) module to the last-level features of the backbone network, capturing multi-scale information through parallel branches. This includes: 1×1 convolutional branch: Preserves the original receptive field and captures local details.
[0113] Three dilated convolution branches with different dilation rates (dilation rates 6, 12, and 18): expand the receptive field without reducing the feature map resolution, adapting to defects of different sizes (e.g., small dents require small receptive fields, while large damage requires large receptive fields).
[0114] The dilated convolution formula, for input features F, dilated kernel K, dilation rate r, and output position i:
[0115] Expanding the receptive field by inserting zero-padding without reducing resolution (avoiding downsampling).
[0116] Global average pooling branch: Provides image-level global context.
[0117] The outputs of the five branches are concatenated along the channel dimension and then reduced to 256 channels using a 1×1 convolution. This multi-scale feature extraction method captures both small defects (local details) and large defects (global context).
[0118] (2) Attention mechanism: Masking to guide attention: This mechanism uses an input protective mask to guide the network's focus. First, the mask is upsampled to the same size as the feature map. Then, a 1×1 convolution is used to adjust the number of channels, followed by a sigmoid function to generate a weight map ranging from 0 to 1. In the weight map, regions marked as 1 in the mask have weights close to 1, while background regions have weights close to 0. The weight map is then multiplied point-by-point with the feature map to enhance the feature response of suspected defective regions and suppress background features.
[0119] By explicitly introducing prior information, the network is forced to focus on the suspected regions already marked in the multi-view fusion stage, reducing false responses to uniform backgrounds (such as box-shaped flat plate regions) and improving the signal-to-noise ratio.
[0120] CBAM module supplement: After masked attention is guided, CBAM (Convolutional Attention Module) is further applied, which consists of two sub-modules: Channel attention: Learn the importance of each feature channel through global pooling and fully connected layers, and enhance channels related to defects (such as edge and texture channels).
[0121] Spatial attention: Learns the importance of spatial location through max pooling, average pooling and convolution operations, focusing on areas where defects may occur.
[0122] To ensure network performance, this embodiment employs a two-stage training strategy: Pre-training phase: The ResNet-101 backbone network is pre-trained on a large-scale general dataset (such as ImageNet) to enable it to have basic image feature extraction capabilities.
[0123] Fine-tuning phase: The complete network is fine-tuned end-to-end on a self-built container defect dataset. During training, the protection mask generated in step S202 is used as the input to the 4th channel, allowing the network to learn how to utilize this prior information. The loss function is a weighted combination of Dice Loss and Focal Loss to address the problem of a severe imbalance in the number of pixels between the defect region and the background region.
[0124] In one embodiment of the present invention, based on step S5, a possible embodiment will be given below, and its specific implementation will be described in a non-limiting manner.
[0125] S501. Backprojection of Multi-view Segmentation Results This step first back-projects the pixel-level segmentation results of each image onto the 3D surface model of the container to generate a sparse defect point cloud.
[0126] Binarization processing: The defect probability map P output in step S204 is processed... prob Application threshold T seg (In this embodiment, we take 0.5), and generate a binary segmentation mask M. seg In the mask, areas with a pixel value of 1 represent defects, and areas with a pixel value of 0 represent the background. A threshold of 0.5 is an empirical value that balances precision and recall, and can be adjusted according to the accuracy requirements of the actual application scenario.
[0127] Pixel sampling: For a binary mask M seg In theory, every pixel (u, v) with a value of 1 should be back-projected into 3D space. However, directly processing all defective pixels would result in an excessively large point cloud data volume (the defective area of a 4K image may contain millions of pixels). To balance computational efficiency and accuracy, this embodiment adopts a uniform sampling strategy: within the defective region, a point is taken every 3 pixels for back-projection. For small defects (area less than 100 pixels), all pixels are retained to ensure integrity.
[0128] Back projection calculation: For each defective pixel (u,v) to be processed, calculate its corresponding 3D world coordinates P=(X,Y,Z) according to the "ray-plane intersection method" established in step S102 of Example 1.
[0129] Constructing a defect point cloud: The 3D coordinates obtained by backprojecting all sampled defect pixels from all images are aggregated to form a defect point cloud set S containing N points. Each point, in addition to its spatial coordinates (X, Y, Z), also includes attribute information: source image ID, original pixel coordinates, and defect probability value (from the output of step S204). This attribute information will be used in subsequent clustering and quantization analysis.
[0130] S502. Defect Point Cloud Clustering and Merging Since the same physical defect is repeatedly detected in multiple images, a large number of points will cluster in the corresponding region of the defect in the back-projected point cloud. This step uses a density-based spatial clustering algorithm—DBSCAN—to cluster these points, merging points belonging to the same physical defect into a single independent defect instance.
[0131] Algorithm selection criteria: The DBSCAN algorithm does not require pre-specifying the number of clusters, can discover clusters of arbitrary shapes, and can effectively identify and remove noise points, making it very suitable for processing defect point clouds in industrial inspection. Container surface defects have diverse shapes (dot-like dents, strip-like scratches, flaky corrosion), and DBSCAN can adapt to these different forms.
[0132] S503. Defect Physical Property Calculation For each cluster, the defect cluster C obtained is k This step further calculates its physical properties, including three-dimensional dimensions, depth information, and confidence scores.
[0133] 3D bounding box calculation: Coordinate extrema: Traversing cluster C k Given all points, find the minimum value in the X, Y, and Z directions (X). min ,Y min Z min ) and maximum value (X) max ,Y max Z max ).
[0134] Constructing the bounding box: with (X min ,Y min Z min ) and (X max ,Y max Z max Using the diagonal vertices as the basis, construct an axis-aligned 3D bounding box, which is the minimum bounding cuboid of the defect.
[0135] Size calculation: Calculate the length of the bounding box in three directions: ΔX=X max -X min ΔY=Y max -Y min ΔZ=Z max -Z min Overall Defect Dimensions: The overall dimensions of a defect can be characterized by the diagonal length L of the bounding box: L = ΔX² + ΔY² + ΔZ² For planar defects (such as rust), L reflects the extent of their coverage on the container surface; for three-dimensional defects (such as dents), L comprehensively reflects their spatial extent.
[0136] Confidence score calculation: Perspective Source Statistics: A Review of Cluster C k For each point, find the source image ID, count the number of duplicate IDs, and denote it as N. views This value represents the number of independent viewpoints that detected the defect.
[0137] Total number of viewing angles determined: In the flight path design step S101, each area of the container surface is divided into at least N views. total The theoretical number of coverage angles N for the location of the defect can be queried based on the flight path planning results. total .
[0138] Confidence score calculation: The confidence score (Conf) for a defect is defined as the ratio of the number of views from which the defect was actually detected to the number of views theoretically covered. For example, if a defect is theoretically covered by four views, but is confirmed to exist in the detection results of three views, the confidence score is 0.75. This indicator objectively reflects the degree of consistency of defect detection results across multiple views and can serve as a reference for subsequent maintenance decisions.
[0139] Defect Classification: In addition to the quantitative indicators mentioned above, this step can also perform preliminary classification of defect types based on their geometric characteristics (such as aspect ratio, depth / area ratio, point cloud density distribution, etc.), distinguishing between different defect types such as dents, scratches, corrosion, and damage. The classification results can be obtained through rule-based judgment or a lightweight classifier.
[0140] After the above processing, this embodiment finally outputs a complete information record for each defect, including: Defect ID: a unique identifier; Defect type: dent, scratch, corrosion, damage, etc.; 3D position coordinates: coordinates of the defect center point or corner point of the bounding box, which facilitates quick location by on-site maintenance personnel; Physical dimensions: length, width, diameter and diagonal length; Confidence score: a value between 0 and 1, reflecting the reliability of the test results.
[0141] Corresponding image list: A list of original image IDs containing the defect, for easy manual review.
[0142] In some embodiments, the AI-based container appearance inspection system may include multiple functional modules composed of computer program segments. The computer programs for each program segment in the AI-based container appearance inspection system may be stored in the memory of a computer device and executed by at least one processor to perform (see details). Figure 1 (Description) AI-based container appearance inspection function.
[0143] In this embodiment, the AI-based container appearance inspection system can be divided into multiple functional modules based on its functions, such as... Figure 3 As shown. The module referred to in this invention is a series of computer program segments that can be executed by at least one processor and perform a fixed function, and is stored in memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.
[0144] The image acquisition module is used to acquire multi-view images of the container and establish a mapping relationship between image pixel coordinates and world coordinates; The defect marking module is used to obtain the defect coordinates of each image, project the defect coordinates onto the 3D model to align the defect coordinates from different viewpoints, and mark suspected damaged areas based on the number of times the same location appears in multiple viewpoints. The preprocessing module is used to generate a mask for suspected damaged areas. When performing image preprocessing, no processing is done on the areas covered by the mask to preserve the original pixels, and only the non-masked areas are preprocessed. The defect segmentation module is used to input the preprocessed image and mask into the AI model, and the AI model outputs pixel-level defect segmentation results; The results fusion module is used to map multi-view segmentation results back to the 3D model, merge defects, and calculate physical properties.
[0145] Figure 4 The AI-based container appearance inspection method provided in this application embodiment can be applied to equipment. Those skilled in the art will understand that the equipment structure involved in the embodiments of this invention does not constitute a limitation on the equipment. The equipment may include more or fewer components than illustrated, or combine certain components, or have different component arrangements. In the embodiments of this invention, the equipment includes, but is not limited to, laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The equipment may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the embodiments of this application described and / or claimed herein.
[0146] The device 400 may include a processor 410, a memory 420, and a communication unit 430. These components communicate via one or more buses. Those skilled in the art will understand that the server structure shown in the figure does not constitute a limitation of the present invention. It may be a bus topology or a star topology, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0147] The memory 420 can be used to store execution instructions of the processor 410. The memory 420 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. When the execution instructions in the memory 420 are executed by the processor 410, the device 400 is able to perform some or all of the steps in the above method embodiments.
[0148] The processor 410 serves as the control center of the storage device, connecting various parts of the electronic device via various interfaces and lines. It executes software programs and / or modules stored in the memory 420, and calls data stored in the memory to perform various functions of the electronic device and / or process data. The processor can be composed of integrated circuits (ICs), such as a single packaged IC or multiple packaged ICs with the same or different functions connected together. For example, the processor 410 may consist only of a central processing unit (CPU). In this embodiment of the invention, the CPU may have a single processing core or include multiple processing cores.
[0149] The communication unit 430 is used to establish a communication channel, enabling the storage device to communicate with other devices. It can receive user data sent by other devices or send user data to other devices.
[0150] The present invention also provides a computer medium, wherein the computer medium may store a program, which, when executed, may include some or all of the steps provided in the embodiments of the present invention. The medium may be a magnetic disk, an optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0151] Those skilled in the art will clearly understand that the techniques in the embodiments of the present invention can be implemented using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solutions in the embodiments of the present invention, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product is stored in a medium such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, or any other medium capable of storing program code. It includes several instructions to cause a computer device (which may be a personal computer, a server, or a second device, network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0152] The same or similar parts between the various embodiments in this specification can be referred to mutually. In particular, the device embodiments are basically similar to the method embodiments, so the description is relatively simple, and the relevant parts can be referred to the description in the method embodiments.
[0153] In the embodiments provided by this invention, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between systems or modules may be electrical, mechanical, or other forms.
[0154] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0155] In addition, the functional modules in the various embodiments of the present invention can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.
[0156] Although the present invention has been described in detail with reference to the accompanying drawings and preferred embodiments, the present invention is not limited thereto. Various equivalent modifications or substitutions can be made to the embodiments of the present invention by those skilled in the art without departing from the spirit and essence of the invention, and such modifications or substitutions should all be within the scope of the present invention. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should also be covered within the protection scope of the present invention.
Claims
1. An AI-based container appearance inspection method, characterized by, include: Acquire multi-view images of the container and establish a mapping relationship between image pixel coordinates and world coordinates; Obtain the defect coordinates of each image, project the defect coordinates onto the 3D model to align the defect coordinates from different viewpoints, and mark the suspected damaged areas based on the number of times the same location appears in multiple viewpoints. A mask is generated for the suspected damaged area. During image preprocessing, no processing is performed on the area covered by the mask to preserve the original pixels. Only the non-masked area is preprocessed. The preprocessed image and mask are input into the AI model, and the AI model outputs pixel-level defect segmentation results. The multi-view segmentation results are mapped back to the 3D model, defects are merged, and physical properties are calculated.
2. The method of claim 1, wherein, Acquire multi-view images of the container, including: By using a drone equipped with a camera with a resolution of ≥4K, and following a preset orbital flight path, the overlap rate between adjacent images is ensured to be ≥60%.
3. The method of claim 1, wherein, Establishing a mapping relationship between image pixel coordinates and world coordinates includes: The camera's intrinsic parameters were calibrated using Zhang Zhengyou's calibration method to obtain the intrinsic parameter matrix K and distortion coefficients. For each image, the preset corner points of the container are detected, and the camera extrinsic parameters are solved using the PnP algorithm; Based on the calibrated camera intrinsic parameters and the solved camera extrinsic parameters, determine the position of the camera optical center in the world coordinate system; Calculate the direction vector of the ray corresponding to the pixel in the world coordinate system based on the pixel coordinates, camera intrinsic parameters, and camera extrinsic parameters. Based on the camera optical center position and the direction vector, construct a ray equation that originates from the camera optical center and passes through the pixel. The ray equation is substituted into the pre-constructed plane equation of the container surface to solve for the coordinates of the intersection point between the ray and the container surface. These intersection point coordinates are the world coordinates corresponding to the pixel.
4. The method of claim 1, wherein, Obtain the defect coordinates for each image, and project these coordinates onto the 3D model, including: Each image is input into a pre-trained lightweight object detection model, which outputs defect bounding boxes with a confidence threshold lower than the conventional detection threshold, in order to prioritize the recall rate of defects. Using the center pixel coordinates of each defect's bounding box as the defect's pixel coordinates, and based on the defect's pixel coordinates and the mapping relationship between the image pixel coordinates and world coordinates, the 3D coordinates of the defect on the container surface model are calculated.
5. The method of claim 1, wherein, Suspected damaged areas are marked based on the frequency of the same location appearing from multiple perspectives, including: The 3D coordinates of defects from different perspectives are unified to the same reference coordinate system for spatial alignment using a point cloud registration algorithm. The registered 3D model space is divided into multiple solid mesh units according to the preset voxel size; Count the number of different viewpoints corresponding to the 3D coordinates of defects contained in each 3D grid cell; The spatial locations corresponding to the number of three-dimensional grid units that are greater than or equal to a preset threshold are marked as suspected damaged areas.
6. The method according to claim 1, characterized in that, A mask is generated for the suspected damaged area. During image preprocessing, no processing is performed on the area covered by the mask to preserve the original pixels. Preprocessing is only performed on the non-masked areas, including: Based on the pixel positions of the suspected damaged areas in each image, a binary mask image is generated for each original image, where pixels with a mask value of 1 correspond to suspected damaged areas and pixels with a mask value of 0 correspond to non-suspected damaged areas. When performing preprocessing operations on the image, the binary mask image is read. For pixels with a mask value of 1, all preprocessing steps are skipped, and the pixel values of the original image are directly retained. For pixels with a mask value of 0, image processing is performed according to a preset preprocessing procedure. The preprocessing process includes: The image after selective preprocessing is transformed to the frequency domain using Fourier transform; Applying a high-pass filter in the frequency domain suppresses low-frequency background information in the image while preserving and enhancing high-frequency components that represent defect edges. The filtered frequency domain image is restored to the spatial domain through inverse Fourier transform to obtain a high-frequency enhanced image; The high-frequency enhanced image is weighted and fused with the original image to obtain the final input image used for fine detection.
7. The method according to claim 1, characterized in that, The preprocessed image and mask are input into the AI model, which outputs pixel-level defect segmentation results, including: The preprocessed RGB image and the corresponding binary mask image are concatenated along the channel dimension to form multi-channel input data; The multi-channel input data is input into a multi-scale attention network, which includes an encoder, a context aggregation module, and a decoder. The encoder performs multi-level feature extraction on multi-channel input data and uses a mask-guided attention mechanism on each level feature map to perform weighted fusion of the upsampled binary mask and the feature map to enhance the feature response of suspected damaged areas. The context aggregation module adopts a dilated spatial pyramid pooling structure and processes the feature map output by the encoder through dilated convolutions with different dilation rates to aggregate multi-scale context information. The decoder progressively upsamples the aggregated feature map and makes skip connections with the feature map of the corresponding level in the encoder, finally restoring the original image resolution and outputting a probability map of each pixel belonging to the defect category, i.e., the pixel-level defect segmentation result.
8. An AI-based container appearance inspection system, characterized in that, include: The image acquisition module is used to acquire multi-view images of the container and establish a mapping relationship between image pixel coordinates and world coordinates; The defect marking module is used to obtain the defect coordinates of each image, project the defect coordinates onto the 3D model to align the defect coordinates from different viewpoints, and mark suspected damaged areas based on the number of times the same location appears in multiple viewpoints. The preprocessing module is used to generate a mask for suspected damaged areas. When performing image preprocessing, no processing is done on the areas covered by the mask to preserve the original pixels, and only the non-masked areas are preprocessed. The defect segmentation module is used to input the preprocessed image and mask into the AI model, and the AI model outputs pixel-level defect segmentation results; The results fusion module is used to map multi-view segmentation results back to the 3D model, merge defects, and calculate physical properties.
9. An AI-based container appearance inspection device, characterized in that, include: Memory for storing AI-based container appearance inspection procedures; A processor is configured to implement the steps of the AI-based container appearance inspection method as described in any one of claims 1-7 when executing the AI-based container appearance inspection procedure.
10. A computer-readable medium storing a computer program, characterized in that, The readable medium stores an AI-based container appearance inspection program, which, when executed by a processor, implements the steps of the AI-based container appearance inspection method as described in any one of claims 1-7.