Construction method and application of urban inland inundation disaster state detection model

By constructing a multi-modal model, fusing image and text features, and generating reconstructed text describing the state of urban waterlogging, it solves the accuracy problem of flood identification in complex scenes in the existing technology, improves the accuracy and consistency of detection, and achieves Provides more fine-grained flood risk detection.

CN118656677AActive Publication Date: 2024-09-17HUAZHONG UNIV OF SCI & TECH
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410793115.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-19
Publication Date
2024-09-17
Estimated Expiration
2044-06-19

AI Technical Summary

Technical Problem

Existing methods for detecting urban flood damage status based on surveillance cameras are difficult to accurately identify flood conditions in complex scenes. In particular, they lack a comprehensive understanding of the image background and context when distinguishing flood water from natural waters, and the relationship between reference objects and water levels is inconsistent. Precise, affecting detection accuracy.

Method used

Build a multi-modal model, through the image feature extraction module, image encoding module, tokenization layer, embedding layer, image decoding module and mapping module, combined with Transformer encoder and decoder, fuse image and text features, and generate a description of urban waterlogging disaster status Reconstruct text, use pre-trained language models and text decoding modules to enhance semantic understanding and generation capabilities, and train by minimizing the loss function to improve the accuracy and consistency of the model.

Benefits of technology

It improves the accuracy and understanding of flood damage status detection in complex urban scenes, enhances the fusion ability of image and text features, ensures the high consistency and naturalness of generated text and image content, and achieves a more fine-grained flood risk detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118656677A
    Figure CN118656677A
Patent Text Reader

Abstract

The invention discloses a construction method and application of an urban inland inundation disaster state detection model, and belongs to the technical field of computer vision. The method comprises the following steps: firstly, extracting a high-dimensional visual feature, namely an image coding feature, of a city image in a training sample pair through an image coding module, and extracting an embedded feature of a real text describing a waterlogging disaster state in the city image through an embedded layer; and then image coding features and text embedding features are fused based on a cross attention mechanism in an image decoding module, so that the association between the image and the text is improved, deep interaction between different modalities is promoted, visual modal information and text modal information are effectively fused in a feature space, and the image quality is improved. The fine-grained information of the semantic level is enriched, the understanding ability of the urban inland inundation disaster state detection model for the complex flood scene is improved, and accurate inland inundation disaster state detection can be performed on the complex urban scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer vision technology, and more specifically, relates to a construction method and application of an urban waterlogging disaster status detection model. Background Art

[0002] In recent years, severe weather phenomena have been increasing around the world, with short-term heavy rainfall, continuous rainfall and other events. Due to the large number of buildings and concrete floors in urban areas, the complexity of the terrain has been greatly increased, resulting in insufficient drainage capacity in the area, frequent floods, and other natural disasters, causing significant property losses and life safety to humans. Urban floods are relatively common in China. From the perspective of the areas where they occur, some coastal areas with relatively low terrain and inland cities with high precipitation are very prone to urban floods, among which the incidence rate is higher in certain specific locations, such as overpasses, underground passages across streets, railway bridges, highway bridges, etc. Therefore, when a disaster occurs, quickly and accurately finding the flooded area and determining the severity of the disaster is of great help and significance for the effective arrangement and implementation of rescue and disaster relief work.

[0003] At present, there are mainly the following ways to detect the state of urban waterlogging: waterlogging detection based on water level meter measurement, waterlogging detection based on remote sensing images, waterlogging detection based on drone cruise, and waterlogging detection based on surveillance cameras. Compared with other methods, waterlogging detection based on surveillance cameras has shown significant advantages. Surveillance cameras are relatively low in cost, easy to deploy, and widely used in cities, which improves the coverage and real-time performance of waterlogging detection. In the existing waterlogging detection methods based on surveillance cameras, in order to estimate the water level more widely, some studies use reference objects to indirectly judge the severity of floods. For example, Chaudhary et al. used semantic segmentation to identify and segment floods, people, cars, buses, bicycles, and houses, divided flood risks into 11 levels, and marked reference objects according to this level classification standard to estimate the water level. Although these methods have demonstrated excellent performance, they are still slightly flawed in parsing the deep semantics of complex scenes, making it difficult to fully understand the scenes. For example, although flood recognition methods can identify water bodies, they cannot distinguish whether they are flood water or natural water bodies, such as ponds, lakes, rivers, etc. under certain circumstances. At this time, the algorithm lacks a comprehensive understanding of the image background and context; for another example, the relationship between reference objects of different sizes (such as cars, SUVs, buses or trucks) and water levels is different, and the height difference between adults and children will also affect the accuracy of waterlogging disaster detection; in addition, in specific application scenarios, pedestrians may be encountered in water activities under non-flood conditions, such as recreational activities in ponds or lakes. Although these scenes contain water bodies, they do not constitute a flood risk. Summary of the invention

[0004] In view of the above defects or improvement needs of the prior art, the present invention provides a method for constructing and applying an urban waterlogging disaster status detection model to solve the technical problem that the prior art cannot accurately detect the waterlogging disaster status of complex urban scenes.

[0005] In order to achieve the above-mentioned object, in a first aspect, the present invention provides a method for constructing a model for detecting urban waterlogging disaster status, comprising:

[0006] Obtain a training sample set; the training sample set includes a plurality of training sample pairs, each training sample pair includes a city image and a corresponding real text describing the state of urban waterlogging;

