Computer vision-based intelligent container breakage detection method and system

CN122798822BActive Publication Date: 2026-11-03ZHEJIANG UNIV CITY COLLEGE +1
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202611282145.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-08-24
Publication Date
2026-11-03
Estimated Expiration
2046-08-24

AI Technical Summary

Technical Problem

Existing visual inspection methods for containers are susceptible to perspective distortion caused by the shooting angle when processing images with periodic wavy structures on the surface. The wavy features interfere with the identification of damaged areas, and the cost of high-precision manual annotation data is high, resulting in low detection accuracy.

Method used

A computer vision-based intelligent container damage detection system is adopted, including image acquisition, data preprocessing, spatial correction, frequency domain feature extraction, and detection and segmentation modules. It eliminates distortion through perspective transformation, separates ripple interference using frequency domain topological prior maps, and reduces annotation costs by combining a pseudo-mask generation module.

Benefits of technology

It improves the recall rate and pixel-level segmentation accuracy of damage detection, reduces the cost of manual annotation, enhances the system's fault tolerance in non-ideal environments, and adapts to complex industrial scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122798822B_ABST
    Figure CN122798822B_ABST
Patent Text Reader

Abstract

The present application relates to the field of image processing and computer vision, and discloses a container intelligent damage detection method and system based on computer vision, wherein the system acquires original images of containers and pre-processes them, and then preliminarily screens the images to be detected to perform spatial correction, triggers a degradation fallback mechanism to transmit images and output a state identifier when perspective transformation fails; extracts frequency domain features of the front view images, generates a phase deviation map and a frequency spectrum reliability weight map to construct a frequency domain topology priori map; splices the front view images with the priori map, dynamically weights the channel level features based on the above-mentioned state identifier, and outputs a bounding box and a prediction mask; and finally restores the coordinates to the original pixel coordinate system and generates a report. The present application uses frequency domain features to exclude complex ripple interference, guarantees the system fault tolerance rate under non-ideal working conditions through the degradation fallback mechanism, reduces the labeling cost by combining weak supervision training, and improves the detection and segmentation accuracy of the damaged area.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of image processing and computer vision technology, specifically to a method and system for intelligent container damage detection based on computer vision. Background Technology

[0002] The structural integrity of shipping containers is directly related to the safety of goods. In recent years, automated inspection technologies based on computer vision have been increasingly applied to container damage detection. Currently, intelligent container damage detection based on computer vision technology has become an important technological direction in port operation and maintenance and logistics management. Several related patents have been published, such as: a container damage detection method and system based on deep learning (CN119672445B); a container damage detection method, system, and equipment (CN120142313A); a container damage detection method based on machine vision and deep learning (CN115222697A); a container damage detection method based on an improved UPAD-YOLO (CN121074053B); and a container surface damage detection method and device based on machine vision (CN120525815A). These existing technologies have achieved automated container damage detection from the perspectives of algorithm model optimization, detection system construction, and multi-scenario defect recognition, providing a corresponding existing technological foundation for the improvement and iteration of technical solutions in this field.

[0003] In port or terminal operation scenarios, the installation location of image acquisition equipment is often limited and subject to angular deviations, resulting in perspective distortion in the captured container images. This geometric distortion alters the spatial scale of the image, affecting the accuracy of visual model feature extraction.

[0004] The surface of shipping containers exhibits a periodic corrugated structure. The texture and shadow features of these corrugations under different lighting conditions share spatial visual similarities with damage features such as dents or cracks. Existing object detection models primarily rely on spatial domain features for recognition, making it difficult to separate the normal corrugated background from the actual damaged area, thus easily leading to false detections due to corrugation interference. Furthermore, to achieve boundary segmentation of the damaged area, existing segmentation models typically require a large amount of pixel-level mask annotation data during the training phase. Due to the complex morphology and irregular edges of container damage, manually annotating these damaged images at the pixel level is extremely time-consuming and labor-intensive, making it difficult to obtain model training data and limiting the application of related detection systems in practical engineering. Summary of the Invention

[0005] To address the shortcomings of existing technologies, this invention provides a computer vision-based intelligent container damage detection system and method. It solves the problems of existing container visual inspection methods being susceptible to perspective distortion caused by the shooting angle when processing images with periodic wavy structures on the surface, making it difficult to extract wavy features; at the same time, wavy structure features can interfere with the identification of damaged areas, and obtaining high-precision manually labeled mask data for damaged areas is costly, resulting in low accuracy of damage detection and segmentation.

[0006] To address the above problems, the present invention provides the following technical solution: A first aspect of the present invention provides a computer vision-based intelligent container damage detection system, comprising: The system comprises the following modules: an image acquisition module for acquiring original images of the container; a data preprocessing module for preprocessing the original images and parsing target annotation files in a preset format to generate image data during the training phase; a binary classification screening module for filtering images to be inspected from the image data based on the probability of damage; a spatial correction module for performing perspective transformation on the images to be inspected and triggering a degradation backoff mechanism to transmit the image when the perspective transformation fails, outputting a front view image with status indicators and a perspective transformation matrix; a frequency domain feature extraction module for extracting frequency domain features from the front view image to generate a phase deviation map and a spectral reliability weight map, and generating a frequency domain topology prior map based on the phase deviation map and the spectral reliability weight map; a detection and segmentation module for stitching the front view image with the frequency domain topology prior map, and performing channel-level feature dynamic weighting based on the status indicators to output bounding boxes and prediction masks; a coordinate reconstruction module for restoring the contour points of the bounding boxes and the prediction masks to the pixel coordinate system of the original image based on the perspective transformation matrix; and a report generation module for generating a detection report based on the restored bounding boxes and the prediction mask.

[0007] Furthermore, the data preprocessing module is used for: A preset fixed input size is obtained, and the horizontal and vertical ratios of the preset fixed input size to the actual size of the original image are calculated. The smaller of the horizontal and vertical ratios is selected as the global scaling factor. Based on the global scaling factor, the original image is scaled proportionally, and the pixel difference between the preset fixed input size and the actual size of the scaled image is calculated. The pixel difference is evenly distributed to both sides of the scaled original image for edge pixel filling. Channel-level numerical normalization is performed on the original image after the edge pixel filling operation, and the image data is output.

[0008] Furthermore, the binary classification screening module is used for: The image data is subjected to feature extraction using an internally constructed backbone network to generate a deep feature map. Global average pooling is then performed on the deep feature map to convert it into an image-level feature vector. This image-level feature vector is input to a fully connected layer for mapping calculation to output the damage probability. A first and a second determination threshold are preset. When the damage probability is greater than or equal to the first determination threshold, or when the damage probability is less than the first determination threshold but greater than or equal to the second determination threshold, the image data meeting the determination criteria is selected as the image to be inspected.

[0009] Furthermore, the spatial correction module is used for: A set of line segments is extracted from the image to be inspected, and a reference point is determined by calculating the pixel intersection points of adjacent or intersecting line segments in the set of line segments. A rectangular boundary of orthogonal viewpoint is established, and the ideal standard point corresponding to the reference point is calculated based on the rectangular boundary. A coordinate mapping point pair is formed by the reference point and the ideal standard point. The perspective transformation matrix is ​​calculated using the coordinate mapping point pair, and the coordinates of the pixel nodes in the image to be inspected are substituted into the perspective transformation matrix to calculate and obtain new coordinates in the front view coordinate system. Pixel remapping is performed based on the new coordinates to generate the front view image. When the number of reference points is insufficient or the perspective transformation matrix solution fails, the degradation backoff mechanism is triggered, and the uncorrected image to be inspected is directly transmitted as the front view image, and a status flag representing the correction failure is generated simultaneously.

[0010] Furthermore, the frequency domain feature extraction module is used for: Spatial gradient calculation is performed on the front view image to obtain the local texture direction of the pixels, and the main direction of the ripple is determined based on the distribution statistics of the local texture direction. Multiple sampling cut-off lines perpendicular to the main direction of the ripple are constructed in the front view image, and gray values ​​are extracted pixel by pixel along the sampling cut-off lines to generate a one-dimensional pixel gray value sequence. Local signal segments are extracted from the one-dimensional pixel gray value sequence and short-time Fourier transform is performed to obtain the frequency domain features including local instantaneous phase, local amplitude response value, dominant frequency, amplitude spectrum, and phase spectrum. The phase deviation map and the spectral reliability weight map are generated based on the local instantaneous phase and the local amplitude response value in the frequency domain features, respectively, and the frequency domain topological prior map is generated based on the phase deviation map and the spectral reliability weight map.

[0011] Furthermore, the detection and segmentation module is used for: The system receives the front view image and the frequency domain topological prior map, and concatenates them along the color channel dimension to form a fused input tensor. It then extracts features from the fused input tensor using a built-in backbone network to output a multi-scale feature map. The multi-scale feature map is dynamically weighted at the channel level to generate a dynamically weighted multi-scale feature map. This dynamically weighted multi-scale feature map is input to a built-in detection head for processing, outputting the bounding box, damage category, confidence score, and mask coefficient matrix. Finally, a global prototype mask is generated using a built-in segmentation head, and the mask coefficient matrix is ​​linearly combined with the global prototype mask to output the predicted mask.

[0012] Furthermore, the aforementioned computer vision-based intelligent container damage detection system also includes a pseudo-mask generation module, which is used for: During the model training phase, weakly supervised training samples lacking artificial masks and corresponding manually labeled bounding boxes are acquired; low-level local features are extracted within the spatial range of the manually labeled bounding boxes, and topological response features are extracted from the frequency domain topological prior map; a binary pseudo-mask is generated based on the low-level local features and the topological response features; a joint loss function is constructed based on the manually labeled bounding boxes, the binary pseudo-mask, and the frequency domain topological prior map to update the model parameters of the detection and segmentation module during the training phase.

[0013] A second aspect of the present invention provides a computer vision-based intelligent container damage detection method, applied to any of the aforementioned computer vision-based intelligent container damage detection systems, the method comprising the following steps: The system acquires original images of the container using an image acquisition module; preprocesses the original images using a data preprocessing module, and parses target annotation files in a preset format during the training phase to generate image data; a binary classification screening module filters images to be inspected from the image data based on damage probability; a spatial correction module performs perspective transformation on the images to be inspected, and triggers a degradation backoff mechanism to transmit the image when the perspective transformation fails, outputting a front view image with status indicators and a perspective transformation matrix; a frequency domain feature extraction module extracts frequency domain features from the front view image to generate a phase deviation map and a spectral reliability weight map, and generates a frequency domain topology prior map based on the phase deviation map and the spectral reliability weight map; a detection and segmentation module stitches the front view image with the frequency domain topology prior map, and performs channel-level feature dynamic weighting based on the status indicators to output bounding boxes and prediction masks; a coordinate reconstruction module restores the contour points of the bounding boxes and the prediction masks to the pixel coordinate system of the original image based on the perspective transformation matrix; and a report generation module generates a detection report based on the restored bounding boxes and the prediction mask.

