An urban road waterlogging depth intelligent classification method and system based on knowledge distillation and diffusion model

CN120852842BActive Publication Date: 2026-08-21NANJING RES INST OF SURV MAP & GEOTECH INVESTIG CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510824795.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-19
Publication Date
2026-08-21
Estimated Expiration
2045-06-19

AI Technical Summary

Technical Problem

1、数据稀缺问题:城市道路积水场景具有突发性和随机性特点,难以获取大规模的标注数据

Benefits of technology

(1)针对现有城市道路积水图像缺失的问题,本发明基于知识蒸馏与扩散模型的城市道路积水深度智能分类方法及系统通过条件扩散模型对已有的城市道路积水图像进行数据增强,通过学习噪声分布,能够生成高质量、多样化的合成积水图像,扩充训练数据集,有效缓解数据稀缺问题,提高积水深度类别预测模型的泛化能力;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120852842B_ABST
    Figure CN120852842B_ABST
Patent Text Reader

Abstract

The application discloses a kind of urban road waterlogging depth intelligent classification method and system based on knowledge distillation and diffusion model, comprising: collecting urban road image under waterlogging scene, and expanding urban road image based on diffusion model;Lightweight pre-judgment slice model and fine classification model based on VIM are constructed;Fine classification model based on VIM is used as student network, and ResNet50 model is used as teacher network, according to the knowledge distillation loss between teacher network and student network, the student network is trained until the knowledge distillation loss function converges, and the training of fine classification model is completed;Real-time acquisition of urban road image, input lightweight pre-judgment slice model to predict whether there is waterlogging on urban road image, input the urban road image with waterlogging into fine classification model, and predict the waterlogging depth category, so as to improve the waterlogging depth classification prediction accuracy of urban road.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of smart cities and intelligent transportation, specifically to a method and system for intelligent classification of urban road water accumulation depth based on a knowledge distillation and diffusion model. Background Technology

[0002] Urban flooding is a significant issue affecting the normal operation of cities and the safety of residents. Real-time and accurate monitoring of urban road flooding, especially the depth of water accumulation, is crucial for timely early warning, traffic management, and emergency rescue.

[0003] Traditional methods for detecting water depth mainly rely on manual inspections and water level sensors, which suffer from drawbacks such as limited coverage, high deployment costs, maintenance difficulties, and poor timeliness. In recent years, with the rapid development of computer vision and deep learning technologies, image / video-based water depth recognition methods have gradually become a research hotspot. However, existing deep learning-based methods still face the following challenges: 1. Data scarcity: Urban road flooding is characterized by its sudden and random nature, making it difficult to obtain large-scale labeled data. Especially for flooding scenarios of varying degrees, the uneven distribution of data due to the varying frequencies of occurrence severely impacts the training performance and generalization ability of the model. 2. Poor adaptability to complex scenes: The urban road environment is complex and ever-changing. Factors such as lighting, shadows, occlusion, rain and fog can all affect image quality, leading to a decrease in the recognition accuracy of existing models. In particular, for light water accumulation, due to its indistinct visual features, it is easily confused with wet road surfaces, making recognition more difficult. 3. Insufficient generalization ability of the model: Most existing methods are based on convolutional neural networks, whose local receptive field characteristics limit the model's ability to capture global information, resulting in poor generalization performance of the model in unseen scenarios such as different cities and different road types. 4. Real-time performance is difficult to guarantee: Some high-precision models are often complex in structure and have a large amount of computation, making it difficult to meet the needs of real-time monitoring. Summary of the Invention

[0004] To address the problems existing in the prior art, this invention provides an intelligent classification method and system for urban road water depth based on a knowledge distillation and diffusion model. By introducing a diffusion model for data augmentation, the problem of data scarcity is solved. Through the Visual State Space Model (VIM) and knowledge distillation technology, an end-to-end intelligent classification framework is constructed, which can effectively cope with the challenges of water depth classification in complex scenarios and significantly improve classification accuracy and robustness.

