Truck outer contour detection method based on iterative regularization and text prompt

By combining iterative regularization of detection boxes with text prompts, semantic information, and a general visual segmentation model, the problem of stable recognition of freight vehicle outlines in complex environments was solved, achieving efficient and stable segmentation results and providing reliable data for 3D detection.

CN122391659APending Publication Date: 2026-07-14浙江交投高速公路运营管理有限公司 +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
浙江交投高速公路运营管理有限公司
Filing Date
2026-03-09
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Existing technologies struggle to achieve stable and complete identification of the external contours of freight vehicles in complex traffic and road environments, resulting in insufficient accuracy in 3D detection and over-limit analysis.

Method used

A method based on iterative regularization of detection boxes and text prompts is adopted to segment vehicle outlines using traffic monitoring video frames. Combining a general visual segmentation model and semantic information, an intermediate regularization and prompt constraint mechanism is introduced to adaptively adjust the segmentation process to adapt to different cargo types and shapes.

Benefits of technology

Stable and complete recognition of the outline of freight vehicles was achieved in multiple scenarios and road environments, improving the integrity and stability of the segmentation results, providing reliable basic data support for subsequent 3D detection, and reducing model training costs and system maintenance difficulties.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122391659A_ABST
    Figure CN122391659A_ABST
Patent Text Reader

Abstract

The application discloses a freight vehicle outer contour segmentation method based on detection frame iteration regularization and text prompts, which comprises the following steps: S1, acquiring video frames collected by a traffic monitoring camera; S2, obtaining an initial two-dimensional detection frame of a target freight vehicle; S3, generating first round segmentation prompt information based on the initial two-dimensional detection frame, fusing the first round segmentation prompt information with semantic text prompts, and inputting the first round segmentation prompt information into a visual segmentation basic model to perform pixel-level segmentation on the target freight vehicle; S4, dynamically evaluating the integrity of a segmentation result; S5, expanding the detection frame, repeating S3 to S5, and forming an iteration regularization process combining detection frame expansion and segmentation result evaluation; and S6, outputting a final outer contour segmentation mask of the target freight vehicle. The application can effectively solve the contour truncation and missing segmentation problems caused by the outward extension and irregular stacking of goods, and realizes fine extraction of the contour of the freight vehicle under a complex loading state without the need of retraining a model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of computer vision and intelligent traffic monitoring technology, and in particular to a method for segmenting the outer contour of freight vehicles based on iterative regularization of detection boxes and text prompts. Background Technology

[0002] With the continued growth in logistics and transportation demand, the frequency of various freight vehicles on national highways, expressways, and urban roads has increased significantly. At the same time, problems such as vehicles exceeding size limits and exhibiting abnormal shapes due to improper cargo loading, vehicle modifications, or overloading are becoming increasingly prominent. These vehicles not only exacerbate wear and tear on roads, bridges, and other transportation infrastructure during operation but also significantly increase the risk of traffic accidents, making them a key focus of road traffic safety management.

[0003] Currently, the management of overloaded freight vehicles in various regions still relies mainly on manual patrols, fixed height restriction facilities, or dedicated detection equipment. These methods generally suffer from high deployment costs, limited coverage, and difficulty adapting to complex road environment changes, making them unsuitable for the practical needs of large-scale, continuous monitoring. With the widespread deployment of traffic monitoring cameras in various road scenarios, intelligent identification technology for freight vehicles based on visual analysis is gradually becoming an important development direction for overloaded vehicle supervision.

[0004] In existing visual technology systems, accurate extraction of the vehicle's outline is a crucial foundation for constructing 3D bounding boxes, calculating vehicle dimensions, and identifying overloaded vehicles. Current mainstream methods typically employ a "target detection and localization + image segmentation" framework. This involves first obtaining the vehicle's 2D localization information through a detection model, and then performing pixel-level segmentation based on this localization result to extract the vehicle's external outline. However, in real-world road environments, this type of method still faces numerous challenges.

