A traffic scene-oriented lightweight visual language large model construction method
By using progressive generation and traffic physics discriminator scoring, combined with a visual language learning architecture and quantized perceptual distillation, the shortcomings of long-tail scene recognition and model deployment problems are solved, achieving lightweight and efficient recognition of large visual language models for traffic scenes.
Patent Information
- Application Number
- CN202611040666.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-14
- Publication Date
- 2026-11-27
AI Technical Summary
Existing large-scale visual language models for traffic scenarios lack sufficient generalization ability in long-tail scenarios such as extreme rain and snow, backlighting, landslides, and severe occlusion. Furthermore, the large number of model parameters makes them difficult to deploy on edge road perception terminals.
By acquiring traffic scene conditional labels and encoding them into conditional embedding vectors, a diffusion model is used for progressive generation, combined with traffic physics discriminator scoring, to generate long-tail traffic scene samples; a learning architecture consisting of a visual encoder, a gating fusion module, and a hierarchical semantic decoder is built for traffic domain adaptation training; structured pruning and quantized perceptual distillation are performed to obtain a lightweight visual language model.
It enables the generation of physically plausible traffic scene samples and the lightweight deployment of models, improving the accuracy and real-time performance of traffic scene recognition at the edge.
Smart Images

Figure CN123181982A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of intelligent transportation and deep learning, and discloses a lightweight visual language large model construction method for traffic scenarios. Background Technology
[0002] With the rapid development of intelligent transportation systems, structured semantic understanding of traffic scenarios based on large visual language models has become an important means to improve road perception capabilities. By deploying visual perception devices and constructing large visual language models in traffic scenarios, it is possible to comprehensively identify and analyze weather conditions, lighting conditions, target attributes, and event risks in traffic scenarios, providing technical support for intelligent traffic management.
[0003] Currently, existing methods for constructing large-scale visual language models for traffic scenes typically rely on training with general-purpose scene datasets or simply fine-tuning pre-trained general-purpose visual language models based on publicly available image and text datasets. In complex traffic scenarios, long-tail scene samples, such as those from extreme rain and snow, backlighting, landslides, and severe occlusion, are severely lacking, resulting in significantly insufficient generalization ability of models in these critical scenarios. While existing generation methods can augment data, the generated traffic scene images often suffer from physical inconsistencies such as lane line distortion and vehicle overlap, making them unsuitable for direct model training. Furthermore, large-scale visual language models for traffic scenes have a massive parameter scale and high computational cost, making direct deployment on edge road perception terminals difficult. Summary of the Invention
[0004] In view of this, this application provides a lightweight visual language large model construction method for traffic scenarios, so as to realize the physical rationality generation of long-tail traffic scenario samples and the lightweight deployment of visual language large models, thereby improving the accuracy and real-time performance of traffic scenario recognition at the edge.
[0005] The first aspect of this application provides a lightweight visual language large model construction method for traffic scenarios, characterized by comprising: Obtain traffic scene condition labels, encode them into conditional embedding vectors, and obtain basic scene samples. Input the conditional embedding vectors and basic scene samples into the diffusion model, use the basic scene samples as the initial noise distribution to perform progressive generation, and use the traffic physics discriminator embedded in the diffusion model to score the physical rationality of the generated image output by the diffusion model in the current step during the progressive generation process. Adjust the parameter update direction of the diffusion model according to the physical rationality score, and output a long-tail traffic scene sample set. A visual language learning architecture consisting of a visual encoder, a gated fusion module, and a hierarchical semantic decoder is constructed. The visual language learning architecture is adapted and trained for the traffic domain using a long-tail traffic scene sample set to obtain a large visual language model specifically for traffic scene recognition. Structural pruning is performed on the large visual language model to obtain a sparse model. The structural pruning is based on the contribution sensitivity of each channel in the large visual language model to the traffic scene recognition accuracy. Channels with contribution sensitivity lower than the first preset threshold are removed and channels with contribution sensitivity higher than the second preset threshold are retained. Quantization-aware distillation is performed on the sparse model to obtain a lightweight visual language model adapted to edge low-computing-power hardware deployment. Quantization-aware distillation uses the large visual language model as the teacher model and the sparse model as the student model, and optimizes the parameters of the student model with distillation loss that includes quantization adaptation loss.
[0006] Optionally, the traffic scene condition labels include weather type, light intensity, occlusion degree and event category, where the occlusion degree is the target occlusion level or target occlusion ratio preset when generating the sample.
[0007] Optionally, traffic scene condition labels are encoded into conditional embedding vectors, including: Illumination intensity is mapped to a modulation vector through a continuous normalized flow, and weather type and event category are mapped to an embedding vector through a learnable embedding table. Occlusion degree is mapped to a modulation tensor through spatial attention.
[0008] Optional, progressive generation includes: Using basic scene samples as the initial noise distribution, conditions are progressively superimposed from high to low according to event category, weather type, light intensity, and occlusion degree to generate extreme combination scene samples: The component corresponding to the event category in the embedding vector is input into the diffusion model, and the event category condition is superimposed on the basic scene sample to output the first intermediate sample containing the event features. The weather type component in the embedded vector is input into the diffusion model. The first intermediate sample is used as the initial noise distribution, and the weather type condition is superimposed to output the second intermediate sample containing event features and weather features. The adjustment vector and modulation tensor are input into the diffusion model. The second intermediate sample is used as the initial noise distribution, and the illumination intensity condition and occlusion degree condition are superimposed to output the extreme combination scene sample.
[0009] Optionally, the traffic physics discriminator has a built-in traffic physics rule library, which includes lane line constraint rules, vehicle spacing constraint rules, traffic light-motion state consistency rules, and weather-road surface reflection feature consistency rules. During the progressive generation process, the traffic physics discriminator performs a weighted synthesis of the degree of conformity of the generated image output by the diffusion model in the current step under each traffic physics rule, and outputs a physical rationality score; the generated image includes the first intermediate sample, the second intermediate sample, and extreme combination scenario samples; The traffic physics discriminator converts the physical rationality score into a feedback signal, which is superimposed on the gradient update of the current step of the diffusion model to correct the sampling path of the current step. The feedback signal is continuously applied in each iteration of the progressive generation process until the physical rationality score reaches a preset threshold. At this point, the diffusion model stops the current generation step and outputs a long-tail traffic scene sample set.
[0010] Optionally, a visual language learning architecture is constructed, consisting of a visual encoder, a gated fusion module, and a hierarchical semantic decoder cascaded sequentially, including: A visual encoder, a gated fusion module, and a hierarchical semantic decoder are constructed respectively. The visual encoder is a Transformer visual backbone network used to encode the input traffic image into a visual feature map carrying spatial and channel information. The gated fusion module includes a global pooling layer, a multilayer perceptron, and a gated weight generation layer, which is used to perform channel-level attention filtering on the visual feature map. The hierarchical semantic decoder is an autoregressive Transformer decoder used to parse the filtered visual features hierarchically and output three layers of structured traffic semantics. The output of the visual encoder is connected to the input of the gated fusion module, and the output of the gated fusion module is connected to the input of the hierarchical semantic decoder, forming a data flow path that is cascaded among the three, thus completing the construction of the visual language learning architecture.
[0011] Optionally, the visual language learning architecture can be trained for traffic domain adaptation using a long-tail traffic scene sample set, including: Three-layer structured traffic semantic annotations (scene-level, target-level, and event-level) are configured for each image in the long-tail traffic scene sample set; Load pre-trained weights from a general image and text dataset into the visual encoder and hierarchical semantic decoder, and randomly initialize the parameters of the gated fusion module; The images in the long-tail traffic scene sample set are input into the visual language learning architecture. The forward propagation outputs a predicted three-level traffic semantic description. The scene-level, target-level, and event-level losses are calculated by combining the real annotations and weighted to obtain the comprehensive loss. The parameters of all modules in the architecture are updated by backpropagation based on the comprehensive loss, and the training is iterated until the loss on the validation set converges, resulting in a large visual language model specifically for traffic scene recognition.
[0012] Optionally, perform structured pruning on the large visual language model to obtain a sparse model, including: Images from the long-tail traffic scene sample set are input into the visual language large model to complete forward propagation and obtain the comprehensive loss of traffic scene recognition. Backpropagation is used to solve the gradient of the loss function with respect to the activation values of each channel, and the absolute value of the gradient is taken as the sensitivity of the corresponding channel to the contribution of the traffic scene recognition accuracy. Set a double threshold where the value is greater than the second preset threshold and the value is greater than the first preset threshold. Classify the channel type according to the contribution sensitivity of each channel: channels with contribution sensitivity lower than the first preset threshold are judged as low contribution channels and removed. Channels with contribution sensitivity higher than the second preset threshold are judged as high contribution channels and retained. Medium contribution channels between the two thresholds are not forcibly removed or retained. By adopting a channel-level structured pruning method, after removing low-contribution channels, the number of remaining channels after pruning is constrained to match the parallel computing width of the target edge hardware. By using a long-tail traffic scenario sample set to fine-tune the pruned network and compensate for the accuracy loss caused by pruning, a sparse model is obtained.
[0013] Optionally, quantization-aware distillation is performed on the sparse model to obtain a lightweight visual language model adapted for low-computing-power edge hardware deployments, including: The visual language model is used as the teacher model, and the sparse model is used as the student model. Images from the long-tail traffic scene sample set are input into the teacher model and the student model respectively. Pseudo-quantization nodes are inserted into the forward propagation of the student model to simulate the impact of quantization operation on the numerical accuracy of the feature map. Calculate distillation losses, which include: KL divergence loss between student model output and teacher model output; Mean squared error loss between intermediate layer features of the student model and intermediate layer features of the teacher model; The difference between the student model's output under the state of inserting pseudo-quantization nodes and the state of removing pseudo-quantization nodes is used as the quantization adaptation loss. The weighted summation of KL divergence loss, mean square error loss and quantization fit loss yields the comprehensive distillation loss. The parameters of the student model are updated by backpropagation based on the comprehensive distillation loss, and the model is iteratively trained until convergence to obtain a lightweight visual language model that is adapted to edge low-computing-power hardware deployment.
[0014] Optional, in the three-layer structured traffic semantic annotation of scene-level, target-level, and event-level: Scene-level annotations include weather type, lighting conditions, road type, and congestion level; Target-level annotations include the location coordinates, category labels, size information, color attributes, and direction of movement of traffic participants; Event-level annotations include types of illegal events and types of environmental risks, and the content of event-level annotations is related to the output results of scenario-level annotations and target-level annotations.
[0015] In summary, due to the adoption of the above technical solutions, the beneficial effects of the present invention include at least the following: This invention addresses the scarcity of long-tail scene samples by progressively generating extreme conditions based on events, weather, lighting, and occlusion. Real-time scoring feedback from a physical discriminator with a built-in traffic physics rule base ensures that generated samples conform to traffic physics laws such as lane line constraints, vehicle spacing constraints, traffic light-motion consistency, and weather-road reflection consistency. A cascaded architecture of a visual encoder, gating fusion module, and hierarchical semantic decoder is built, utilizing long-tail sample sets for adaptive training, enabling the model to output end-to-end three-layer structured traffic semantic descriptions. The model volume is compressed by calculating the sensitivity of each channel contribution and pruning using a dual-threshold strategy. Quantization-perceptual distillation optimizes the student model with three distillation losses including KL divergence loss, mean squared error loss, and quantization adaptation loss, making the lightweight model suitable for low-computing-power edge deployments. This invention effectively solves the problems of data scarcity in long-tail scenes, unreasonable physical generated samples, and the difficulty of deploying large models at the edge, improving the accuracy and real-time performance of traffic scene recognition at the edge. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0017] Figure 1 A flowchart of the method provided by the present invention; Figure 2 This invention provides a flowchart of the structured pruning and quantitative sensing distillation process. Detailed Implementation
[0018] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0019] In this application, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.
[0020] As can be seen from the above background technology, the lack of long-tail traffic scene samples, insufficient physical rationality of generated samples, and the difficulty in deploying large visual language models at the edge are the three major technical challenges currently facing intelligent recognition technology for traffic scenes.
[0021] In existing technologies, large-scale visual language models for traffic scenarios typically rely on publicly available datasets of general scenarios for training, or on pre-trained general visual language models based on publicly available image and text datasets for simple fine-tuning. However, general scenario datasets lack coverage of long-tail scenarios such as extreme rain and snow, backlighting, landslides, and severe occlusion, resulting in severely insufficient generalization ability of models in these critical scenarios. Although existing technologies include data augmentation methods based on diffusion models or generative adversarial networks, the generated traffic scene images often exhibit physical irregularities such as distorted lane lines, overlapping vehicles, unreasonable vehicle spacing, and contradictions between traffic lights and vehicle motion states, making them unsuitable for direct model training. Furthermore, large-scale visual language models for traffic scenarios require a large number of parameters and high computational cost to achieve semantic understanding of complex scenarios, making them difficult to deploy directly on low-computing-power hardware devices such as edge road perception terminals, thus limiting their real-time application in actual traffic scenarios. Therefore, how to generate physically plausible long-tail traffic scene samples and achieve lightweight deployment of large-scale visual language models is a pressing technical problem to be solved in this field.
[0022] Therefore, this application provides a lightweight visual language large model construction method for traffic scenarios, such as... Figure 1 and Figure 2 As shown, the method includes steps S101 to S104: S101: Obtain traffic scene condition labels, encode the traffic scene condition labels into condition embedding vectors, and obtain basic scene samples. Input the condition embedding vectors and the basic scene samples into the diffusion model, use the basic scene samples as the initial noise distribution to perform progressive generation, and use the traffic physics discriminator embedded in the diffusion model to score the physical rationality of the generated image output by the diffusion model in the current step during the progressive generation process. Adjust the parameter update direction of the diffusion model according to the physical rationality score, and output a long-tail traffic scene sample set.
[0023] Step S101 specifically includes the following sub-steps S1011 to S1014: S1011: Obtain traffic scene condition labels and encode them into conditional embedding vectors.
[0024] Traffic scene condition labels are obtained, which include four dimensions: weather type, light intensity, occlusion degree, and event category. The occlusion degree is a preset target occlusion level or target occlusion ratio when generating samples, rather than a label identified from the image. Light intensity (numerical condition) is mapped to a modulation vector using a continuous normalized flow; weather type and event category (categorical condition) are mapped to an embedding vector using a learnable embedding table; and occlusion degree (spatial condition) is mapped to a modulation tensor using spatial attention.
[0025] It should be noted that the continuous normalization flow maps scalar illumination intensity values to high-dimensional vectors through a series of invertible transformations, so that the continuous changes in illumination intensity are smoothly expressed in the embedding space; the learnable embedding table assigns a dense vector of fixed dimension to each category and is continuously optimized through training; spatial attention generates a modulation tensor aligned with the spatial dimension of the image feature map by calculating the attention weight between the occlusion region mask and the feature map.
[0026] S1012: Obtain basic scene samples.
[0027] A batch of normal traffic scene samples were obtained as the base scene samples. The base scene samples are ordinary traffic scene images that do not contain extreme weather, extreme lighting, occlusion, or special events, such as urban road scenes with clear daytime conditions, no obstructions, and normal traffic.
[0028] It should be noted that using basic scene samples instead of standard Gaussian noise as the initial noise distribution for the diffusion model ensures that the starting point of generation retains the basic structure and texture features of the real traffic scene, thereby improving the realism of the generated samples.
[0029] S1013: Perform progressive generation of the conditional embedding vector and the base scene sample input diffusion model.
[0030] The conditional embedding vector and the base scene sample are input into the diffusion model, and progressive generation is performed using the base scene sample as the initial noise distribution. The progressive generation adds conditions in descending order of event category, weather type, light intensity, and occlusion degree to generate extreme combination scene samples. Specifically, the component of the embedding vector corresponding to the event category is input into the diffusion model, and event category conditions are added to the base scene sample to output a first intermediate sample containing event features; the component of the embedding vector corresponding to the weather type is input into the diffusion model, and weather type conditions are added to the first intermediate sample as the initial noise distribution to output a second intermediate sample containing event features and weather features; the adjustment vector and the modulation tensor are input into the diffusion model, and light intensity and occlusion degree conditions are added to the second intermediate sample as the initial noise distribution to output the extreme combination scene sample.
[0031] The adjustment vector, the embedding vector, and the modulation tensor are input to the corresponding feature layers at different depths within the diffusion model network structure. Specifically, the adjustment vector (derived from illumination intensity) is injected into the shallow feature layers of the UNet to regulate the low-level visual features of the generated image, such as global brightness and contrast; the embedding vector (derived from weather type and event category) is injected into the intermediate layers of the UNet to control the presence or absence of target categories in the scene and their semantic attributes; and the modulation tensor (derived from occlusion degree) is injected into the deep feature layers of the UNet to regulate the spatial layout and local occlusion areas in the generated image.
[0032] S1014: Utilize traffic physics discriminator to adjust the generation process through real-time scoring feedback.
[0033] During the progressive generation process, a traffic physics discriminator embedded in the diffusion model is used to score the physical plausibility of the generated image output by the current step of the diffusion model, and the parameter update direction of the diffusion model is adjusted according to the physical plausibility score.
[0034] The traffic physics discriminator has a built-in traffic physics rule library, which includes lane line constraint rules, vehicle spacing constraint rules, traffic light-motion state consistency rules, and weather-road surface reflection feature consistency rules. In each denoising iteration of the progressive generation process, the traffic physics discriminator performs a weighted synthesis of the degree of conformity of the generated image output by the diffusion model in the current step under each traffic physics rule, and outputs a physical rationality score.
[0035] Optionally, the physical rationality score is expressed as: in, To generate the image in the first The compliance score under each physical rule. The weight coefficients of the corresponding rules satisfy the following conditions: .
[0036] The traffic physics discriminator converts the physical rationality score into a feedback signal, which is then superimposed on the gradient update of the current step of the diffusion model to correct the sampling path of the current step. The feedback signal is continuously applied in each iteration of the progressive generation process until the physical rationality score reaches a preset threshold. At this point, the diffusion model stops the current generation step and outputs the long-tail traffic scene sample set.
[0037] Optionally, the feedback signal is represented as: in, This represents the original gradient update direction of the diffusion model. The gradient of the physical plausibility score with respect to the model parameters. This is the balance coefficient.
[0038] Optionally, the preset threshold is set according to the actual application scenario. In this embodiment, the preset threshold is set to 0.75, that is, when the physical rationality score reaches 0.75 or above, it is determined that the currently generated image meets the requirements of traffic physical laws, the diffusion model stops the current generation step and outputs the current intermediate sample. If the score is still below 0.75 after multiple iterations, the current step is forcibly terminated and the sample is discarded. It should be noted that this threshold is only an illustrative example and can be adjusted according to the complexity of the traffic scenario and the generation quality requirements in actual applications. For example, it can be set to 0.70 in simple scenarios and 0.80 in complex scenarios.
[0039] In some embodiments, the generated image includes the images output at each step of the generation process corresponding to the first intermediate sample, the second intermediate sample, and the extreme combination scenario sample. The physics discriminator intervenes throughout the three-step generation process, rather than just in the last step, ensuring that the intermediate samples output at each step conform to traffic physics laws.
[0040] S102: Construct a visual language learning architecture consisting of a visual encoder, a gating fusion module, and a hierarchical semantic decoder cascaded in sequence. Use the long-tail traffic scene sample set to perform traffic domain adaptation training on the visual language learning architecture to obtain a large visual language model specifically for traffic scene recognition.
[0041] Step S102 specifically includes the following sub-steps S1021 to S1024: S1021: Construct three modules respectively.
[0042] A visual encoder, a gated fusion module, and a hierarchical semantic decoder are constructed. The visual encoder is a Transformer visual backbone network used to encode the input traffic image into a visual feature map carrying spatial and channel information. The gated fusion module includes a global pooling layer, a multilayer perceptron, and a gated weight generation layer, used to perform channel-level attention filtering on the visual feature map. The hierarchical semantic decoder is an autoregressive Transformer decoder used to parse the filtered visual features hierarchically and output three layers of structured traffic semantics.
[0043] S1022: Establish cascading connections between modules.
[0044] The output of the visual encoder is connected to the input of the gated fusion module, and the output of the gated fusion module is connected to the input of the hierarchical semantic decoder, forming a data flow path that is cascaded among the three, thus completing the construction of the visual language learning architecture.
[0045] S1023: Configure three-layer structured traffic semantic annotation.
[0046] A three-tiered structured traffic semantic annotation system—scene-level, target-level, and event-level—is configured for each image in the long-tail traffic scene sample set. The scene-level annotation includes weather type, lighting conditions, road type, and congestion level; the target-level annotation includes the location coordinates, category label, size information, color attributes, and direction of movement of traffic participants; and the event-level annotation includes the type of violation and the type of environmental risk. The content of the event-level annotation is correlated with the output results of the scene-level annotation and the target-level annotation.
[0047] S1024: Conduct adaptation training in the transportation sector.
[0048] Pre-trained weights from a general image-text dataset (such as weight parameters pre-trained on large-scale image-text data by CLIP, LLaVA, etc.) are loaded onto the visual encoder and hierarchical semantic decoder, while the parameters of the gating fusion module are randomly initialized. Images from the long-tail traffic scene sample set are input into the visual language learning architecture. The images first enter the visual encoder, and after multi-layer self-attention calculation and feedforward network processing, a visual feature map is output. The visual feature map is passed to the gating fusion module for global pooling, multi-layer perceptron transformation, and gating weight generation. It is then multiplied channel-by-channel with the original feature map to complete channel-level attention filtering. After filtering, the visual features are passed to the hierarchical semantic decoder, which outputs the predicted three-level traffic semantic description in the order of "scene level → target level → event level" through autoregressive generation.
[0049] By combining real-world annotations, the scene-level loss, target-level loss, and event-level loss are calculated separately, and then weighted to obtain the comprehensive loss. The comprehensive loss is expressed as: in, These are the weighting coefficients for each type of loss. The scene-level classification loss is calculated by summing or averaging the cross-entropy loss for weather type, lighting conditions, road type, and congestion level. The target-level loss is a weighted sum of the regression loss of position coordinates and the classification loss of attributes such as category, size, color, and direction of motion. The event-level classification loss is calculated by summing or averaging the cross-entropy loss for each type of illegal event and environmental risk.
[0050] The parameters of all modules in the architecture are updated by backpropagation based on the comprehensive loss, and the training is iterated until the loss on the validation set converges, resulting in a large visual language model specifically for traffic scene recognition.
[0051] Optionally, the weighting coefficients of the scene-level loss, target-level loss, and event-level loss... In this embodiment, they are respectively set as The scene-level loss weights are slightly lower than the target-level loss because the target-level loss includes both location regression and attribute classification, and its accuracy has a greater impact on the overall model performance. It should be noted that the above weight coefficients can be adjusted according to the emphasis required for the semantic description accuracy at different levels in specific application scenarios. For example, in a scenario focused on monitoring illegal activities, the weights can be adjusted accordingly. Increase it appropriately to 0.4.
[0052] S103: Perform structured pruning on the large visual language model to obtain a sparse model.
[0053] Step S103 specifically includes the following sub-steps S1031 to S1034: S1031: Calculate the contribution sensitivity of each channel.
[0054] The images from the long-tail traffic scene sample set are input into the visual language large model to complete forward propagation, obtaining the comprehensive loss for traffic scene recognition. Backpropagation is then performed to calculate the gradient of the loss function with respect to the activation values of each channel, and the absolute value of the gradient is taken as the sensitivity of the corresponding channel's contribution to the accuracy of traffic scene recognition. The sensitivity of the $i$-th channel is expressed as: in, To identify comprehensive losses in traffic scenarios, For the first The activation values of each channel. The larger the absolute value of the gradient, the more sensitive the activation value of that channel is to the loss function, meaning that the channel is more important for the model to maintain the accuracy of traffic scene recognition.
[0055] S1032: Set dual thresholds and classify channel types.
[0056] Set a double threshold where the value is greater than the second preset threshold. Based on the contribution sensitivity of each channel. Channel type classification: like The channel was identified as having low contribution and was removed. like The channel was identified as a high-contribution channel and retained in its entirety; like It is determined to be a medium-contribution channel and will not be subject to mandatory removal or retention.
[0057] Optionally, the specific values of the first preset threshold and the second preset threshold are determined comprehensively based on the total number of channels in the model, the target compression ratio, and the accuracy performance of the validation set. In this embodiment, the contribution sensitivity of each channel is normalized to the [0,1] interval, the first preset threshold is set to 0.15, and the second preset threshold is set to 0.45. That is, channels with a contribution sensitivity lower than 0.15 are judged as low contribution channels and are removed, channels with a contribution sensitivity higher than 0.45 are judged as high contribution channels and are forcibly retained, and medium contribution channels between 0.15 and 0.45 are not forcibly processed and are retained for the next stage of evaluation. It should be noted that the above values are only illustrative examples and can be adjusted according to the model size and hardware constraints in actual applications.
[0058] S1033: Perform channel-level structured pruning and hardware adaptation.
[0059] A channel-level structured pruning method is employed. After removing low-contribution channels, the number of remaining channels after pruning is constrained to match the parallel computing capacity of the target edge hardware. For example, it ensures that the number of channels after pruning is an integer multiple of the parallel computing granularity that the target hardware can efficiently support.
[0060] S1034: Fine-tuning to restore accuracy after pruning.
[0061] The pruned network is fine-tuned and trained using the long-tail traffic scenario sample set to compensate for the accuracy loss caused by pruning, resulting in a sparse model.
[0062] S104: Perform quantization-perceptual distillation on the sparse model to obtain a lightweight visual language model adapted to edge low-computing-power hardware deployment.
[0063] Step S104 specifically includes the following sub-steps S1041 to S1043: S1041: Establish a teacher-student distillation framework.
[0064] The large visual language model is used as the teacher model, and the sparse model is used as the student model.
[0065] S1042: Insert a pseudo-quantization node and calculate the three-term distillation loss.
[0066] Images from the long-tail traffic scene sample set are input into the teacher model and the student model, respectively. A pseudo-quantization node is inserted into the forward propagation of the student model to simulate the impact of quantization operations on the numerical accuracy of the feature map.
[0067] Calculate distillation losses, which include: (1) The KL divergence loss between the student model output and the teacher model output: in, The output probability distribution of the student model. This represents the output probability distribution of the teacher model.
[0068] (2) Mean squared error loss between the intermediate features of the student model and the intermediate features of the teacher model: in, and The student model and the teacher model are respectively the first Intermediate features of the layer This represents the number of intermediate feature layers.
[0069] (3) The difference between the output of the student model in the state of inserting pseudo-quantization nodes and the state of removing pseudo-quantization nodes is taken as the quantization adaptation loss: in, This is the output of the student model when pseudo-quantization nodes are inserted. This is the output of the student model after removing pseudo-quantized nodes. This loss term explicitly constrains the accuracy loss caused by quantization operations, allowing the model to be aware of quantization errors during the training phase.
[0070] S1043: Weighted summation is used to obtain the comprehensive distillation loss and iterative updates are performed.
[0071] The weighted sum of the KL divergence loss, the mean square error loss, and the quantization fit loss yields the comprehensive distillation loss: in, Let be the weighting coefficients for each loss, satisfying... .
[0072] The parameters of the student model are updated by backpropagation based on the comprehensive distillation loss, and the training is iterated until convergence to obtain a lightweight visual language model adapted to edge low-computing-power hardware deployment.
[0073] Optionally, the weighting coefficients of the KL divergence loss, the mean square error loss, and the quantization adaptation loss... In this embodiment, they are respectively set as The KL divergence loss has a slightly higher weight than the other two values because the alignment of the output layer probability distribution has the most direct impact on the final model performance. It should be noted that the above weight coefficients can be adjusted according to the number of quantization bits and hardware requirements. For example, when the number of quantization bits is low, the weight γ3 of the quantization adaptation loss can be appropriately increased to 0.4 to enhance the perception and compensation of quantization errors.
[0074] Optionally, the number of quantization bits for the pseudo-quantization node is configured according to the computing power specifications of the target edge hardware. For low-computing-power edge hardware (such as Jetson Nano), the quantization precision is configured to 8-bit fixed-point; for medium-to-high-computing-power edge hardware (such as Jetson Orin), the quantization precision can be configured to 16-bit fixed-point.
[0075] In some embodiments, after deploying the lightweight visual language model on an edge road perception terminal, visual features of consecutive frame images are extracted and input into a temporal Transformer model to output traffic risk behavior prediction results. These prediction results include the probability of rear-end collision, the probability of collision, and the probability of illegal lane changing. The consecutive frame images are extracted by sliding sampling within a fixed time window (e.g., 3 seconds). After visual features are extracted from each frame image using the lightweight visual language model, they are sequentially stitched together and input into a temporal Transformer model for temporal modeling, outputting the probability of occurrence of various traffic risks.
[0076] like Figure 2 The diagram illustrates the flowchart of the two stages of structured pruning and quantization-perceptual distillation in this invention. In the structured pruning stage, the large visual language model serves as input. Through channel sensitivity calculation and a dual-threshold pruning strategy, low-contribution channels are pruned, high-contribution channels are retained, and medium-contribution channels are selectively processed, outputting a sparse model. In the quantization-perceptual distillation stage, the large visual language model serves as the teacher model, and the sparse model serves as the student model. A pseudo-quantization node is inserted during the forward propagation of the student model. Three losses—KL divergence loss, feature mean squared error loss, and quantization adaptation loss—are calculated, weighted, and summed to obtain the comprehensive distillation loss. After iterative optimization, a lightweight visual language model is output.
[0077] Optionally, the criterion for "convergence of the validation set loss during iterative training" is as follows: Calculate the comprehensive loss value on the validation set. If the loss value decreases by less than 0.5% for 10 consecutive iterations, the model is considered to have converged, and training is stopped. It should be noted that this convergence condition is only an illustrative example and can be adjusted according to the model size, sample set size, and training time requirements in practical applications.
[0078] It should be noted that the numbering of the above method steps is only used to distinguish different processing stages and does not constitute an absolute limitation on the execution order of each step. In actual implementation, steps S101 to S104 are executed sequentially as described above to complete the entire process from long-tail sample generation to lightweight model deployment. The long-tail traffic scene sample set generated in step S101 serves as the training data for adaptation training in step S102; the large visual language model trained in step S102 serves as the object of structured pruning in step S103; the sparse model obtained in step S103 serves as the student model for quantization perceptual distillation in step S104; each step is sequentially connected, forming a complete technical chain.
[0079] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.
[0080] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
[0081] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A lightweight visual language large model construction method for traffic scenarios, characterized in that, include: Traffic scene condition labels are obtained, and the traffic scene condition labels are encoded into condition embedding vectors. Basic scene samples are obtained, and the condition embedding vectors and the basic scene samples are input into a diffusion model. The basic scene samples are used as the initial noise distribution to perform progressive generation. During the progressive generation process, the traffic physics discriminator embedded in the diffusion model is used to score the physical rationality of the generated image output by the current step of the diffusion model. The parameter update direction of the diffusion model is adjusted according to the physical rationality score, and a long-tail traffic scene sample set is output. A visual language learning architecture consisting of a visual encoder, a gated fusion module, and a hierarchical semantic decoder is constructed. The visual language learning architecture is adapted and trained for the traffic domain using the long-tail traffic scene sample set to obtain a large visual language model specifically for traffic scene recognition. Structural pruning is performed on the large visual language model to obtain a sparse model; The structured pruning is based on the sensitivity of each channel in the visual language big model to the traffic scene recognition accuracy, pruning channels with a sensitivity lower than a first preset threshold and retaining channels with a sensitivity higher than a second preset threshold. Quantization-aware distillation is performed on the sparse model to obtain a lightweight visual language model adapted to edge low-computing-power hardware deployment; the quantization-aware distillation uses the large visual language model as the teacher model and the sparse model as the student model, and optimizes the parameters of the student model with distillation loss including quantization adaptation loss.
2. The lightweight visual language large model construction method for traffic scenarios according to claim 1, characterized in that, The traffic scene condition labels include weather type, light intensity, occlusion degree and event category, where the occlusion degree is the target occlusion level or target occlusion ratio preset when generating the sample.
3. The method for constructing a lightweight visual language large model for traffic scenarios according to claim 2, characterized in that, Encoding the traffic scene condition labels into conditional embedding vectors includes: Illumination intensity is mapped to a modulation vector through a continuous normalized flow, and weather type and event category are mapped to an embedding vector through a learnable embedding table. Occlusion degree is mapped to a modulation tensor through spatial attention.
4. The lightweight visual language large model construction method for traffic scenarios according to claim 3, characterized in that, The progressive generation includes: Using the basic scene samples as the initial noise distribution, conditions are progressively superimposed from high to low according to the order of event category, weather type, light intensity, and occlusion degree to generate extreme combination scene samples: The component corresponding to the event category in the embedding vector is input into the diffusion model, and the event category condition is superimposed on the basic scene sample to output a first intermediate sample containing event features; The weather type component in the embedded vector is input into the diffusion model. The first intermediate sample is used as the initial noise distribution, and the weather type condition is superimposed to output a second intermediate sample containing event features and weather features. The adjustment vector and the modulation tensor are input into the diffusion model, and the second intermediate sample is used as the initial noise distribution. Simultaneously, the illumination intensity condition and the occlusion degree condition are superimposed to output the extreme combination scene sample.
5. The lightweight visual language large model construction method for traffic scenarios according to claim 4, characterized in that, The traffic physics discriminator has a built-in traffic physics rule library, which includes lane line constraint rules, vehicle spacing constraint rules, traffic light-motion state consistency rules, and weather-road surface reflection feature consistency rules. During the progressive generation process, the traffic physics discriminator performs a weighted synthesis of the degree of conformity of the generated image output by the diffusion model in the current step under each traffic physics rule, and outputs a physical rationality score; the generated image includes the first intermediate sample, the second intermediate sample, and the extreme combination scenario sample; The traffic physics discriminator converts the physical rationality score into a feedback signal, which is then superimposed on the gradient update of the current step of the diffusion model to correct the sampling path of the current step. The feedback signal is continuously applied in each iteration of the progressive generation process until the physical rationality score reaches a preset threshold. At this point, the diffusion model stops the current generation step and outputs the long-tail traffic scene sample set.
6. The method for constructing a lightweight visual language large model for traffic scenarios according to claim 1, characterized in that, The construction of the visual language learning architecture, consisting of a visual encoder, a gated fusion module, and a hierarchical semantic decoder cascaded sequentially, includes: A visual encoder, a gated fusion module, and a hierarchical semantic decoder are constructed respectively. The visual encoder is a Transformer visual backbone network used to encode the input traffic image into a visual feature map carrying spatial and channel information. The gated fusion module includes a global pooling layer, a multilayer perceptron, and a gated weight generation layer, used to perform channel-level attention filtering on the visual feature map. The hierarchical semantic decoder is an autoregressive Transformer decoder used to parse the filtered visual features hierarchically and output three layers of structured traffic semantics. The output of the visual encoder is connected to the input of the gated fusion module, and the output of the gated fusion module is connected to the input of the hierarchical semantic decoder, forming a data flow path that is cascaded among the three, thus completing the construction of the visual language learning architecture.
7. The method for constructing a lightweight visual language large model for traffic scenarios according to claim 6, characterized in that, The step of using the long-tail traffic scene sample set to perform traffic domain adaptation training on the visual language learning architecture includes: Three-layer structured traffic semantic annotations (scene-level, target-level, and event-level) are configured for each image in the long-tail traffic scene sample set; Load pre-trained weights from a general image and text dataset into the visual encoder and hierarchical semantic decoder, and randomly initialize the parameters of the gated fusion module; The images in the long-tail traffic scene sample set are input into the visual language learning architecture. The forward propagation outputs a predicted three-level traffic semantic description. The scene-level, target-level, and event-level losses are calculated and weighted to obtain the comprehensive loss. The parameters of all modules in the architecture are updated by backpropagation based on the comprehensive loss, and the training is iterated until the loss on the validation set converges, resulting in a large visual language model specifically for traffic scene recognition.
8. The method for constructing a lightweight visual language large model for traffic scenarios according to claim 1, characterized in that, The step of performing structured pruning on the large visual language model to obtain a sparse model includes: The images in the long-tail traffic scene sample set are input into the visual language big model to complete forward propagation and obtain the comprehensive loss of traffic scene recognition. Backpropagation is used to solve the gradient of the loss function with respect to the activation values of each channel, and the absolute value of the gradient is taken as the sensitivity of the corresponding channel to the contribution of the traffic scene recognition accuracy. Set a double threshold where the value is greater than the second preset threshold and the value is greater than the first preset threshold. Classify the channel type according to the contribution sensitivity of each channel: channels with contribution sensitivity lower than the first preset threshold are judged as low contribution channels and removed. Channels with contribution sensitivity higher than the second preset threshold are judged as high contribution channels and retained. Medium contribution channels between the two thresholds are not forcibly removed or retained. By adopting a channel-level structured pruning method, after removing low-contribution channels, the number of remaining channels after pruning is constrained to match the parallel computing width of the target edge hardware. The pruned network is fine-tuned and trained using the long-tail traffic scenario sample set to compensate for the accuracy loss caused by pruning, resulting in a sparse model.
9. The method for constructing a lightweight visual language large model for traffic scenarios according to claim 1, characterized in that, The step of performing quantization-perceptual distillation on the sparsed model to obtain a lightweight visual language model adapted to edge low-computing-power hardware deployment includes: The large visual language model is used as the teacher model, and the sparse model is used as the student model. The images in the long-tail traffic scene sample set are input into the teacher model and the student model respectively. A pseudo-quantization node is inserted in the forward propagation of the student model to simulate the impact of quantization operation on the numerical accuracy of the feature map. Calculate distillation losses, which include: The KL divergence loss between the student model output and the teacher model output; The mean squared error loss between the intermediate layer features of the student model and the intermediate layer features of the teacher model; The difference between the output of the student model in the state of inserting pseudo-quantization nodes and the state of removing pseudo-quantization nodes is used as the quantization adaptation loss. The weighted summation of the KL divergence loss, the mean square error loss, and the quantization fit loss yields the comprehensive distillation loss. The parameters of the student model are updated by backpropagation based on the comprehensive distillation loss, and the training is iterated until convergence to obtain a lightweight visual language model adapted to edge low-computing-power hardware deployment.
10. A lightweight visual language large model construction method for traffic scenarios according to claim 7, characterized in that, In the three-layer structured traffic semantic annotation of scene-level, target-level, and event-level: Scene-level annotations include weather type, lighting conditions, road type, and congestion level; Target-level annotations include the location coordinates, category labels, size information, color attributes, and direction of movement of traffic participants; Event-level annotations include illegal event types and environmental risk types, and the content of the event-level annotations is related to the output results of the scenario-level annotations and the output results of the target-level annotations.