[0007] Constructing a multimodal model; wherein the multimodal model includes: an image feature extraction module, an image encoding module, a tokenization layer, an embedding layer, an image decoding module and a mapping module; the image encoding module includes a Transformer encoder; the image decoding module includes a Transformer decoder;

[0008] The training sample pairs are input into the multimodal model. The city images are sequentially passed through the image feature extraction module and the image encoding module to obtain the image encoding features. The real texts are sequentially passed through the tokenization layer and the embedding layer to obtain the text embedding features {e1, e2, …, e m}; where e l is the embedding feature of the lth token of the real text, l = 1, 2, ..., m; insert the preset start symbol feature e0 before the text embedding feature, and at the j+1th time step, combine the image encoding feature with the feature {e0, e1, e2, ..., e j} Input to the image decoding module for fusion, obtain the corresponding modal fusion features, and then obtain the text output of the corresponding time step through the mapping module; after m+1 time steps, obtain the reconstructed text describing the state of urban flooding; j=0,1,…,m; m is the total number of tokens of the real text;

[0009] The multimodal model is trained by minimizing the difference loss between the reconstructed text and the corresponding real text;

[0010] After the training is completed, a model for detecting urban waterlogging disaster status is constructed, which includes a cascaded image feature extraction module, an image encoding module, an image decoding module, and a mapping module.

[0011] Further preferably, the multimodal model further comprises: a pre-trained language model and a text decoding module; the text decoding module comprises a Transformer decoder;

[0012] The above text embedding features are input into the pre-trained language model to obtain text features; at the j+1th time step, the text features are also combined with the above features {e0, e1, e2, …, e j} Input to the text decoding module for fusion, obtain the corresponding text fusion features, and then obtain the text output of the corresponding time step through the mapping module; after m+1 time steps, obtain the generated text describing the state of urban waterlogging;

[0013] When training the multimodal model, the difference loss between the generated text and the corresponding real text is also minimized.

[0014] Further preferably, when training the multimodal model, the similarity between the image coding features of the city image and the text features of the corresponding real text is minimized, the similarity between the image coding features of the city image and the text features of the non-corresponding real text is maximized, the similarity between the text features of the real text and the image coding features of the corresponding city image is minimized, and the similarity between the text features of the real text and the image coding features of the non-corresponding city image is maximized.

[0015] Further preferably, when the image coding module is a plurality of cascaded Transformer encoders, the image coding features used when training the multimodal model are the image coding features output by the last-level Transformer encoder of the image coding module, or the image coding features output by the last-level Transformer encoder of the image coding module and one or more other Transformer encoders.

[0016] Further preferably, the image encoding module comprises: a plurality of cascaded Transformer encoders; the image decoding module comprises a plurality of cascaded Transformer decoders;

[0017] The input of the r-th level Transformer encoder is the image coding features output by the r-1-th level Transformer encoder; r = 2, 3, ..., R; R is the total number of Transformer encoders; the input of the first level Transformer encoder is the features extracted from the city image after passing through the image feature extraction module;

[0018] The input of the p-th level Transformer decoder is the modal fusion features output by the p-1-th level Transformer decoder and the image coding features output by the R-th level Transformer encoder; p = 2, 3, …, P; P is the total number of Transformer decoders; the input of the first level Transformer decoder is the preset start symbol feature and the image coding features output by the R-th level Transformer encoder.

[0019] Further preferably, the real text describing the urban waterlogging disaster status includes: relationship information between reference objects and water levels in the urban image; wherein the relationship information between the reference objects and water levels is represented by water level levels; the reference objects include: people and / or vehicles;

[0020] For the reference object, when the person is not in the water, the water level is marked as level 0; when the person is in the water and the water level is below the person's knees, the water level is marked as level 1; when the water level is above the person's knees and below the waist, the water level is marked as level 2; when the water level is above the person's waist, the water level is marked as level 3;

[0021] For the reference vehicle, when the vehicle is not in the water, the water level is marked as level 0; when the vehicle is in the water and the water level is below the tire radius, the water level is marked as level 1; when the water level is above the tire radius and below the license plate, the water level is marked as level 2; when the water level is above the license plate, the water level is marked as level 3;

[0022] The higher the water level, the more serious the waterlogging situation.

[0023] In a second aspect, the present invention provides a method for detecting a state of urban waterlogging, comprising:

[0024] The city image to be detected is input into the urban waterlogging disaster state detection model constructed by adopting the construction method of the urban waterlogging disaster state detection model provided by the first aspect of the present invention. The city image passes through the image feature extraction module and the image coding module of the urban waterlogging disaster state detection model in sequence to obtain the image coding feature; at the first time step, the preset start symbol feature and the image coding feature are input into the image decoding module of the urban waterlogging disaster state detection model for fusion to obtain the corresponding modal fusion feature; starting from the second time step, the modal fusion feature at the previous time step and the image coding feature are input into the image decoding module for fusion to obtain the corresponding modal fusion feature; the modal fusion feature at each time step is respectively outputted through the mapping module of the urban waterlogging disaster state detection model to obtain the text output of the corresponding time step; after multiple time steps, a reconstructed text describing the urban waterlogging disaster state is obtained.

[0025] In a third aspect, the present invention provides an electronic device, comprising: a memory and a processor, wherein the memory stores a computer program, and the processor executes the method provided in the first aspect or the second aspect of the present invention when executing the computer program.

[0026] In a fourth aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method provided in the first aspect or the second aspect of the present invention is performed.

[0027] In a fifth aspect, the present invention further provides a computer program product, comprising a computer program or instructions, wherein the computer program or instructions, when executed by a processor, implement the steps of the method provided in the first aspect or the second aspect of the present invention.