[0005] On the one hand, freight vehicles have complex and diverse external structures. Different types of cargo vary significantly in size proportions, shape, and spatial relationship with the vehicle body, often exhibiting issues such as cargo protrusion, irregular stacking, or partial occlusion. Due to variations in shooting angle, lighting conditions, background interference, and vehicle movement, the two-dimensional bounding boxes output by the detection model often fail to fully cover the true outline of the vehicle and its cargo, leading to problems such as outline truncation, missed segmentation, or discontinuous regions in subsequent segmentation results.

[0006] On the other hand, while pursuing real-time performance, existing vehicle segmentation methods typically rely on single detection results as segmentation cues, lacking an effective mechanism for determining the completeness of segmentation results and struggling to adaptively adjust based on vehicle shape features. Under multi-scenario and multi-road conditions, the system's adaptability to different freight vehicle shapes is insufficient, and the stability and consistency of the shape contour segmentation are difficult to guarantee, thus affecting the accuracy of subsequent 3D size estimation and over-limit determination.

[0007] Therefore, how to achieve stable and complete recognition of the outlines of various freight vehicles in complex traffic environments, and provide reliable basic algorithm support for subsequent 3D detection and over-limit analysis, remains a key technical problem that urgently needs to be solved in the field of intelligent transportation. Summary of the Invention

[0008] The technical problem this invention aims to solve is to address the shortcomings of existing technologies by providing a freight vehicle contour segmentation method based on iterative regularization of detection boxes and text prompts. This method uses traffic monitoring video frames as input and vehicle contour segmentation as the key foundational algorithm. An intermediate regularization and prompt constraint mechanism is introduced between the detection results and the segmentation process, enabling the segmentation process to adaptively adjust according to the vehicle's shape features. By combining the generalization ability of a universal visual segmentation foundation model (FoundationModel) in multi-object and multi-morphological scenarios, it avoids complex model training and parameter tuning for different cargo types and shapes, thereby improving the system's applicability in multiple scenarios and road environments. Furthermore, this invention incorporates semantic information about freight vehicle and cargo types to provide auxiliary guidance for segmentation prompts, enabling the segmentation model to better adapt to complex shapes such as cargo extensions and irregular stacking. This achieves stable and complete recognition of various freight vehicle contours without additional training.

[0009] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:

[0010] A method for segmenting the outer contour of freight vehicles based on iterative regularization of detection boxes and text prompts includes the following steps.

[0011] S1. Acquire the video stream captured by the traffic monitoring camera, and preprocess the video stream to obtain a video frame sequence.

[0012] S2. From the video frame sequence, the moving freight vehicle is located using a target detection model to obtain the initial two-dimensional detection box of the target freight vehicle.

[0013] S3. Generate the first round of segmentation prompt information based on the initial two-dimensional detection box, merge the segmentation prompt information with the preset semantic text prompt to form fused segmentation prompt information, and input it into the visual segmentation basic model to perform pixel-level segmentation of the target freight vehicle and obtain the corresponding initial segmentation mask of the vehicle's outer contour.

[0014] S4. Calculate the area ratio of the initial segmentation mask of the vehicle's outer contour to the area ratio of the initial two-dimensional detection box, and dynamically evaluate the integrity of the segmentation result; if the area ratio does not meet the preset integrity condition, proceed to step S5; otherwise, jump to S6.

[0015] S5. Perform a scale expansion operation on the current detection box to generate an expanded detection box, and reconstruct the segmentation prompt information based on the expanded detection box; repeat S3 to S5 to form an iterative regularization process that combines detection box expansion with segmentation result evaluation.

[0016] S6. Determine whether the preset iteration termination condition is met. If it is met, output the final outer contour segmentation mask of the target freight vehicle; otherwise, repeat S3 to S5 until the iteration terminates.

[0017] In S1, the preprocessing includes: using the intrinsic parameter matrix and distortion coefficients of the traffic monitoring camera to perform image distortion correction using the cv2.undistort function; using the cv2.fillPoly function to extract the effective monitoring area based on the scene topology; and using bilinear interpolation to unify the image scale.

[0018] In S2, the method for obtaining the initial two-dimensional detection box through the object detection model includes:

[0019] S2-1. Input the video frame sequence output by S1 into the trained target detection model to obtain a coarse candidate target set for freight vehicles. Each coarse candidate target for freight vehicles includes at least a category label, confidence score, and corresponding two-dimensional bounding box information.