[0014] Further, the generation of a phase deviation map and a spectral reliability weight map, and the generation of a frequency domain topology prior map based on the phase deviation map and the spectral reliability weight map, includes: A reference phase spatial distribution model is constructed based on the main direction of the corrugations to obtain the theoretical reference phase; local instantaneous phase and local amplitude response values ​​are extracted from the frequency domain features; the difference between the local instantaneous phase and the theoretical reference phase is calculated point by point to generate the two-dimensional phase deviation map; the spectral reliability weight map is generated based on the local amplitude response values, and a spatial mask is obtained to distinguish the corrugated main area of ​​the container and the shielding area of ​​non-periodic components; in a unified two-dimensional image space, the deviation values ​​in the phase deviation map, the weight values ​​in the spectral reliability weight map, and the mask values ​​in the spatial mask are multiplied pixel by pixel to reconstruct the frequency domain topology prior map of the single-channel tensor structure.

[0015] Further, based on the perspective transformation matrix, the contour points of the bounding box and the predicted mask are restored to the pixel coordinate system of the original image, including: The perspective transformation matrix is ​​retrieved, and the inverse perspective transformation matrix is ​​derived using the inverse matrix algorithm; the two-dimensional coordinates of the contour points of the prediction mask and the corner points of the bounding box in the front view coordinate system are extracted; the two-dimensional coordinates are expanded into homogeneous coordinate form and then matrix multiplication is performed with the inverse perspective transformation matrix to calculate and obtain the actual two-dimensional coordinate data of the contour points and corner points of the prediction mask mapped in the pixel coordinate system of the original image.

[0016] The present invention also provides an electronic device comprising: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the computer vision-based intelligent container damage detection method.

[0017] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the aforementioned computer vision-based intelligent container damage detection method.

[0018] This invention provides a computer vision-based intelligent container damage detection system and method, which has the following beneficial effects: This invention performs perspective transformation on images through a spatial correction module to eliminate perspective distortion caused by differences in shooting angles and unify the spatial reference. At the same time, for working conditions where there is insufficient reference points due to severe damage or limited shooting angle, a degradation backoff mechanism and a linkage strategy of dynamic weighting of channel-level features are designed. When perspective transformation fails, the system transmits the uncorrected image with a status indicator to trigger the downstream module to dynamically adjust the channel feature weights, avoiding the problem of interruption of the overall detection process due to failure of pre-correction, and improving the fault tolerance of the system in non-ideal industrial environments.

[0019] This invention extracts frequency domain features from a front view image to generate a phase deviation map and a spectral reliability weight map, thereby constructing a frequency domain topological prior map and performing channel stitching with the original image features. It utilizes the periodic physical structure features of the container surface ripples to separate the structural distortion information caused by damage in the frequency domain space, and combines spatial masking to shield the background interference of non-periodic components, reducing the interference of complex ripple textures on the identification of damaged targets, thereby improving the recall rate and pixel-level segmentation accuracy of defect detection.

[0020] In the model training phase, this invention generates a binary pseudomask by extracting low-level local features and topological response features within the manually labeled bounding box, and constructs a joint loss function accordingly. It uses weak supervision signals at the bounding box level to guide the training of the pixel-level segmentation network, reducing the model training's dependence on high-precision manually labeled mask data. While maintaining segmentation accuracy, it reduces the human cost of data labeling, facilitating low-cost training and rapid iteration of industrial vision inspection models. Attached Figure Description

[0021] Figure 1 This is an architecture diagram of a computer vision-based intelligent container damage detection system according to an embodiment of the present invention. Figure 2 This is a flowchart of a computer vision-based intelligent container damage detection method according to an embodiment of the present invention; Figure 3 This is a flowchart of the perspective transformation matrix solution according to an embodiment of the present invention; Figure 4 This is a flowchart of the local frequency domain mapping process according to an embodiment of the present invention; Figure 5 This is a network structure topology diagram of the detection and segmentation module in an embodiment of the present invention; Figure 6 This is a flowchart illustrating the generation, training, and optimization of the bounding box constraint pseudomask according to an embodiment of the present invention. Figure 7 This is an example of image output (single problem) according to an embodiment of the present invention; Figure 8 This is an example of image output in an embodiment of the present invention (multiple issues); Figure 9 This is a precision-recall evaluation curve for an embodiment of the present invention; Figure 10 This is a precision-confidence evaluation curve for an embodiment of the present invention; Figure 11 This is a graph showing the F1 score-confidence assessment of an embodiment of the present invention. Figure 12 This is a graph showing the performance evaluation results of the classification model in an embodiment of the present invention; Figure 13 This is a screenshot of the running result log of the batch inference evaluation of the YOLOv8 object detection model in an embodiment of the present invention. Detailed Implementation

[0022] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0023] See Figure 1 This invention provides a computer vision-based intelligent container damage detection system, which includes: The image acquisition module is used to acquire raw images of the container; The data preprocessing module is used to preprocess the original images and parse the target annotation files in a preset format to generate image data during the training phase; The binary classification screening module is used to filter images to be inspected from image data based on the probability of damage. The spatial correction module is used to perform perspective transformation on the image to be inspected, and triggers a degradation backoff mechanism to transmit the image when the perspective transformation fails, outputting a front view image with status indicators and a perspective transformation matrix. The frequency domain feature extraction module is used to extract frequency domain features from the front view image to generate a phase deviation map and a spectral reliability weight map, and to generate a frequency domain topological prior map based on the phase deviation map and the spectral reliability weight map. The detection and segmentation module is used to stitch the front view image with the frequency domain topological prior image, and perform dynamic weighting of channel-level features based on state labels to output bounding boxes and prediction masks. The coordinate reconstruction module is used to restore the contour points of the bounding box and the prediction mask to the pixel coordinate system of the original image based on the perspective transformation matrix; The report generation module is used to generate an inspection report based on the restored bounding box and the predicted mask.

[0024] In an optional embodiment, the system further includes a pseudo-mask generation module, which is used for: During the model training phase, weakly supervised training samples lacking artificial masks and corresponding manually labeled bounding boxes are obtained. Extract low-level local features within the spatial range of manually annotated bounding boxes, and extract topological response features from the frequency domain topological prior map; Generate a binary pseudomask based on low-level local features and topological response features; A joint loss function is constructed based on manually labeled bounding boxes, binarized pseudomasks, and frequency domain topological prior graphs to update the model parameters of the detection and segmentation modules during the training phase.

[0025] See Figure 2 This invention provides a computer vision-based intelligent damage detection method for containers, comprising the following steps: S100, the image acquisition module acquires the original image of the container surface, and the data preprocessing module reads and parses the original image; during the model training phase, the data preprocessing module also reads and parses the corresponding target annotation file (such as, but not limited to, label data in YOLO, COCO or VOC formats) simultaneously. S200, after the data preprocessing module completes the preprocessing, it inputs the image data into the binary classification screening module. The binary classification screening module performs feature extraction and classification on the input image, filters out the images to be inspected that contain abnormal features and filters out images without abnormalities. S300, the spatial correction module acquires the filtered images to be inspected and performs geometric perspective transformation, projecting the container surface image with perspective view into a front view, eliminating the influence of the shooting angle on the geometric deformation of the corrugated plate periodic structure. S400, the frequency domain feature extraction module receives the front view image output by the spatial correction module, converts it to the frequency domain space, and uses a filter to separate the structural anomaly region of the ripple period to generate a frequency domain topological prior map. S500's detection and segmentation module simultaneously receives the front view image and the frequency domain topology prior map. In the network feature extraction layer, it fuses and calculates the RGB image features and frequency domain structural features, and outputs the bounding box of the damaged area and the initial mask prediction results. In the S600, during the model training phase, the pseudo-mask generation module receives the bounding boxes output by the detection and segmentation module, generates pseudo-masks based on the spatial range of the bounding boxes and a weakly supervised training strategy, and uses the pseudo-mask supervision network to update the model weights; during the model inference phase, the pseudo-mask generation and weight update steps are skipped. S700, the coordinate reconstruction module obtains the detection and segmentation coordinate matrix output by the network, and restores the bounding box vertices and mask contour points in the front view coordinate system to the pixel coordinate system of the original image based on the inverse matrix of the perspective transformation in step S300. S800, the coordinate reconstruction module overlays and displays the restored coordinate data on the original image. The output parameters include damage type, confidence value, bounding box coordinates, mask area, contour node set and corresponding damage area. The S900 report generation module receives output parameters, calculates the error index between the network prediction data and the labeled true value during the model validation stage, and summarizes various detection data and renders a visualization image during the model inference stage to generate the final automated damage assessment report.

[0026] In this embodiment, due to the inherent geometric periodic structure on the surface of the container, the image acquisition module needs to acquire high-quality image data to support subsequent algorithm logic in order to accurately capture the structural anomalies of the corrugated plate. The specific process of image acquisition in step S100 is as follows.

[0027] Before image acquisition, the image acquisition module receives an external trigger signal and completes device initialization. Preferably, the image acquisition module is configured as a fixed industrial area scan camera or a camera terminal mounted on a mobile device platform. The fixed industrial area scan camera is positioned on both sides of the container inspection channel or in the gantry crane operating area, while the mobile device platform includes a drone or a handheld inspection terminal. The external hardware trigger source, photoelectric sensor placement, and interface communication protocol for the camera can be conventionally selected and configured based on the layout of the actual work site, and will not be elaborated further here.

[0028] After initialization, the image acquisition module captures raw images of the container surface area in RGB color image data format. Considering that some damage (e.g., minor rust or small holes) is relatively small in actual space, insufficient image spatial resolution can lead to target feature information being overwhelmed by background noise after multiple downsampling operations by the neural network. Therefore, the spatial resolution of the raw image needs to be constrained during the image acquisition stage. Specifically, the lens focal length and shooting distance of the image acquisition module are configured based on the maximum downsampling step size of the backbone feature extraction network in the network model. This ensures that the minimum pixel size occupied by the target damage in the raw image is greater than the maximum downsampling step size. This configuration logic allows even small damaged areas to retain at least one feature pixel on the underlying feature map.

[0029] After a single exposure and photoelectric data conversion, the image acquisition module encapsulates the acquired raw image into a matrix data stream. The dimensions of this matrix data stream are uniformly formatted as follows: ,in This represents the pixel height in the vertical direction of the image. Represents the pixel width in the horizontal direction of the image. This indicates the number of color channels; for an RGB color image, the number of channels is set to 3. Subsequently, the image acquisition module transmits the raw image in matrix data stream mode to the storage node where the data preprocessing module resides, awaiting parsing.

[0030] In this embodiment, image data acquired by different hardware devices typically have different underlying encoding and channel characteristics. To ensure the consistency of the data distribution input to the network model, the data preprocessing module performs format conversion on the acquired raw images. This processing flow specifically includes the following steps.

[0031] S121, the data preprocessing module extracts the raw image in matrix data stream state from the storage node. In real-world operating environments where various acquisition devices are deployed in combination, the color channel arrangement order of their output images often differs. As a preferred approach, the data preprocessing module parses the header metadata of the raw image to extract the number of channels, channel arrangement attributes, and bit depth information of the current raw image, thereby providing parameter basis for subsequent structural alignment operations.