[0028] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects:

[0029] 1. The present invention provides a method for constructing a model for detecting the state of urban waterlogging. First, the high-dimensional visual features of the urban image in the training sample pair, namely, the image coding features, are extracted through the image coding module, and the embedding features of the real text describing the state of waterlogging in the urban image are extracted through the embedding layer; then, the image coding features and the text embedding features are fused based on the cross-attention mechanism in the image decoding module, thereby improving the association between the image and the text, promoting the deep interaction between different modalities, and effectively integrating the visual modal information and the text modal information in the feature space, enriching the fine-grained information at the semantic level, improving the understanding ability of the urban waterlogging disaster state detection model for complex flood scenes, and being able to accurately detect the state of waterlogging in complex urban scenes.

[0030] 2. Furthermore, the method for constructing a model for detecting the urban waterlogging disaster status provided by the present invention takes into account that the urban waterlogging disaster status detection scenario is more complex than other scenarios, and the urban image contains rich water level reference information, which requires more accurate semantic information. Therefore, the designed multimodal model also includes a pre-trained language model and a text decoding module; the pre-trained language model helps to extract more abstract flood level features so as to provide the text decoding module with richer semantic information; the text decoding module extracts high-dimensional text features of the real text based on the pre-trained language model to reconstruct the real text of the waterlogging disaster status in the city image, and obtains the corresponding generated text, so as to enhance the multimodal model's understanding and generation capabilities of language expression at the text level. By further adding textual language descriptions as auxiliary supervision, the text decoder can help the multimodal model to understand the structure and semantics of the language more deeply, more effectively integrate text features and image features, and assist in supervising flood images to generate more accurate flood risk descriptions, thereby narrowing the feature distance between images and texts, and further strengthening the internal consistency and semantic coherence of the multimodal model when processing text information, thereby improving the accuracy and naturalness of the reconstructed text generated by the urban waterlogging disaster status detection model.

[0031] 3. Furthermore, the method for constructing a model for detecting urban waterlogging disaster status provided by the present invention also minimizes the similarity between the image coding features of urban images and the text features of corresponding real texts, maximizes the similarity between the image coding features of urban images and the text features of non-corresponding real texts, minimizes the similarity between the text features of real texts and the image coding features of corresponding urban images, and maximizes the similarity between the text features of real texts and the image coding features of non-corresponding urban images when training the multimodal model; through the above process, the multimodal model's ability to align image and text features in a shared space is enhanced, and through comparative learning, the feature representations of corresponding images and texts are made closer, while the feature representations of non-corresponding images and texts are made farther apart, thereby ensuring a high degree of consistency between the generated text and the image content, promoting deep semantic alignment and complementary learning between images and texts, and thereby improving the understanding and generation capabilities of the model for detecting urban waterlogging disaster status.

[0032] 4. Furthermore, in the method for constructing a model for detecting the state of urban flooding, when the image coding module is a plurality of cascaded Transformer encoders, the image coding features used in training the multimodal model can be the image coding features output by the last level Transformer encoder of the image coding module and one or more other Transformer encoders. This multi-level feature comparison learning strategy helps the model capture the relationship between images and texts at different abstract levels, thereby achieving a deeper level of semantic understanding and representation.

[0033] 5. Furthermore, in the method for constructing a model for detecting urban waterlogging disaster status provided by the present invention, the real text describing the urban waterlogging disaster status includes the relationship information between the reference object of the city image and the water level, and the relationship information between the reference object and the water level is represented by water level grades. The water level grades are divided according to different reference object types and in combination with actual scenarios, and then the waterlogging situation is divided into multiple grades, thereby achieving more fine-grained detection of urban waterlogging situations. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 A flow chart of a method for constructing a model for detecting urban waterlogging disaster status provided by the present invention;

[0035] Figure 2 A schematic diagram of using water level grades to represent relationship information between a reference object and a water level provided in an embodiment of the present invention;

[0036] Figure 3 A schematic diagram of real text in a training sample pair provided by an embodiment of the present invention;

[0037] Figure 4 A schematic diagram of the overall structure of a multimodal model provided by an embodiment of the present invention;

[0038] Figure 5 A schematic diagram of the detailed structure of the multimodal model provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0040] In order to achieve the above objectives, firstly, Figure 1 As shown, the present invention provides a method for constructing a city waterlogging disaster status detection model, comprising:

[0041] Obtain a training sample set; the training sample set includes a plurality of training sample pairs, each training sample pair includes a city image and a corresponding real text describing the state of urban waterlogging;

[0042] Constructing a multimodal model; wherein the multimodal model includes: an image feature extraction module, an image encoding module, a tokenization layer, an embedding layer, an image decoding module and a mapping module; the image encoding module includes a Transformer encoder; the image decoding module includes a Transformer decoder;

[0043] The training sample pairs are input into the multimodal model. The city images are sequentially passed through the image feature extraction module and the image encoding module to obtain the image encoding features. The real texts are sequentially passed through the tokenization layer and the embedding layer to obtain the text embedding features {e1, e2, …, e m}; where e l is the embedding feature of the lth token of the real text, l = 1, 2, ..., m; insert the preset start symbol feature e0 before the text embedding feature, and at the j+1th time step, combine the image encoding feature with the feature {e0, e1, e2, ..., e j} is input into the image decoding module for fusion based on the cross-attention mechanism to obtain the corresponding modal fusion features, and then the text output of the corresponding time step is obtained through the mapping module; after m+1 time steps, the reconstructed text describing the state of urban flooding is obtained; j = 0, 1, ..., m; m is the total number of tokens of the real text; it should be noted that the preset start symbol feature e0 is a special symbol indicating the start, such as <bos>.

