ViViT model efficient compression method for vehicle collision detection

By performing automated hierarchical pruning, dynamic hybrid precision quantization, and knowledge distillation on the ViViT model, the problem of high computational complexity in vehicle collision detection is solved, enabling efficient deployment and high-precision detection on edge devices.

CN119312702AInactive Publication Date: 2025-01-14ZHEJIANG UNIV

Patent Information

Application Number
CN202411854180.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-01-14
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing ViViT model has high computational complexity and a large number of parameters in vehicle collision detection, making it difficult to deploy in real time on resource-constrained edge devices.

Method used

We employ automated hierarchical pruning, dynamic mixed-precision quantization, and knowledge distillation based on cost-sensitive learning to compress the ViViT model, including hierarchical pruning, quantization, and knowledge distillation, to reduce model complexity while maintaining high accuracy.

Benefits of technology

It significantly reduces model complexity and computational cost while improving the accuracy and reliability of vehicle collision detection, making it suitable for resource-constrained edge devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119312702A_ABST
    Figure CN119312702A_ABST
Patent Text Reader

Abstract

The invention relates to a ViViT model efficient compression method for vehicle collision detection. The method comprises the following steps: acquiring an original ViViT model; dividing the original ViViT model according to a hierarchical structure, and performing automatic hierarchical pruning; based on the sensitivities of different layers in the pruned ViViT model, a dynamic mixing precision quantification scheme is designed; and carrying out knowledge distillation training on the quantized ViViT model by adopting a knowledge distillation strategy based on cost sensitive learning to obtain a compressed ViViT model. The method has the beneficial effects that the complexity of the model is remarkably reduced, and meanwhile, the high precision of the ViViT model is kept. And particularly, a cost-sensitive loss function is adopted, so that the missing report rate is effectively reduced, and the reliability and accuracy of the model in a vehicle collision detection task are enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of intelligent transportation systems, and more specifically, to an efficient compression method of a ViViT model for vehicle collision detection. Background Art

[0002] With the rapid development of intelligent transportation and autonomous driving technologies, real-time detection of vehicle collision events in traffic video data has become increasingly important. This is of great significance for improving road safety and reducing traffic accidents. However, traditional vehicle collision detection methods mainly rely on manually designed feature extraction and simple classification algorithms, such as optical flow, background modeling, and rule-based methods. These methods often fail to achieve ideal results in complex traffic scenes (such as lighting changes, occlusions, and changes in viewing angles), and have problems such as low detection accuracy and poor robustness.

[0003] In recent years, vehicle collision detection methods based on deep learning have gradually attracted attention. Among them, convolutional neural networks (CNNs) are widely used in feature extraction of images and videos, but traditional CNNs focus mainly on the extraction of spatial features when processing video data, and it is difficult to effectively capture the temporal dynamic information of videos. To this end, models such as three-dimensional convolutional neural networks (3D CNNs) and long short-term memory networks (LSTMs) have been introduced to simultaneously process the spatial and temporal features of videos. However, these models often have problems such as large number of parameters and high computational complexity, which is not conducive to real-time deployment on resource-constrained edge devices. Recently, the Transformer model has achieved remarkable results in the fields of natural language processing and computer vision. As a visual Transformer architecture, ViViT (Video Vision Transformer) uses a self-attention mechanism to effectively capture the spatiotemporal information in videos and performs well in tasks such as video classification and action recognition.

[0004] However, the high computational complexity and large number of parameters of the ViViT model make it extremely challenging to deploy in resource-constrained environments. Summary of the invention

[0005] The purpose of the present invention is to address the deficiencies of the prior art and to propose an efficient compression method of the ViViT model for vehicle collision detection.