[0032] S122, based on the extracted metadata, the data preprocessing module performs color space alignment. Specifically, when the original image is detected as a single-channel grayscale image, the data preprocessing module expands it into a three-channel data matrix by matrix dimension copying; when the color order of the original image is in BGR format, the data preprocessing module performs channel matrix reversal rearrangement on the image data. Converting all types of acquired image data to the standard RGB color space reduces the probability of data dimension misalignment caused by differences in hardware interface settings, ensuring that the channel distribution characteristics of the preprocessed image match the model's preset input structure.

[0033] S123, based on this, the data preprocessing module further converts the numerical data type of the original image. Most raw images output by conventional devices are stored in 8-bit unsigned integer format. To adapt to the data processing requirements of the tensor computation framework, the data preprocessing module converts the integer pixel matrix into a 32-bit floating-point data tensor. Simultaneously, the data preprocessing module changes the dimensional arrangement of the aforementioned tensor from... The mode was adjusted to Pattern. The underlying memory allocation and type mapping logic involved in converting integer multidimensional arrays into floating-point tensors can be conventionally configured by those skilled in the art based on existing deep learning frameworks. The underlying conversion mechanism is a well-known technology in this field and will not be elaborated upon here.

[0034] In this embodiment, in order to meet the training requirements of the binary classification screening module (i.e., the ResNet model), the data preprocessing module needs to parse and augment the labeled data, specifically including the following steps: S131, convert the YOLO format to the ResNet general format and extract valid categories. The data preprocessing module reads the YOLO format detection annotation file corresponding to the original image and parses the bounding boxes and category data. Based on whether the current image contains valid damage annotation instances, it extracts and converts them into binary classification image-level labels (normal or abnormal categories) suitable for ResNet model training.

[0035] S132, adding random noise and perturbations. To improve the model's generalization ability in complex container environments, the data preprocessing module performs data augmentation operations on the input image before inputting the processed data into the training model. These operations include introducing random Gaussian noise, simulating illumination changes, and random geometric perturbations.

[0036] S133, Constructing the ResNet model training task and validation mechanism. The data preprocessing module packages the augmented data and feeds it into the constructed binary ResNet training model architecture for forward computation. Simultaneously, the system configures a validation monitoring mechanism in the training workflow (e.g., plotting the confusion matrix and outputting the loss and accuracy changes of the training set), providing monitoring methods for the network's backpropagation, error investigation, and final convergence and solidification of model parameters in subsequent steps (see step S234).

[0037] In this embodiment, before the data preprocessing module transmits data to the binary classification screening module (i.e., proceeds to step S200), in order to meet the requirements of the subsequent neural network for the dimension of the input data and reduce the impact of external illumination changes on the distribution of image pixel values, the data preprocessing module also needs to perform spatial size adjustment and numerical normalization processing on the original image after format conversion. This seamless preprocessing process specifically includes the following steps.

[0038] S211, the data preprocessing module performs a proportional scaling operation on the original image. Forced stretching and scaling can easily cause geometric distortion of the corrugated structure and potential damage boundaries on the container surface. To reduce such deformation, the data preprocessing module obtains a pre-set fixed input dimension for the model (setting the target width as...). The target altitude is (For example, it can be set to 224×224 pixels), and the fixed input size is calculated to be the same as the actual width of the original image. and actual height The ratio. As a preferred approach, the data preprocessing module selects the smaller of the ratios in the horizontal and vertical directions as the global scaling factor. The formula for calculating the global scaling factor is: ; In the formula, Indicates the global scaling factor. The target width; For target height; This is the actual width; This refers to the actual height.

[0039] Based on this global scaling factor, the data preprocessing module can combine bilinear interpolation algorithm to perform pixel mapping on the horizontal and vertical dimensions of the image to the same extent, so as to maintain the initial aspect ratio of the image.

[0040] S212, since the dimensions of some parts of the proportionally scaled image may be smaller than the fixed input size, the data preprocessing module needs to further perform pixel filling operations on the image edges. Specifically, the data preprocessing module calculates the pixel difference between the fixed input size and the actual size of the scaled image, and evenly distributes this pixel difference to both sides of the image for center alignment. For uncovered blank boundary areas, the data preprocessing module fills them with fixed background pixel values ​​(e.g., constants 114 or 128), thus expanding the overall image size to the set value. Input dimension format. This strategy of proportional scaling combined with boundary padding helps to preserve the actual shape of the damaged target while ensuring that the data dimensions meet the input requirements of subsequent models.

[0041] S213, To eliminate data distribution differences caused by varying illumination under different acquisition environments, the data preprocessing module performs channel-level numerical normalization on the filled and aligned image. This step uses the standard deviation normalization method to independently calculate the values ​​for each color channel of the image, making the pixel values ​​approximate a standard normal distribution. The formula for channel normalization is as follows: ; in, Indicates the number of digits after normalization. A tensor of pixel values ​​for each color channel; Indicates the first digit before normalization. A tensor of pixel values ​​for each color channel; Indicates the index number of the color channel; Indicates the first The pixel mean of each color channel on the training dataset; Indicates the first The standard deviation of pixels for each color channel on the training dataset. As one implementation, and The data is obtained by performing statistical calculations on the sample set before model training and used as a fixed parameter during the inference deployment phase. After the above processing steps, the data preprocessing module completes the standardization construction of the underlying image data, and then outputs it to the binary classification screening module for subsequent feature extraction.

[0042] In this embodiment, the binary classification screening module receives the standardized image tensor output by the data preprocessing module and performs feature extraction on the tensor using the internally constructed ResNet-50 backbone network. The feature extraction process specifically includes the following steps.

[0043] S221, the binary classification initial screening module inputs the received standardized image tensor into the initial computation layer of the backbone network. Preferably, this tensor is downsampled and computed sequentially through a 7×7 convolutional layer and a 3×3 max-pooling layer. By performing preliminary spatial compression on the input data, this initial stage generates a shallow feature map characterizing the basic texture and edge contours of the container surface.

[0044] In step S222, based on the generated shallow feature maps, the binary classification screening module uses multiple residual stages (containing four consecutive stages) connected in series within the backbone network to perform layer-by-layer abstract mapping of the data. To avoid gradient decay when the network deepens, the aforementioned residual stages are constructed by stacking multiple residual blocks. In the data flow of a single residual block, in addition to the convolutional mapping path containing multiple layers of parameter weights, a jump connection path spanning the aforementioned convolutional layers is also connected in parallel. During computation, the model adds the feature tensor input to the residual block element-wise with the residual mapping tensor output through the convolutional path, and then uses a non-linear activation function to generate the output feature tensor. The weight parameters within the backbone network are updated during the training phase based on the aforementioned generated image-level labels through backpropagation. The specific channel allocation rules within the residual blocks can be conventionally configured based on the standard ResNet-50 network architecture by those skilled in the art, and will not be elaborated here.

[0045] S223, after continuous transmission through multiple residual stages, the binary classification initial screening module outputs a deep feature map for the current input image. Combined with the input data dimension set in the aforementioned embodiments (e.g., 3×224×224), this deep feature map, after downsampling through network layers, has a spatial data dimension of 2048×7×7. Here, 2048 represents the number of feature channels, and 7 represents the pixel grid size of the deep feature map in the horizontal and vertical directions. This deep feature map integrates the multi-level structural features of the container surface and is used as intermediate result data input to subsequent network nodes to support classification probability inference.

[0046] In this embodiment, after acquiring the deep feature map, the binary classification initial screening module needs to compress and map its spatial data to calculate the probability value of whether the current input image is damaged. Combining the model's training and inference process, this initial screening and parameter update process specifically includes the following steps.

[0047] S231, the binary classification initial screening module performs global average pooling on the deep feature map. To reduce the number of model parameters and lower the risk of overfitting, this embodiment uses a global average pooling layer to independently calculate the average value of the pixel grid for each feature channel of the deep feature map. The formula for global average pooling is as follows: ; in, Represents image-level feature vectors The Middle The eigenvalues ​​of each feature channel; Indicates the index number of the feature channel; and These represent the height and width dimensions of the deep feature map, respectively. Represents the row index of the deep feature map. Column index representing the deep feature map; The deep feature map is represented in the th... The spatial coordinates in each feature channel are The feature value at the location. After pooling calculation, the binary classification screening module converts the deep feature map into an image-level feature vector with a length equal to the total number of feature channels. .

[0048] S232, in obtaining image-level feature vectors Subsequently, the binary classification initial screening module combines a linear classification layer with an activation function to calculate the classification result. As a preferred approach, the binary classification initial screening module uses image-level feature vectors... The input is mapped to a fully connected layer, and the predicted probability of the input image belonging to a damaged positive sample is output through a normalized exponential function. The calculation formula is as follows: ; in, This represents the probability of breakage, and its value ranges from 0 to 1. This represents the normalized exponential function; This represents the weight matrix of the fully connected layer; This represents the aforementioned generated image-level feature vector; This represents the bias vector of the fully connected layer.

[0049] S233, During the reasoning phase, the binary classification initial screening module uses the calculated damage probability as a basis. Perform a sorting operation on the image to be inspected. As a basic implementation, a single classification threshold can be preset (e.g., a value of 0.5). When the probability of damage... When the probability of damage is greater than or equal to the classification threshold, the binary classification initial screening module determines that the current input image contains a damaged area and identifies it as a positive sample image. To ensure the accuracy of subsequent geometric correction and segmentation, the system retrieves the high-resolution formatted data of the image before scaling and downsampling (i.e., the high-resolution image matrix aligned to the standard RGB color space output in step S122) and outputs this high-resolution image to the subsequent module for anomaly localization. Conversely, when the probability of damage is lower than or equal to the classification threshold, the system retrieves the high-resolution formatted data of the image before scaling and downsampling (i.e., the high-resolution image matrix aligned to the standard RGB color space output in step S122) and outputs this high-resolution image to the subsequent module for anomaly localization. When the image size is below the classification threshold, the binary classification initial screening module determines that the current input image is undamaged, directly outputs a normal status, and terminates the subsequent processing of that image. This diversion mechanism helps to intercept undamaged background images, reducing computational resource consumption.

[0050] S234, During the training phase, the binary classification initial screening module iteratively updates the parameters of the fully connected layers and the backbone network. Specifically, the binary classification initial screening module obtains the image-level labels generated by the data preprocessing module. And calculate the probability of damage output from the forward calculation. With image-level tags The classification loss value is calculated by substituting the values ​​into the binary cross-entropy loss function. Then, the weight matrix is ​​updated incrementally using the backpropagation algorithm and optimizer. Bias vector The parameters within the backbone network are also processed until the model converges on the training set. Through this training process, the binary classification initial screening module completes the mapping relationship between feature maps and classification states.