[0044] The multimodal model is trained by minimizing the difference loss between the reconstructed text and the corresponding real text;

[0045] After the training is completed, a model for detecting urban waterlogging disaster status is constructed, which includes a cascaded image feature extraction module, an image encoding module, an image decoding module, and a mapping module.

[0046] It should be noted that the real text describing the urban waterlogging disaster status includes: the relationship information between the reference objects and the water level of the urban image; wherein the relationship information between the reference objects and the water level is represented by the water level level; the reference objects include: people, cars, etc.;

[0047] like Figure 2 As shown, for the reference object, when the person is not in the water, the water level is marked as level 0; when the person is in the water and the water level line is below the person's knees, the water level is marked as level 1; when the water level line is above the person's knees and below the waist, the water level is marked as level 2; when the water level line is above the person's waist, the water level is marked as level 3;

[0048] For the reference vehicle, when the vehicle is not in the water, the water level is marked as level 0; when the vehicle is in the water and the water level is below the tire radius, the water level is marked as level 1; when the water level is above the tire radius and below the license plate, the water level is marked as level 2; when the water level is above the license plate, the water level is marked as level 3;

[0049] The higher the water level, the more serious the waterlogging situation.

[0050] Preferably, in an optional implementation manner, the real text describing the urban waterlogging disaster status also includes: a global scene description of the city image and a global flood risk description of the image.

[0051] It should be noted that the image encoding module can be a Transformer encoder or multiple cascaded Transformer encoders; the image decoding module can be a Transformer decoder or multiple cascaded Transformer decoders;

[0052] When the image encoding module is a plurality of cascaded Transformer encoders, the input of the rth level Transformer encoder is the image encoding feature output by the r-1th level Transformer encoder; r = 2, 3, ..., R; R is the total number of Transformer encoders; the input of the first level Transformer encoder is the feature extracted from the city image after passing through the image feature extraction module;

[0053] The input of the p-th level Transformer decoder is the modal fusion features output by the p-1-th level Transformer decoder and the image coding features output by the R-th level Transformer encoder; p = 2, 3, …, P; P is the total number of Transformer decoders in the image decoding module; wherein the input of the first level Transformer decoder is the preset start symbol feature and the image coding features output by the R-th level Transformer encoder.

[0054] In an optional implementation, the multimodal model further includes: a pre-trained language model and a text decoding module; the text decoding module includes a Transformer decoder;

[0055] The above text embedding features are input into the pre-trained language model to obtain text features; at the j+1th time step, the text features are also combined with the above features {e0, e1, e2, …, e j The input is sent to the text decoding module for fusion based on the cross attention mechanism to obtain the corresponding text fusion features, and then the text output of the corresponding time step is obtained through the mapping module; after m+1 time steps, the generated text describing the state of urban flooding is obtained;

[0056] When training the multimodal model, the difference loss between the generated text and the corresponding real text is also minimized.

[0057] It should be noted that the text decoding module can be a Transformer decoder or multiple cascaded Transformer decoders;

[0058] The input of the s-th level Transformer decoder is the text fusion features output by the s-1-th level Transformer decoder and the text features output by the pre-trained language model; s = 2, 3, ..., S; S is the total number of Transformer decoders in the text decoding module; wherein, the input of the first level Transformer decoder is the preset start symbol feature and the text features output by the pre-trained language model.

[0059] In an optional implementation, when training the multimodal model, the contrast loss for aligning the image coding features of the city image and the text features of the corresponding real text is also minimized, specifically including: minimizing the similarity between the image coding features of the city image and the text features of the corresponding real text, maximizing the similarity between the image coding features of the city image and the text features of the non-corresponding real text, minimizing the similarity between the text features of the real text and the image coding features of the corresponding city image, and maximizing the similarity between the text features of the real text and the image coding features of the non-corresponding city image.

[0060] It should be noted that when the image coding module is a plurality of cascaded Transformer encoders, the above-mentioned image coding features may be only the image coding features output by the last level Transformer encoder, or may be the image coding features output by the last level Transformer encoder and one or more other Transformer encoders.

[0061] It should be noted that the image feature extraction module can be CNN, ResNet, MobileNet, VisionTransformer, etc., which are not limited here. The mapping module can be MLP, KAN, etc., which are not limited here. The pre-trained language model can be BERT model, RoBERTa model, DeBERTa model, etc., which are not limited here.

[0062] In order to further illustrate the construction method of the urban waterlogging disaster status detection model provided by the present invention, a specific embodiment is described in detail below:

[0063] The method for constructing a model for detecting urban waterlogging disaster status provided in this embodiment includes:

[0064] Step 1: Obtain a dataset of urban image waterlogging descriptions. Most of the images in the dataset of the present invention come from the Internet. Use Python crawlers to search major search engines, including but not limited to Baidu, Google, and Bing. The keywords used are mainly: urban flood, waterlogging, urban flood, etc. The data contains 3220 urban images, each of which is equipped with detailed JSON format metadata, which accurately reflects the flood scene information and risk level in the urban image with descriptive text as the real text describing the urban waterlogging disaster status. Among them, 2576 images are used for training to construct a training sample set, and 644 images are used for testing to construct a test sample set. This training sample set uses reference objects to assess flood risks. The annotations of each image not only include the overall picture and key details of the scene, but also refine the hierarchical description of the risk. Cars and people are selected as the standards for assessing the urban waterlogging disaster status, which are divided into four levels in total. Specifically, for the reference object, a person, when the person is not in the water, the water level is marked as level 0; when the person is in the water and the water level is below the person's knees, the water level is marked as level 1; when the water level is above the person's knees and below the waist, the water level is marked as level 2; when the water level is above the person's waist, the water level is marked as level 3. For the reference object, a car, when the car is not in the water, the water level is marked as level 0; when the car is in the water and the water level is below the tire radius height, the water level is marked as level 1; when the water level is above the tire radius height and below the license plate height, the water level is marked as level 2; when the water level is above the license plate height, the water level is marked as level 3. The higher the water level, the more serious the waterlogging situation. In this embodiment, 0-3 represent no flooding, the probability of flooding is less than or equal to 25%, the probability of flooding is greater than 25% and less than or equal to 50%, and the probability of flooding is greater than 50%.

[0065] Annotation examples are Figure 3 As shown, it specifically includes the following six main annotation parts:

[0066] 1) Image content description (image_content_caption): describes the scene information in the image and emphasizes the objects and elements in the scene.