[0006] In the first aspect, an efficient compression method of a ViViT model for vehicle collision detection is provided, comprising: Step 1: Get the original ViViT model; Step 2: Divide the original ViViT model according to the hierarchical structure and perform automatic hierarchical pruning; the automatic hierarchical pruning includes: removing redundant weight parameters in the original ViViT model by evaluating the importance of each layer of weight parameters; Step 3: Based on the sensitivity of different layers in the pruned ViViT model, a dynamic mixed precision quantization scheme is designed; the dynamic mixed precision quantization scheme includes: setting different quantization precisions for different layers of the pruned ViViT model, and quantizing the pruned ViViT model; Step 4: Use the knowledge distillation strategy based on cost-sensitive learning to perform knowledge distillation training on the quantized ViViT model to obtain the compressed ViViT model.

[0007] Preferably, step 2 comprises: Step 2.1, divide the original ViViT model according to the hierarchical structure, and perform automatic hierarchical search on the weight parameters of each layer in the original ViViT model, calculate the absolute value of the weight parameters of each layer, and prune according to the preset threshold; Step 2.2: Perform sparse regularization training on the original ViViT model to obtain the first loss function .

[0008] Preferably, step 3 comprises: Step 3.1, use entropy or gradient sensitivity analysis method to evaluate the importance of each layer, and allocate higher bit width to the more important layer, and allocate lower bit width to the less important layer; Step 3.2, design a quantization function, and calculate the quantization step size of each layer according to the bit width; Step 3.3: Perform quantization-aware training on the pruned ViViT model according to the quantization function and the quantization step size.

[0009] Preferably, in step 3.3, the quantization-aware training includes: inserting quantization and dequantization operations in the forward propagation to simulate the impact of quantization on the model; in the backward propagation, using the straight-through estimator method to enable the gradient to pass through the non-differentiable quantization function; and obtaining the second loss function .

[0010] Preferably, step 4 comprises: Step 4.1, construct a teacher model and a student model; the teacher model is the original ViViT model, and the student model is the quantized ViViT model; Step 4.2: Based on the cost of underreporting and false alarm costs , construct a cost-sensitive loss function; Step 4.3: Using the soft labels of the teacher model and the output of the student model , define the distillation loss function, and perform knowledge distillation training on the quantized ViViT model to obtain the compressed ViViT model.

[0011] In a second aspect, a vehicle collision detection method is provided, which is performed by any compressed ViViT model described in the first aspect, comprising: Step 1: Obtain vehicle video data; Step 2: Input the vehicle video data into the compressed ViViT model; Step 3: The compressed ViViT model outputs collision detection results.

[0012] In a third aspect, a ViViT model efficient compression system for vehicle collision detection is provided, which is used to execute any of the methods described in the first aspect, including: The acquisition module is used to obtain the original ViViT model; A pruning module, used to divide the original ViViT model according to a hierarchical structure and perform automatic hierarchical pruning; the automatic hierarchical pruning includes: removing redundant weight parameters in the original ViViT model by evaluating the importance of each layer of weight parameters; A quantization module is used to design a dynamic mixed precision quantization scheme based on the sensitivity of different layers in the pruned ViViT model; the dynamic mixed precision quantization scheme includes: setting different quantization precisions for different layers of the pruned ViViT model, and quantizing the pruned ViViT model; The knowledge distillation module is used to adopt a knowledge distillation strategy based on cost-sensitive learning to perform knowledge distillation training on the quantized ViViT model to obtain a compressed ViViT model.

[0013] According to a fourth aspect, a computer storage medium is provided, wherein a computer program is stored in the computer storage medium; when the computer program is executed on a computer, the computer executes any method described in the first aspect.

[0014] In a fifth aspect, an electronic device is provided, including: Memory, used to store computer programs; A processor is used to execute the computer program to implement any method as described in the first aspect.

[0015] The beneficial effects of the present invention are: 1. This invention uses automatic hierarchical pruning, mixed precision quantization, and knowledge distillation technology based on cost-sensitive learning to significantly reduce the complexity of the model while maintaining the high accuracy of the ViViT model. In particular, the use of a cost-sensitive loss function effectively reduces the false negative rate and enhances the reliability and accuracy of the model in vehicle collision detection tasks.

[0016] 2. This invention is not only suitable for vehicle collision detection tasks, but can also be extended to other Transformer-based video analysis models, providing a new solution for the compression and deployment of deep learning models.