[0051] In this embodiment, considering the complex surface environment of the container, slight deformation, stains, or light and shadow and other interference factors can easily lead to an increase in the probability of damage output by the model. The image is in an uncertain range. To reduce the false negative rate of minor damage, as an alternative optimized embodiment to the aforementioned single-threshold determination mechanism, the binary classification screening module can also construct a suspected sample bypass mechanism based on dual thresholds to perform image splitting. When the system adopts this dual-threshold mechanism, it will replace the single-threshold splitting step in S233 above. The specific execution flow of this bypass mechanism includes the following steps.

[0052] S241, the binary classification screening module pre-configures a first judgment threshold and a second judgment threshold for dividing the image into intervals. As a preferred embodiment, the first judgment threshold is set to a value range of 0.6 to 0.8, and the second judgment threshold is set to a value range of 0.2 to 0.4. Those skilled in the art can calibrate the specific threshold constants mentioned above based on historical statistical data from the field and the tolerance for false negatives in actual business operations.

[0053] S242, Obtain the damage probability of the current input image. Then, the binary classification screening module compares it with the aforementioned judgment threshold. When the probability of damage... When the value is greater than or equal to the first judgment threshold, the binary classification initial screening module determines that the current input image is suspected of being damaged and identifies it as a positive sample image. For such images, the binary classification initial screening module maintains the normal data flow and inputs them into the subsequent detection and segmentation network for anomaly localization and category determination.

[0054] S243, when the probability of breakage When the image value is less than the first judgment threshold but greater than or equal to the second judgment threshold, the binary classification initial screening module determines that the current input image belongs to the suspected sample image. For suspected sample images within this probability interval, the binary classification initial screening module triggers a bypass routing strategy. As one implementation, the binary classification initial screening module also inputs the suspected sample image into the subsequent detection and segmentation network for secondary calculation and confirmation; as another optional implementation, the binary classification initial screening module pushes the suspected sample image to the manual review queue and prompts the user on the terminal interface for confirmation by business personnel.

[0055] S244, when the probability of breakage... When the image size is below the second threshold, the binary classification screening module determines that the current input image is likely undamaged and identifies it as a negative sample image. For such images, the binary classification screening module directly outputs a normal state result indicating that the container surface is undamaged, and intercepts the data transmission of this image to the subsequent detection and segmentation network. Through the above interval division, this interception mechanism filters out a large number of normal background images while maintaining detection accuracy, thereby reducing the system's computational resource consumption.

[0056] In this embodiment, for the data to be inspected that has been determined as positive or suspected sample images by the binary classification screening module, the surface of the container in the image usually exhibits a certain degree of perspective distortion due to the limited shooting angle of the on-site camera. To reduce the spatial position deviation caused by this distortion in subsequent local damage location, the spatial correction module needs to extract the geometric reference of the image in advance. The positioning process specifically includes the following steps.

[0057] S311, the spatial correction module acquires the input image to be processed (i.e., the high-resolution formatted image transmitted by the preceding screening module) and extracts its basic geometric features. As a standardized logistics carrier, the container surface contains inherent geometric features such as corner pieces, edge lines, and corrugated plate outlines. These features can be directly used as a reference for spatial distortion correction. As a preferred approach, the spatial correction module uses an edge detection algorithm combined with a line detection algorithm to extract a set of line segments representing the container frame and the main body of the container surface. The configuration of underlying visual operators such as the Canny edge operator and Hough transform can be implemented by those skilled in the art based on standard machine vision libraries; these are well-known technologies in the field and will not be elaborated upon here.

[0058] S312, based on the acquired set of line segments, the spatial correction module determines initial candidate points by calculating the pixel intersections of adjacent or intersecting line segments. Considering background interference on the container surface, the extracted initial candidate points are prone to containing redundant information from non-target areas. Therefore, the spatial correction module introduces a priori geometric model of the container to perform geometric consistency filtering on the aforementioned initial candidate points. In specific implementation, an angle deviation tolerance can be preset (e.g., a value range of -5° to 5°). Combining the rectangular contour constraints of the container standard and the angle constraints of the corrugated plate parallelism, the spatial correction module retains intersection points that meet the angle deviation tolerance and removes free points that deviate from the topology of the main area of ​​the container surface.

[0059] S313, after the geometric consistency filtering described above, the spatial correction module establishes the retained nodes as reference points, forming a set of reference points. Each reference point in this set records its horizontal and vertical coordinates in the two-dimensional pixel coordinate system of the current input image. The aforementioned determined reference points mark the positions of the container corner fittings, the intersections of edge lines, and the boundary vertices of the main body area of ​​the container surface, providing positional constraints for the subsequent calculation of spatial transformation parameters.

[0060] S314, to ensure the completeness of the spatial transformation matrix solution logic, the spatial correction module performs a validity check on the total number of reference points. Since calculating the homography transformation matrix of an image requires at least 4 pairs of non-collinear matching points, when the total number is greater than or equal to 4, the spatial correction module confirms the validity of the extracted reference points and outputs them to subsequent calculation steps. Conversely, if the container surface is obstructed or affected by lighting, resulting in incomplete feature extraction and a total number less than 4, the spatial correction module determines that the current image is difficult to calculate the perspective transformation matrix using conventional geometric features. In this case, the system triggers an exception handling mechanism, suspending the conventional perspective transformation matrix solution process and entering the subsequent weak correction and system rollback operation logic. This verification step helps avoid algorithm calculation stalls caused by insufficient feature points.

[0061] See Figure 3 In this embodiment, following the aforementioned feature point count verification results, when the number of obtained reference points meets the calculation requirements, the spatial correction module needs to calculate spatial mapping parameters to eliminate perspective distortion of the image. The perspective transformation matrix solution process specifically includes the following steps.

[0062] S321, after constructing the target plane coordinate system, the spatial correction module establishes ideal standard points for mapping comparison. To restore the true geometric proportions of the container, the spatial correction module sets a rectangular boundary with an orthogonal perspective based on the inherent length-to-width ratio constant of the standard container. Based on this rectangular boundary, the spatial correction module calculates the theoretical two-dimensional coordinates of each reference point under the orthogonal perspective, thereby generating ideal standard points. Thus, each extracted reference point establishes a spatial mapping relationship with an ideal standard point, forming a coordinate mapping point pair.

[0063] In step S322, combining the coordinate mapping point pairs obtained above, the spatial correction module calculates the perspective transformation matrix to achieve homogeneous coordinate projection between two-dimensional planes. Specifically, this perspective transformation matrix is ​​a 3×3 matrix with 8 degrees of freedom. To solve for the mapping parameters within this matrix, the spatial correction module employs numerical optimization algorithms such as direct linear transformation or least squares method, using the aforementioned coordinate mapping point pairs to calculate the matrix element with the smallest fitting error. To address the possibility that approximately collinear feature points might lead to singular matrix solutions, the system includes a fallback mechanism. If the matrix solution fails, the spatial correction module determines that the conventional perspective correction operation has failed, at which point it terminates the current transformation matrix solution process and triggers subsequent weak correction logic (see step S330 for details). For the specific derivation of the numerical optimization algorithm for solving the perspective transformation matrix, those skilled in the art can refer to standard computer vision theory, which is well-known in the field and will not be elaborated upon here.

[0064] In step S323, after obtaining the perspective transformation matrix, the spatial correction module performs global pixel remapping on the input image. As a preferred method, the spatial correction module substitutes the coordinates of all pixel nodes in the input image into the perspective transformation model to calculate their new coordinates in the target plane coordinate system. Considering that the new coordinate values ​​after mapping are mostly non-integer, the spatial correction module uses an image interpolation algorithm to assign pixel values ​​of color channels to the new coordinate nodes. During this process, a bilinear interpolation algorithm is used for resampling calculations. After pixel-by-pixel mapping and interpolation operations, the spatial correction module outputs a corrected image with orthogonal perspective. This corrected image eliminates the tilt and perspective scaling effects caused by the camera's shooting angle, making the container surface appear visually flat and unfolded, thus providing a structural basis for the subsequent detection and segmentation network to maintain the consistency of the damage feature scale.

[0065] Existing image correction methods (such as conventional perspective transformations that rely solely on point alignment) typically require ideal visual conditions. When applied to real container handling environments, due to environmental interference such as partial occlusion, overexposure, or camera defocus, the system often struggles to obtain a sufficient number of evenly distributed reference points, leading to interruptions or outright failure of the spatial correction process.

[0066] To address the limitations of the aforementioned single rigid correction strategy, this embodiment not only performs the conventional perspective correction but also further configures a step-by-step dimensionality reduction weak correction and a system backoff mechanism. This mechanism establishes adaptive linkage with the channel attention mechanism of the downstream detection network through data pass-through with attached state identifiers. This dynamically adjusts feature weights when front-end feature extraction is hindered, avoiding secondary distortion caused by forced geometric intervention and ensuring the continuity of data flow and the robustness of overall detection under extreme conditions.

[0067] The specific execution process of this degradation handling mechanism includes the following steps: S331, when the number of extracted reference points is less than 4 pairs, or the reprojection error when calculating the perspective transformation matrix based on the reference points exceeds a preset pixel tolerance, the spatial correction module determines that the current perspective transformation matrix solution has failed, thereby triggering weak correction logic. As a preferred approach, the preset pixel tolerance can be set to a range of 3 to 5 pixels, which can be conventionally calibrated according to the image resolution by those skilled in the art. After triggering the weak correction logic, the reference for feature alignment is converted from discrete point coordinates to continuous line segment direction features.

[0068] In step S332, after entering the weak correction stage, the spatial correction module uses the parallel texture attributes of the corrugated plate on the container surface or the edge lines of the container's outer frame for feature estimation. Specifically, the spatial correction module calls the line detection operator to extract a set of parallel line segments from the image and calculates the dominant tilt angle of these line segments. Based on this dominant tilt angle, the spatial correction module constructs an affine transformation matrix containing planar rotation and two-dimensional translation parameters, using it as the weak correction matrix. This matrix is ​​then used to align the input image through two-dimensional plane rotation and translation. This processing method, through limited angle compensation, corrects the tilt and deflection of the container surface to a certain extent, maintaining the parallelism of the local corrugated texture.

[0069] S333. If the visual environment is highly interfering, the ripple contour or edge lines may fail to be extracted, or the angle distribution of the extracted line segments may be scattered (e.g., the angle variance is greater than the preset angle distribution threshold), resulting in the weak correction matrix also failing to be calculated effectively. In such cases, the spatial correction module performs a system rollback operation. As a fallback strategy, the spatial correction module does not perform spatial geometric intervention on the current input image, but instead directly transmits the input image with its original distortion to the downstream detection and segmentation network. This operation ensures the continuity of data flow and avoids secondary image distortion caused by erroneous calculations.

[0070] S334. Typically, uncorrected images transmitted through the network still retain perspective distortion, and their surface textures tend to exhibit non-uniform frequency variations in spatial distribution. To reduce the interference of such distortions on subsequent feature extraction, when a backoff operation is triggered, the spatial correction module simultaneously generates a status flag indicating correction failure and appends it to the data header of the transmitted image. Upon receiving the uncorrected image and its corresponding frequency domain topological prior map, the downstream detection and segmentation network, due to the high dispersion of frequency domain features caused by distortion, adaptively reduces the weight coefficient of the frequency domain topological prior features in the comprehensive decision-making process using its internally configured channel attention mechanism (see subsequent step S530), while relatively increasing the proportion of local appearance texture features. Through data-driven dynamic weight allocation, the system can increase its tolerance to structural distortion to a certain extent, maintaining the stability of the overall detection process.