[0067] 2) Image risk description (image_risk_caption): Based on the risk level system, an overall risk assessment of the urban flooding scene depicted in the image was conducted.

[0068] 3) Car risk caption (car_risk_caption): Assess the risk level of vehicles in the city image.

[0069] 4) Car position caption (car_position_caption): Based on the spatial relationship between the vehicle and the flood, words such as "tire" and "hood" are used to provide key location context in the scene.

[0070] 5) Pedestrian risk caption (person_risk_caption): Assess the risk level of the pedestrian.

[0071] 6) Person position caption (person_position_caption): describes the relative position of individuals to the flood, and describes the position of the water level and the human body through the key parts of the human body, "ankle", "knee" and "waist", depicting their proximity to the flood and possible interaction dynamics.

[0072] Step 2: Build a multimodal model;

[0073] Through deep feature extraction and serialization processing, accurate semantic analysis of complex scenes is achieved. The overall structure diagram of the multimodal model constructed in this embodiment is as follows Figure 4 shown.

[0074] Urban images and corresponding text information have different characteristics and representation methods. Images are visual information based on pixels, while text is semantic information based on symbols. Fusion of these two types of information requires solving the heterogeneity and complexity of data. This paper proposes a Transformer-based multimodal collaborative attention mechanism, which encodes and decodes images and texts through self-attention mechanism and cross-attention mechanism to learn the association between images and texts.

[0075] First, the multimodal model uses a convolutional neural network to extract features from the input urban image. The convolutional neural network used in this embodiment is ResNet-101, which is a network with a depth of 101 layers. Its deep hierarchical structure enables the network to capture complex and subtle features in the image at different levels. These features not only involve the basic visual elements of the image, such as color, shape, and texture, but also include higher-order abstract features, which help to fully analyze the content of flood images and deep contextual semantic information. In addition, the residual connection design of ResNet helps solve the performance degradation problem that may occur in the model, ensuring effective learning even when the model level is very deep.

[0076] In addition, in order to enhance the semantic representation ability of visual features, text features are also introduced as auxiliary information in this embodiment. The corresponding real text is converted into tokens through the tokenization layer and the embedding layer and the position encoding is added to obtain the corresponding text embedding features, thereby ensuring the integrity of the word sequence information. The text contains a specific description of the flood scene, including the relative spatial relationship between the reference objects pedestrians and vehicles and the flood water level and the relevant description of the flood risk level. Further, the BERT model is used to perform context-aware feature encoding on the text embedding features to obtain the corresponding text features. As a deep learning architecture based on Transformer, the BERT model can capture the complex contextual relationships in text data through its bidirectional encoding mechanism, which enables the model to not only identify key words (such as "water level depth", "flooding", etc.) in the description of flood images, but also understand the meaning of these words in a specific context, thereby generating a more accurate and detailed image description. In addition to the bidirectional encoding mechanism, BERT's deep feature extraction capability enables the model to identify and understand fine-grained information in image descriptions. For example, the model can distinguish between different degrees of flooding, such as mild waterlogging or severe flooding.

[0077] Subsequently, the features of these images and texts are passed to a Transformer-based multimodal collaborative attention mechanism module, which consists of a series of Transformer encoders and Transformer decoders; Transformer can effectively learn the complex associations and dependencies between data by using the self-attention mechanism to consider the relationship between all elements in the input data when processing the input data, so as to capture the long-distance dependencies in the input data, which is particularly important for understanding the complex and context-related information in text and images. In this embodiment, each encoder layer further refines and enhances the features to enhance the model's global understanding of the scene. The decoder part focuses on reconverting the encoded mixed features into a detailed text description closely related to the original urban image content, and reconstructing the reconstructed text describing the state of urban flooding in the image. This process can be regarded as a process of "reconstructing" or "restoring" text features from visual features. Multi-head attention mechanisms are embedded in both the encoder and the decoder. This mechanism gives the model the ability to learn on multiple feature subsets by assigning input features to different subspaces and independently calculating attention scores in each subspace. In the context of flood risk description, the multi-head attention mechanism does not focus on key objects in the scene alone, but combines the visual context of the image with the corresponding text information, so that the model can not only capture single features, but also grasp the complex interactions between these objects in the image in a specific environment, showing its insight into the deep semantics of the scene, thereby generating a description with rich contextual awareness. For example, in a flood scene, there are many visual elements involved, including water surface height, affected vehicles, pedestrians, etc. The use of the multi-head attention mechanism can give parallel attention to different aspects of these visual elements. Specifically, one attention head of the model may focus on the change of water surface height, while another may focus on locating the victims. Through this multi-dimensional observation, the model achieves a full-scale capture and description of the panorama of flood risk.