[0017] 3. By introducing knowledge distillation and cost-sensitive learning, the model of the present invention can more effectively learn the key features of vehicle collisions, improve the detection performance in complex traffic scenarios, and reduce false alarms and missed alarms caused by factors such as environmental interference and lighting changes. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 A flowchart of a ViViT model efficient compression method for vehicle collision detection provided by an embodiment of the present invention; Figure 2 A network model structure diagram of the ViViT model efficient compression method for vehicle collision detection provided by an embodiment of the present invention; Figure 3 A schematic diagram of a weight importance assessment and pruning strategy provided by an embodiment of the present invention; Figure 4 A schematic diagram of a mixed precision quantization strategy provided by an embodiment of the present invention; Figure 5 A diagram of a knowledge distillation process based on cost-sensitive learning provided by an embodiment of the present invention; Figure 6 A schematic diagram of the structure of a ViViT model efficient compression system for vehicle collision detection provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0019] The present invention is further described below in conjunction with embodiments. The description of the following embodiments is only used to help understand the present invention. It should be noted that for ordinary persons in the art, without departing from the principle of the present invention, the present invention can also be modified in some ways, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.

[0020] Embodiment 1: In order to reduce the computational complexity and storage requirements of the ViViT model, Example 1 of the present application provides an efficient compression method for the ViViT model for vehicle collision detection, which significantly reduces the complexity of the model while maintaining the high accuracy of the ViViT model through pruning, quantization and knowledge distillation techniques. Among them, pruning technology reduces the number of model parameters by removing unimportant network connections; quantization technology reduces storage and computing requirements by reducing the accuracy of parameters and activation values; knowledge distillation technology improves the performance of small models by allowing small models to learn the knowledge of large models.

[0021] like Figure 1 As shown, the ViViT model efficient compression method for vehicle collision detection provided by this application includes: Step 1: Get the original ViViT model.

[0022] In step 1, the structure of the original ViViT model is as follows Figure 2 shown.

[0023] It includes several key modules, which are described as follows: (a) Input: Video clip The video clip is divided into multiple time windows of fixed length (e.g., a number of consecutive frames).

[0024] Each video frame is input as an independent image and enters the embedding module after preprocessing.

[0025] (b) Position and Token Embedding Tokenization: Each video frame is processed through a convolutional neural network or a fully connected layer to generate a vector of fixed dimension.

[0026] These vectors are called “tokens” and they are feature representations of each frame in the spatiotemporal sequence.

[0027] Positional encoding: In order for the model to capture time series information, each token is added with time step information to form a "positional encoding".

[0028] The positional encoding can be a fixed form (such as sine and cosine functions) or a learnable parameter.

[0029] CLS Token (Ledger Token): A special CLS token is added to capture the global information of the whole video segment, which is finally used for classification.

[0030] (c) The Transformer module consists of the following parts: 1. Self-attention mechanism: 1.1 Multi-head dot product attention: Extract inter-frame dependencies and global context information.

[0031] Modeling from different feature spaces through multiple attention heads.

[0032] 1.2 Q (query), K (key), V (value) matrix: The input token is linearly transformed to generate Q, K, V, which are used to calculate the attention score.

[0033] The attention scores are weighted into the V matrix to generate weighted features.

[0034] 2 Normalization and residual connection: Layer normalization: Balance the distribution of input features to prevent gradient disappearance.

[0035] Residual connections: Add skip connections in each attention and feed-forward sub-layer to enhance feature flow.

[0036] (d) Decomposition encoder The factorized encoder further improves the performance of the model by separating the processing of the temporal and spatial dimensions: Time dimension module: The sequence features are modeled time-step by time-step to capture the temporal dynamic relationship between frames.

[0037] Spatial Dimension Module: Spatial feature extraction is performed separately for each frame to model the spatial distribution of the image.

[0038] (e) Classification Head Multilayer Perceptron (MLP) head: The output of the Transformer encoder is either globally pooled or the feature vector of the CLS token is directly extracted.

[0039] Multilayer perceptron further processes high-dimensional features and finally outputs category probabilities.