[0071] In this embodiment, the main body of the container surface is typically composed of a corrugated plate with a periodic undulating structure. To extract the topological regularity of this structure in the frequency domain, the frequency domain feature extraction module needs to pre-determine the arrangement direction of the corrugations, i.e., the main direction of the corrugations. The estimation process specifically includes the following steps: S411, the frequency domain feature extraction module acquires the pre-processed input image and calculates its spatial gradient. Regardless of whether the current input image is a corrected image after perspective transformation or an uncorrected image transmitted through a backtracking mechanism, the structural edges of the corrugated plate exhibit grayscale differences in pixel brightness. As a preferred approach, the frequency domain feature extraction module calls gradient operators to calculate the differential response values ​​of each pixel node in the horizontal and vertical directions, thereby obtaining the local texture direction and gradient magnitude of each pixel. The configuration of basic gradient operators such as the Sobel or Scharr operators can be implemented by those skilled in the art based on standard digital image processing specifications; these are well-known technologies in the field and will not be elaborated upon here.

[0072] S412, after obtaining the local texture direction, the frequency domain feature extraction module performs statistical analysis on the gradient distribution information within the image. Specifically, the frequency domain feature extraction module constructs a gradient direction histogram with angle as the horizontal axis. This histogram divides the angle space from 0 to 180° into multiple equally wide angle intervals. As a preferred approach, the width of the angle interval can be set to 3° to 5°, a range that ensures the accuracy of direction estimation while also considering the tolerance for local noise. In the statistical calculation, the frequency domain feature extraction module uses the gradient magnitude of each pixel as a weight and accumulates it within the angle interval to which its local texture direction belongs. Due to the parallel consistency of the container corrugated plate structure, the gradient directions of most effective edge pixels will be concentrated within a specific interval, thus forming a numerical peak on the histogram.

[0073] S413, based on the aforementioned gradient direction histogram, the frequency domain feature extraction module searches for and locates the main peak with the largest accumulated weight, and extracts the center angle of the interval where the main peak is located. Since the image gradient direction is usually perpendicular to the edge extension direction, the frequency domain feature extraction module orthogonally offsets this center angle by 90°, establishing the offset angle as the initial main ripple direction. Considering that the container surface is easily affected by factors such as stains or paint peeling in real-world scenarios, resulting in scattered local texture directions, the frequency domain feature extraction module further extracts the edge line direction of the outer frame of the container surface as a global constraint benchmark, and performs weighted smoothing processing on the initial main ripple direction. In specific implementation, if the main peak of the histogram is prominent, the frequency domain feature extraction module assigns a higher calculation weight to the initial main ripple direction (for example, a weight value of 0.7 to 0.8). If the accumulated weight of the main peak of the histogram is lower than the preset peak threshold, or if there are multiple peaks with similar heights, the frequency domain feature extraction module determines that the current gradient-based local texture direction is unreliable. To avoid algorithmic dead zones, the frequency domain feature extraction module directly uses the edge line direction of the aforementioned outer frame as the final main ripple direction.

[0074] S414, after weighted smoothing correction or logical judgment, the frequency domain feature extraction module outputs the final main direction of the corrugations. This main direction of the corrugations represents the actual extension direction of the corrugated plate groove ridge in the current image, which provides a spatial angle reference basis for the subsequent construction of one-dimensional sampling cut-off lines.

[0075] See Figure 4 In this embodiment, since the corrugated sheet on the surface of the container normally exhibits a continuous periodic undulating structure, its local periodic regularity is often disrupted when dents or structural damage occur. To quantify such structural changes, the frequency domain feature extraction module performs local frequency domain mapping on the image region, converting the pixel signals in space into frequency domain features to assist in identifying abnormal regions. This mapping process specifically includes the following steps: S421, the frequency domain feature extraction module constructs multiple sampling cutoff lines perpendicular to the main corrugation direction within the corrugated plate region of the input image, based on the main corrugation direction determined in the previous step. As a preferred method, to meet the spatial feature extraction coverage requirements, the interval between the sampling cutoff lines can be set to 1 to 2 pixels. Subsequently, the frequency domain feature extraction module extracts grayscale values ​​pixel-by-pixel along each sampling cutoff line, thereby generating the corresponding one-dimensional pixel grayscale sequence. Through this spatial sampling operation, the system effectively converts the corrugated cross-sectional contour in the two-dimensional image into a one-dimensional spatial signal.

[0076] S422, after acquiring multiple one-dimensional pixel grayscale sequences, to address the limitation of global frequency domain transformation in capturing the precise location of local structural abrupt changes, the frequency domain feature extraction module performs short-time Fourier transforms on the aforementioned sequences respectively. Specifically, the frequency domain feature extraction module introduces a sliding window along the one-dimensional pixel grayscale sequence, uses this window to extract local signal segments, and performs discrete Fourier transforms on each segment, thus balancing the computational needs of spatial positioning and frequency domain analysis.

[0077] In practical applications, the length of the sliding window can be configured based on the standard pixel width of the container corrugations, for example, covering 1.5 to 2 complete corrugation cycles. Combined with the spatial resolution calibrated by the subsequent system, its specific value range can be set to 128 to 256 pixels. Furthermore, a pixel overlap rate of 50% to 75% is set between adjacent sliding windows to ensure the continuity of spatial signal extraction. To reduce spectral leakage caused by signal truncation, the system uses a Hanning window or Hamming window as the sliding window function to weight the truncated signal segments. For the specific algorithm derivation and code call of the short-time Fourier transform, those skilled in the art can refer to standard digital signal processing specifications for implementation; this is well-known technology in the field and will not be elaborated upon here.

[0078] S423, Based on the above transformation results, the frequency domain feature extraction module further extracts frequency domain feature components within the local sliding window. These components specifically include the amplitude spectrum, phase spectrum, and local dominant frequency. In specific processing, the frequency domain feature extraction module calculates the complex modulus of each local frequency domain transformation result to generate an amplitude spectrum, used to characterize the physical intensity of local ripple fluctuations; simultaneously, it calculates the complex phase angle to generate a phase spectrum, used to record the spatial relative position of the ripple structure. Based on this, the frequency domain feature extraction module searches for the maximum response peak within the amplitude spectrum and extracts the frequency corresponding to that peak as the local dominant frequency.

[0079] S424. In areas without anomalies on the container surface, the numerical distribution of the aforementioned frequency domain features typically remains stable; however, in damaged or deformed areas, the local dominant frequencies and phase spectra are prone to numerical shifts. To adapt to the data input dimension of downstream algorithm modules, the frequency domain feature extraction module stitches together the local dominant frequencies, amplitude spectra, and phase spectra corresponding to each sampling cutoff line according to the physical arrangement order of the sampling cutoff lines in the original image, combining them to generate a two-dimensional feature tensor that matches the spatial dimension of the input image, and using it as the frequency domain topological prior feature. Finally, this frequency domain topological prior feature is output to subsequent processing nodes, providing an independent reference based on structural periodicity for determining the location of damage on the container surface.

[0080] In this embodiment, the corrugated sheet of a container typically exhibits a quasi-periodic structure in space. Due to limitations such as local surface deformation, residual viewpoint distortion, or image noise interference in real-world applications, the calculated local dominant frequencies are prone to numerical fluctuations. To accurately measure the severity of local structural damage, the frequency domain feature extraction module needs to construct a corrugated baseline model representing an ideal, undamaged state as a global benchmark. Therefore, the frequency domain feature extraction module extracts the global dominant frequency and reference phase of the corrugation within a candidate frequency range. This process specifically includes the following steps.

[0081] S431, the frequency domain feature extraction module pre-calibrates a candidate frequency range to characterize effective corrugation features based on the standard structural dimensions of the container corrugated sheet and the current camera's imaging spatial resolution. Specifically, using the standard container corrugation period (e.g., 150mm to 300mm) as a benchmark, combined with the camera's calibration resolution (e.g., 2mm / pixel), technicians can calculate the pixel span corresponding to a single corrugation period in the image. As a preferred approach, the frequency domain feature extraction module takes the reciprocal of the aforementioned pixel span and directly uses it as the upper and lower limits of the candidate frequency range. This defined range not only filters out low-frequency background interference caused by gradual changes in illumination but also eliminates random high-frequency noise generated by surface dirt or sensors, enabling the system to focus on the true topological features.

[0082] S432, within the defined candidate frequency range, the frequency domain feature extraction module further calculates the global dominant frequency of the ripple structure. Considering that other structured interference may still remain in the frequency domain data, to avoid deviations in dominant frequency calculation caused by direct fusion of global data, the frequency domain feature extraction module integrates the amplitude spectrum information of each local sliding window, accumulates the amplitude responses corresponding to the same frequency nodes, and searches for the node with the largest peak of the accumulated amplitude response within the candidate frequency range. To prevent the algorithm from encountering logical dead zones in flat regions, the system introduces a ripple confidence threshold for judgment. If the accumulated amplitude corresponding to the largest peak is lower than the ripple confidence threshold, the frequency domain feature extraction module determines that the region where the current sampling cutoff line is located does not have obvious ripple periodic characteristics and actively stops the dominant frequency calculation of the current cutoff line; otherwise, the frequency domain feature extraction module extracts the frequency domain data of the largest peak node and its preset neighborhood, and uses a weighted average algorithm to determine the global dominant frequency. In the specific calculation, the frequency domain feature extraction module uses the accumulated amplitude response in the aforementioned neighborhood as weights to perform weighted summation on the corresponding discrete frequency nodes. The resulting global main frequency smooths out the discretization error and more accurately reflects the overall topological period of the corrugated plate from the current perspective.

[0083] S433, after obtaining the global dominant frequency, the frequency domain feature extraction module estimates the reference phase of the ripple structure in spatial distribution. In an ideal lossless ripple state, its phase value typically exhibits a linear increasing or decreasing trend with the extension of spatial coordinates. However, the original phase output by the short-time Fourier transform is often truncated within the dominant value interval, resulting in a sawtooth-like jump phenomenon in space. To address this issue, the frequency domain feature extraction module extracts the phase values ​​corresponding to the global dominant frequency from the actual phase sequence distributed along the sampling cutoff line and performs a one-dimensional phase unwrapping operation. Specifically, the system detects the phase difference between adjacent sampling points. When the absolute value of this difference is greater than pi, phase compensation is performed by adding or subtracting an integer period of the corresponding multiple, restoring the truncated dominant phase to a continuous absolute phase sequence. After unwrapping, the frequency domain feature extraction module uses the least squares method to linearly fit the above continuous absolute phase sequence, constructing a reference phase spatial distribution model. The model uses the relative pixel coordinates along the sampling intercept direction as the independent variable and the angular frequency determined by the global dominant frequency as the fitting slope to obtain the initial phase constant, thereby establishing a linear functional relationship between the reference phase and the spatial coordinates.