[0078] Finally, the features generated by the decoder are further processed by a multi-layer perceptron (MLP) to output risk assessment levels and descriptive sentences based on the specific characteristics of the scene, providing a detailed semantic description for each element detected in the scene, such as "person risk level is 3", "water level is below half the tire", "a group of people walking through a flooded area", etc.

[0079] Specifically, the detailed structure diagram of the multimodal model is as follows: Figure 5 As shown in the figure, the image and text are encoded and decoded through the self-attention mechanism and the cross-attention mechanism to learn the association between the image and the text. The city image is obtained through the feature extraction network to obtain a high-dimensional feature vector ax. The corresponding real text is tokenized and firstly obtained through position embedding to obtain the enhanced text embedding feature e i , and then use the BERT model for deep encoding to obtain rich text features t i The image feature vector is passed through the image encoder to obtain a deep visual representation v i , recorded as the image encoding feature. The multi-head attention mechanism is used in the image encoder to split the attention mechanism into multiple "heads". Each head independently learns different parts of the input data, so that the model can capture information in different representation subspaces, thereby obtaining richer expression capabilities. In order to further enhance the semantic processing ability of the model and enable semantic information to assist in generating more accurate descriptions of images, this embodiment designs two Transformer decoders, one for the image decoder and the other for the text decoder. The image decoder embeds the text feature e i With the image encoding feature v i The cross-attention mechanism is integrated to promote deep interactions between different modalities, so as to explore the complex relationships and patterns between modalities, enrich and enhance the expressive power of features, realize the reconstruction process from image to description, and ensure that the generated description can accurately reflect the image content. The text decoder is mainly responsible for the reconstruction process of the description content. Its core role is to enhance the model's understanding and generation ability of language expression at the text level. By reconstructing the original description information, the text decoder helps the model to understand the structure and semantics of the language more deeply, strengthens the internal consistency and semantic coherence of the model when processing text information, and thus improves the accuracy and naturalness of the generated text. The combination of these two decoders makes the model more accurate in understanding and generating descriptions. The image decoder ensures that the generated description is highly relevant to the image content by integrating visual and language information; the text decoder improves the accuracy and fluency of the model in text generation by strengthening language processing capabilities. The design of the dual decoder reflects the advantages of multimodal fusion. It not only improves the performance of the model at the language level, but also achieves significant progress in the fusion of vision and language.

[0080] In addition, this embodiment adopts the strategy of image-text multiple loss functions to jointly train the multimodal model to enhance its performance when processing multimodal data. The loss function includes three parts: image-text generation loss, image-text contrast loss and text autoregressive generation loss.

[0081] The image-text generation loss is used to measure the difference between the reconstructed text and the corresponding real text, ensuring that the model can generate text that is semantically close to the real description to improve the accuracy of converting visual information into language description. It can be measured by cross entropy loss function, KL divergence loss function, mean square error loss function, etc. This embodiment uses cross entropy loss for calculation. The image-text contrast loss aims to enhance the model's ability to align image encoding features and corresponding text features in a shared space. Through contrast learning, the feature representations of corresponding images and texts are closer, while the feature representations of non-corresponding images and texts are farther apart, thereby ensuring a high degree of consistency between the generated text and the image content. It can be measured by contrast loss function (such as normalized temperature scale cross entropy contrast loss function), cosine similarity loss function, Focal Loss loss function, etc. This embodiment uses normalized temperature scale cross entropy contrast loss function to optimize this. The text autoregression generation loss is used to measure the difference between the generated text and the corresponding real text to evaluate the ability of the language model to generate text. It can be measured using loss functions such as the cross entropy loss function, KL divergence loss function, and mean square error loss function. This implementation uses the cross entropy loss function for calculation.

[0082] Through multiple loss functions, the model can not only generate corresponding text descriptions from images more accurately, but also achieve effective semantic alignment between multimodal data, ultimately improving the overall performance of the model in multimodal learning tasks.

[0083] The total loss function expression of the multimodal model is:

[0084] l total = l ce_ITG +l ce_ITG +βl NT_ITG

[0085] Among them, l ce_ITG represents the image-text generation loss; l ce_ITG Generate loss for text autoregression; l NT_ITG For the image-text contrast loss, only the image coding features output by the image coding module can be selected for contrast learning with the text features; when the image coding module includes multiple cascaded Transformer encoders, the contrast loss can also evaluate the consistency between the image coding features output by the Transformer encoders of different layers in the image coding module and the generated description text. Specifically, the image coding features output by the Transformer decoders of different layers in the image coding module (such as the image coding features output by the last layer, the third to last layer, and the fifth to last layer of the Transformer decoders) can be selected for contrast learning with the text features. This multi-level feature contrast learning strategy helps the model capture the relationship between images and texts at different abstract levels, thereby achieving deeper semantic understanding and representation in multimodal learning tasks. By adjusting the weight β of the information loss (set to 0.2 in this embodiment), the contribution of each part of the loss to the total loss during the training process can be controlled. This weighted strategy enables the model to not only generate accurate descriptions, but also better understand and express the details and contextual information of the image.