[0005] To achieve the above technical objectives, the present invention adopts the following technical solution: an intelligent classification method for urban road waterlogging depth based on a knowledge distillation and diffusion model, comprising the following steps: Step S1: Collect images of urban roads in flooded scenes and expand the urban road images based on a diffusion model; Step S2: Construct a lightweight pre-judgment slicing model and a VIM-based fine-grained classification model; Step S3: Input the expanded urban road image into the lightweight pre-judgment slice model for training until the cross-entropy loss function converges, thus completing the training of the lightweight pre-judgment slice model, enabling the lightweight pre-judgment slice model to predict whether there is water accumulation in the urban road image. Step S4: Use the VIM-based fine classification model as the student network and the ResNet50 model as the teacher network. Input the predicted images of urban roads with water accumulation into the teacher network and the student network respectively. Guide the training of the student network according to the knowledge distillation loss between the teacher network and the student network until the knowledge distillation loss function converges, thus completing the training of the fine classification model and enabling the fine classification model to predict the water depth category. Step S5: Real-time acquisition of urban road images, input into a trained lightweight pre-judgment slicing model to predict whether there is water accumulation in the urban road images, and input urban road images with water accumulation into a trained fine classification model to predict the water depth category.

[0006] Furthermore, the specific process of expanding urban road images based on the diffusion model is as follows: i. Label the water accumulation category on the collected urban road images, and encode the water accumulation category into a conditional vector as the input of the diffusion model; ii. Gradually add Gaussian noise to the urban road image until the urban road image becomes pure noise; iii. Set up a denoising network based on the U-Net architecture, starting from pure noise and using the denoising network and conditional vectors to gradually generate urban road images that meet the conditions.

[0007] Furthermore, the denoising network based on the U-Net architecture includes four cascaded downsampling layers, four cascaded upsampling layers, and four cross-attention layers. The four downsampling layers are used to extract multi-scale feature maps from pure noise. The multi-scale feature maps are input into the corresponding cross-attention layers and combined with conditional vectors to obtain semantic information feature maps. The semantic information feature maps are input into the corresponding upsampling layers to generate urban road images that meet the conditions.

[0008] Furthermore, the lightweight pre-judgment slicing model adopts a lightweight CNN model based on the MobileNetV2 architecture, including: a channel expansion layer, a depthwise separable convolutional layer, a linear bottleneck layer, and residual connections. The channel expansion layer is used to expand the number of input channels of the urban road image; the depthwise separable convolutional layer is used to extract water accumulation features on the urban road image; the linear bottleneck layer is used to reduce the number of channels and retain low-dimensional water accumulation features; the residual connections are used to fuse the low-dimensional water accumulation features with the urban road image to predict the binary classification result of whether there is water accumulation in the urban road image.

[0009] Furthermore, the VIM-based fine classification model includes an image patch embedding layer, several VIM blocks, a global average pooling layer, and a fully connected layer connected in sequence. The image patch embedding layer is used to segment the image of a flooded urban road into image patches and map the image patches to a high-dimensional feature space. Each VIM block is used to capture long-distance dependency features between image patches in the high-dimensional feature space. The global average pooling layer is used to aggregate the captured long-distance dependency features. The fully connected layer predicts the flood depth category based on the aggregated long-distance dependency features.

[0010] Furthermore, each VIM block includes: a first normalization module, a selective state space layer, a first residual connection, a second normalization module, a feedforward neural network layer, and a second residual connection. The first normalization module is used to normalize the input features, input them into the selective state space layer, and capture long-range dependency features from the normalized features. The first residual connection is used to fuse the long-range dependency features and the normalized features, input them into the second normalization module for secondary normalization, input the secondary normalized features into the feedforward neural network layer for nonlinear feature extraction, and the second residual connection is used to fuse the nonlinear features and the secondary normalized features.

[0011] Furthermore, the specific process by which the selective state space layer captures long-range dependent features is as follows: i. Through a learnable weight matrix and learnable bias matrix Construct a dual projection mechanism to normalize features Mapping to a high-dimensional state space yields the transformed feature vector. ,in, t For time steps; ii. Transform the feature vector Combined with learnable state transition matrix For the hidden state vector Perform nonlinear transformation ,in, It is a non-linear activation function; iii. Transform the hidden state vector of the nonlinear transformation By combining selective scanning mechanism to dynamically update state information, long-distance dependency modeling is achieved, and the updated state vector... ,in, For adaptive gating coefficients, This represents element-wise multiplication; iv. Utilizing learnable projection matrices Implement from state vector To output space Mapping: .

[0012] Furthermore, the calculation process of the knowledge distillation loss function is as follows:

[0013] in, The cross-entropy loss is calculated between the student's online predictions and the actual labels. , N The number of images of flooded city roads used for training. i for N index, C Number of categories for water depth c for C index, For the first i Image of a city road with standing water. c The actual labels for each water depth category For student network to the first i The first prediction of images of urban roads with water accumulation. c Confidence level for each category of water depth for Weighting coefficients; For teacher networks and student networks, predict the category of water depth. KL Divergence loss, , for KL divergence, To assess the confidence level of the teacher network's predictions regarding the category of water depth, To assess the confidence level of students' online predictions of water depth categories, For temperature coefficient, for Weighting coefficients; For the intermediate features between student networks and teacher networks MSE loss, , Intermediate features generated by the teacher network These are the intermediate features corresponding to the intermediate features of the teacher network in the student network. MSE Mean square error, for Weighting coefficients; For the attention graph between student network and teacher network MSE loss, , An attention map generated by the teacher network focusing on areas of water accumulation. An attention map generated by the student network focusing on the waterlogged area. for Weighting coefficients; .

[0014] Furthermore, the present invention also provides an intelligent classification system for urban road water accumulation depth based on a knowledge distillation and diffusion model, including: an image preprocessing module, a lightweight pre-judgment slicing module, and a VIM-based fine classification module; The image preprocessing module is used to preprocess the collected images of urban roads in waterlogged scenes; The lightweight pre-judgment slicing module uses a lightweight pre-judgment slicing model to input preprocessed urban road images into the lightweight pre-judgment slicing model to predict whether there is water accumulation on the urban road images; The VIM-based fine classification module uses a VIM-based fine classification model to input images of urban roads with water accumulation into the trained fine classification model and predict the water depth category.

[0015] Furthermore, the preprocessing includes: image denoising, adaptive histogram equalization, perspective geometry correction, size normalization, and image standardization.

[0016] Compared with the prior art, the present invention has the following beneficial effects: (1) In view of the problem of missing images of urban road waterlogging, the present invention provides an intelligent classification method and system for urban road waterlogging depth based on knowledge distillation and diffusion model. The system uses a conditional diffusion model to augment existing urban road waterlogging images. By learning the noise distribution, it can generate high-quality and diverse synthetic waterlogging images, expand the training dataset, effectively alleviate the problem of data scarcity, and improve the generalization ability of the waterlogging depth category prediction model. (2) To meet the requirements of low latency and high accuracy in intelligent classification of urban road water accumulation, this invention constructs a lightweight pre-judgment slicing model and a VIM-based fine classification model. The lightweight pre-judgment slicing model predicts whether there is water accumulation in urban road images, which can quickly screen potential water accumulation areas. Then, the VIM-based fine classification model predicts the water accumulation depth category, thereby achieving efficient and accurate prediction of urban road water accumulation depth category. At the same time, the fine classification model combines selective state space layer and knowledge distillation technology to greatly reduce inference latency while maintaining high accuracy prediction. Attached Figure Description

[0017] Figure 1 This is an overall flowchart of the intelligent classification method for urban road water accumulation depth based on the knowledge distillation and diffusion model of the present invention; Figure 2 This is a flowchart of urban road image augmentation in this invention; Figure 3 This is a schematic diagram of the lightweight pre-judgment slicing model in this invention; Figure 4 This is a schematic diagram of the VIM-based fine classification model in this invention; Figure 5 This is a flowchart of the knowledge distillation training in this invention. Detailed Implementation

[0018] The technical solution of the present invention will be further explained and described below with reference to the accompanying drawings.