[0084] S434, after the calculation process is completed, the frequency domain feature extraction module outputs the aforementioned global dominant frequency and reference phase spatial distribution model. In downstream processing nodes, the system compares the actual frequency and unwrapped actual phase obtained from local observations with the aforementioned global dominant frequency and reference phase. When the actual feature value deviates from the reference model beyond the set tolerance range, it can be quantitatively determined that the corrugated structure at the corresponding location has undergone deformation such as depression, bulge, or breakage. This evaluation mechanism provides a topological geometric reference independent of pixel grayscale for subsequent detection networks.

[0085] In this embodiment, when the corrugated plate on the container surface deforms, its local phase deviates from the ideal periodic variation pattern. To represent this deviation, the frequency domain feature extraction module generates a two-dimensional phase deviation map by calculating the difference between the local instantaneous phase and the reference phase. The construction process specifically includes the following steps: S441, the frequency domain feature extraction module acquires the local instantaneous phase extracted from the corrugated region. This local instantaneous phase is the continuous absolute phase sequence obtained after the one-dimensional phase unwrapping operation in the previous step. Simultaneously, the frequency domain feature extraction module retrieves the constructed reference phase spatial distribution model, which reflects the phase evolution law of the container surface under undeformed conditions. By performing spatial coordinate alignment, the frequency domain feature extraction module provides a unified reference benchmark for subsequent difference calculations.

[0086] S442, after establishing the reference benchmark, the frequency domain feature extraction module calculates the difference between the local instantaneous phase and the corresponding reference phase point by point. Specifically, the frequency domain feature extraction module uses the local instantaneous phase under the same spatial coordinates to subtract the theoretical reference phase calculated by the reference phase spatial distribution model, obtaining the phase deviation at that coordinate. Considering the calculation effectiveness in flat regions, if the sampling intercept to which the current coordinate belongs is determined to lack obvious ripple periodic characteristics, the frequency domain feature extraction module directly sets the phase deviation of the corresponding region to zero to avoid logical dead zones. Through the above algebraic subtraction operation, the frequency domain feature extraction module removes the inherent periodic background of the ripple structure and retains the phase distortion data related to surface deformation.

[0087] S443, after acquiring the phase deviations distributed along each sampling cutoff line, the frequency domain feature extraction module maps them back to the two-dimensional image space. During this process, the frequency domain feature extraction module stitches and reassembles the phase deviations row by row or column by column according to the spatial arrangement of each sampling cutoff line in the input image, thus forming a two-dimensional data array. Since grid-like numerical abrupt changes are easily generated during image acquisition and discretization calculations, as a preferred method, the frequency domain feature extraction module uses a median filter or a Gaussian filter to perform spatial smoothing processing on the two-dimensional data array. The window size of the smoothing filter can be configured as 3×3 or 5×5 pixels depending on the actual imaging noise level, in order to eliminate isolated noise nodes while preserving the edge contours of deformed areas.

[0088] After spatial smoothing (S444), the frequency domain feature extraction module performs linear normalization on the two-dimensional data array to generate a phase deviation map. Specifically, the module uses a minimax normalization algorithm to map the phase deviation values ​​to a standard grayscale range of 0 to 255. In the generated phase deviation map, areas with pixel values ​​close to the background grayscale median typically correspond to areas with normal corrugation structures, while bright or dark areas deviating from the background grayscale median correspond to geometrically deformed areas on the container surface. Subsequently, the frequency domain feature extraction module outputs this phase deviation map to downstream processing nodes, providing data reference for subsequent evaluation of the container structure's integrity.

[0089] In this embodiment, in addition to the corrugated sheet, the container surface often includes non-periodic structures such as locking bars and nameplates, and the corrugation imaging in different areas is easily affected by ambient light, resulting in differences in clarity. To reduce the interference of non-corrugated features on deformation determination, the frequency domain feature extraction module combines spectral reliability, the main area of ​​the container surface, and the shielding area of ​​non-periodic components to reconstruct the aforementioned phase deviation map, thereby generating a frequency domain topology prior map. This reconstruction process specifically includes the following steps: S451, the frequency domain feature extraction module calculates the spectral reliability of each local region. In actual imaging, differences in the clarity of local ripples often affect the effectiveness of phase calculation. To quantify this impact, the frequency domain feature extraction module retrieves the amplitude spectrum extracted in the previous step and extracts the amplitude response value of each local sliding window at the global dominant frequency. After obtaining this response value, the frequency domain feature extraction module uses a minimax normalization algorithm to linearly scale the amplitude response value, thereby generating a spectral reliability weight map with values ​​ranging from 0 to 1. In this weight map, the closer the value is to 1, the clearer the ripple periodicity of the corresponding region is usually, and the higher the reference value of the corresponding phase deviation.

[0090] S452, considering that aperiodic structures are prone to causing computational interference, the frequency domain feature extraction module acquires a spatial mask to distinguish different structural units of the container. This spatial mask predefines the regional attributes of the container surface. Specifically, the main body area of ​​the container surface containing continuous corrugations is divided into the effective analysis area, and its mask value is set to 1; at the same time, areas such as locking rods, door hinges, ventilation holes, and label lettering that do not have corrugation periodic characteristics are divided into aperiodic component shielding areas, and their mask values ​​are set to 0. As a preferred approach, introducing the above spatial mask helps to reduce invalid anomalous signals induced by aperiodic components in frequency domain calculations.

[0091] S453, after acquiring the aforementioned feature data, the frequency domain feature extraction module fuses the phase deviation map, the spectral reliability weight map, and the spatial mask. In specific implementation, the frequency domain feature extraction module performs pixel-by-pixel multiplication within a unified two-dimensional image space. That is, for any pixel coordinate in the image, its deviation value in the phase deviation map, the corresponding reliability weight in the spectral reliability weight map, and the corresponding mask value in the spatial mask are multiplied together to obtain the reconstructed topological feature value for that coordinate. Through this fusion calculation method, the mask value can be used to set the features of the non-periodic component shielding area to zero, and the reliability weight can be used to numerically attenuate the phase deviation in low-resolution areas.

[0092] In step S454, after completing the pixel-by-pixel fusion operation, the frequency domain feature extraction module outputs the reconstructed frequency domain topology prior map. At this point, the frequency domain topology prior map primarily retains the confidence-weighted spatial deformation data within the main container surface area. To adapt to the data specifications of the subsequent dual-branch network algorithm, the frequency domain feature extraction module maintains the single-channel tensor structure of this frequency domain topology prior map. Finally, this frequency domain topology prior map and the original input image are synchronously transmitted to the downstream processing node, providing a structural periodic-based reference constraint for subsequently locating the damage location on the container surface and assessing the degree of deformation.

[0093] See Figure 5In this embodiment, the detection and segmentation module employs a single-stage instance segmentation network framework to perform the detection and fine-grained segmentation of damaged areas. The process specifically includes the following steps: S510, Input Image Feature Extraction and Multimodal Data Fusion. To match the network's fixed input size, the detection and segmentation module first performs synchronous bilinear interpolation resampling on the received frontal view image (RGB format) and the frequency domain topology prior image generated by the preceding reconstruction, uniformly adjusting their spatial resolution to 640×640 pixels. Subsequently, the detection and segmentation module synchronously receives the above data and performs data fusion in the network's initial feature extraction layer.

[0094] In practice, the module concatenates the (3×640×640) front view matrix and the (1×640×640) frequency domain topological prior map matrix along the color channel dimension, forming a fused input tensor of dimension (4×640×640). Next, the network backbone, using a CSPDarknet structure, extracts features from the fused tensor through continuous convolutions and cross-stage local connections, outputting multi-scale feature maps (specifically P3, P4, and P5 scale features) containing appearance texture and topological deformation information. Here, P3, P4, and P5 represent three different scale feature maps output by the backbone network.

[0095] S520, channel-level dynamic feature weighting. To address feature interference caused by spatial correction failure, the detection and segmentation module introduces a channel attention mechanism after deep feature mapping in the backbone network. Specifically, the network performs global average pooling on the extracted feature maps and calculates the dynamic weight coefficients of each feature channel through a multilayer perceptron. Especially when receiving an uncorrected image that triggers the pre-order backoff mechanism, the channel attention mechanism can identify abstract feature channels containing high noise generated by scattered topological prior data mapping, and adaptively decay the weight coefficients of these invalid channels, while relatively increasing the weights of feature channels representing effective RGB appearance texture, thereby effectively avoiding false detections caused by local distortions.

[0096] S530, Feature Aggregation and Bounding Box Output. The multi-scale feature maps are then input into the neck network. The neck network uses a PAN-FPN (Path Aggregation Feature Pyramid Network) structure to perform bidirectional feature fusion from top to bottom and bottom to top, outputting enhanced multi-scale feature maps (N3, N4, N5), where N3, N4, and N5 represent the three scale feature maps enhanced by the neck network. Subsequently, the enhanced multi-scale features are fed into the detection head. In this embodiment, the detection head uses an anchor-free mechanism, directly outputting the bounding box of the target damage (including the x-coordinate of the center point, the y-coordinate of the center point, the width w of the bounding box, and the height h of the bounding box) and the class probability of its category.

[0097] S540, Prototype Mask Generation and Instance Segmentation. While outputting bounding boxes, the network's segmentation head receives features to generate masks. The segmentation head utilizes a ProtoNet branch to output a set of low-resolution global prototype masks. Finally, the network performs mask synthesis, linearly combining the mask coefficient matrix output from the detection branch with the aforementioned prototype masks to output a high-precision final instance segmentation result.

[0098] It should be noted that, in order to enable the detection and segmentation module to have the high-precision inference capabilities described in S510 to S540, the system needs to train the multimodal fusion detection and segmentation model using historical data before the model is officially put into inference.

[0099] Before the S550 model is officially deployed for inference, the system needs to train the multimodal fusion detection and segmentation model using historical data. Training samples are derived from historically collected container sample images and synchronously generated frequency domain topology prior maps. Label data consists of manually pre-annotated ground truth bounding boxes, category labels, and ground truth segmentation masks. During training iterations, the system calculates the error between the network's predictions and the ground truth labels using a total loss function. This total loss function comprises classification loss, bounding box regression loss, and segmentation cross-entropy loss. Based on the total loss, the model updates its internal network weights using a backpropagation algorithm until the network converges, and then the parameters are fixed for online detection.

[0100] See Figure 6In this embodiment, obtaining a large number of damaged mask samples with pixel-level fine annotations requires significant manual effort, while obtaining samples with only target bounding box annotations is relatively easy. To improve the model's generalization ability by utilizing historical data with different annotation accuracies, the pseudo-mask generation module designs a weakly supervised learning mechanism based on bounding box constraints. This process specifically includes the following steps, and strictly distinguishes between the model's training and inference phases in its processing logic.