[0020] S2-2. Apply both category restrictions and confidence level filtering to the coarse candidate freight vehicles output in step S2-1, retaining only those classified as "trucks" with a confidence level not lower than a preset threshold. The detection results yield a set of candidate freight vehicle targets; each candidate freight vehicle target includes at least the corresponding two-dimensional bounding box information.

[0021] S2-3. For any candidate target i of a freight vehicle, output its corresponding initial two-dimensional detection box. ;in and These represent the pixel coordinates of the top left and bottom right corners of the initial 2D detection box in the image coordinate system, respectively. A unique target identifier is assigned to each initial 2D detection box for target association and state maintenance in subsequent segmentation iterations.

[0022] In S3, the method for obtaining the initial segmentation mask of the vehicle's outer contour includes:

[0023] S3-1. The initial two-dimensional detection box is transformed into visually guided segmentation prompts, and the text description information is transformed into semantic text prompts through a text encoder. The segmentation prompts and semantic text prompts are fused using a cross-attention mechanism to form fused segmentation prompts, which are then input into the prompt encoding module of the visual segmentation base model. The segmentation prompts include point prompts based on the center point of the detection box or shape prompts based on the boundary of the detection box.

[0024] S3-2, The decoder of the visual segmentation basic model retrieves target pixels in the image feature map based on the fused segmentation cue information. By calculating the correlation density between the target pixels and the segmentation cue information, it generates the corresponding initial segmentation mask for the vehicle's outer contour. .

[0025] In S3, semantic text prompts are obtained by matching the cargo type information of the target freight vehicle from a preset cargo type text prompt library, including one or a combination of container, bulk stack, plate, cylindrical and bagged cargo types; the fusion segmentation prompt information focuses on the visual features of irregular stacks, cargo that extends backward or laterally, thereby correcting the missing segmentation edges caused by abnormal cargo shape.

[0026] In S4, the dynamic evaluation includes absolute integrity evaluation and relative improvement evaluation: the former is based on the preset integrity condition of the current round. Mask area coverage ratio The mask area coverage ratio does not exceed a set ratio threshold; where the mask area coverage ratio... The ratio of the area of ​​the initial segmentation mask for the vehicle's outer contour to the area of ​​the initial two-dimensional detection box. If If the ratio exceeds the set threshold, it is determined that the mask may be physically truncated due to the detection box being too narrow, triggering S5 to perform two-dimensional detection box scale expansion;

[0027] The relative improvement assessment is mainly conducted in subsequent segmentation rounds by comparing the current mask area. Compared to the previous round of mask area area change rate This is used to dynamically evaluate the gain effect of expanding the detection box on the segmentation results; the rate of change This serves as the quantitative basis for determining whether the mask area in S6 tends to flatten out, thus terminating the iteration.

[0028] In S6, the iteration termination condition is that, provided the mask area coverage ratio is not higher than a set ratio threshold, the mask area change rate does not exceed a set area change threshold or the set maximum number of iterations is reached.

[0029] In S5, the method for generating the expanded detection box is as follows: taking the center of the initial two-dimensional detection box as the origin, and expanding the current detection box... Expand the boundary outward according to the set step size to generate an expanded detection box. An expanded detection box containing more contextual information.

[0030] The present invention also provides a storage medium storing a computer program thereon, which, when executed by a processor, implements the above-described method for segmenting the outer contour of freight vehicles based on iterative regularization of detection boxes and text prompts.

[0031] The present invention also provides an electronic device including the above-described storage medium.

[0032] The present invention has the following beneficial effects:

[0033] First, this invention proposes an automatic segmentation method for the outer contours of freight vehicles in complex traffic environments. By introducing a general visual segmentation model with prompting response capabilities, it achieves refined extraction of the outer contours of various freight vehicles and their cargo. This method eliminates the need to retrain segmentation models for different cargo types or shapes, and can be directly deployed and run under existing traffic monitoring camera conditions, significantly reducing model training costs and system maintenance difficulty.