[0019] like Figure 1 This is an overall flowchart of the intelligent classification method for urban road waterlogging depth based on the knowledge distillation and diffusion model of the present invention. The intelligent classification method for urban road waterlogging depth includes the following steps: Step S1: Collect urban road images under waterlogged conditions and expand the urban road images based on the diffusion model to generate high-quality, diverse synthetic waterlogged images and expand the training dataset; Step S2: Construct a lightweight pre-judgment tiling model and a VIM-based fine classification model. The lightweight pre-judgment tiling model is used to quickly filter urban road images with potential water accumulation areas, and the VIM-based fine classification model is used to accurately classify the water depth type on urban road images. Step S3: Input the expanded urban road image into the lightweight pre-judgment slice model for training until the cross-entropy loss function converges, thus completing the training of the lightweight pre-judgment slice model, enabling the lightweight pre-judgment slice model to predict whether there is water accumulation in the urban road image. Step S4: As Figure 5 A VIM-based fine-grained classification model was used as the student network, and a ResNet50 model was used as the teacher network. Images of urban roads predicted to have water accumulation were input into the teacher and student networks, respectively. The student network was trained based on the knowledge distillation loss between the teacher and student networks until the knowledge distillation loss function converged, thus completing the training of the fine-grained classification model and enabling it to predict the water depth category. A progressive knowledge transfer strategy was adopted, gradually adjusting the distillation intensity to ensure that the student network could effectively absorb the knowledge from the teacher network. Step S5: Real-time acquisition of urban road images, input into a trained lightweight pre-judgment slicing model to predict whether there is water accumulation in the urban road images, and input urban road images with water accumulation into a trained fine classification model to predict the water depth category.

[0020] In one technical solution of the present invention, images of waterlogged urban roads captured by surveillance cameras are collected to establish a large-scale urban road waterlogging image database. The collected urban road images undergo multi-stage preprocessing, including: image denoising to eliminate camera noise and environmental interference; adaptive histogram equalization enhancement to improve image quality and detail visibility; perspective geometry correction to eliminate viewpoint distortion; size normalization to unify the input format and ensure data quality and consistency; and image standardization processing, including pixel value normalization and channel mean-variance normalization, to improve the stability and convergence of training.

[0021] In one technical solution of the present invention, such as Figure 2 The specific process of expanding urban road images based on the diffusion model is as follows: i. Label the water accumulation categories on the collected urban road images, including: no water accumulation (0-2cm), light water accumulation (2-10cm), moderate water accumulation (10-30cm), and severe water accumulation (>30cm); use the CLIP text encoder to encode the water accumulation categories into 77-dimensional conditional vectors. At the same time, auxiliary information such as weather conditions and light intensity are also encoded into the conditional vectors to construct a multi-dimensional conditional embedding space containing key information such as water accumulation depth level, ambient light conditions, and weather conditions. This space serves as the control signal for the diffusion model. Through location encoding and feature mapping, it is ensured that the conditional information can effectively guide the urban road image generation process and enhance the diversity of generated images. ii. Gaussian noise is gradually added to the urban road image until the urban road image becomes pure noise, constructing a Markov chain from clear image to pure noise; in each diffusion step, the noise intensity is dynamically adjusted according to a predefined noise scheduling table to ensure the smoothness and controllability of noise addition, while maintaining the consistency of conditional information in the diffusion process. iii. Set up a denoising network based on the U-Net architecture. Starting from pure noise, use the denoising network and conditional vectors to gradually generate urban road images that meet the conditions, ensuring that the generated urban road images are sufficiently representative in terms of water depth, range, and environmental conditions.

[0022] The denoising network based on the U-Net architecture comprises four cascaded downsampling layers, four cascaded upsampling layers, and four cross-attention layers. The four downsampling layers extract multi-scale feature maps from pure noise. These multi-scale feature maps are then input into the corresponding cross-attention layers and combined with conditional vectors to obtain semantic information feature maps. Finally, these semantic information feature maps are input into the corresponding upsampling layers to generate urban road images that meet the specified conditions. The introduction of cross-attention layers enables the denoising network to adaptively fuse conditional vector semantic information and multi-scale spatial features during the generation of urban road images that meet the specified conditions, achieving dual-dimensional feature enhancement of both semantics and space, thus better meeting the data augmentation needs of complex scenarios.

[0023] In one technical solution of the present invention, the diffusion model is efficiently fine-tuned using the low-rank adaptive LoRA technique. Specifically, for the weight matrix in the diffusion model... This invention expresses it through low-rank decomposition as follows:

[0024] in, These are the original pre-trained weights. d and k These represent the number of rows and columns of the original pre-trained weights, respectively. r It is the intermediate rank introduced in low-rank analysis, which is adjusted... r The value can balance model efficiency and performance, therefore, and It is a low-rank matrix ( , By training only these low-rank matrix parameters, the training cost is significantly reduced. This method not only maintains the original generative ability of the model, but also quickly adapts to the specific distribution of water accumulation scenarios.

[0025] In one technical solution of the present invention, such as Figure 3 The lightweight pre-judgment slicing model adopts a lightweight CNN model based on the MobileNetV2 architecture, including: a channel expansion layer, a depthwise separable convolutional layer, a linear bottleneck layer, and residual connections. The channel expansion layer uses 1×1 pointwise convolutions to expand the number of input channels of urban road images, enhancing the expressive power of potential water accumulation area features; the depthwise separable convolutional layer is used to extract water accumulation features on urban road images, reducing computational cost; the linear bottleneck layer uses 1×1 pointwise convolutions to reduce the number of channels, retaining low-dimensional water accumulation features and replacing traditional ReLU activation to avoid information loss; the residual connections are used to fuse low-dimensional water accumulation features with urban road images to predict the binary classification result of whether there is water accumulation in the urban road images.

[0026] In one technical solution of the present invention, such as Figure 4The VIM-based fine-grained classification model comprises a series of image patch embedding layers, several VIM blocks, a global average pooling layer, and a fully connected layer. The image patch embedding layer segments images of flooded urban roads into image patches and maps these patches to a high-dimensional feature space. Each VIM block captures long-range dependency features between image patches in the high-dimensional feature space. The global average pooling layer aggregates these long-range dependency features. The fully connected layer predicts the flood depth category based on the aggregated long-range dependency features. This VIM-based fine-grained classification model efficiently captures global dependencies between image patches through efficient long-range dependency modeling, overcoming the limitations of traditional CNNs' local receptive field. It accurately identifies the distribution patterns and depth differences of flooded areas, improving the model's predictive ability for complex flooded scenes.

[0027] Each VIM block includes: a first normalization module, a selective state space layer, a first residual connection, a second normalization module, a feedforward neural network layer, and a second residual connection. The first normalization module normalizes the input features, which are then input into the selective state space layer to capture long-range dependency features from the normalized features. The first residual connection fuses the long-range dependency features and the normalized features, which are then input into the second normalization module for secondary normalization. The secondary normalized features are then input into the feedforward neural network layer for nonlinear feature extraction. The second residual connection fuses the nonlinear features and the secondary normalized features.

[0028] The specific process of selective state space layers capturing long-range dependent features is as follows: i. Through a learnable weight matrix and learnable bias matrix Construct a dual projection mechanism to normalize features Mapping to a high-dimensional state space yields the transformed feature vector. Among them, the learnable weight matrix Used to define features Linear projection onto a high-dimensional state space enhances the expressive power of fine-grained classification models; learnable bias matrices. Used to adjust the distribution of input features and improve the sensitivity of fine classification models to local features; ii. Transform the feature vector Combined with learnable state transition matrix For the hidden state vector Perform nonlinear transformation ,in, It is a non-linear activation function; iii. Transform the hidden state vector of the nonlinear transformation By combining a selective scanning mechanism to dynamically update state information, long-distance dependency modeling is achieved, adaptively improving the ability of the fine-grained classification model to capture features of waterlogged areas. The updated state vector ,in, The adaptive gating coefficient has a value of 0 to 1. This represents element-wise multiplication; iv. Utilizing learnable projection matrices Implement from state vector To output space Mapping: .

[0029] In one technical solution of the present invention, a multi-level knowledge distillation loss function is designed: the prediction results of the teacher network are used as soft labels, and the attention loss, i.e., the MSE loss between the attention graphs of the student network and the teacher network, is calculated. This ensures that the student network focuses on the same water accumulation area as the teacher network in the water depth classification task; through temperature coefficient Scaling adjusts the smoothness of the soft labels to help the student network learn the teacher network's potential connections to different water depths. The logits loss, i.e., the KL divergence loss between the predictions of the teacher and student networks, is calculated. This approach helps the student network learn the discrimination boundary of the teacher network for different water depths; it also considers the distillation of intermediate layer features and calculates the feature loss, i.e., the MSE loss between the intermediate features of the student network and the teacher network. This method captures hierarchical knowledge representations of the teacher network, including shallow water accumulation texture features and deep water accumulation semantic features. It combines multi-level knowledge distillation loss with cross-entropy loss between student network predictions and ground truth labels. The contribution of each loss factor is balanced by adjustable weighting coefficients to calculate the knowledge distillation loss function, jointly optimizing the parameters of the VIM-based fine-grained classification model. A progressive knowledge transfer strategy is employed to gradually adjust the distillation intensity, ensuring that the student network can effectively absorb the knowledge from the teacher network. The calculation process of the knowledge distillation loss function is as follows:

[0030] in, The cross-entropy loss is calculated between the student's online predictions and the actual labels. , N The number of images of flooded city roads used for training. i for N index, C Number of categories for water depth c for C index, For the first iImage of a city road with water accumulation. c The actual labels for each water depth category For student network to the first i The first prediction of urban road images with water accumulation. c Confidence level for each category of water depth for Weighting coefficients; For teacher networks and student networks, predict the water depth category results. KL Divergence loss, , for KL divergence, To assess the confidence level of the teacher network's predictions regarding the category of water depth, To assess the confidence level of students' online predictions of water depth categories, For temperature coefficient, for Weighting coefficients; For the intermediate features between student networks and teacher networks MSE loss, , Intermediate features generated by the teacher network These are the intermediate features corresponding to the intermediate features of the teacher network in the student network. MSE Mean square error, for Weighting coefficients; For the attention graph between student network and teacher network MSE loss, , An attention map generated by the teacher network focusing on areas of water accumulation. An attention map generated by the student network focusing on the waterlogged area. for Weighting coefficients; .

[0031] The training and optimization of the student network were implemented using the PyTorch deep learning framework. Regarding data configuration: the training dataset consisted of 12,000 original images and 4,000 synthetic images; the validation and test sets each contained 1,500 images. To enhance the model's generalization ability, data augmentation techniques were applied during training, including random cropping, horizontal flipping, color jittering, and random adjustments to brightness and contrast. Regarding training parameter configuration: the batch size was set to 32; the optimizer used was AdamW, with the following parameters... β1 Configured to 0.9, β2The learning rate is set to 0.999; the initial learning rate is set to 2e-4 and dynamically adjusted using a cosine annealing strategy; the training process lasts for a maximum of 100 epochs, and an early stopping mechanism is configured to terminate training early if the validation set accuracy does not improve for 10 consecutive epochs; to stabilize training, gradient pruning is used to limit the maximum value of the gradient norm to 1.0; in addition, PyTorch's automatic mixed-precision training is enabled to improve computational efficiency.

[0032] Table 1 shows the accuracy evaluation metrics of the lightweight pre-judgment slicing model, the VIM-based fine-grained classification model, and the VIM-based fine-grained classification model with knowledge distillation. The lightweight pre-judgment slicing model achieves accuracy metrics better than 95.8%. Introducing knowledge distillation into the VIM-based fine-grained classification model improves all accuracy metrics compared to the original model, with accuracy, precision, recall, F1 score, and mAP increasing by 1.7%, 2.2%, 1.7%, 2.0%, and 1.7%, respectively. The diffusion model enhancement technique employed in this invention achieves a balance between generation quality, realism, and diversity, providing high-quality data support for subsequent model training, and demonstrating significant advantages, especially in data-scarce scenarios. In terms of generation quality and realism, the FID score is as low as 12.8 and the SSIM value is 0.892, indicating that the generated images are highly similar to the distribution of real data, and the enhanced images maintain a high degree of consistency with the original data in terms of details such as structural similarity and brightness contrast. In terms of diversity, the IS score reaches 3.45, reflecting that the model can generate data samples with differentiated features. The 3.5-fold data augmentation generates high-quality samples, which significantly expands the size of the training set.

[0033] The key indicators of computational efficiency of the technical solution of this invention are shown in Table 2. In terms of inference speed, the lightweight pre-judgment slicing model has an inference time of less than 10ms for a single image at a resolution of 512×512, indicating that the lightweight pre-judgment slicing model can quickly complete pre-tasks such as image filtering or feature extraction. The inference time of the VIM-based fine classification model is controlled within 30ms. After combining the lightweight pre-judgment slicing model, the end-to-end latency of the system is still kept within 50ms, which meets the real-time requirements. In terms of resource consumption, the total storage space of the two models is 156MB. After TensorRT optimization, the GPU memory consumption is 2.1GB.

[0034] This invention presents an intelligent classification method for urban road flooding depth based on a knowledge distillation and diffusion model, achieving high levels of accuracy, real-time performance, and stability. Particularly noteworthy is its ability to maintain stable performance under complex weather conditions and varying lighting environments, demonstrating strong practical value. This method has been successfully applied to urban flood control emergency command systems, providing robust technical support for urban flooding early warning and traffic safety management.

[0035] Table 1 Performance Indicators of Each Model in this Invention

[0036] Table 2 Computational efficiency of the present invention

[0037] In one technical solution of the present invention, an intelligent classification system for urban road water accumulation depth based on a knowledge distillation and diffusion model is also provided, including: an image preprocessing module, a lightweight pre-judgment slicing module, and a VIM-based fine classification module; The image preprocessing module is used to preprocess the collected urban road images under water accumulation scenarios, including: image denoising, adaptive histogram equalization, perspective geometry correction, size normalization, and image standardization. The lightweight pre-judgment slicing module uses a lightweight pre-judgment slicing model to input preprocessed urban road images into the lightweight pre-judgment slicing model to predict whether there is water accumulation on the urban road images; The VIM-based fine classification module uses a VIM-based fine classification model to input images of waterlogged urban roads into the trained fine classification model and predict the water depth category.

[0038] In one technical solution of the present invention, a computer-readable storage medium is also provided, storing a computer program that enables a computer to execute an intelligent classification method for urban road waterlogging depth based on a knowledge distillation and diffusion model.

[0039] In one technical solution of the present invention, an electronic device is also provided, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements an intelligent classification method for urban road waterlogging depth based on a knowledge distillation and diffusion model.

[0040] In the embodiments disclosed in this application, a computer storage medium may be a tangible medium that may contain or store programs for use by or in conjunction with an instruction execution system, apparatus, or device. The computer storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of computer storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0041] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0042] The above are merely preferred embodiments of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should be considered within the scope of protection of the present invention.