[0101] In S610, during the model training phase, the pseudo-mask generation module acquires the training sample set input to the model and splits each sample according to the level of detail of the labels. During the determination process, if the current training sample has a manually labeled pixel-level mask, the pseudo-mask generation module classifies it as a strongly supervised sample and directly uses this manually labeled mask as the ground truth label to supervise the training and updating of the network's segmentation branch. If the current training sample only has manually labeled target bounding boxes but lacks a pixel-level mask, the pseudo-mask generation module classifies it as a weakly supervised sample and triggers subsequent pseudo-mask generation operations.

[0102] S620, for weakly supervised samples, the pseudo-mask generation module uses the known target bounding box as a spatial constraint range to automatically generate a pseudo-mask within the box region to replace manual annotation. Specifically, the pseudo-mask generation module extracts various low-level features within the local region defined by the bounding box. For example, it extracts color anomaly features by calculating the difference between local pixels and the median grayscale value of the background within the box; it extracts edge gradient features using conventional edge operators; and it extracts texture difference features based on the gray-level co-occurrence matrix. Simultaneously, the pseudo-mask generation module retrieves the topological response features of this region from the previously generated frequency domain topological prior map.

[0103] To integrate the aforementioned multi-dimensional information, the pseudo-mask generation module linearly normalizes all feature values ​​to the range of 0 to 1, and performs a weighted summation of color anomaly features, edge gradient features, texture difference features, and topological response features to calculate the pseudo-mask response score for each pixel within the bounding box that belongs to the damaged region. As a preferred approach, the fusion weights of each feature can be pre-configured, and the sum of the weights is limited to 1. After obtaining the response scores, the pseudo-mask generation module uses Otsu's method to calculate an adaptive response score threshold. To avoid the entire bounding box area being damaged, causing Otsu's method to fail, if the variance of the features within the bounding box is detected to be below a preset lower limit, the system directly uses the entire bounding box area as a coarse mask; otherwise, the pseudo-mask generation module classifies pixels with scores higher than the threshold as damaged regions and generates a binarized pseudo-mask. The generated pseudo-mask is treated as a weakly supervised label in subsequent processes and participates in the error calculation of the segmentation branches.

[0104] In step S630, after obtaining the artificial mask for strongly supervised samples and the pseudo mask for weakly supervised samples, the pseudo mask generation module constructs a joint loss function to guide the overall update of the neural network weights. This joint loss function comprehensively considers the errors in target localization, contour segmentation, and feature alignment, and is composed of the detection loss, segmentation loss, and topology consistency loss with introduced hyperparameter coefficients. Specifically, the detection loss is used to evaluate the errors in bounding box regression and classification; the segmentation loss is composed of the cross-entropy loss calculated between the artificial mask or pseudo mask and the output of the network segmentation branch; and the topology consistency loss guides the model to learn the actual deformed contour by calculating the mean square error between the predicted mask region and the high-response region of the frequency domain topological prior map. Based on this joint loss function, the model iteratively updates the weight parameters within the network using the backpropagation algorithm until the total joint loss function converges.

[0105] After training optimization and model parameter solidification are completed in S640, the system enters the inference phase for application deployment. During inference, the pseudo-mask generation module no longer relies on label data and the aforementioned pseudo-mask generation and error calculation processes are suspended. The input image, after preprocessing, is directly propagated forward within the network structure. Based on the multi-scale feature extraction capabilities accumulated during training, the network's segmentation head branch directly outputs a predicted mask containing the two-dimensional contours of the damaged area. This mechanism preserves the model's pixel-level segmentation accuracy while avoiding the introduction of additional image processing computational overhead during actual inference.

[0106] In this embodiment, because a perspective transformation operation was performed on the original image during preprocessing, both the damaged bounding box and the prediction mask output by the neural network are located in the corrected image coordinate system. To accurately locate the damaged area and perform geometric quantization evaluation on the image from the original viewpoint, the coordinate reconstruction module restores the detection results to the original image coordinate system. This process specifically includes the following steps: S710, the coordinate reconstruction module obtains the perspective transformation matrix generated in the preceding spatial correction stage and calculates its inverse. Specifically, in earlier image preprocessing nodes, based on reference feature points on the container surface, calculate the perspective transformation matrix used to eliminate shooting distortion. The coordinate reconstruction module retrieves this matrix data. If it detects that a previous system rollback operation was triggered without spatial correction, it directly sets the perspective transformation matrix as the identity matrix (or skips the inverse mapping step). If normal or weak perspective correction was performed previously, it uses a conventional matrix inversion algorithm to derive the corresponding inverse perspective transformation matrix, which is then used as the calculation parameter for subsequent coordinate inverse transformation.

[0107] S720, after obtaining the inverse perspective transformation matrix, the coordinate reconstruction module maps the broken bounding box, prediction mask, and related edge contour points in the corrected image coordinate system back to the original image coordinate system. In specific implementations, for the edge contour points of the prediction mask or the corner points of the broken bounding box, the coordinate reconstruction module extracts the two-dimensional coordinates of each point in the corrected image coordinate system and expands them to homogeneous coordinate form. Then, it performs a matrix multiplication operation with the inverse perspective transformation matrix. After the operation, by dividing the first two terms of the matrix product by the scaling factor in the result, the actual two-dimensional coordinates of the mapped point in the original image coordinate system can be obtained. Through the above point-by-point calculation mechanism, the coordinate reconstruction module can complete the spatial inverse mapping of the prediction results.

[0108] S730, after completing the coordinate system transformation, the coordinate reconstruction module calculates the damaged area based on the binarized prediction mask in the original image coordinate system. As a preferred method, the coordinate reconstruction module counts the total number of pixels within the prediction mask in the original image coordinate system that are identified as damaged. Combining this with the pre-calibrated spatial resolution coefficient of the camera system, i.e., the actual geometric area corresponding to a single pixel, the coordinate reconstruction module converts the total number of pixels into the actual damaged area value. For the calculation logic of camera calibration and pixel spatial equivalent derivation, those skilled in the art can refer to existing machine vision calibration models, which are well-known technologies in the field and will not be elaborated upon here.

[0109] After the parameter restoration is completed, the coordinate reconstruction module packages and visualizes the final data. S810, based on the aforementioned data mapping and geometric calculations, the coordinate reconstruction module generates a detection result consistent with the perspective of the original image acquired on-site. This detection result uses the original image as a base map, overlaying the mapped damage bounding box and predicted mask contour at the corresponding pixel locations, and includes damage category labels and calculated damage area values. Finally, the coordinate reconstruction module outputs the detection result to downstream display terminals or business systems, providing data support for container condition assessment.

[0110] In this embodiment, corresponding to the aforementioned step S900, in order to transform the detection data generated in the previous stage into a basis for easy intuitive understanding and repair damage assessment, the system enters the report generation and output stage. The report generation module is responsible for summarizing and evaluating various data, and its specific implementation can be divided into the encapsulation and rendering of detection results (steps S910 to S950) and model performance evaluation and damage assessment report output (steps S960 to S990).

[0111] S910, the report generation module receives the detection and calculation data transmitted by the preceding module and performs status verification. Specifically, the report generation module checks whether there are any detected damage instances in the current image. If the list of detected instances is empty, the report generation module directly outputs the original image containing the normal status identifier as the result to avoid processing anomalies. If a damage instance is detected, the report generation module extracts its corresponding attribute data for each independent target in the image. As a preferred approach, the aforementioned attribute data specifically includes: the predicted damage category, the confidence score representing the reliability of the prediction, the bounding box coordinate parameters restored to the original image coordinate system, the pixel-level binarized segmentation mask, the two-dimensional contour point set corresponding to the mask edge, and the damage area value obtained through the preceding calculation.

[0112] After acquiring the attribute data, the report generation module (S920) encapsulates the detection indicators across various dimensions into structured data. During implementation, the module associates and binds the identification number, category, confidence level, bounding box parameters, contour point set coordinate array, and damaged area value for each damage instance, generating a standardized text format file. This text format file can use Extensible Markup Language (XML) or Lightweight Data Interchange (LDLI) format. This structured processing provides a machine-readable data foundation for downstream database archiving and automated damage assessment system parsing.

[0113] In S930, while generating structured data, the report generation module uses a graphics rendering algorithm to generate a single-object detection visualization image (often referred to as a single-issue output image in specific business applications). For the verification of local defects, the report generation module uses the center of the bounding box of the current single damaged instance as a reference and performs local cropping of the original input image according to a preset expansion ratio. On the acquired local base image, the report generation module overlays the bounding box corresponding to the instance with a semi-transparent segmentation mask, and adds text annotation information containing the category, confidence level, and damaged area to the blank areas of the image, thereby facilitating detailed confirmation of single defects by reviewers.

[0114] Figure 7This paper illustrates an example of the detection result output of the intelligent container damage detection system based on computer vision according to the present invention. After performing target detection on the acquired container sidewall image, the system automatically identifies the existing damaged areas and locates the detected targets using a green rectangle. The text displayed above the rectangle includes two parts: detection category and confidence level. "dent" indicates that the damage type identified by the model is a dent; the number 0.502 indicates that the confidence level of the detection result is 0.502, meaning that the model considers the target to be a dent defect with a confidence level of approximately 50.2%. The green rectangle represents the spatial location and detection range of the damaged target, and its coordinate information can be further used to calculate the geometric parameters of the damaged target, such as center coordinates, area, width, and height. In addition to outputting visual detection results, the system can also simultaneously generate structured data such as damage category, location coordinates, bounding box dimensions, and area, providing data support for container damage assessment, defect management, and maintenance decisions.

[0115] S940, to provide an overall overview of the container surface's condition, the report generation module further generates a multi-object detection visualization image (i.e., a multi-problem output image). During this image generation process, the report generation module uses the complete original input image as a background map and simultaneously overlays and renders the bounding boxes and segmentation masks of all detected damage instances on the current container surface. To improve the identification of different damage types, the report generation module assigns corresponding display colors to different damage categories based on a pre-configured color mapping dictionary and summarizes and displays the statistical quantity and total area of ​​each type of damage in the image's edge areas.

[0116] Figure 8This diagram illustrates an example of the batch detection result output of the intelligent container damage detection system based on computer vision according to the present invention. The diagram shows the visualization result after the target detection model completes inference on multiple container images. Each sub-image corresponds to one container image to be detected, and the number in the upper left corner is the image name. The system first preprocesses the input images and then inputs them into the trained target detection model for feature extraction and defect identification. For identified damaged targets, the system marks their location with a blue rectangle, and the area covered by the rectangle represents the spatial range of the corresponding defect. The number displayed above the rectangle indicates the detection category number. In this embodiment, the number "0" corresponds to a predefined type of damage (e.g., dents, cracks, etc., the specific category is determined by the category label mapping relationship of the training dataset). If the system sets multiple damage categories, different category numbers are displayed accordingly. The position of each rectangle is determined by the coordinates of its upper left corner, width, and height. Further calculations can be made to obtain the geometric information such as the center coordinates, bounding box area, and dimensions of the defect target, serving as the data basis for subsequent quantitative defect analysis. When multiple damaged targets exist in the same image, the system can generate multiple detection boxes simultaneously, enabling the synchronous identification and localization of multiple defective targets. For images where no defects are detected, no detection boxes are generated or only the background result is output. Different sub-images in the figure contain detection results under different shooting angles, lighting conditions, container colors, and background environments, indicating that the target detection model adopted in this invention can automatically identify and locate damaged container targets in complex application scenarios, and output structured detection results such as corresponding categories, locations, and geometric parameters.