[0040] Output dimensions: The output of the classification task is the probability distribution of each category, which is used for the final decision.

[0041] Step 2: Divide the original ViViT model into a hierarchical structure and perform automatic hierarchical pruning; the automatic hierarchical pruning includes: removing redundant weight parameters in the original ViViT model by evaluating the importance of each layer of weight parameters to reduce computational complexity while retaining key spatiotemporal feature extraction capabilities.

[0042] Step 2 includes: Step 2.1: Divide the original ViViT model into a hierarchical structure, perform an automated hierarchical search on the weight parameters of each layer in the original ViViT model, calculate the absolute value of the weight parameters of each layer, and perform pruning according to a preset threshold.

[0043] Specifically, the original ViViT model is divided into a hierarchical structure, including a Patch Embedding layer, multiple Transformer encoder layers, and a classification layer. For each weight parameter in the Transformer encoder layer, its importance metric is calculated using a gradient-based sensitivity analysis method, and the formula is as follows:

[0044] in, For the Layer , weight parameters, is the loss function.

[0045] Afterwards, if Figure 3 As shown, set the global pruning rate , use optimization algorithms (such as Bayesian optimization or evolutionary algorithms) to distribute pruning rates among layers , so that the total pruning rate meets the preset value, that is, For each layer, sort by weight importance and cut off the weights with low importance so that the remaining weight ratio is .

[0046] In addition, the pruned weight matrix W′ satisfies the sparsity requirement:

[0047] Where W is the original weight matrix, is the L1 norm, and the weight matrix is ​​made sparse through sparse regularization in order to remove weight connections that have little impact on the model.

[0048] Step 2.2: Perform sparse regularization training on the original ViViT model to obtain the first loss function .

[0049] During the model training process, a sparse regularization term is added to promote weight sparsification. The formula of the first loss function is:

[0050] in, is the cross entropy loss, is the weight matrix of the lth layer, is the regularization coefficient. Fine-tune the pruned model and use a smaller learning rate to restore the model performance. The pruned model reduces the computational complexity, especially significantly reducing the amount of floating-point operations in the attention layer.

[0051] Step 3. Based on the sensitivity of different layers in the pruned ViViT model, a dynamic mixed precision quantization scheme is designed; the dynamic mixed precision quantization scheme includes: setting different quantization precisions for different layers of the pruned ViViT model, quantizing the pruned ViViT model, and especially applying adaptive quantization in the attention mechanism to reduce storage requirements and maintain high precision.

[0052] like Figure 4 As shown, step 3 includes: Step 3.1: Use entropy or gradient sensitivity analysis to evaluate the importance of each layer, and allocate higher bit widths to layers with higher importance, and lower bit widths to layers with lower importance.

[0053] In step 3.1, the importance of each layer is evaluated based on its contribution to the model performance, and mixed precision bit width is allocated. For example, a higher bit width (such as 8-bit or 16-bit) is allocated to important layers (such as self-attention layers), and a lower bit width (such as 4-bit or 2-bit) is allocated to non-critical layers to balance performance and computing requirements.

[0054] The quantization error is defined as:

[0055] in, Represents the quantized weight, the goal is to minimize the square of the quantization error .

[0056] In addition, the ranking loss is introduced to ensure the consistency of the output order of the attention mechanism after quantization, so that the spatiotemporal features can be preserved in complex scenes. The ranking loss is defined as:

[0057] in, and Represent the attention scores before and after quantization, respectively, by minimizing Keep the effect of attention mechanism.

[0058] Step 3.2: Design a quantization function and calculate the quantization step size of each layer according to the bit width.

[0059] In step 3.2, the quantization function is defined as:

[0060] in, is the input value to be quantified. For the The quantization step size of the layer, is the minimum value of quantization, is the maximum value of quantization, and clip() is a clipping function that limits the value to This application uses a symmetric quantization function to convert floating point weights Mapping to quantized integers , the formula is:

[0061] In addition, the calculation formula for the quantization step size is:

[0062] in, The number of quantization bits is the number of binary bits used to represent the quantized value.