[0034] Secondly, this invention effectively solves the problems of contour truncation and missed segmentation that easily occur in traditional methods under scenarios with outward-extending cargo, irregular stacking, and complex occlusion by constructing an iterative regularization mechanism for detection boxes between target detection and segmentation processing, combined with adaptive expansion of detection box scale and evaluation of segmentation result integrity. This mechanism significantly improves the integrity, continuity, and stability of the segmentation results of the outer contour of freight vehicles, providing reliable basic data support for subsequent 3D detection box construction and dimensional measurement of vehicles.

[0035] Third, this invention further integrates a pre-built text prompt library for cargo types to provide semantic assistance and guidance during the segmentation process. This enables the system to adapt to the vast majority of cargo shapes and loading methods, maintaining consistent segmentation performance across multiple scenarios and road environments. This method balances segmentation accuracy and inference efficiency, and is applicable to various traffic monitoring scenarios such as national highways, expressways, and urban roads. It offers a comprehensive advantage of easy deployment, high robustness, and good engineering applicability. Attached Figure Description

[0036] Figure 1This is a flowchart of the freight vehicle outer contour segmentation method based on detection box iterative regularization and text prompts according to the present invention.

[0037] Figure 2 This is a schematic diagram illustrating the combined processing of detection box iterative regularization and semantic hints in this invention.

[0038] Figure 3 This is a schematic diagram illustrating the visual evolution of the detection box expansion and mask update in this invention. Detailed Implementation

[0039] The present invention will now be described in further detail with reference to the accompanying drawings and specific preferred embodiments.

[0040] like Figure 1 ,and Figure 2 and Figure 3 As shown, a method for segmenting the outer contour of freight vehicles based on iterative regularization of detection boxes and text prompts includes the following steps.

[0041] S1. Obtain real-time video streams of road targets from forward or side views captured by traffic monitoring cameras deployed on the side of the road, and preprocess the video streams to obtain a video frame sequence.

[0042] The aforementioned preprocessing preferably includes:

[0043] A. Using the intrinsic parameter matrix and distortion coefficients of the traffic monitoring camera, image distortion correction is performed using the cv2.undistort function.

[0044] B. Based on the scene topology of different road sections (such as Nanjing Ring Expressway and Yixing National Highway), use the cv2.fillPoly function to extract the effective monitoring area, that is, the region of interest (ROI) mask, and remove interference from roadside vegetation and buildings.

[0045] C. Use bilinear interpolation to unify image scale.

[0046] S2. From the video frame sequence, the moving freight vehicle is located using a target detection model to obtain the initial two-dimensional detection box of the target freight vehicle.

[0047] The target detection model mentioned above is preferably the RF-detr-det target detection model. The input is a video frame with a set uniform image scale, and the output is the initial two-dimensional detection box of the target freight vehicle. It is trained using a freight vehicle detection dataset.

[0048] In this embodiment, the aforementioned freight vehicle detection dataset, collected and labeled from six different monitoring perspectives in Yixing, Zhejiang, and Nanjing, Jiangsu, enables high-precision vehicle positioning under complex lighting and occlusion environments. The freight vehicles include various types such as flatbed trucks, container trucks, and bulk cargo trucks.

[0049] In this embodiment, the method for obtaining an initial two-dimensional detection box through a target detection model preferably includes the following steps.

[0050] S2-1. Input the video frame sequence output by S1 into the trained target detection model to obtain a coarse candidate target set for freight vehicles. Each coarse candidate target for freight vehicles includes at least a category label, confidence score, and corresponding two-dimensional bounding box information.

