A container damage information detection and counting method based on yolov9 and DeepSort
By combining the yolov9 and DeepSort algorithms, combined with ESRGAN and RT-DETR networks, efficient and accurate container damage detection is achieved, solving the problems of low detection efficiency and insufficient accuracy in the existing technology, saving human resources and improving detection accuracy.
Patent Information
- Application Number
- CN202411749113.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2044-12-02
AI Technical Summary
The prior art has low efficiency and insufficient accuracy in container damage detection, and cannot provide accurate damage information, resulting in low detection efficiency and waste of resources.
The container loss information detection and counting method based on yolov9 and DeepSort is used to perform super-resolution preprocessing through the ESRGAN network, and combined with RT-DETR and yolov9 target detection networks, DeepSort tracking algorithm is used for detection and counting.
It realizes efficient and accurate container damage detection, improves detection speed and accuracy, saves human resources, and effectively calculates the container throughput.
Smart Images

Figure CN119229221B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of container information detection, and in particular to a container damage information detection and counting method based on yolov9 and DeepSort. Background Art
[0002] Container transportation is a common mode of cargo transportation in international trade, but during transportation, containers may be damaged by various factors, such as collision, squeezing, vibration, etc. Early detection and repair of container damage is crucial for the safe transportation of goods and the interests of both parties in the trade. The current situation mainly relies on manual screening, which has low detection efficiency, wastes a lot of manpower and material resources, increases the risk level of detection personnel, and causes unnecessary loss of social resources. At the same time, the existing technology still has some shortcomings, such as insufficient detection accuracy or only being able to detect whether there is damage but unable to provide accurate damage information. Therefore, it is of great significance to develop an efficient and accurate container damage detection system.
[0003] In view of the above problems, the present invention provides a container damage information detection and counting method based on yolov9 and DeepSort, which can efficiently and accurately detect container damage. Summary of the invention
[0004] The present invention provides a container damage information detection and counting method based on yolov9 and DeepSort which can efficiently and accurately detect container damage.
[0005] The purpose of the present invention is to provide a container damage information detection and counting method based on yolov9 and DeepSort, the method comprising the following steps:
[0006] Step 1: Collect data on the transported containers, including information about the containers and overall perception of the containers;
[0007] Step 2: Use the ESRGAN network to perform super-resolution preprocessing on the collected container data to increase the resolution of the image and improve the quality of the input image;
[0008] Step 3: Input the preprocessed image data in step 2 into the trained target detection RT-DETR neural network, and also input it into the trained yolov9 semantic segmentation network. The target detection network extracts features from the data to obtain the detected category and bounding box, and the semantic segmentation network outputs the damaged category and damaged area information.
[0009] Step 4: The detection information obtained in step 3 is further passed to the DeepSort tracking algorithm for processing and counting;
[0010] Step 5: Combine the tracking information obtained in step 4 with the neural network segmentation processing information of the container damage information in step 3 to draw the final result;
[0011] Step 6: If the information in step 5 does not meet expectations, a corresponding alarm is issued, and all information and container counting information are stored in the database;
[0012] Furthermore, the RT-DETR neural network in step three includes a backbone, a hybrid feature enhancement encoder, an efficient feature fusion module, a decoder, and a prediction head. The backbone uses Resnet-50 to extract features from image information and reduce the size of the feature map. A CoordAttention module with both spatial attention and channel attention is added to the third-to-last layer of the backbone. A spatial attention ECA module is added to the second-to-last layer of the backbone. The outputs of these two attention modules are residually connected with the inputs of the corresponding attention mechanisms. The last layer of the backbone is handed over to the AIFI self-attention mechanism module to calculate the correlation, obtain high-level semantic information, and reshape the resulting one-dimensional vector into a two-dimensional matrix. The three types of data are processed together by the efficient feature fusion module.
[0013] Furthermore, the sampling module in the backbone is replaced by the Adown module. In the initial stage of input, the maximum pooling is used to halve the size of the feature map. Split is used to divide the feature map channel number c into two feature maps with the number of channels c / / 2. One part uses the CBS module to extract features using a convolution kernel of 3*3 and a step size of 2, and the other part first performs maximum pooling, followed by a feature extraction module using a 1*1 convolution kernel and a step size of 1. Finally, the two feature maps are concatenated using the concat operation.
[0014] Furthermore, the original CSPRepLayer module in the efficient feature fusion module is replaced by the RepNCSPELAN4 module, the number of input channels of the RepNCSP inside the RepNCSPELAN4 is made the same as the number of channels of RepNCSPELAN4, the number of output channels is the same as the number of output channels of RepNCSPELAN4, the number of RepNBottleneck inside the RepNCSP is increased from 1 to 2, and the overall structure of the efficient feature fusion module adopts the GELAN+PANet structure.
[0015] Furthermore, the loss of the prediction head is:
[0016]
[0017] in, is the predicted value, is the real frame, is the predicted category, is the true category, IoU is giou, and giou is used to constrain the learning of the category.
[0018] Furthermore, the image segmentation algorithm adopts the yolov9 algorithm, which is mainly divided into a backbone and a head using programmable gradient information and generalized ELAN. The programmable gradient information mainly includes three components: the main branch, the auxiliary reversible branch, and the multi-level auxiliary information. The PANet structure is changed to the BiFPN structure, and the fusion modules of different feature layers still use the generalized ELAN, and the upsampling and downsampling modules remain the same.
[0019] Furthermore, the image tracking algorithm adopts the deepsort algorithm. The algorithm is mainly divided into four parts: target detector, feature extractor, motion model, and data associator. The target detector is received from the RT-DETR detection result; the motion model is changed from the original motion model Kalman Filter algorithm to the short-term prediction network LSTM; the data associator part adds a cache information pool of size 3 for each tracker to store previously matched target information. When the Hungarian algorithm in the Matching Cascade of the data associator selects a current target information for matching, if it does not match the characteristics of the current information in the tracker, the next information in the cache information pool is selected for matching. If the information in the information pool is successfully matched, the next target is matched and the current successful matching information is added to the cache information pool. If all the information in the information pool does not match, the tracker is abandoned and the next target is matched; if it matches the characteristics of the current information, the currently matched target information is added and the last information in the information pool is discarded. The association loss is the Euclidean distance, and the calculation formula is:
[0020]
[0021] Among them, b and a are two eigenvectors, and n is the dimension of the eigenvector.
[0022] Furthermore, the image segmentation algorithm in step 5 adopts the yolov9 algorithm, which is mainly divided into the backbone and head using programmable gradient information and generalized ELAN. The programmable gradient information mainly includes three components: the main branch, the auxiliary reversible branch and the multi-level auxiliary information. The PANet structure is changed to the BiFPN structure, and the fusion modules of different feature layers still use the generalized ELAN. The upsampling and downsampling modules remain the same. The loss function calculation steps are:
[0023] Classification loss:
[0024]
[0025] in, is the predicted probability of the target class, and is a hyperparameter that adjusts the weight of difficult-to-classify samples.
[0026] Regression loss, CIoU loss formula is as follows:
[0027]
[0028] in, Represents the distance between the center point of the predicted box and the real box, Represents the diagonal distance of the minimum bounding box between the predicted box and the true box, and Used to adjust the aspect ratio.
[0029] The total loss function is the weighted sum of the two:
[0030]
[0031] in is the weight of the focal loss, is the weight of the regression loss.
[0032] The present invention has the following advantages: the present invention adopts the most advanced transformer structure neural network. Due to the attention mechanism, different objects can be well distinguished when objects overlap, which perfectly solves the overlapping problem caused by two vehicles running in parallel. Compared with traditional algorithms, the DETR model can better capture large targets, especially detection targets of the same volume as containers.
[0033] The present invention automatically detects damage and predicts related locations through a deep learning algorithm to alert relevant personnel.
[0034] Compared with traditional images, the present invention adopts the ESRGAN network for super-resolution preprocessing in the case of complex conditions and high noise, thereby increasing the robustness of the detector, improving the detection speed, and making the performance of the network more prominent.
[0035] The present invention uses deep learning to replace manual counting for the target tracking module, which not only saves manpower and improves efficiency, but also effectively calculates the throughput of containers. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 is a flow chart of the present invention;
[0037] Figure 2 It is a schematic diagram of the RT-DETR network after the improvement of the present invention;
[0038] Figure 3 A schematic diagram of the yolov9 network with BiFPN added to the present invention;
[0039] Figure 4 Schematic diagram of the DeepSort tracker with memory of the present invention. DETAILED DESCRIPTION
[0040] The present invention provides a container damage information detection and counting method based on yolov9 and DeepSort, the method comprising the following steps:
[0041] Step 1: Collect data on the transported containers, including information about the containers and overall perception of the containers;
[0042] Step 2: Use the ESRGAN network to perform super-resolution preprocessing on the collected container data;
[0043] Step 3: Input the preprocessed image data in step 2 into the trained target detection RT-DETR neural network, and also input it into the trained yolov9 semantic segmentation network. The target detection network extracts features from the data to obtain the detected category and bounding box, and the semantic segmentation network outputs the damaged category and damaged area information.
[0044] Step 4: The detection information obtained in step 3 is further passed to the DeepSort tracking algorithm for processing and counting;
[0045] Step 5: Combine the tracking information obtained in step 4 with the neural network segmentation processing information of the container damage information in step 3 to draw the final result;
[0046] Step 6: If the information in step 5 does not meet expectations, a corresponding alarm is issued, and all information and container counting information are stored in the database;
[0047] In this embodiment, the RT-DETR neural network in step three includes a backbone, a hybrid feature enhancement encoder, an efficient feature fusion module, a decoder, and a prediction head, wherein the backbone uses Resnet-50 to extract features from image information and reduce the size of the feature map. A CoordAttention module with both spatial attention and channel attention is added to the third-to-last layer of the backbone, and a spatial attention ECA module is added to the second-to-last layer of the backbone. The output parts of the two attention modules are residually connected with the inputs of the corresponding attention mechanisms. The last layer of the backbone is handed over to the AIFI self-attention mechanism module to calculate the correlation, obtain high-level semantic information, and reshape the resulting one-dimensional vector into a two-dimensional matrix. The three types of data are processed together by the efficient feature fusion module.
[0048] In this embodiment, the sampling module in the backbone is replaced by the Adown module. In the initial stage of input, the maximum pooling is used to halve the size of the feature map. Split is used to divide the feature map channel number c into two feature maps with the number of channels c / / 2. One part uses the CBS module to extract features using a convolution kernel of 3*3 and a step size of 2, and the other part first performs maximum pooling, and then uses a feature extraction module with a 1*1 convolution kernel and a step size of 1. Finally, the two feature maps are spliced using a concat operation.
[0049] In this embodiment, the original CSPRepLayer module in the efficient feature fusion module is replaced by the RepNCSPELAN4 module, the number of input channels of the RepNCSP inside the RepNCSPELAN4 is the same as the number of channels of RepNCSPELAN4, the number of output channels is the same as the number of output channels of RepNCSPELAN4, the number of RepNBottleneck inside the RepNCSP is increased from 1 to 2, and the overall structure of the efficient feature fusion module adopts the GELAN+PANet structure.
[0050] In this embodiment, the loss of the prediction head is:
[0051]
[0052] in, is the predicted value, is the real frame, is the predicted category, is the true category and IoU is giou.
[0053] In this embodiment, the image segmentation algorithm adopts the yolov9 algorithm, which is mainly divided into a backbone and a head using programmable gradient information and a generalized ELAN. The programmable gradient information mainly includes three components: a main branch, an auxiliary reversible branch, and multi-level auxiliary information. The PANet structure is changed to a BiFPN structure, and the fusion modules of different feature layers still use the generalized ELAN, and the upsampling and downsampling modules remain the same.
[0054] In this embodiment, the image tracking algorithm adopts the deepsort algorithm, and the algorithm is mainly divided into four parts: target detector, feature extractor, motion model, and data associator. The target detector receives the detection result of RT-DETR; the motion model is changed from the original motion model Kalman Filter algorithm to the short-term prediction network LSTM; the data associator part adds a cache information pool of size 3 for each tracker to store previously matched target information. When the Hungarian algorithm in the Matching Cascade of the data associator selects a current target information for matching, if it does not match the feature of the current information in the tracker, the next information in the cache information pool is selected for matching. If the information in the information pool is matched successfully, the next target is matched and the current successfully matched information is added to the cache information pool. If all the information in the information pool does not match, the matching of the tracker is abandoned and the next target is matched; if it matches the feature of the current information, the currently matched target information is added, and the last information in the information pool is discarded. The association loss is the Euclidean distance, and the calculation formula is:
[0055]
[0056] Among them, b and a are two eigenvectors, and n is the dimension of the eigenvector.
[0057] In this embodiment, the image segmentation algorithm in step 5 adopts the yolov9 algorithm, which is mainly divided into a backbone and a head using programmable gradient information and generalized ELAN. The programmable gradient information mainly includes three components: a main branch, an auxiliary reversible branch, and multi-level auxiliary information. The PANet structure is changed to a BiFPN structure, and the fusion modules of different feature layers still use the generalized ELAN. The upsampling and downsampling modules remain the same. The loss function calculation steps are:
[0058] Classification loss:
[0059]
[0060] in, is the predicted probability of the target class, and is a hyperparameter that adjusts the weight of difficult-to-classify samples.
[0061] Regression loss, CIoU loss formula is as follows:
[0062]
[0063] in, Represents the distance between the center point of the predicted box and the real box, Represents the diagonal distance of the minimum bounding box between the predicted box and the true box, and Used to adjust the aspect ratio.
[0064] The total loss function is the weighted sum of the two:
[0065]
[0066] in is the weight of the focal loss, is the weight of the regression loss.
[0067] In this embodiment, an application example is provided, which specifically includes the following steps:
[0068] Step 1: Collect image information collected by relevant cameras at the implementation site and create a data set based on it.
[0069] Target tracking requires a powerful target detector, and the performance of the detector depends on high-quality data sets. These data sets rely on real and representative data, especially real data in actual application scenarios. Therefore, the data sets produced in this way can enable the model to perform more outstandingly in this task scenario during the reasoning process. The collected images will be used to produce data sets from two aspects. On the one hand, the real boxes containing containers (upper left corner to lower right corner) will be marked. These real boxes contain containers of different sizes shown in the pictures. On the other hand, the damage information of the containers (size, shape, outline, damage type) will be marked. In order to adapt to the task requirements in different environments, these two data sets have collected pictures in different situations (daytime, night with lights, cloudy days, rainy days) so that the model can fully learn and be applied to harsh environments.
[0070] Step 2: Use the dataset to train the object detection model.
[0071] In order to avoid the mutual interference between the detection and segmentation functions in the model, which may lead to the decline of model performance, the idea of expert system is adopted to submit different data sets to different models for training. Considering that containers are mostly large objects, the detection model is trained based on RT-DETR. The model uses a hybrid encoder and a deformable attention mechanism to set the same sampling points in feature maps of different scales to ensure the accuracy of the model. At the same time, the ResNet-50 backbone network is used to balance accuracy and speed while ensuring real-time performance. The model uses a detail feature enhancement module (DFE) and an intermediate feature enhancement module (IFE) to enhance features of different scales to ensure that the detection performance of different objects can be improved under the guidance of high-level semantic information. At the same time, a generalized aggregation network is used and different blocks are set to perceive features from different depths and directions, realize feature fusion of different scales, and provide high-quality mapping and query information for the decoder.
[0072] The specific implementation is as follows:
[0073] (1) Establish an End-to-End RT-DETR target detection model:
[0074] A. Select ResNet-50 as the backbone network:
[0075] B. Construct high-level semantic information extraction module, detail feature enhancement module (DFE), and intermediate feature enhancement module (IFE):
[0076] C. Building a Generalized ELAN
[0077] D, B and C form a hybrid encoder
[0078] E. Deformable attention based on discrete_sample operator. This module sets the same sampling points for feature maps of different scales to ensure that performance is not weakened. Learnable query generation performs self-attention to enhance the distinction between different generated query choices. Construct Decoder module
[0079] F. Improve the original Loss, propose a strong constraint perception query based on the soft label, improve the comprehensive learning of the target frame features based on multiple factors such as the size, position and direction of the object, ensure the shape invariance and the sensitivity of positioning accuracy. At the same time, the regression Loss is also strongly constrained.
[0080] G. Set different batches according to the different performance of the hardware and adjust the relevant training parameters.
[0081] (2) Based on the collected data set, set relevant parameters and train the RT-DETR target detection model:
[0082] Adjust the data enhancement strategy for data enhancement (random cropping, scaling transformation, rotation, horizontal flipping, vertical flipping, projection transformation, scale adaptation, etc.), use the AdamW optimizer, and set the MultiStepLR learning rate scheduler for training.
[0083] Step 3: Use the dataset to train the segmentation model.
[0084] The backbone network of yolov9 uses CSPDarknet53, combined with BiFPN to enhance the extraction of multi-scale damage features. The detection head is responsible for outputting bounding boxes and semantic segmentation masks. The yolov9 model first detects the damaged area in the image and extracts the bounding box. The semantic segmentation task is performed in the detected area to identify and annotate the damage information on the surface of the container. The model outputs a mask of the damaged area and classifies it, indicating the specific damage type (such as cracks, dents, scratches, etc.). Based on the training data, the model classifies the damage into multiple types such as cracks, dents, scratches, etc., and marks their corresponding confidence levels. Based on the semantic segmentation mask, the area of each damage is calculated, and the severity of the damage is graded according to the preset threshold. The location information of the damaged area is matched with the overall coordinates of the container to generate damage information containing specific location information.
[0085] The specific implementation is as follows:
[0086] (1) Construct Bi-yolov9 model:
[0087] The original feature fusion network is improved, and the multi-scale features are fully integrated based on the structure of BiFPN.
[0088] (2) Improve the loss function:
[0089] A. Localization Loss is responsible for penalizing the difference between the predicted bounding box and the actual bounding box (GroundTruth). The localization loss in YOLOv9 uses CIoU (Complete Intersection over Union), which takes into account the following aspects: IoU (Intersection over Union): measures the degree of overlap between the predicted box and the real box. Center point distance: the distance between the center point of the predicted box and the real box. Aspect ratio difference: penalizes the difference between the width and height ratio of the predicted box and the width and height ratio of the real box. The CIoU loss formula is as follows:
[0090]
[0091] in, Represents the distance between the center point of the predicted box and the real box, Represents the diagonal distance of the minimum bounding box between the predicted box and the true box, and Used to adjust the aspect ratio.
[0092] B. Classification Loss is used to measure the accuracy of the model's prediction of the target category. YOLOv9's classification loss uses Focal Loss. Focal Loss formula:
[0093]
[0094] in, is the predicted probability of the target class, and It is a hyperparameter that adjusts the weight of difficult-to-classify samples.
[0095] C. Confidence Loss YOLOv9 outputs a confidence value for each predicted bounding box, indicating whether the box contains an object. Confidence loss is used to measure the model's prediction accuracy of the existence of the target, using Binary Cross-Entropy Loss (BCE Loss). For bounding boxes that contain objects, this loss penalizes the model's low confidence prediction of the existence of the target; for bounding boxes that do not contain objects, this loss penalizes the model's high confidence prediction of the existence of the target.
[0096] D. Segmentation Loss uses IoU Loss to measure the similarity between the segmentation mask and the true mask. IoU Loss emphasizes the overlap between the predicted mask and the true mask.
[0097] F. Comprehensive loss, which is the weighted sum of all losses.
[0098] (3) Based on the collected data set, set relevant parameters and train the yolov9 semantic segmentation model.
[0099] Step 4: Deploy the trained object detection model and semantic segmentation model.
[0100] The images captured by the camera are input into the ESRGAN super-resolution generation network for processing to improve the resolution and detail quality of the image.
[0101] Step 5: The processed images are sent to RT-DETR for processing.
[0102] The detection results are passed back to the tracking function module.
[0103] Step 6: The semantic segmentation module processes the input image.
[0104] The specific implementation is as follows:
[0105] (1) Image preprocessing:
[0106] The container surface images collected by the camera equipment first go through preprocessing steps such as scale adjustment, color standardization, and denoising to ensure that the images input to the YOLOv9 model can meet the training requirements of the model and improve the detection accuracy. The image enhancement operations used include cropping and brightness adjustment.
[0107] (2) Damage area detection:
[0108] According to the input preprocessed image, multiple damaged areas in the image are detected, and the bounding box of each damaged area is output. The coordinates and size of each bounding box represent the position and range of the damaged area in the image.
[0109] (3) Semantic segmentation and mask generation:
[0110] In the detected damage area, the semantic segmentation task is performed. By further refining the detection area, a semantic mask of the damage area is generated, which accurately marks the location and contour of the damage.
[0111] (4) Damage classification and confidence assessment:
[0112] Based on the training data, the YOLOv9 model can classify each damage mask into a specific damage type, such as cracks, dents, scratches, etc. The model outputs a confidence value for each classification to indicate the accuracy of the classification result.
[0113] (5) Area calculation and severity classification:
[0114] Using the mask information generated by semantic segmentation, the system calculates the actual area of each damaged area and grades the severity of the damage according to a pre-set threshold. For example, a smaller damage area is defined as a minor damage, while a larger damage area is classified as a severe damage.
[0115] (6) Damage location matching and report generation:
[0116] The location information of the damaged area will be matched with the coordinate system of the entire container to accurately locate the specific location of the damage on the container. Finally, a damage data packet containing damage type, confidence, area and location information is generated.
[0117] Step 7: DeepSort receives RT-DETR target detection information.
[0118] Tracking is achieved using DeepSort.
[0119] The specific implementation is as follows:
[0120] (1) Target detection and initialization:
[0121] The target detection model RT-DETR is used to detect each frame of the image and identify the bounding box and category label of the container. Each time a container is detected, a target is initialized, a unique ID is assigned, and tracking begins.
[0122] (2) Target tracking and ID allocation:
[0123] The tracking algorithm tracks the movement trajectory of each container. DeepSort assigns a unique ID to each detected container through Kalman filter and appearance feature matching, and continuously tracks the container in multiple frames. Even if the target disappears temporarily in some frames, the algorithm will retrieve the previous data from the tracking cache to resume tracking so that its ID remains unchanged.
[0124] (3) Define the counting area:
[0125] Set up virtual counting areas, and when the container's bounding box passes through these lines or areas, counting is triggered.
[0126] (4) Counting when passing through the counting line:
[0127] Taking the center as the target location, a counting operation is triggered every time the center point of the container boundary box passes through the defined counting line or area. The tracker will record the container ID that passes through the line to ensure that the same container is counted only once to avoid duplicate counting.
[0128] (5) Avoid double counting:
[0129] Through DeepSort’s ID tracking, each container will be marked as counted after passing through the counting line, avoiding repeated counting of the same container when it passes through the counting line multiple times in consecutive frames.
[0130] (6) Handling target disappearance:
[0131] When the container leaves the picture or is not detected again within a specific time frame, tracking of the target is stopped and the container is marked as counted in the counting record.
[0132] (7) Multi-target tracking and parallel counting:
[0133] DeepSort tracks multiple containers simultaneously and assigns a unique ID to each container. If multiple containers pass through the counting line at the same time in the same frame, they are identified and counted simultaneously.
[0134] (8) Entry and exit direction:
[0135] In order to record the in and out situation of the container, the direction of the container passing through the counting line is detected. The direction of movement of the container (entry or exit) is determined according to the position of the container before and after the counting line, thereby recording the in and out flow of the container.
[0136] (9) Result output:
[0137] Finally, the tracker continuously outputs each container's ID, location, number of times the count line has been passed, and in and out directions, which can be used to count the container's transportation volume.
[0138] Step 8: Process the tracker and semantic segmentation results.
[0139] The results obtained by the tracker are continuously input into the database for storage. At the same time, a buffer pool is set up to input the tracking results and the damage information obtained in yolov9 into the storage queue. The different results are combined in the form of the same frame and finally output to the screen. According to the set damage threshold, if the container is found to be damaged, an alarm is sent to the duty personnel. Finally, the final results of each frame are input into the database.
[0140] Although the specific embodiments of the present invention are described in detail in conjunction with the accompanying drawings, it should not be understood as limiting the scope of protection of the present invention. Within the scope described in the claims, various modifications and variations that can be made by those skilled in the art without creative work still belong to the scope of protection of the present invention.
Claims
1. A container damage information detection and counting method based on yolov9 and DeepSort, characterized in that: The method comprises the following steps: Step 1: Collect data on the transported containers, including information about the containers and overall perception of the containers; Step 2: Use the ESRGAN network to perform super-resolution preprocessing on the collected container data; Step 3: Input the preprocessed image data in step 2 into the trained target detection RT-DETR neural network, and also input it into the trained yolov9 semantic segmentation network. The target detection network extracts features from the data to obtain the detected category and bounding box, and the semantic segmentation network outputs the damaged category and damaged area information. The RT-DETR neural network includes a backbone, a hybrid feature enhancement encoder, an efficient feature fusion module, a decoder, and a prediction head, wherein the backbone uses Resnet-50 to extract features from image information, reduces the size of the feature map, adds a CoordAttention module with both spatial attention and channel attention to the third-to-last layer of the backbone, and adds a spatial attention ECA module to the second-to-last layer of the backbone. The outputs of the two attention modules are residually connected with the inputs of the corresponding attention mechanisms. The last layer of the backbone is handed over to the AIFI self-attention mechanism module to calculate the correlation, obtain high-level semantic information, and reshape the resulting one-dimensional vector into a two-dimensional matrix. The three types of data are processed together by the efficient feature fusion module; The sampling module in the backbone is replaced by the Adown module. In the initial stage of input, the size of the feature map is halved using the maximum pooling. The number of channels of the feature map c is divided into two feature maps with the number of channels c / / 2 using Split. One part is extracted using the CBS module with a convolution kernel of 3*3 and a step size of 2. The other part is first subjected to the maximum pooling, followed by a feature extraction module with a 1*1 convolution kernel and a step size of 1. Finally, the two feature maps are spliced using the concat operation. The original CSPRepLayer module in the efficient feature fusion module is replaced with the RepNCSPELAN4 module, the number of input channels of the RepNCSP inside the RepNCSPELAN4 is the same as the number of channels of RepNCSPELAN4, the number of output channels is the same as the number of output channels of RepNCSPELAN4, the number of RepNBottleneck inside the RepNCSP is increased from 1 to 2, and the overall structure of the efficient feature fusion module adopts the GELAN+PANet structure; The loss of the prediction head is: ; in, is the predicted value, is the real frame, is the predicted category, is the true category, and IoU is giou; Step 4: The detection information obtained in step 3 is further passed to the DeepSort tracking algorithm for processing and counting; Step 5: Combine the tracking information obtained in step 4 with the neural network segmentation processing information of the container damage information in step 3 to draw the final result; Step 6: If the information in step 5 does not meet expectations, a corresponding alarm will be issued, and all information and container counting information will be stored in the database.
2. The container damage information detection and counting method based on yolov9 and DeepSort as claimed in claim 1, characterized in that: In step 4, the image tracking algorithm uses the deepsort algorithm. The algorithm is mainly divided into four parts: target detector, feature extractor, motion model, and data associator. The target detector receives the detection results from RT-DETR; the motion model is changed from the original motion model Kalman Filter algorithm to the short-term prediction network LSTM; the data associator adds a cache information pool of size 3 for each tracker to store previously matched target information. When the Hungarian algorithm in the Matching Cascade of the data associator selects a current target information for matching, if it does not match the characteristics of the current information in the tracker, the next information in the cache information pool is selected for matching. If the information in the information pool matches successfully, the next target is matched and the current successful matching information is added to the cache information pool. If all the information in the information pool does not match, the tracker is abandoned and the next target is matched; if it matches the characteristics of the current information, the currently matched target information is added and the last information in the information pool is discarded. The association loss is the Euclidean distance, and the calculation formula is: ; Among them, b and a are two eigenvectors, and n is the dimension of the eigenvector.
3. The container damage information detection and counting method based on yolov9 and DeepSort as claimed in claim 1, characterized in that: The counting in step 4 is performed by selecting a range on the screen, and when the tracked target appears in the selected area and appears multiple times, the target is counted.
4. The container damage information detection and counting method based on yolov9 and DeepSort as claimed in claim 1, characterized in that: In step five, the image segmentation algorithm uses the yolov9 algorithm, which is mainly divided into a backbone and a head using programmable gradient information and generalized ELAN. The programmable gradient information mainly includes three components: the main branch, the auxiliary reversible branch, and the multi-level auxiliary information. The PANet structure is changed to the BiFPN structure, and the fusion modules of different feature layers still use the generalized ELAN. The upsampling and downsampling modules remain the same.
5. The container damage information detection and counting method based on yolov9 and DeepSort as claimed in claim 4 is characterized by: In the yolov9 algorithm, the loss function calculation steps are: Classification loss: ; in, is the predicted probability of the target class, and is a hyperparameter that adjusts the weight of difficult-to-classify samples. Regression loss, CIoU loss formula is as follows: ; in, Represents the distance between the center point of the predicted box and the real box, Represents the diagonal distance of the minimum bounding box between the predicted box and the true box, and Used to adjust the aspect ratio. The total loss function is the weighted sum of the two: ; in is the weight of the focal loss, is the weight of the regression loss.
Citation Information
Patent Citations
Container damage real-time detection method based on deep learning
CN113240641A
Alarm image determination method and device
CN119027644A