[0086] Among them, the contrast loss l NT_ITG The normalized temperature scale cross entropy contrast loss function is used for measurement, and its calculation formula is:

[0087]

[0088]

[0089] It should be noted that the image and text in the same training sample pair in the training sample set correspond to each other, while the images and text in different training sample pairs do not correspond to each other; N is the total number of training sample pairs in the training sample set; λ is the weight parameter; z vi 、z ui 、z vk 、z uk To pass the fully connected layer to the i-th training sample pair (I i ,T i ) in the city image I i The image encoding features and the real text T i The text features and the k-th training sample pair (I k ,T k ) in the city image I k The image encoding features and the real text T k The features after the text features are projected into a common low-dimensional feature space; sim(z vi ,z ui ) represents the feature zx i and z ui The similarity between them is measured by cosine similarity in this embodiment; τ is a temperature parameter used to adjust the sensitivity of contrast loss.

[0090] l image_text,i Image-oriented pairing focuses on the association between images and text, helping multimodal models understand image content and generate corresponding text descriptions, which strengthens the ability of multimodal models in converting visual information into language descriptions. text_image,i The processing of text-dominated pairings focuses on the association of text to images, enabling the multimodal model to identify relevant visual content based on the text description, which enhances the multimodal model's understanding of the details in the text description and matches it with specific visual features. This two-way processing mechanism helps ensure that the model can not only understand text from images, but also understand images from text, thereby achieving more comprehensive feature learning in multimodal flood scene learning tasks.

[0091] Multiple loss functions help improve the ability of multimodal models in processing and interpreting image content, ensuring that the reconstructed text not only matches the true text description but is also closely related to the image content.

[0092] This example uses the ADAM optimizer to train the multimodal model, with a batch size of 16 and an initial learning rate of 1e -4 , set the maximum number of iterations of the multimodal model to 100 times, and the cycle of learning rate decrease during training is 20. When this value is reached or not reached, the model has converged and the multimodal model terminates the iteration.

[0093] Step 3: After the multimodal model training is completed, an urban waterlogging disaster status detection model is constructed, which includes a cascaded image feature extraction module, an image encoding module, an image decoding module, and a mapping module.

[0094] In a second aspect, the present invention provides a method for detecting a state of urban waterlogging, comprising:

[0095] The city image to be detected is input into the urban waterlogging disaster state detection model constructed by adopting the construction method of the urban waterlogging disaster state detection model provided by the first aspect of the present invention. The city image passes through the image feature extraction module and the image coding module of the urban waterlogging disaster state detection model in sequence to obtain the image coding feature; at the first time step, the preset start symbol feature and the image coding feature are input into the image decoding module of the urban waterlogging disaster state detection model to be fused based on the cross attention mechanism to obtain the corresponding modal fusion feature; starting from the second time step, the modal fusion feature and the image coding feature at the previous time step are input into the image decoding module of the urban waterlogging disaster state detection model to be fused based on the cross attention mechanism to obtain the corresponding modal fusion feature; the modal fusion feature at each time step is respectively outputted by the mapping module of the urban waterlogging disaster state detection model to obtain the text output of the corresponding time step; after multiple time steps, a reconstructed text describing the urban waterlogging disaster state in the city image to be detected is obtained.

[0096] The related technical scheme is the same as the method for constructing the urban waterlogging disaster status detection model provided by the first aspect of the present invention, and will not be described in detail here.

[0097] In a third aspect, the present invention provides an electronic device, comprising: a memory and a processor, wherein the memory stores a computer program, and the processor executes the method provided in the first aspect or the second aspect of the present invention when executing the computer program.

[0098] The relevant technical solutions are the same as the method for constructing a city waterlogging disaster status detection model provided by the first aspect of the present invention and the method for detecting the city waterlogging disaster status provided by the second aspect of the present invention, and will not be described in detail here.

[0099] In a fourth aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method provided in the first aspect or the second aspect of the present invention is performed.

[0100] The relevant technical solutions are the same as the method for constructing a city waterlogging disaster status detection model provided by the first aspect of the present invention and the method for detecting the city waterlogging disaster status provided by the second aspect of the present invention, and will not be described in detail here.

[0101] In a fifth aspect, the present invention further provides a computer program product, comprising a computer program or instructions, wherein the computer program or instructions, when executed by a processor, implement the steps of the method provided in the first aspect or the second aspect of the present invention.

[0102] The relevant technical solutions are the same as the method for constructing a city waterlogging disaster status detection model provided by the first aspect of the present invention and the method for detecting the city waterlogging disaster status provided by the second aspect of the present invention, and will not be described in detail here.

[0103] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.< / bos>

Claims

1. A method for constructing a model for detecting urban waterlogging disaster status. It is characterized in that include: Obtain a training sample set; the training sample set includes a plurality of training sample pairs, each training sample pair includes a city image and a corresponding real text describing the state of urban waterlogging; Constructing a multimodal model; the multimodal model includes: an image feature extraction module, an image encoding module, a tokenization layer, an embedding layer, an image decoding module and a mapping module; the image encoding module includes a Transformer encoder; the image decoding module includes a Transformer decoder; The training sample pairs are input into the multimodal model, wherein the city image is sequentially passed through the image feature extraction module and the image encoding module to obtain the image encoding feature; the real text is sequentially passed through the tokenization layer and the embedding layer to obtain the text embedding feature {e 1 , e 2 ,…,e m }; where e l is the embedding feature of the lth token of the real text, l = 1, 2, ..., m; insert the preset start symbol feature e before the text embedding feature 0 , at the j+1th time step, the image encoding feature is combined with the feature {e 0 , e 1 , e 2 ,…,e j } is input into the image decoding module for fusion to obtain the corresponding modal fusion features, and then the text output of the corresponding time step is obtained through the mapping module; after m+1 time steps, the reconstructed text describing the state of urban flooding is obtained; j=0, 1, ..., m; m is the total number of tokens of the real text; Training the multimodal model by minimizing the difference loss between the reconstructed text and the corresponding real text; After the training is completed, a city waterlogging disaster status detection model including the cascaded image feature extraction module, the image encoding module, the image decoding module and the mapping module is constructed.