[0117] S950, after completing the above data encapsulation and image rendering, the report generation module packages the aforementioned standardized text format files, single-question output images, and multi-question output images into a unified package and outputs them to the display terminal or business server of the container management system. For the image local transparency overlay and blending rendering and the network data packet encapsulation and transmission protocol, those skilled in the art can refer to existing computer graphics and data communication standards, which are well-known technologies in the field and will not be elaborated upon here.

[0118] In S960, the report generation module determines the current operational stage of the system and accordingly decides whether to initiate the performance indicator calculation logic. During the verification or testing phase of model building, the input sample data typically includes manually labeled real data. At this stage, the report generation module extracts the model's forward propagation prediction results along with the aforementioned real labels, triggering subsequent model quantification and evaluation calculations. If the current stage is the actual business deployment in-situ inference phase, since the input images do not have corresponding real labels, the report generation module skips the evaluation indicator calculation step and directly executes the damage assessment report generation logic, thus avoiding the algorithm falling into a logical dead zone due to missing ground truth data.

[0119] In S970, during the validation or testing phase, the report generation module quantitatively evaluates the model's target classification and localization capabilities. For classification performance, the module calculates accuracy, precision, recall, and the F1 score, and constructs a confusion matrix to show the misclassification distribution among different damage categories. For target bounding box localization performance, the module calculates the Intersection over Union (IoU) by comparing the intersection and union of the predicted and actual bounding box areas. Based on this data, the module further calculates the average precision (AP) for each category and summarizes the overall average precision (mAP@0.5) when the IoU threshold is fixed at 0.5, as well as the overall average precision (mAP@0.5:0.95) when the IoU threshold increases between 0.5 and 0.95.

[0120] S980, after acquiring the basic detection metrics, the report generation module simultaneously calculates segmentation metrics for pixel-level deformed regions and efficiency metrics reflecting deployment and operation costs. For the segmentation metrics, the report generation module calculates the Mask IoU (intersection over union), mean IoU (mIoU), and Dice coefficient between the predicted and ground masks. As a preferred approach, the Dice coefficient is calculated by multiplying the number of pixels at the intersection of the predicted mask pixel set output by the model and the manually labeled ground mask pixel set by 2, and then dividing by the sum of the total number of pixels contained within both sets. The calculated Dice coefficient value is between 0 and 1; the closer the value is to 1, the higher the spatial overlap between the predicted result and the actual situation. For the system efficiency metrics, the report generation module calculates the system's frames per second (FPS), the average forward inference time per image, and the number of model parameters reflecting the network size. For the specific calculation logic of the above conventional statistical evaluation metrics, those skilled in the art can refer to existing deep learning model evaluation standards, which are well-known technologies in the field and will not be elaborated upon here.

[0121] To provide an intuitive benchmark for model performance evaluation, the S990 report generation module generates multiple sets of evaluation curves and charts using the calculated evaluation metrics.

[0122] For specific implementation, please refer to Figure 9 The report generation module plots a precision-recall curve to illustrate the relationship between precision and recall. In actual test data, the system independently mapped three types of defects: dent, hole, and rust. The generated PR curves show that when the cross-union threshold is set to 0.5, the average precision (mAP@0.5) for all categories meets the baseline requirement, effectively validating the model's ability to detect multi-morphological defects on container surfaces.

[0123] See Figure 10 and Figure 11 The report generation module sets a confidence threshold that slides between 0 and 1, and plots precision-confidence curves and F1 score-confidence curves with this confidence level as the x-axis. The precision-confidence curves show that as the confidence threshold increases, the model's prediction accuracy for each defect category (especially dents and holes) steadily rises. The F1 score-confidence curves show that the F1 scores for each category reach their peak within a specific confidence range, comprehensively reflecting the optimal balance between precision and recall. By consulting these graphs, technical personnel can select appropriate confidence thresholds in actual business deployments to adapt to different automated loss assessment standards.

[0124] During the on-site reasoning phase without labeled truth values, the report generation module aggregates various business data generated by the preceding modules to produce an automated damage assessment and inspection report. This report structurally integrates the damage category of each detected target, its location information in the original image coordinate system, the calculated actual damage area, and the corresponding predicted confidence level. Furthermore, the report embeds the single-problem output graph and multi-problem output graph generated in the aforementioned process. Finally, the report generation module pushes the inspection report to the business management terminal device, providing data support for container status verification, maintenance plan formulation, and automatic billing operations.

[0125] For detailed model evaluation results, please refer to [link / reference]. Figure 12 and Figure 13 , Figure 12 This is a screenshot of the evaluation results log of a custom ResNet50 image classification model, which fully presents the performance statistics of the classification model on the test dataset, including evaluation metrics such as category information, accuracy, true / predicted category distribution, and inference speed. Figure 13 This is a screenshot of the log of the batch inference evaluation of the YOLOv8 object detection model. It fully records the entire output of the model's detection evaluation on the test image set, including core performance indicators such as detection rate, inference speed, and category distribution.

Claims

1. A computer vision-based intelligent container damage detection system, characterized in that, include: The image acquisition module is used to acquire raw images of the container; The data preprocessing module is used to preprocess the original image to generate image data; The binary classification screening module is used to screen images to be inspected from the image data based on the probability of damage. The spatial correction module is used to perform perspective transformation on the image to be inspected, and trigger a degradation backoff mechanism to transmit the image when the perspective transformation fails, and output a front view image with status indicators and a perspective transformation matrix. The frequency domain feature extraction module is used to extract the frequency domain features of the front view image to generate a phase deviation map and a spectral reliability weight map, and to generate a frequency domain topology prior map based on the phase deviation map and the spectral reliability weight map. Specifically, the frequency domain feature extraction module is used for: Spatial gradient calculation is performed on the front view image to obtain the local texture direction of the pixels, and the main direction of the ripple is determined based on the distribution statistics of the local texture direction; Multiple sampling cut-off lines perpendicular to the main direction of the ripples are constructed within the front view image, and gray values ​​are extracted pixel by pixel along the sampling cut-off lines to generate a one-dimensional pixel gray value sequence. A local signal segment is extracted from the one-dimensional pixel grayscale sequence and a short-time Fourier transform is performed to obtain the frequency domain features including local instantaneous phase, local amplitude response value, dominant frequency, amplitude spectrum and phase spectrum; The phase deviation map and the spectral reliability weight map are generated based on the local instantaneous phase and the local amplitude response value in the frequency domain features, respectively, and the frequency domain topology prior map is generated based on the phase deviation map and the spectral reliability weight map; The detection and segmentation module is used to stitch the front view image with the frequency domain topological prior image, and perform dynamic weighting of channel-level features based on the state identifier to output bounding boxes and prediction masks. Specifically, the detection and segmentation module is used for: Receive the front view image and the frequency domain topology prior map, and stitch the front view image and the frequency domain topology prior map together in the color channel dimension to form a fused input tensor; The fused input tensor is used to extract features through a built-in backbone network to output a multi-scale feature map. The multi-scale feature map is dynamically weighted at the channel level to generate a multi-scale feature map after dynamic weighting at the channel level. The multi-scale feature map, which is dynamically weighted by the channel-level features, is input into the built-in detection head for processing, and the bounding box, damage category, confidence value and mask coefficient matrix are output. A global prototype mask is generated by a built-in segmentation head, and the mask coefficient matrix is ​​linearly combined with the global prototype mask to output the predicted mask. The coordinate reconstruction module is used to restore the contour points of the bounding box and the prediction mask to the pixel coordinate system of the original image based on the perspective transformation matrix.

2. The intelligent container damage detection system based on computer vision according to claim 1, characterized in that, It also includes a report generation module for generating a detection report based on the restored bounding box and the prediction mask.

3. The intelligent container damage detection system based on computer vision according to claim 1, characterized in that, The binary classification screening module is used for: The image data is subjected to feature extraction using an internally constructed backbone network to generate a deep feature map, and a global average pooling operation is performed on the deep feature map to convert the deep feature map into an image-level feature vector. The image-level feature vector is input into a fully connected layer for mapping calculation to output the damage probability; At least one judgment threshold is preset. When the probability of damage is greater than or equal to the lowest judgment threshold, the corresponding image data is selected as the image to be inspected.

4. The intelligent container damage detection system based on computer vision according to claim 1, characterized in that, The space correction module is used for: Perform perspective transformation correction on the image to be inspected to obtain a front view image; When the perspective transformation correction cannot be completed due to insufficient reference points or matrix solution failure, a downgrade rollback mechanism is triggered, and the uncorrected image to be inspected is directly transmitted as the front view image, while a status indicator representing the correction failure is generated simultaneously.

5. The intelligent container damage detection system based on computer vision according to claim 1, characterized in that, It also includes a pseudo-mask generation module, used for: Obtain weakly supervised training samples and their corresponding manually annotated bounding boxes; Extract low-level local features within the spatial range of the manually annotated bounding box, and extract topological response features from the frequency domain topological prior map; A binary pseudomask is generated based on the underlying local features and the topological response features; A joint loss function is constructed based on the manually labeled bounding box, the binarized pseudomask, and the frequency domain topological prior graph to update the model parameters of the detection and segmentation module.

6. A computer vision-based intelligent damage detection method for containers, characterized in that, The method applied to the computer vision-based intelligent container damage detection system according to any one of claims 1 to 5 includes: Obtain the original image of the container; Preprocess the original image to generate image data; Images to be inspected are selected from the image data based on the probability of damage. The image to be inspected is subjected to perspective transformation, and a degradation backoff mechanism is triggered when the perspective transformation fails to transmit the image, and a front view image with status label and perspective transformation matrix are output. Frequency domain features of the front view image are extracted to generate a phase deviation map and a spectral reliability weight map, and a frequency domain topology prior map is generated based on the phase deviation map and the spectral reliability weight map. The front view image is stitched together with the frequency domain topological prior image, and channel-level features are dynamically weighted based on the state identifier to output the bounding box and prediction mask. Based on the perspective transformation matrix, the contour points of the bounding box and the prediction mask are restored to the pixel coordinate system of the original image.

7. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the computer vision-based intelligent container damage detection method as described in claim 6.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the intelligent container damage detection method based on computer vision as described in claim 6.

Citation Information

Patent Citations

  • Container damage detection method based on machine vision and deep learning

    CN115222697A

  • A container damage detection method and system based on deep learning

    CN119672445B

  • Container damage detection method, container damage detection system and container damage detection equipment

    CN120142313A

  • Container surface damage detection method and device based on machine vision

    CN120525815A

  • An Improved UPAD-YOLO-Based Method for Container Damage Detection

    CN121074053B