Claims

1. A smart classification method for urban road waterlogging depth based on a knowledge distillation and diffusion model, characterized in that, Includes the following steps: Step S1: Collect images of urban roads in flooded scenes and expand the urban road images based on a diffusion model; Step S2: Construct a lightweight pre-judgment slicing model and a VIM-based fine-grained classification model; Step S3: Input the expanded urban road image into the lightweight pre-judgment slice model for training until the cross-entropy loss function converges, thus completing the training of the lightweight pre-judgment slice model, enabling the lightweight pre-judgment slice model to predict whether there is water accumulation in the urban road image. Step S4: Use the VIM-based fine classification model as the student network and the ResNet50 model as the teacher network. Input the predicted images of urban roads with water accumulation into the teacher network and the student network respectively. Guide the training of the student network according to the knowledge distillation loss between the teacher network and the student network until the knowledge distillation loss function converges, thus completing the training of the fine classification model and enabling the fine classification model to predict the water depth category. Step S5: Real-time acquisition of urban road images, input into a trained lightweight pre-judgment slice model to predict whether there is water accumulation in the urban road images, and input urban road images with water accumulation into a trained fine classification model to predict the water depth category. The lightweight pre-judgment slicing model adopts a lightweight CNN model based on the MobileNetV2 architecture, including: a channel expansion layer, a depthwise separable convolutional layer, a linear bottleneck layer, and residual connections. The channel expansion layer is used to expand the number of input channels of the urban road image; the depthwise separable convolutional layer is used to extract water accumulation features on the urban road image; the linear bottleneck layer is used to reduce the number of channels and retain low-dimensional water accumulation features; the residual connections are used to fuse the low-dimensional water accumulation features with the urban road image to predict the binary classification result of whether there is water accumulation in the urban road image. The VIM-based fine-grained classification model comprises a sequentially connected image patch embedding layer, several VIM blocks, a global average pooling layer, and a fully connected layer. The image patch embedding layer segments the image of a flooded urban road into image patches and maps these patches to a high-dimensional feature space. Each VIM block captures long-range dependency features between image patches in the high-dimensional feature space. The global average pooling layer aggregates the captured long-range dependency features. The fully connected layer predicts the flood depth category based on the aggregated long-range dependency features. Each VIM block includes: a first normalization module, a selective state space layer, a first residual connection, a second normalization module, a feedforward neural network layer, and a second residual connection. The first normalization module is used to normalize the input features, input them into the selective state space layer, and capture long-range dependency features from the normalized features. The first residual connection is used to fuse the long-range dependency features and the normalized features, input them into the second normalization module for secondary normalization, input the secondary normalized features into the feedforward neural network layer for nonlinear feature extraction, and the second residual connection is used to fuse the nonlinear features and the secondary normalized features. The specific process by which the selective state space layer captures long-range dependency features is as follows: i. Through a learnable weight matrix and learnable bias matrix Construct a dual projection mechanism to normalize features Mapping to a high-dimensional state space yields the transformed feature vector. ,in, t For time steps; ii. Transform the feature vector Combined with learnable state transition matrix For the hidden state vector Perform nonlinear transformation ,in, It is a non-linear activation function; iii. Transform the hidden state vector of the nonlinear transformation By combining selective scanning mechanism to dynamically update state information, long-distance dependency modeling is achieved, and the updated state vector... ,in, For adaptive gating coefficients, This represents element-wise multiplication; iv. Utilizing learnable projection matrices Implement from state vector To output space Mapping: ; The calculation process of the knowledge distillation loss function is as follows: in, The cross-entropy loss is calculated between the student's online predictions and the actual labels. , N The number of images of flooded city roads used for training. i for N index, C Number of categories for water depth c for C index, For the first i Image of a city road with standing water. c The actual labels for each water depth category For student network to the first i The first prediction of images of urban roads with water accumulation. c Confidence level for each category of water depth for Weighting coefficients; For teacher networks and student networks, predict the category of water depth. KL Divergence loss, , for KL divergence, To assess the confidence level of the teacher network's predictions regarding the category of water depth, To assess the confidence level of students' online predictions of water depth categories, For temperature coefficient, for Weighting coefficients; For the intermediate features between student networks and teacher networks MSE loss, , Intermediate features generated by the teacher network These are the intermediate features corresponding to the intermediate features of the teacher network in the student network. MSE Mean square error, for Weighting coefficients; For the attention graph between student network and teacher network MSE loss, , An attention map generated by the teacher network focusing on areas of water accumulation. An attention map generated by the student network focusing on the waterlogged area. for Weighting coefficients; .