[0063] Step 3.3: Perform quantization-aware training (QAT) on the pruned ViViT model according to the quantization function and the quantization step size.

[0064] In step 3.3, the quantization-aware training includes: inserting quantization and dequantization operations in the forward propagation to simulate the impact of quantization on the model; using the straight-through estimator method in the back propagation to enable the gradient to pass through the non-differentiable quantization function; and obtaining the second loss function .

[0065] Specifically, the second loss function The calculation formula is:

[0066] in, is the quantized loss weight.

[0067] Step 4: Use the knowledge distillation strategy based on cost-sensitive learning to perform knowledge distillation training on the quantized ViViT model to obtain the compressed ViViT model.

[0068] Embodiment 2: Based on Example 1, Example 2 of the present application provides a more specific ViViT model efficient compression method for vehicle collision detection, including: Step 1: Get the original ViViT model.

[0069] Step 2: Divide the original ViViT model according to the hierarchical structure and perform automatic hierarchical pruning; the automatic hierarchical pruning includes: removing redundant weight parameters in the original ViViT model by evaluating the importance of each layer of weight parameters.

[0070] Step 3: Based on the sensitivity of different layers in the pruned ViViT model, a dynamic mixed precision quantization scheme is designed; the dynamic mixed precision quantization scheme includes: setting different quantization precisions for different layers of the pruned ViViT model, and quantizing the pruned ViViT model.

[0071] Step 4: Use the knowledge distillation strategy based on cost-sensitive learning to perform knowledge distillation training on the quantized ViViT model to obtain the compressed ViViT model.

[0072] In step 4, during the process of transferring knowledge from the teacher model to the student model, the false positives and missed negatives in vehicle collision detection are weighted and optimized to improve the reliability and recall rate of the compressed model.

[0073] like Figure 5 As shown, step 4 includes: Step 4.1, construct a teacher model and a student model; the teacher model is the original ViViT model, and the student model is the quantized ViViT model.

[0074] Step 4.2: Based on the cost of underreporting and false alarm costs , construct a cost-sensitive loss function.

[0075] Specifically, , the weighted cross entropy loss function (i.e., cost-sensitive loss function) is constructed as:

[0076] in, The samples are allocated according to their category and cost weight.

[0077] This application defines cost weights for different error types during the knowledge distillation process, increases the cost of missed detection by modifying the cross entropy loss function, and ensures that the model is more inclined to reduce missed detection, which is particularly suitable for vehicle collision detection tasks.

[0078] Step 4.3: Using the soft labels of the teacher model and the output of the student model , define the distillation loss function, and perform knowledge distillation training on the quantized ViViT model to obtain the compressed ViViT model.

[0079] The formula for the distillation loss function is:

[0080] in, is the temperature parameter, is the softmax function, KL represents the Kullback-Leibler divergence, and Represent the outputs of the teacher model and the student model respectively.

[0081] The total loss function is updated as:

[0082] In addition, image block-level manifold learning (Manifold Learning) ensures that the manifold relationship between the teacher model and the student model is consistent between images. The feature loss is expressed by minimizing the mean square error between the features of the teacher model and the student model:

[0083] in, is the number of image blocks, and are the feature extraction functions of the teacher and student models on image patches, respectively.

[0084] In addition, through joint training, the student model can still achieve performance similar to that of the teacher model under compression, and the hyperparameters are adjusted using the validation set. , , , and temperature parameters .

[0085] In the joint training process of the model, the optimization goals of pruning, quantization and knowledge distillation are combined to achieve comprehensive optimization of model parameters through the joint loss function. The joint loss function is:

[0086] After fusion training, the model has the ability to detect and classify vehicle collision videos in real time, which not only effectively reduces the number of model parameters and computing requirements, but also ensures high-precision classification performance.

[0087] Finally, the trained model is converted to a model format suitable for edge devices, such as TensorRT, ONNX, etc. Operator fusion and memory optimization are performed on the model to improve reasoning efficiency.

[0088] The embodiment of the present application also provides a vehicle collision detection method, which is performed by the above-mentioned compressed ViViT model, including: Step 1: Obtain vehicle video data.