2. The method for constructing a model for detecting urban waterlogging disaster status according to claim 1, It is characterized in that The multimodal model further includes: a pre-trained language model and a text decoding module; the text decoding module includes a Transformer decoder; The text embedding feature is input into the pre-trained language model to obtain the text feature; at the j+1th time step, the text feature is also combined with the feature {e 0 , e 1 , e 2 ,…,e j } is input into the text decoding module for fusion to obtain the corresponding text fusion features, and then the text output of the corresponding time step is obtained through the mapping module; after m+1 time steps, the generated text describing the state of urban waterlogging is obtained; When training the multimodal model, the difference loss between the generated text and the corresponding real text is also minimized.

3. The method for constructing a model for detecting urban waterlogging disaster status according to claim 2, It is characterized in that When training the multimodal model, the similarity between the image coding features of the city image and the text features of the corresponding real text is minimized, the similarity between the image coding features of the city image and the text features of the non-corresponding real text is maximized, the similarity between the text features of the real text and the image coding features of the corresponding city image is minimized, and the similarity between the text features of the real text and the image coding features of the non-corresponding city image is maximized.

4. The method for constructing a model for detecting urban waterlogging disaster status according to claim 3, It is characterized in that When the image coding module is a plurality of cascaded Transformer encoders, the image coding features used for training the multimodal model are the image coding features output by the last-stage Transformer encoder of the image coding module, or the image coding features output by the last-stage Transformer encoder of the image coding module and one or more other Transformer encoders.

5. A method for constructing a model for detecting urban waterlogging disaster status according to any one of claims 1 to 4, It is characterized in that The image encoding module includes: a plurality of cascaded Transformer encoders; the image decoding module includes a plurality of cascaded Transformer decoders; The input of the r-th level Transformer encoder is the image coding feature output by the r-1-th level Transformer encoder; r = 2, 3, ..., R; R is the total number of Transformer encoders; the input of the first level Transformer encoder is the feature extracted from the city image after passing through the image feature extraction module; The input of the p-th level Transformer decoder is the modal fusion features output by the p-1-th level Transformer decoder and the image coding features output by the R-th level Transformer encoder; p = 2, 3, ..., P; P is the total number of Transformer decoders; the input of the first level Transformer decoder is the preset start symbol features and the image coding features output by the R-th level Transformer encoder.

6. A method for constructing a model for detecting urban waterlogging disaster status according to any one of claims 1 to 4, It is characterized in that The real text describing the urban waterlogging disaster status includes: relationship information between reference objects and water levels in the urban image; wherein the relationship information between the reference objects and water levels is represented by water level grades; the reference objects include: people and / or vehicles; For the reference object, when the person is not in the water, the water level is marked as level 0; when the person is in the water and the water level is below the person's knees, the water level is marked as level 1; when the water level is above the person's knees and below the waist, the water level is marked as level 2; when the water level is above the person's waist, the water level is marked as level 3; For the reference vehicle, when the vehicle is not in the water, the water level is marked as level 0; when the vehicle is in the water and the water level is below the tire radius, the water level is marked as level 1; when the water level is above the tire radius and below the license plate, the water level is marked as level 2; when the water level is above the license plate, the water level is marked as level 3; The higher the water level, the more serious the waterlogging situation.

7. A method for detecting urban waterlogging disaster status, It is characterized in that include: The city image to be detected is input into the urban waterlogging disaster state detection model constructed by the construction method of the urban waterlogging disaster state detection model according to any one of claims 1 to 6, and the city image is sequentially passed through the image feature extraction module and the image coding module of the urban waterlogging disaster state detection model to obtain the image coding feature; at the first time step, the preset start symbol feature and the image coding feature are input into the image decoding module of the urban waterlogging disaster state detection model for fusion to obtain the corresponding modal fusion feature; Starting from the second time step, the modal fusion features of the previous time step and the image coding features are input into the image decoding module for fusion to obtain corresponding modal fusion features; the modal fusion features of each time step are respectively outputted through the mapping module of the urban waterlogging disaster status detection model to obtain the text output of the corresponding time step; after multiple time steps, a reconstructed text describing the urban waterlogging disaster status is obtained.

8. An electronic device, It is characterized in that include: A memory and a processor, wherein the memory stores a computer program, and the processor executes the method according to any one of claims 1 to 7 when executing the computer program.

9. A computer-readable storage medium, It is characterized in that A computer program is stored thereon, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is performed.

10. A computer program product, It is characterized in that The method comprises a computer program or an instruction, wherein when the computer program or the instruction is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Error correction method and device for Chinese text in power field, storage medium and computing equipment

    CN114118065A

  • Multi-modal trademark retrieval method and system based on comparative learning algorithm

    CN116662599A

  • CLIP-based end-to-end scene text recognition method

    CN117058667A

  • Commodity image description method based on fine-grained features

    CN118096302A

  • Text generation method and apparatus

    WO2024046189A1