[0051] S2-2. Apply both category restrictions and confidence level filtering to the coarse candidate freight vehicles output in step S2-1, retaining only those classified as "trucks" with a confidence level not lower than a preset threshold. (like The detection results of freight vehicles are used to obtain a set of candidate targets; each candidate target of freight vehicles includes at least the corresponding two-dimensional bounding box information.

[0052] S2-3. For any candidate target i of a freight vehicle, output its corresponding initial two-dimensional detection box. ;in and These represent the pixel coordinates of the top left and bottom right corners of the initial 2D detection box in the image coordinate system, respectively. A unique target identifier is assigned to each initial 2D detection box for target association and state maintenance in subsequent segmentation iterations.

[0053] S3. Generate the first round of segmentation prompt information based on the initial two-dimensional detection box, merge the segmentation prompt information with the preset semantic text prompt to form fused segmentation prompt information, and input it into the visual segmentation basic model to perform pixel-level segmentation of the target freight vehicle and obtain the corresponding initial segmentation mask of the vehicle's outer contour.

[0054] The preferred visual segmentation model is the SAM3 model, which has strong generalization capabilities.

[0055] The method for obtaining the initial segmentation mask of the vehicle's outer contour as described above preferably includes the following steps.

[0056] S3-1. The initial two-dimensional detection box is transformed into visually guided segmentation prompts, and the text description information is transformed into semantic text prompts through a text encoder. The segmentation prompts and semantic text prompts are fused using a cross-attention mechanism to form fused segmentation prompts, which are then input into the prompt encoding module of the visual segmentation base model.

[0057] The segmentation prompts mentioned above include point prompts based on the center point of the detection box or shape prompts based on the boundaries of the detection box.

[0058] The semantic text prompts mentioned above are obtained by matching the cargo type information of the target freight vehicle from a preset cargo type text prompt library, including one or a combination of container, bulk stack, plate, cylindrical and bagged cargo types; the fusion segmentation prompt information focuses on the visual features of irregular stacks, cargo that extends backward or laterally, thereby correcting the missing segmentation edges caused by abnormal cargo shape.

[0059] S3-2, The decoder of the visual segmentation basic model retrieves target pixels in the image feature map based on the fused segmentation cue information. By calculating the correlation density between the target pixels and the segmentation cue information, it generates the initial segmentation mask for the corresponding vehicle outer contour. .

[0060] In this embodiment, the SAM3 cue encoding module uses positional encoding technology to map the geometric coordinates of the detection box to a 256-dimensional latent space. The SAM3 decoder combines the image feature map and cue vector, and uses a cross-attention mechanism to predict pixel-level attribution probabilities to generate an initial vehicle outline mask. .

[0061] S4. Calculate the area ratio of the initial segmentation mask of the vehicle's outer contour to the area of ​​the initial two-dimensional detection box. The integrity of the segmentation result is dynamically evaluated; if the area ratio does not meet the preset integrity condition, step S5 is executed; otherwise, the process jumps to S6.

[0062] The above The preferred calculation formula is:

[0063] ;

[0064] In the formula, This represents the total number of valid pixels in the initial segmentation mask of the vehicle's outer contour, which is also the area of ​​the initial segmentation mask of the vehicle's outer contour. This represents the area of ​​the initial two-dimensional detection box.

[0065] The above-mentioned preset integrity condition is that the mask area coverage ratio is not higher than a set ratio threshold (0.8 in a specific implementation case); wherein, the mask area coverage ratio is the area ratio of the initial segmentation mask of the vehicle outer contour to the area of ​​the initial two-dimensional detection box.

[0066] like If the ratio exceeds the preset integrity ratio threshold (e.g., 0.8), it is determined that there is cargo protrusion (such as extra-long plates or extended steel bars) that prevents the detection frame from completely covering the target, triggering S5 to perform scale expansion.

[0067] In subsequent segmentation rounds, the current mask area is compared. Compared to the previous round of mask area area change rate This is used to dynamically evaluate the gain effect of expanding the detection box on the segmentation results; the rate of change This serves as the quantitative basis for determining whether the mask area in S6 tends to flatten out, thus terminating the iteration.

[0068] S5. Perform a scale expansion operation on the current detection box to generate an expanded detection box, and reconstruct the segmentation prompt information based on the expanded detection box; repeat S3 to S5 to form an iterative regularization process that combines detection box expansion with segmentation result evaluation.

[0069] The preferred method for generating the extended detection box is to take the center of the initial two-dimensional detection box as the origin and then... According to the set step size Expand the boundary to generate an extended detection box. An expanded detection box containing more contextual information.

[0070] During the iteration process, the SAM3 Text Prompt interface is used to perform semantic text-assisted guided multimodal enhancement.

[0071] Semantic matching: Based on the detected fine-grained features, text descriptions such as "cargo extending backward", "irregular stacking", and "cylindrical timber" are automatically extracted from the preset semantic library.

[0072] Fusion Correction: Text-guided vectors and extended detection box features are fused within SAM3. TextPrompt guides the model to pay more attention to irregular edges that extend beyond the detection box boundaries during spatial feature extraction, thereby correcting contour truncation caused by abnormal cargo shapes.

[0073] S6. Determine whether the preset iteration termination condition is met. If it is met, output the final outer contour segmentation mask of the target freight vehicle; otherwise, repeat S3 to S5 until the iteration terminates.

[0074] The above iteration termination condition is that, provided the mask area coverage ratio is not higher than a set ratio threshold, the mask area change rate does not exceed a set area change threshold (e.g., ...). (or until the maximum number of iterations is reached.)

[0075] The aforementioned mask area change rate is also the mask area change rate between two adjacent iterations. When satisfied Or reach the maximum number of iterations Stop iterating when the time is right.

[0076] Post-processing: cv2.findContours is used to extract closed curves from the high-probability mask output by SAM3, and cv2.approxPolyDP is used to smooth the edges, outputting the final stable segmentation result.

[0077] In this embodiment, the final output of the freight vehicle's outer contour segmentation result is used as the underlying data to connect with subsequent business processes, such as vehicle 3D detection box construction, 3D size recognition, and size over-limit prediction.

[0078] This invention can effectively solve the problems of outline truncation and missing segmentation caused by cargo overhang and irregular stacking. It achieves fine extraction of the outline of freight vehicles under complex loading conditions without retraining the model, and has extremely high engineering practicality and robustness.

[0079] The present invention also provides a storage medium, wherein the computer program stored in the storage medium executes the above-described method for segmenting the outer contour of freight vehicles based on iterative regularization of detection boxes and text prompts when running.

[0080] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above-described method for segmenting the outer contour of a freight vehicle based on iterative regularization of detection boxes and text prompts via the computer program.

[0081] The preferred embodiments of the present invention have been described in detail above. However, the present invention is not limited to the specific details in the above embodiments. Within the scope of the technical concept of the present invention, various equivalent transformations can be made to the technical solutions of the present invention, and these equivalent transformations all fall within the protection scope of the present invention.

Claims

1. A method for segmenting the outer contour of freight vehicles based on iterative regularization of detection boxes and text prompts, characterized in that: include: S1. Acquire the video stream captured by the traffic monitoring camera, and preprocess the video stream to obtain a video frame sequence; S2. From the video frame sequence, locate the moving freight vehicle using a target detection model to obtain the initial two-dimensional detection box of the target freight vehicle; S3. Generate the first round of segmentation prompt information based on the initial two-dimensional detection box, merge the segmentation prompt information with the preset semantic text prompt to form fused segmentation prompt information, and input it into the visual segmentation basic model to perform pixel-level segmentation of the target freight vehicle and obtain the corresponding initial segmentation mask of the vehicle's outer contour. S4. Calculate the area ratio of the initial segmentation mask of the vehicle's outer contour to the area of ​​the initial two-dimensional detection box, and dynamically evaluate the completeness of the segmentation result; If the area ratio does not meet the preset integrity condition, step S5 is executed; Otherwise, proceed to S6; S5. Perform a scale expansion operation on the current detection box to generate an expanded detection box, and reconstruct the segmentation prompt information based on the expanded detection box; Repeat steps S3 to S5 to form an iterative regularization process that combines detection box expansion with segmentation result evaluation; S6. Determine whether the preset iteration termination condition is met. If it is met, output the final outer contour segmentation mask of the target freight vehicle. Otherwise, repeat S3 to S5 until the iteration terminates.

2. The method for segmenting the outer contour of freight vehicles based on iterative regularization of detection boxes and text prompts according to claim 1, characterized in that: In S1, the preprocessing includes: using the intrinsic parameter matrix and distortion coefficients of the traffic monitoring camera to perform image distortion correction using the cv2.undistort function; using the cv2.fillPoly function to extract the effective monitoring area based on the scene topology; and using bilinear interpolation to unify the image scale.

3. The method for segmenting the outer contour of freight vehicles based on iterative regularization of detection boxes and text prompts according to claim 1, characterized in that: In S2, the method for obtaining the initial two-dimensional detection box through the object detection model includes: S2-1. Input the video frame sequence output by S1 into the trained target detection model to obtain a coarse candidate target set for freight vehicles. Each coarse candidate target for freight vehicles includes at least a category label, confidence score, and corresponding two-dimensional bounding box information. S2-2. Apply both category restrictions and confidence level filtering to the coarse candidate freight vehicles output in step S2-1, retaining only those classified as "trucks" with a confidence level not lower than a preset threshold. The detection results yield a set of candidate freight vehicle targets; each candidate freight vehicle target includes at least the corresponding two-dimensional bounding box information. S2-3. For any candidate target i of a freight vehicle, output its corresponding initial two-dimensional detection box. ;in and These represent the pixel coordinates of the top left and bottom right corners of the initial 2D detection box in the image coordinate system, respectively. A unique target identifier is assigned to each initial 2D detection box for target association and state maintenance in subsequent segmentation iterations.

4. The method for segmenting the outer contour of freight vehicles based on iterative regularization of detection boxes and text prompts according to claim 1, characterized in that: In S3, the method for obtaining the initial segmentation mask of the vehicle's outer contour includes: S3-1. The initial two-dimensional detection box is transformed into visually guided segmentation prompts, and the text description information is transformed into semantic text prompts through a text encoder. The segmentation prompts and semantic text prompts are fused using a cross-attention mechanism to form fused segmentation prompts, which are then input into the prompt encoding module of the visual segmentation base model. The segmentation prompts include point prompts based on the center point of the detection box or shape prompts based on the boundary of the detection box. S3-2, The decoder of the visual segmentation basic model retrieves target pixels in the image feature map based on the fused segmentation cue information. By calculating the correlation density between the target pixels and the segmentation cue information, it generates the corresponding initial segmentation mask for the vehicle's outer contour. .

5. The method for segmenting the outer contour of freight vehicles based on iterative regularization of detection boxes and text prompts according to claim 4, characterized in that: In S3, semantic text prompts are obtained by matching the cargo type information of the target freight vehicle from a preset cargo type text prompt library, including one or a combination of container, bulk stack, plate, cylindrical and bagged cargo types; the fusion segmentation prompt information focuses on the visual features of irregular stacks, cargo that extends backward or laterally, thereby correcting the missing segmentation edges caused by abnormal cargo shape.

6. The method for segmenting the outer contour of freight vehicles based on iterative regularization of detection boxes and text prompts according to claim 1, characterized in that: In S4, the dynamic evaluation includes absolute integrity evaluation and relative improvement evaluation: the former is based on the preset integrity condition of the current round. Mask area coverage ratio The mask area coverage ratio does not exceed a set ratio threshold; where the mask area coverage ratio... The ratio of the area of ​​the initial segmentation mask for the vehicle's outer contour to the area of ​​the initial two-dimensional detection box. If If the ratio exceeds the set threshold, it is determined that the mask may be physically truncated due to the detection box being too narrow, triggering S5 to perform two-dimensional detection box scale expansion; The relative improvement assessment is mainly conducted in subsequent segmentation rounds by comparing the current mask area. Compared to the previous round of mask area area change rate This is used to dynamically evaluate the gain effect of expanding the detection box on the segmentation results; the area change rate This serves as the quantitative basis for determining whether the mask area in S6 tends to flatten out, thus terminating the iteration.

7. The method for segmenting the outer contour of freight vehicles based on iterative regularization of detection boxes and text prompts according to claim 6, characterized in that: In S6, the iteration termination condition is that, provided the mask area coverage ratio is not higher than a set ratio threshold, the mask area change rate does not exceed a set area change threshold or the set maximum number of iterations is reached.

8. The method for segmenting the outer contour of freight vehicles based on iterative regularization of detection boxes and text prompts according to claim 1, characterized in that: In S5, the method for generating the expanded detection box is as follows: taking the center of the initial two-dimensional detection box as the origin, and expanding the current detection box... Expand the boundary outward according to the set step size to generate an expanded detection box. An expanded detection box containing more contextual information.

9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the freight vehicle outer contour segmentation method based on iterative regularization of detection boxes and text prompts as described in any one of claims 1-8.

10. An electronic device, characterized in that: Includes the storage medium as described in claim 9.