[0089] Specifically, a real-time video stream is obtained from a camera, and the video frames are preprocessed, such as resizing and normalizing.

[0090] Step 2: Input the vehicle video data into the compressed ViViT model.

[0091] In step 2, the compressed ViViT model is deployed on the edge device. Select an edge device with AI acceleration capabilities, configure the corresponding inference engine and driver, and ensure that the model can run efficiently. Input the preprocessed image into the deployed model to obtain the collision detection result.

[0092] Step 3: The compressed ViViT model outputs collision detection results.

[0093] In step 3, based on the model output, it is determined in real time whether a vehicle collision occurs, triggering corresponding alarms and safety measures.

[0094] In order to verify the effectiveness of the method of the present invention, experiments were conducted on a self-made CrashNet dataset, which contains vehicle collision and non-collision videos in various traffic scenarios.

[0095] Table 1 Comparison of model performance

[0096] As can be seen from Table 1, the method of the present invention has significant advantages in terms of parameter volume and computational complexity. The parameter volume is only 2.6 MB, and the FLOPs is 2.44 G, which is much lower than other comparison models. At the same time, the accuracy of the model reaches 95.51%, and the F1 score is 92.20%, which is better than most comparison models.

[0097] Among them, although MoViNet-A2 has a slight advantage in accuracy and F1 score, reaching 98.56% and 96.72% respectively, its parameter volume and computational complexity are also significantly increased, with the parameter volume being 5.3 MB and the FLOPs reaching 10.30 G, which is not conducive to deployment on resource-constrained edge devices. In contrast, the method of the present invention significantly reduces the complexity and computational cost of the model while maintaining high detection performance, meeting the requirements of real-time performance and low resource consumption.

[0098] Other models such as TVN-1 and I3D, although they have certain accuracy and F1 scores, have large parameters and computational complexity and cannot meet the deployment requirements of edge devices. Although X3D-XS and VoV3D-M have relatively small parameters, their computational complexity is still high, at 23.30 G and 34.20 G respectively.

[0099] In summary, the effectiveness and superiority of the proposed method have been verified through comparative experiments with a variety of mainstream video models. While maintaining high detection performance, this method significantly reduces the number of model parameters and computational complexity, making it suitable for real-time vehicle collision detection on resource-constrained edge devices, and has important practical application value.

[0100] It should be noted that the parts in this embodiment that are the same or similar to those in Embodiment 1 can be referenced to each other and will not be described in detail in this application.

[0101] Embodiment 3: Based on Examples 1 and 2, Example 3 of the present application provides a ViViT model efficient compression system for vehicle collision detection, such as Figure 6 As shown, including: The acquisition module is used to obtain the original ViViT model; A pruning module, used to divide the original ViViT model according to a hierarchical structure and perform automatic hierarchical pruning; the automatic hierarchical pruning includes: removing redundant weight parameters in the original ViViT model by evaluating the importance of each layer of weight parameters; A quantization module is used to design a dynamic mixed precision quantization scheme based on the sensitivity of different layers in the pruned ViViT model; the dynamic mixed precision quantization scheme includes: setting different quantization precisions for different layers of the pruned ViViT model, and quantizing the pruned ViViT model; The knowledge distillation module is used to adopt a knowledge distillation strategy based on cost-sensitive learning to perform knowledge distillation training on the quantized ViViT model to obtain a compressed ViViT model.

[0102] Specifically, the system provided in this embodiment is a system corresponding to the method provided in Embodiments 1 and 2. Therefore, the parts in this embodiment that are the same or similar to Embodiments 1 and 2 can be referenced to each other and will not be repeated in this application.

Claims