2. The intelligent classification method for urban road waterlogging depth based on a knowledge distillation and diffusion model according to claim 1, characterized in that, The specific process of expanding urban road images based on the diffusion model is as follows: i. Label the water accumulation category on the collected urban road images, and encode the water accumulation category into a conditional vector as the input of the diffusion model; ii. Gradually add Gaussian noise to the urban road image until the urban road image becomes pure noise; iii. Set up a denoising network based on the U-Net architecture, starting from pure noise and using the denoising network and conditional vectors to gradually generate urban road images that meet the conditions.

3. The intelligent classification method for urban road waterlogging depth based on a knowledge distillation and diffusion model according to claim 2, characterized in that, The denoising network based on the U-Net architecture includes four cascaded downsampling layers, four cascaded upsampling layers, and four cross-attention layers. The four downsampling layers are used to extract multi-scale feature maps from pure noise. The multi-scale feature maps are input into the corresponding cross-attention layers and combined with conditional vectors to obtain semantic information feature maps. The semantic information feature maps are input into the corresponding upsampling layers to generate urban road images that meet the conditions.

4. An intelligent classification system for urban road waterlogging depth applying the intelligent classification method for urban road waterlogging depth based on the knowledge distillation and diffusion model as described in any one of claims 1-3, characterized in that, include: Image preprocessing module, lightweight pre-judgment slicing module, and VIM-based fine classification module; The image preprocessing module is used to preprocess the collected images of urban roads in waterlogged scenes; The lightweight pre-judgment slicing module uses a lightweight pre-judgment slicing model to input preprocessed urban road images into the lightweight pre-judgment slicing model to predict whether there is water accumulation on the urban road images; The VIM-based fine classification module uses a VIM-based fine classification model to input images of urban roads with water accumulation into the trained fine classification model and predict the water depth category.

5. The intelligent classification system for urban road waterlogging depth based on a knowledge distillation and diffusion model according to claim 4, characterized in that, The preprocessing includes: image denoising, adaptive histogram equalization, perspective geometry correction, size normalization, and image standardization.

Citation Information

Patent Citations

  • Urban road scene waterlogging detection method, electronic equipment and storage medium

    CN117953421A

  • Urban scene analysis prediction method of multi-mode urban scene analysis network based on three-mode contrast learning distillation

    CN119068334A