Night scene road water body segmentation method, device and readable storage medium
By combining Retinex theory and deep learning architecture, the problem of insufficient identification accuracy of road water recognition at night under low light conditions is solved, and an efficient, economical and adaptable road water body segmentation method is realized, which is suitable for autonomous driving and intelligent transportation systems. .
Patent Information
- Application Number
- CN202410818425.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-06-24
AI Technical Summary
When existing technologies identify road water accumulation at night or under low-light conditions, there are problems such as insufficient recognition accuracy, high cost, high technical complexity, strong dependence on specific hardware, and insufficient domain adaptability.
Combining Retinex theory and deep learning architecture, the semantic-oriented disentanglement module, SwinTransformer feature extraction module and illumination information-guided decoder are used to improve the accuracy and robustness of water accumulation recognition through image preprocessing, disentanglement processing and loss function optimization. sex.
It significantly improves the recognition accuracy of road water segmentation at night and its adaptability to complex lighting conditions, reduces hardware costs and dependence on specific data, enhances domain adaptability and generalization capabilities, and enables efficient image analysis in low-light environments.
Smart Images

Figure CN118379503B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing and machine vision, and in particular to a method, a device and a readable storage medium for segmenting road water bodies in night scenes based on retinex decomposition. Background Art
[0002] In the current era of intelligence, computer vision technology plays a vital role in autonomous driving and intelligent transportation systems. Among them, road waterlogging identification, as a core task, is directly related to driving safety and the accuracy of urban disaster warnings. Waterlogging not only affects the safety of vehicle driving and reduces road friction, but may also be a preliminary manifestation of urban waterlogging. Therefore, it is particularly important to efficiently and accurately identify road waterlogging areas.
[0003] Traditional research on road water recognition mostly relies on convolutional neural networks (CNNs), which have shown excellent performance in image recognition and feature extraction. However, when the application environment changes to nighttime or scenes with poor lighting conditions, the performance of CNNs drops significantly. The main reason is that the visual information in nighttime environments is drastically reduced, which makes feature extraction more difficult and affects the model's effective capture of water features. Although in recent years, models based on the Transformer architecture have made breakthrough progress in multiple visual tasks due to their powerful global attention mechanism, they still face the problem of insufficient recognition accuracy when dealing with road water recognition in low-light environments, which shows that current segmentation models have limitations when dealing with extreme lighting conditions.
[0004] In response to the above challenges, researchers have tried a variety of strategies to improve the ability to identify water accumulation at night. On the one hand, some methods rely on enhanced sensor configurations, such as infrared cameras, which can penetrate the limitations of visible light and provide richer environmental information. However, such a solution not only increases the hardware cost of the system, but may also be limited by the popularity and maintenance costs of the equipment in actual deployment. On the other hand, domain adaptation technology is introduced to solve the problem of model migration under different lighting conditions, that is, by adjusting the trained daytime semantic segmentation model to adapt it to the night environment. Although this method is theoretically feasible, in practice it often requires additional nighttime data for fine-tuning, which is not only time-consuming and labor-intensive, but also requires a large amount of annotated data support, and has limited processing effect on the large differences between the source domain and the target domain (i.e., the intra-domain gap problem), making it difficult to achieve satisfactory generalization performance.
[0005] In summary, existing technologies for identifying road water accumulation at night or in low light conditions generally have problems such as high cost, high technical complexity, strong dependence on specific hardware, and insufficient domain adaptability. There is an urgent need for a more efficient, economical and adaptable solution to fill this technological gap. Summary of the invention
[0006] The embodiments of the present invention provide a method, device and readable storage medium for road and water segmentation in night scenes based on retinex decomposition, which aims to address the challenges of reduced recognition accuracy in current technologies under nighttime or low-light conditions, increased costs due to reliance on additional sensors, and exploration of domain adaptation methods which are still limited by large data requirements and limited effects on processing intra-domain differences.
[0007] The core technology of this invention is to combine Retinex theory with advanced deep learning architecture, aiming to effectively improve the accuracy and robustness of water accumulation identification without the need for additional expensive hardware or a large amount of specific field data.
[0008] In a first aspect, the present invention provides a method for segmenting road water bodies in night scenes based on retinex decomposition, the method comprising the following steps:
[0009] a) Obtain images of road water accumulation at night and perform preprocessing operations;
[0010] b) Input the preprocessed image into a Retinex decomposition-based model, which includes a semantically guided disentanglement module, a four-layer SwinTransformer feature extraction module, and a three-layer illumination-guided decoder;
[0011] c) In the semantically guided disentanglement module, the image is separated into a reflectance map and an illumination map that conform to the retinal cortex theory, and the illumination interaction features are extracted;
[0012] d) using the reflectance map and the illumination map to be input again into the semantic-oriented disentanglement module for disentanglement processing, and obtaining updated reflectance map, illumination map and illumination interaction features for calculating the loss function;
[0013] e) inputting the updated reflection map into the SwinTransformer feature extraction module to extract high-level features;
[0014] f) After merging the extracted high-level features with the illumination interaction features, a decoder guided by illumination information is used to generate a segmentation prediction map;
[0015] g) Complete model training by calculating and optimizing segmentation loss, disentanglement loss, retinal cortex image reconstruction loss, and illumination smoothing reconstruction loss;
[0016] h) Input the nighttime road waterlogging image to be segmented into the trained model to obtain the segmentation result.
[0017] Furthermore, in step a), preprocessing includes random flipping, image data enhancement by adding noise, and resizing to 256x512.
[0018] Furthermore, in step b), the semantically-oriented disentanglement module specifically includes an illumination interaction feature extraction layer, a feature embedding layer and a retinal cortex Retinex representation layer, and each layer is responsible for a specific image feature processing task.
[0019] Furthermore, in step b), the Swin Transformer feature extraction module adopts a moving window self-attention mechanism to effectively extract long-term dependent features in the image.
[0020] Furthermore, in step b), the decoder guided by illumination information dynamically generates attention masks by applying illumination attention blocks to guide segmentation decisions and enhance adaptability to illumination changes.
[0021] Furthermore, the illumination interaction feature extraction layer extracts the preprocessed nighttime road water accumulation images as illumination interaction features; the feature embedding layer converts the illumination interaction features into reflectance map embedding and illuminance map embedding; the input of the retinal cortex Retinex representation layer comes from the low-latitude features of the illumination interaction features and the reflectance map embedding and illuminance map embedding of the feature embedding layer, and the output is the reflectance map and illuminance map that conform to the retinal cortex theoretical retinex.
[0022] Furthermore, in step b), the decoder guided by the illumination information performs illumination interaction feature F Rl Use the illumination attention block to calculate the attention mask M Rl , the attention mask M Rl Quantitative evaluation of the illumination interaction feature F Rl The pixel richness of the semantic information contained, and then the high-level feature map F corresponding to its input R Perform dot product and finally upsample to 256x512 to get the predicted segmentation map .
[0023] In a second aspect, the present invention provides a night scene road water body segmentation device based on retinex decomposition, comprising:
[0024] An image acquisition device, used to collect nighttime road environment images of different sources and qualities;
[0025] A preprocessing unit performs random transformation, contrast enhancement, noise suppression and adaptive scale adjustment on the received image to standardize the input image;
[0026] A multimodal feature extraction network is used to input the preprocessed image into a model based on Retinex decomposition, which includes a semantically guided disentanglement module, a four-layer Swin Transformer feature extraction module, and a three-layer decoder guided by illumination information; in the semantically guided disentanglement module, the image is separated into a reflectance map and an illumination map that conform to the retinal cortex theory, and illumination interaction features are extracted at the same time; the reflectance map and the illumination map are used for re-disentanglement processing to obtain updated reflectance map, illumination map and illumination interaction features for calculating the loss function; the updated reflectance map is input into the Swin Transformer feature extraction module to extract high-level features;
[0027] A segmentation prediction unit is used to combine the extracted high-level features with the illumination interaction features and generate a segmentation prediction map through a decoder guided by illumination information;
[0028] An optimization and feedback control unit, which is used to complete model training by calculating and optimizing segmentation loss, disentanglement loss, retinal cortex image reconstruction loss, and illumination smoothing reconstruction loss;
[0029] The output module is used to input the nighttime road waterlogging image to be segmented into the trained model to obtain the segmentation result.
[0030] In a third aspect, the present invention provides an electronic device including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the above-mentioned night scene road water segmentation method based on retinex decomposition.
[0031] In a fourth aspect, the present invention provides a readable storage medium, in which a computer program is stored. The computer program includes a program code for controlling a process to execute the process. The process includes the night scene road water body segmentation method based on retinex decomposition mentioned above.
[0032] The main contributions and innovations of the present invention are as follows:
[0033] 1. Significantly improve recognition accuracy and robustness: By integrating Retinex theory and deep learning technology, especially the innovative Swin Transformer feature extraction module, the present invention can effectively improve the accuracy of nighttime road water segmentation and its adaptability to complex lighting conditions without relying on additional expensive hardware. This method significantly enhances the performance of the model in low-light environments through meticulous image preprocessing, semantic-oriented disentanglement, and full use of lighting information.
[0034] 2. Reduce hardware costs and specific data dependence: Compared with solutions that rely on high-cost sensors such as infrared cameras, this invention achieves efficient processing of night images through algorithm optimization, avoiding the cost of hardware upgrades. At the same time, it reduces the dependence on large-scale specific field (night data) annotation, reducing the complexity and cost of data collection and processing.
[0035] 3. Enhanced domain adaptability and generalization ability: Through the combined use of Retinex decomposition and deep learning models, the present invention not only solves the problem of insufficient generalization ability of traditional methods under different lighting conditions, but also enhances the model's adaptive learning of lighting changes through designs such as lighting attention blocks, so that the model can still maintain stable and reliable segmentation performance when facing night scenes with drastic light changes.
[0036] 4. Comprehensive loss function optimization: The multi-loss function optimization strategy adopted in the present invention includes segmentation loss, disentanglement loss, retinal cortex image reconstruction loss and illumination smoothing reconstruction loss. This comprehensive consideration ensures that the model can learn image features more comprehensively during the training process, thereby improving the accuracy of the segmentation results and the quality of image reconstruction.
[0037] 5. Technical versatility and wide application: The proposed nighttime road water segmentation method is not limited to the field of road traffic safety. Its core technology and framework are also applicable to other scenarios that require accurate image analysis and recognition in low-light environments, such as security monitoring, disaster prevention and other fields, showing broad application prospects and industry promotion value.
[0038] In summary, the present invention provides an efficient, economical and adaptable solution for nighttime road water segmentation, which effectively makes up for the shortcomings of existing technologies in dealing with extreme lighting conditions. It is of great significance to promote the safety of autonomous driving technology, the efficiency of intelligent transportation systems and urban flood prevention and disaster reduction capabilities.
[0039] The details of one or more embodiments of the invention are set forth in the following drawings and description so that other features, objects, and advantages of the invention are more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0041] Figure 1 This is a process of a night scene road water body segmentation method based on retinex decomposition according to an embodiment of the present invention;
[0042] Figure 2is a schematic diagram of the structure of a deep learning model according to an embodiment of the present invention;
[0043] Figure 3 is a schematic diagram of a picture retinex detangling structure according to an embodiment of the present invention;
[0044] Figure 4 is a schematic diagram of a decoder structure guided by illumination information according to an embodiment of the present invention;
[0045] Figure 5 yes Figure 2 An example image of the image to be segmented;
[0046] Figure 6 yes Figure 2 Example diagram of the detection results in ;
[0047] Figure 7 4 is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0048] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of this specification. Instead, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.
[0049] It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may be combined into a single step for description in other embodiments.
[0050] Due to the common artificial light sources and water reflective characteristics in night road scenes, in order to overcome the defects in the prior art for night scene road water segmentation, this embodiment provides a night scene road water segmentation method based on retinex decomposition to improve the accuracy of night road water segmentation.
[0051] Embodiment 1
[0052] The present invention aims to propose a night scene road water body segmentation method based on retinex decomposition. Specifically, referring to Figure 1 , the method comprising:
[0053] Step 1: Acquire images of waterlogged roads at night and preprocess the images of waterlogged roads at night.
[0054] In order to meet the input requirements of the model, this embodiment needs to scale the nighttime road waterlogging image to an image size of 256x512. The preprocessing operation in this embodiment is to scale the image size, the preprocessing operation in this embodiment is to scale the image size, random flipping: each time an image is processed, a random number is generated, if the number is less than the set threshold of 0.5, the image is flipped, random cropping: set the size and position of the cropping area, and then crop the area from the original image, the size and position of the cropping area are usually selected by the generated random number.
[0055] Step 2: Input the preprocessed nighttime road water accumulation image into the de-entanglement module of the deep learning model to obtain the retinex representation of the image, that is, the reflectance map and illumination map that conforms to the retinal cortex theory.
[0056] Step 3: In order to obtain a more accurate and stable retinex representation, the decoupled image retinex representation is interleaved and coupled and then input into the deentanglement module again to obtain a new retinex representation.
[0057] Step 4: Input the reflection map represented by the retinex of the image into Swim Transformer to extract features.
[0058] Step 5: Input to the decoder module to obtain the segmentation map.
[0059] Step 6: Figure 2-6 As shown, the image to be segmented is input into the trained network to obtain the detection result.
[0060] This embodiment introduces a deep learning model and combines it with the retinex theory to perform semantic segmentation, thereby improving the accuracy and stability of the segmentation operation. Figure 2 As shown, the deep learning model of this embodiment is an asymmetric network structure, including a semantic-oriented disentanglement module (Semantic-Oriented Disentanglement, SOD), a four-layer SwinTransformer feature extraction module, and a three-layer illumination information-guided decoder (IIIumination-Guide). The following is a detailed introduction to each module to illustrate the deep learning model used in this embodiment.
[0061] 1) If Figure 3As shown in Figure 1, the semantically-oriented disentanglement module (SOD) is a U-shaped structure. The module structure is improved based on the existing U-Net network. The biggest difference from U-Net is that the bottleneck layer is replaced by three illumination attention modules instead of the original two 3*3 convolution blocks. The input is sent to the illumination attention module of the bottleneck layer after convolution downsampling in the SOD encoder part to obtain semantic features full of illumination information, and then passes through a convolution layer in the decoder part of SOD to obtain the illumination interaction feature F. Rl , lighting interaction feature F Rl After upsampling, the reflection map and illumination map L represented by retinex are obtained through two different convolutional layers.
[0062] 2) Feature Extraction Swin Transformer: Receives the reflectance map R obtained after decoupling the SOD image, and outputs the high-level feature map F through a four-layer structure R .
[0063] The encoder of this embodiment adopts Swin Transformer. For the convenience of description, its four-layer structure is defined as a first layer structure, a second layer structure, a third layer structure and a fourth layer structure according to the data flow direction.
[0064] The first layer structure includes a patch partition block (PatchPartition), a linear embedding block (Linear Embedding) and a Swin Transformer block (Swin TransformerBlock) connected in sequence from the data input side to the output side. Each layer structure in the second layer structure, the third layer structure and the fourth layer structure includes a patch merging layer (Patch Merging) and a Swin Transformer block connected in sequence from the data input side to the output side.
[0065] The entire Swin Transformer model adopts a hierarchical design and contains a total of four layers. At the beginning of the input, a Patch Partition is performed to cut the image into tiles and embed them into Linear Embedding (divided into 4*4 patches, stretched into one-dimensional vectors and embedded in Linear Embedding). The Patch Merging module mainly reduces the image resolution at the beginning of each layer. The Swin Transformer Block is mainly composed of the normalization layer LayerNorm, the multi-layer perceptron MLP, the window attention mechanism Window Attention and the shifted window attention mechanism Shifted Window Attention.
[0066] It should be noted that Swin Transformer is an existing network structure, and its specific structure and workflow are not described in detail in this embodiment.
[0067] 3) Illumination-Guide (IG) decoder, the network structure is as follows Figure 4 As shown in Figure 1, IG adopts a 3-layer U-shaped structure. The input of IG is the illumination interaction feature F Rl and the high-level features of the reflection map F R In the downsampling branch, F Rl Hierarchical features are generated through a 3*3 convolution, an illumination-guided attention block (IGAB), a stride 4*4 convolution (for downscaling features), two IGABs, and a stride 3*3 convolution. , where i = 0,1,2.
[0068] Then F2 obtains the attention mask M through two IGABs Rl , which quantitatively evaluates the illumination interaction feature F Rl The pixel richness of the semantic information contained in , and then the corresponding high-level reflection map features F R Then, a symmetric structure is designed as the upsampling branch. These features are upsampled using a 2*2 deconvolution with stride = 2. Skip connections are used to mitigate the information loss caused by the downsampling branch, and finally the predicted segmentation map is upsampled to the input size of 256x512. .
[0069] In order to ensure the application effect of the deep learning model, the deep learning model needs to be trained in advance. This embodiment provides a training process as follows:
[0070] Step S1, obtaining a nighttime road waterlogging image training dataset with annotated road waterlogging segmentation masks, performing random flipping and photometric distortion data enhancement on the nighttime road waterlogging image training dataset, and then starting training in batches.
[0071] This embodiment performs random flipping and photometric distortion data enhancement on the training data set. Random flipping, that is, flipping the training images in each batch horizontally or vertically with a probability of 50%, has the advantage of increasing the robustness of our small data set and having better accuracy for the subsequent nighttime road water segmentation. Photometric distortion data enhancement, that is, adjusting the brightness, chromaticity, contrast, saturation of the image, and adding noise, makes the data set more consistent with the road water images obtained in nighttime scenes.
[0072] Step S2: adjust the input image size of the enhanced image training dataset to 256×512, and input it into the semantic-oriented disentanglement module to obtain the reflectance map R and illumination map L represented by retinex, as well as the illumination interaction feature F. Rl .
[0073] Step S3: In order to obtain a more accurate and stable retinex representation, the invariance of the decoupled reflection map is implicitly constrained, and the decoupled image retinex representation is interleaved and coupled and then input into the disentanglement module again to obtain a new retinex representation: the new reflection map R' and illumination map L' and the illumination interaction feature F Rl’ .
[0074] Step S4: Extract high-level features F from the reflection image R through Swin Transformer R .
[0075] This application uses Swin Transformer as the backbone network for feature extraction. The Swin Transformer used is pre-added with pre-trained weights trained on two nighttime datasets, Nightcity and Cityscapes. Training is performed in batches. During the training process, the batch size is 8 (that is, 8 images are processed in each batch), the optimizer is AdamW, the initial learning rate is 6e-05, the momentum is 0.9, the learning rate adjustment strategy is the poly strategy, the power is set to 1, and the weight decay is 0.01.
[0076] The 256×512 reflection image is put into the encoder Swin Transformer. After passing through the four-layer encoder, the high-level feature F is output. R .
[0077] The size of the feature map is determined by the backbone network Swin Transformer, which will not be described here.
[0078] Step S5: The illumination interaction feature F output from step S2 Rl And in step S4, Swin Transformer extracts high-level features F from the reflection image R R Input to the decoder module to get the predicted segmentation map.
[0079] Step S6: Calculate the disentanglement loss for the new retinex representation of the reflectance map R and the illumination map L obtained by the semantically guided disentanglement module in step S2 and the new retinex representation generated by the disentanglement module in step S3: the new reflectance map R' and the illumination map L' and retinex reconstruction loss and lighting smoothing loss , the predicted segmentation map output by the decoder guided by illumination information (IIIumination-Guide) Calculate segmentation loss , and add hyperparameters to control each loss item, thus obtaining the final loss of the entire network model. Before the end of each batch, back propagation is performed to reduce the loss. At the same time, the network parameters are updated and the next batch of training is started until all batches of training data are trained. Finally, the trained weights are obtained, and all updated parameters are saved in the Work_dirs weight file.
[0080] The losses include:
[0081] SOD’s disentanglement loss:
[0082]
[0083] Retinex reconstruction loss:
[0084]
[0085] Lighting smoothing loss:
[0086]
[0087] Semantic segmentation loss:
[0088]
[0089] It should be noted that The cross entropy loss is a relatively mature technology in this field, so I will not go into details here. The final network loss is as follows:
[0090]
[0091] where λ i (i∈1,2,3,4) is a hyperparameter.
[0092] Embodiment 2
[0093] Based on the same concept, the present invention also proposes a night scene road water body segmentation device based on retinex decomposition, comprising:
[0094] An image acquisition device, used to collect nighttime road environment images of different sources and qualities;
[0095] A preprocessing unit performs random transformation, contrast enhancement, noise suppression and adaptive scale adjustment on the received image to standardize the input image;
[0096] A multimodal feature extraction network is used to input the preprocessed image into a model based on Retinex decomposition, which includes a semantically guided disentanglement module, a four-layer Swin Transformer feature extraction module, and a three-layer decoder guided by illumination information; in the semantically guided disentanglement module, the image is separated into a reflectance map and an illumination map that conform to the retinal cortex theory, and illumination interaction features are extracted at the same time; the reflectance map and the illumination map are used for re-disentanglement processing to obtain updated reflectance map, illumination map and illumination interaction features for calculating the loss function; the updated reflectance map is input into the Swin Transformer feature extraction module to extract high-level features;
[0097] A segmentation prediction unit is used to combine the extracted high-level features with the illumination interaction features and generate a segmentation prediction map through a decoder guided by illumination information;
[0098] An optimization and feedback control unit, which is used to complete model training by calculating and optimizing segmentation loss, disentanglement loss, retinal cortex image reconstruction loss, and illumination smoothing reconstruction loss;
[0099] The output module is used to input the nighttime road waterlogging image to be segmented into the trained model to obtain the segmentation result.
[0100] Embodiment 3
[0101] This embodiment also provides an electronic device, referring to Figure 7 , comprises a memory 404 and a processor 402, wherein the memory 404 stores a computer program, and the processor 402 is configured to run the computer program to execute the steps in any of the above method embodiments.
[0102] Specifically, the processor 402 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiment of the present invention.
[0103] Among them, the memory 404 may include a large capacity memory 404 for data or instructions. For example, but not limitation, the memory 404 may include a hard disk drive (HDD), a floppy disk drive, a solid state drive (SSD), a flash memory, an optical disk, a magneto-optical disk, a tape, or a universal serial bus (USB) drive, or a combination of two or more of these. In appropriate cases, the memory 404 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 404 may be inside or outside the data processing device. In a specific embodiment, the memory 404 is a non-volatile memory. In a specific embodiment, the memory 404 includes a read-only memory (ROM) and a random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (Programmable Read-Only Memory, PROM for short), an erasable PROM (Erasable Programmable Read-Only Memory, EPROM for short), an electrically erasable PROM (Electrically Erasable Programmable Read-Only Memory, EEPROM for short), an electrically alterable ROM (Electrically Alterable Read-Only Memory, EAROM for short) or a flash memory (FLASH) or a combination of two or more of these. In appropriate circumstances, the RAM may be a static random access memory (SRAM) or a dynamic random access memory (DRAM), wherein the DRAM may be a fast page mode dynamic random access memory 404 (FPMDRAM), an extended data output dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.
[0104] The memory 404 may be used to store or cache various data files required for processing and / or communication, as well as possible computer program instructions executed by the processor 402 .
[0105] The processor 402 reads and executes the computer program instructions stored in the memory 404 to implement any one of the night scene road and water body segmentation methods based on retinex decomposition in the above embodiments.
[0106] Optionally, the electronic device may further include a transmission device 406 and an input / output device 408 , wherein the transmission device 406 is connected to the processor 402 , and the input / output device 408 is connected to the processor 402 .
[0107] The transmission device 406 can be used to receive or send data via a network. The specific examples of the above-mentioned network may include a wired or wireless network provided by a communication provider of the electronic device. In one example, the transmission device includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 406 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.
[0108] Input / output devices 408 are used to input or output information.
[0109] Embodiment 4
[0110] This embodiment also provides a readable storage medium, in which a computer program is stored. The computer program includes a program code for controlling a process to execute the process. The process includes the night scene road water body segmentation method based on retinex decomposition according to the first embodiment.
[0111] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0112] In general, various embodiments may be implemented in hardware or dedicated circuits, software, logic, or any combination thereof. Some aspects of the invention may be implemented in hardware, while other aspects may be implemented in firmware or software executed by a controller, microprocessor, or other computing device, but the invention is not limited thereto. Although various aspects of the invention may be shown and described as block diagrams, flow charts, or using some other graphical representation, it should be understood that, as non-limiting examples, the boxes, devices, systems, techniques, or methods described herein may be implemented in hardware, software, firmware, dedicated circuits or logic, general-purpose hardware or controllers or other computing devices, or some combination thereof.
[0113] Embodiments of the present invention can be implemented by computer software, which is executable by a data processor of a mobile device, such as in a processor entity, or implemented by hardware, or implemented by a combination of software and hardware. Computer software or programs (also referred to as program products) including software routines, applets and / or macros can be stored in any device-readable data storage medium, and they include program instructions for performing specific tasks. Computer program products can include one or more computer executable components configured to perform embodiments when the program is running. One or more computer executable components can be at least one software code or a part thereof. In addition, at this point, it should be noted that any box of the logic flow in the figure can represent program steps, or interconnected logic circuits, boxes and functions, or a combination of program steps and logic circuits, boxes and functions. Software can be stored in physical media such as memory chips or storage blocks implemented in processors, magnetic media such as hard disks or floppy disks, and optical media such as, for example, DVDs and data variants thereof, CDs. Physical media are non-transient media.
[0114] Those skilled in the art should understand that the technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0115] The above embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present invention. It should be pointed out that, for those of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the attached claims.
Claims
1. A method for segmenting road and water bodies in night scenes, characterized in that: The following steps are involved: a) Obtain images of road water accumulation at night and perform preprocessing operations; b) Input the preprocessed image into a Retinex decomposition-based model, which includes a semantically guided disentanglement module, a four-layer SwinTransformer feature extraction module, and a three-layer illumination-guided decoder; The semantically guided disentanglement module specifically includes an illumination interaction feature extraction layer, a feature embedding layer, and a retinal cortex Retinex representation layer, each of which is responsible for a specific image feature processing task; the illumination information-guided decoder dynamically generates an attention mask by applying an illumination attention block to guide segmentation decisions and enhance adaptability to illumination changes; The illumination interaction feature extraction layer extracts the preprocessed nighttime road water accumulation image as illumination interaction features; the feature embedding layer converts the illumination interaction features into reflectance map embedding and illuminance map embedding; the input of the retinal cortex Retinex representation layer comes from the low-latitude features of the illumination interaction features and the reflectance map embedding and illuminance map embedding of the feature embedding layer, and the output is the reflectance map and illuminance map that conform to the retinal cortex theoretical retinex; c) in the semantically-guided disentanglement module, separating the image into a reflectance map and an illumination map that conform to retinal cortex theory, and extracting illumination interaction features; d) using the reflectance map and the illumination map to be input again into the semantically guided disentanglement module for disentanglement processing, and obtaining updated reflectance map, illumination map and illumination interaction features for calculating the loss function; e) inputting the updated reflection map into the SwinTransformer feature extraction module to extract high-level features; f) After merging the extracted high-level features with the illumination interaction features, a decoder guided by illumination information is used to generate a segmentation prediction map; g) Complete model training by calculating and optimizing segmentation loss, disentanglement loss, retinal cortex image reconstruction loss, and illumination smoothing reconstruction loss; h) Input the nighttime road waterlogging image to be segmented into the trained model to obtain the segmentation result.
2. The method for night scene road water segmentation as claimed in claim 1, characterized in that: In step a), the preprocessing includes random flipping, image data enhancement by adding noise, and resizing to 256x512.
3. The night scene road water body segmentation method according to claim 1, characterized in that: In step b), the SwinTransformer feature extraction module adopts a moving window self-attention mechanism to effectively extract long-term dependent features in the image.
4. The method for night scene road water segmentation according to any one of claims 1 to 3, characterized in that: In step b), the decoder guided by the illumination information is trained on the illumination interaction feature F Rl Use the illumination attention block to calculate the attention mask M Rl , the attention mask M Rl Quantitative evaluation of the illumination interaction feature F Rl The pixel richness of the semantic information contained, and then the high-level feature map F corresponding to its input R Perform dot product and finally upsample to 256x512 to get the predicted segmentation map .
5. A night scene road water segmentation device, characterized in that: include: An image acquisition device, used to collect nighttime road environment images of different sources and qualities; A preprocessing unit performs random transformation, contrast enhancement, noise suppression and adaptive scale adjustment on the received image to standardize the input image; A multimodal feature extraction network is used to input the preprocessed image into a model based on Retinex decomposition, which includes a semantically guided disentanglement module, a four-layer Swin Transformer feature extraction module, and a three-layer decoder guided by illumination information; in the semantically guided disentanglement module, the image is separated into a reflectance map and an illumination map that conform to the retinal cortex theory, and illumination interaction features are extracted at the same time; the reflectance map and the illumination map are used for re-disentanglement processing to obtain updated reflectance map, illumination map and illumination interaction features for calculating the loss function; the updated reflectance map is input into the Swin Transformer feature extraction module to extract high-level features; The semantically guided disentanglement module specifically includes an illumination interaction feature extraction layer, a feature embedding layer, and a retinal cortex Retinex representation layer, each of which is responsible for a specific image feature processing task; the illumination information-guided decoder dynamically generates an attention mask by applying an illumination attention block to guide segmentation decisions and enhance adaptability to illumination changes; The illumination interaction feature extraction layer extracts the preprocessed nighttime road water accumulation image as illumination interaction features; the feature embedding layer converts the illumination interaction features into reflectance map embedding and illuminance map embedding; the input of the retinal cortex Retinex representation layer comes from the low-latitude features of the illumination interaction features and the reflectance map embedding and illuminance map embedding of the feature embedding layer, and the output is the reflectance map and illuminance map that conform to the retinal cortex theoretical retinex; A segmentation prediction unit is used to combine the extracted high-level features with the illumination interaction features and generate a segmentation prediction map through a decoder guided by illumination information; An optimization and feedback control unit, which is used to complete model training by calculating and optimizing segmentation loss, disentanglement loss, retinal cortex image reconstruction loss, and illumination smoothing reconstruction loss; The output module is used to input the nighttime road waterlogging image to be segmented into the trained model to obtain the segmentation result.
6. An electronic device comprising a memory and a processor, characterized in that: The memory stores a computer program, and the processor is configured to run the computer program to execute the method for segmenting road and water bodies in night scenes according to any one of claims 1 to 4.
7. A readable storage medium, characterized in that: The readable storage medium stores a computer program, which includes a program code for controlling a process to execute a process, wherein the process includes the method for segmenting road water bodies in night scenes according to any one of claims 1 to 4.
Citation Information
Patent Citations
All-day image low-illumination enhancement and semantic segmentation combined method and system
CN116188307A