1. An efficient compression method of ViViT model for vehicle collision detection, characterized in that: include: Step 1: Get the original ViViT model; Step 2: Divide the original ViViT model according to the hierarchical structure and perform automatic hierarchical pruning; The automatic layer pruning includes: removing redundant weight parameters in the original ViViT model by evaluating the importance of each layer weight parameter; Step 3: Based on the sensitivity of different layers in the pruned ViViT model, a dynamic mixed precision quantization scheme is designed; the dynamic mixed precision quantization scheme includes: setting different quantization precisions for different layers of the pruned ViViT model, and quantizing the pruned ViViT model; Step 4: Use the knowledge distillation strategy based on cost-sensitive learning to perform knowledge distillation training on the quantized ViViT model to obtain the compressed ViViT model.

2. The ViViT model efficient compression method for vehicle collision detection according to claim 1 is characterized in that: Step 2 includes: Step 2.1, divide the original ViViT model according to the hierarchical structure, and perform automatic hierarchical search on the weight parameters of each layer in the original ViViT model, calculate the absolute value of the weight parameters of each layer, and prune according to the preset threshold; Step 2.2: Perform sparse regularization training on the original ViViT model to obtain the first loss function .

3. The ViViT model efficient compression method for vehicle collision detection according to claim 2 is characterized in that: Step 3 includes: Step 3.1, use entropy or gradient sensitivity analysis method to evaluate the importance of each layer, and allocate higher bit width to the more important layer, and allocate lower bit width to the less important layer; Step 3.2, design a quantization function, and calculate the quantization step size of each layer according to the bit width; Step 3.3: Perform quantization-aware training on the pruned ViViT model according to the quantization function and the quantization step size.

4. The ViViT model efficient compression method for vehicle collision detection according to claim 3 is characterized in that: In step 3.3, the quantization-aware training includes: inserting quantization and dequantization operations in the forward propagation to simulate the impact of quantization on the model; using the straight-through estimator method in the back propagation to enable the gradient to pass through the non-differentiable quantization function; and obtaining the second loss function .

5. The ViViT model efficient compression method for vehicle collision detection according to claim 4 is characterized in that: Step 4 includes: Step 4.1, construct a teacher model and a student model; the teacher model is the original ViViT model, and the student model is the quantized ViViT model; Step 4.2: Based on the cost of underreporting and false alarm costs , construct a cost-sensitive loss function; Step 4.3: Using the soft labels of the teacher model and the output of the student model , define the distillation loss function, and perform knowledge distillation training on the quantized ViViT model to obtain the compressed ViViT model.

6. A vehicle collision detection method, characterized in that: Executed by the compressed ViViT model according to any one of claims 1 to 5, comprising: Step 1: Obtain vehicle video data; Step 2: Input the vehicle video data into the compressed ViViT model; Step 3: The compressed ViViT model outputs collision detection results.

7. An efficient compression system of ViViT model for vehicle collision detection, characterized in that: The method for executing any one of claims 1 to 5 comprises: The acquisition module is used to obtain the original ViViT model; A pruning module, used to divide the original ViViT model according to a hierarchical structure and perform automatic hierarchical pruning; the automatic hierarchical pruning includes: removing redundant weight parameters in the original ViViT model by evaluating the importance of each layer of weight parameters; A quantization module is used to design a dynamic mixed precision quantization scheme based on the sensitivity of different layers in the pruned ViViT model; the dynamic mixed precision quantization scheme includes: setting different quantization precisions for different layers of the pruned ViViT model, and quantizing the pruned ViViT model; The knowledge distillation module is used to adopt a knowledge distillation strategy based on cost-sensitive learning to perform knowledge distillation training on the quantized ViViT model to obtain a compressed ViViT model.

8. A computer storage medium, characterized in that: The computer storage medium stores a computer program; when the computer program is executed on a computer, the computer executes any one of the methods described in claims 1 to 5.

9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Model training method and device and computer readable storage medium

    CN112329885A

  • Power distribution equipment anomaly detection method and device, electronic equipment and storage medium

    CN116385963A

  • Long and short-term memory compression method based on knowledge distillation recovery strategy pruning

    CN116861257A

  • Recognition convolutional network model compression method on mobile equipment

    CN117494763A

  • Deep learning model compression method for network intrusion detection

    CN117669655A

Cited By

  • Road safety early warning method and system based on mixed precision quantification visual large model

    CN120808095A