Aerial image rail extraction method based on MRC-Net network
By introducing a multi-scale feature encoder and encoding-decoding structure into the MRC-Net network, combined with depth-separable convolution and channel spatial attention mechanisms, the accuracy problem of rail extraction in complex aerial railway images is solved and a higher accuracy is achieved. Rail extraction accuracy and model robustness.
Patent Information
- Application Number
- CN202410892295.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-04
- Publication Date
- 2024-09-24
AI Technical Summary
Existing technology is difficult to achieve accurate rail extraction in complex aerial railway images. It is affected by illumination, scale changes, noise and complex backgrounds, resulting in inaccurate rail extraction results.
Using a method based on MRC-Net network, through multi-scale feature encoder and encoding and decoding structure, combined with depth separable convolution and channel spatial attention mechanism, a multi-scale residual feature fusion attention encoder and skip connection module are designed, and the introduction Canny edge detection and Focal_Loss, Dice_Loss loss functions enhance the robustness and robustness of the model.
It improves the accuracy of rail extraction and the robustness of the model, ensuring the continuity and topological relationship of rail extraction, which is better than the performance of traditional methods and other deep learning models in complex scenarios.
Smart Images

Figure CN118691996A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of unmanned aerial image processing and deep learning, and in particular to a method for extracting rail tracks from aerial images based on an MRC-Net network. Background Art
[0002] In the planning and design stage of railways, understanding the location, direction and status of railway tracks is crucial for determining routes, construction and safety. At the same time, in the process of manually drawing electronic maps, manual drawing is affected by the subjective experience of the drawing staff. Automatic extraction of rails can provide accurate railway layout information, which is helpful for the design of railway electronic maps. Compared with manual extraction of rails, automatic extraction of track lines reduces labor costs and time costs. It does not require a large amount of human resources to mark and detect rail lines, and can realize real-time monitoring and updating of the status of the railway system. It can process a large amount of aerial image data in a short time, and improve the efficiency of railway inspection and management. Therefore, it is of great significance to realize the automatic extraction of rail lines; research on rail extraction through aerial images has been carried out for many years, but due to the different materials and shapes of rails, and the influence of trees, buildings, contact networks, etc., it makes it technically difficult to accurately extract rails through aerial images.
[0003] Among many traditional segmentation algorithms in the past, shape feature-based extraction and threshold analysis methods can be used for road extraction, and edge detection-based methods can detect edges and contours in roads. With the development of deep learning, more and more models are designed for extracting rails and roads from aerial images, such as using the dilated convolution method to extract road area features from aerial images.
[0004] The above method still has obvious shortcomings: it cannot accurately extract complex aerial railway images. However, in actual applications, aerial images are affected by changes in light intensity, shooting scale, noise and complex background, and some road features are not obvious, resulting in traditional algorithms and general deep learning methods not being accurate enough for rail extraction results. Summary of the invention
[0005] In order to solve the problems in the prior art of discontinuous road extraction and inability to generate correct topological connection relationships using pixel-level semantic segmentation, the present invention provides a method for extracting railroad tracks from drone aerial images based on an MRC-Net network.
[0006] The method of extracting rail tracks from drone images based on the MRC-Net network is implemented by the following steps:
[0007] Step 1: Obtain a dataset of railway track images taken by a drone, and divide the dataset into a training set and a validation set;
[0008] Step 2: Input the RGB image in the image dataset of step 1 into the MRC-Net network, downsample it through the multi-scale feature encoder, and obtain the feature information of the railroad in the image;
[0009] Step 3: Upsample the feature information obtained in step 2 to restore the feature size, and enhance the encoded features through the feature fusion module between the codec and then connect them to the decoder;
[0010] Step 4: Perform edge detection on the last two layers of the result after connection in step 3 to enhance edge information, and calculate the loss function at the same time to obtain a MRC-Net network training model;
[0011] Step 5: Use the training set in step 1 to train the training model obtained in step 4 to obtain a prediction model;
[0012] Step 6: Use the validation set in step 1 to predict the prediction model and extract the railway in the image.
[0013] Beneficial effects of the present invention: The method for extracting railroad tracks from aerial images based on the MRC-Net network integrates the encoding and decoding structure design of multi-scale feature extraction and multi-scale feature fusion, thereby improving the accuracy of railroad track extraction.
[0014] (1) The MRC-Net network model is used to downsample the features. A multi-scale residual feature fusion attention encoder (Res_mrdsBlock) is designed in the encoder process to project the original feature map. The deep separable convolution and channel space attention mechanism are used to effectively fuse and select features of different scales, weight different spatial information, and reduce the interference of irrelevant information on the model.
[0015] (2) A (R-DU) module is designed in the skip connection part to combine the low-level detail information and high-level semantic information of adjacent layers, reduce the semantic differences between different layers, introduce a channel interaction mechanism, and residually learn important semantic features of the image, which promotes the transmission and interaction of cross-layer information and helps the model learn information of different scales.
[0016] (3) The first and second layer features sampled on the decoder are combined with canny edge detection results and feature maps to strengthen edge extraction. At the same time, Focal_Loss and Dice_Loss loss functions are used for multi-scale prediction and weighted loss function calculation to enhance the robustness and robustness of the model and accelerate the convergence of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a schematic diagram of the process of the present invention;
[0018] Figure 2 is a network structure diagram of the present invention;
[0019] Figure 3 Schematic diagram of a feature extraction block in a multi-scale encoder in the present invention;
[0020] Figure 4 Schematic diagram of the feature fusion module in the present invention;
[0021] Figure 5 It is the Canny edge enhancement module in the present invention; wherein, (a) is the gradient calculation process of the Sobel operator, (b) is the non-maximum suppression process, and (c) is the channel attention mechanism strengthening process;
[0022] Figure 6 The segmentation effect diagram of the 3×512×512 aerial image of the present invention in an unobstructed and complex scene; wherein (a) is the original image, (b) is the real label, (c) is the predicted image after the multi-scale feature extraction module is enhanced, (d) is the predicted image after the multi-scale feature fusion module is enhanced, and (e) is the predicted image after the Canny edge is enhanced;
[0023] Figure 7 The figure is a segmentation effect diagram of a 3×1024×1024 remote sensing image in the Deep Globe dataset of the present invention; wherein (a) is the original image, (b) is the true label, (c) is the predicted image after the multi-scale feature extraction module is enhanced, (d) is the predicted image after the multi-scale feature fusion module is enhanced, and (e) is the predicted image after the Canny edge is enhanced;
[0024] Figure 8 The following are the comparison and segmentation effect diagrams of common models of 3×512×512 aerial images in the self-built aerial railway dataset of the present invention; wherein, (a) is the original image, (b) is the true label, (c) is the predicted image of the deeplabv3+ model, (d) is the predicted image of the Unet++ model, (e) is the predicted image of the SegNet model, and (f) is the predicted image of the MRC-Net model;
[0025] Fig. 9 The figure shows the comparison of segmentation effects of common models of 3×1024×1024 remote sensing images under the Deep Globe dataset of the present invention; wherein, (a) is the original image, (b) is the true label, (c) is the predicted image of the deeplabv3+ model, (d) is the predicted image of the Unet++ model, (e) is the predicted image of the SegNet model, and (f) is the predicted image of the MRC-Net model. DETAILED DESCRIPTION
[0026] Combination Figures 1 to 9 The present embodiment describes a method for extracting rail tracks from aerial images based on an MRC-Net network. The method is implemented by the following steps:
[0027] The method for extracting rail tracks from aerial images based on the MRC-Net network includes the following steps:
[0028] Step 1: Create a railway image dataset based on drone aerial photography, specifically:
[0029] Step 1.1, use labelme software to mark the rail area of the original image, complete the production of a picture, and generate the corresponding json file, which contains the location information of the pixels in the rail area;
[0030] Step 1.2: According to the original image in step 1.1 and the corresponding json file, a corresponding label image is produced according to the location information in the json file, and the pixel areas of the rails and the background are distinguished in the label image;
[0031] Step 1.3: Divide the self-built railway dataset prepared in step 1.2 into a dataset with 1028 training set images and 106 validation set images, with an image size of 4864×3648.
[0032] Step 1.4: Expand the training set data and perform sliding window cropping on each image, where the cropping size is 512×512 and the step size is set to 400, resulting in a training set of 37,825 images.
[0033] Step 2: Input the RGB image in step 1 into the MRC-Net network to obtain the feature information of the image;
[0034] Step 2.1: In step 1, the size of the 3-channel RGB image is 512×512×3, the size of the real label is 512×512×3, and the original image and the label image are input into the MRC-Net network. According to the value of the hyperparameter batchsize set before training, the feature information of the image is extracted in batches according to the value;
[0035] Step 2.2, set the first layer of multi-scale feature extraction module, the structure is a three-layer residual block, the Conv convolution kernel size is 3×3, the step size is 1, the DWConv1 convolution kernel size is 1×1, the padding is 0, the DWConv3 convolution kernel size is 3×3, the padding is 1, the DWConv5 convolution kernel size is 5×5, the padding is 2, and the number of features is 64;
[0036] Step 2.3, set the second-layer multi-scale feature extraction module, the structure is a four-layer residual block, the Conv convolution kernel size is 3×3, the step size is 2, the DWConv1 convolution kernel size is 1×1, the padding is 0, the DWConv3 convolution kernel size is 3×3, the padding is 1, the DWConv5 convolution kernel size is 5×5, the padding is 2, and the number of features is 128;
[0037] Step 2.4, set the third-layer multi-scale feature extraction module, the structure is a six-layer residual block, the Conv convolution kernel size is 3×3, the step size is 2, the DWConv1 convolution kernel size is 1×1, the padding is 0, the DWConv3 convolution kernel size is 3×3, the padding is 1, the DWConv5 convolution kernel size is 5×5, the padding is 2, and the number of features is 256;
[0038] Step 2.5, set the fourth-layer multi-scale feature extraction module, the structure is a three-layer residual block, the Conv convolution kernel size is 3×3, the step size is 2, the DWConv1 convolution kernel size is 1×1, the padding is 0, the DWConv3 convolution kernel size is 3×3, the padding is 1, the DWConv5 convolution kernel size is 5×5, the padding is 2, and the number of features is 512;
[0039] Step 2.6, set the last layer of multi-scale feature extraction module, the structure is a three-layer residual block Conv convolution kernel size of 3×3, step size of 2, DWConv1 convolution kernel size of 1×1, padding of 0, DWConv3 convolution kernel size of 3×3, padding of 1, DWConv5 convolution kernel size of 5×5, padding of 2, and feature number of 1024;
[0040] Step 2.7. The specific implementation of the residual block in steps 2.2 to 2.6 is to input the original feature according to the formula X i =chunk(project_in(X)) The original feature input is mapped out through the Project_in operation to generate hidden features. The feature size remains unchanged, and the number of channels becomes 1.5 times the original. The mapped features are then divided into three equal parts through the chunk operation.
[0041] Step 2.8: The first, second and third features evenly divided in step 2.7 are respectively divided according to the formula The feature importance of the channel attention mechanism is extracted. After a series of operations such as global average pooling, convolution, and activation, the channel weight α of the feature map is obtained. α and F c The corresponding elements of each channel in are multiplied to get F s, where Conv represents the convolution operation, δ and σ represent the Relu function and the Sigmoid activation function respectively. Indicates element-by-element multiplication; then according to the formula Perform feature importance extraction of spatial pixel attention mechanism and obtain F s After convolution, activation and other operations, the spatial pixel weight β of the feature map is obtained, and the spatial pixel weight β and F s Multiply the corresponding elements in to get F o ;
[0042] Step 2.9: The first layer of enhanced features F in step 2.8 o According to the formula X o =Cat(Dwconv(F o )) Perform Dwconv convolution calculation, perform 1×1 depth-separable convolution on the first layer of enhanced features, 3×3 depth-separable convolution on the second layer, and 5×5 depth-separable convolution on the third layer, and perform relu activation on the three layers of enhanced features; then use the cat function to splice the three layers of features in the channel dimension;
[0043] Step 2.10: Use the cat function to concatenate the three-layer features in the channel dimension after relu activation in step 2.9, and concatenate the concatenated features according to the formula Perform channel importance learning of SENet, where W is the learned weight parameter, x i is the i-th channel of the input feature;
[0044] Step 2.11: The features learned in step 2.10 are converted into X o =Project_out(X o ) Map back to the original feature shape through Project_out and return the enhanced feature;
[0045] Step 2.12: First, perform the conv1 convolution operation on the batched images in step 2.1 to change the number of feature channels from the original 3 channels to 64 channels, and then perform the Batch Norm operation to normalize and the maximum pooling operation to downsample to a feature size of 128×128×64 to extract the shallow feature information of the input original image;
[0046] Step 2.13, further extract features from the shallow feature information extracted in step 2.12 through conv1, and the features of this layer remain unchanged at 128×128×64, and then normalize and activate through Batch Norm and relu operations; normalize the activated features again through Convd2 and Batch Norm operations, and enhance the normalized feature map through the operations of steps 2.7 to 2.11. The enhanced features are connected to the shallow feature residuals extracted in step 2.12, where the number of residual blocks is set to 3, and this step needs to be repeated 3 times;
[0047] Step 2.14: further extract features from the enhanced feature information extracted in step 2.13 through conv1, and adjust the features from 128×128×64 to 64×64×128; then perform normalization and activation through Batch Norm and relu operations; normalize the activated features again through Convd2 and Batch Norm operations, and enhance the normalized feature map through the operations of steps 2.7 to 2.11. The enhanced features are residually connected with the enhanced features extracted in step 2.13, where the number of residual blocks is set to 4, and this step needs to be repeated 4 times;
[0048] Step 2.15: further extract features from the enhanced feature information extracted in step 2.14 through conv1, and adjust the features from 64×64×128 to 32×32×256; then perform normalization and activation through Batch Norm and relu operations; normalize the activated features again through Convd2 and Batch Norm operations, and enhance the normalized feature map through the operations of steps 2.7 to 2.11. The enhanced features are residually connected with the enhanced features extracted in step 2.14, where the number of residual blocks is set to 6, and this step needs to be repeated 6 times;
[0049] Step 2.16: further extract features from the enhanced feature information extracted in step 2.15 through conv1, and adjust the features from 32×32×256 to 16×16×512; then perform normalization and activation through Batch Norm and relu operations; normalize the activated features again through Convd2 and BatchNorm operations, and enhance the normalized feature map through the operations of steps 2.7 to 2.11. The enhanced features are residually connected with the enhanced features extracted in step 2.15, where the number of residual blocks is set to 3, and this step needs to be repeated 3 times;
[0050] Step 2.17, further extract features from the enhanced feature information extracted in specific step 2.16 through conv1, and adjust the features from 16×16×512 to 8×8×1024; then normalize and activate through Batch Norm and relu operations; normalize the activated features again through Convd2 and BatchNorm operations, and enhance the normalized feature map through the operations of specific steps 2.7 to specific steps 2.11, and the enhanced features are residually connected with the enhanced features extracted in specific step 2.16, where the number of residual blocks is set to 3, and this step needs to be repeated 3 times.
[0051] Step 3: For the feature map obtained in step 2, the feature maps og_feat1, og_feat2, og_feat3, og_feat4 from the first to the fourth layer are passed into the feature fusion module, and the features of adjacent layers are fused according to the formula weight_fp i,i+1 = fuse_conv(α*fp i +(1-α)*fp i+1 )+fp i+1 Through the fuse_conv operation, two-by-two splicing is performed, where α is a custom weight coefficient, and the maximum pooling is gradually downsampled to the fourth layer feature size of 16×16×512, and then the transposed convolution is upsampled to restore the first layer feature size of 128×128×64. The feature fusion module outputs the enhanced four layers of features to the decoding layer respectively;
[0052] Step 3.1: In step 3, the feature map og_feat1 is downsampled by the maximum pooling and concatenated with og_feat2, the concatenated features are enhanced by Conv2d operation, then Batch Norm normalization and relu activation are performed, and finally the feature map fe_12 is obtained by strengthening through the ela attention module;
[0053] Step 3.2: Perform the maximum pooling downsampling on the feature map feat_12 obtained in the specific step 3.1 and concatenate it with og_feat3, perform the Conv2d operation on the concatenated features, perform Batch Norm normalization and relu activation, and finally obtain the feature map feat_23 through the ela attention module.
[0054] Step 3.3, perform maximum pooling downsampling on the feature map feat_23 obtained in the specific step 3.2 and concatenate it with og_feat4, perform Conv2d operation on the concatenated features for enhancement, then perform Batch Norm normalization and relu activation, and finally enhance them through the ela attention module to obtain the feature map feat_34;
[0055] Step 3.4, upsample the enhanced feature map feat_34 obtained in step 3.3 by transposed convolution and concatenate it with feat_23 in step 3.2, perform Conv2d operation on the concatenated features, and then perform BatchNorm normalization and relu activation to obtain fuse_feat3 and fuse_feat4;
[0056] Step 3.5, upsample the feature map fuse_feat3 obtained in step 3.4 by transposed convolution and concatenate it with feat_12 in step 3.1, perform Conv2d operation on the concatenated features, and then perform Batch Norm normalization and relu activation to obtain fuse_feat2;
[0057] Step 3.6, upsample the feature map fuse_feat2 obtained in step 3.5 by transposed convolution and concatenate it with og_feat1 in step 2, perform Conv2d operation on the concatenated features, and then perform Batch Norm normalization and relu activation to obtain fuse_feat1;
[0058] Step 3.7, after passing fuse_feat1, fuse_feat2, fuse_feat3, and fuse_feat4 in specific steps 3.4 to specific steps 3.6 into the decoder part, they are concatenated with the encoder features og_feat1, og_feat2, og_feat3, and og_feat4 in the channel dimension using the cat operation to obtain the concatenated feature maps cat_feat1, cat_feat2, cat_feat3, and cat_feat4.
[0059] Step 4: Perform edge detection on the last two layers of the result after connection in step 3 to enhance edge information, and calculate the loss function at the same time to obtain a MRC-Net network training model;
[0060] Step 4.1: cat_feat1 and cat_feat2 obtained in step 3.7 are respectively A Gaussian filter denoising operation is performed to reduce the impact of noise on the edge, where (x, y) is the image coordinate and σ is the standard deviation. Then follow the formula Calculate the Sobel operator, where G x and G y The difference G is obtained in the X direction and Y direction of the pixel point x and differential G y , and finally, the edge feature information boundary_1 is 128×128×64 and boundary_2 is 64×64×128 through non-maximum suppression operation;
[0061] Step 4.2: directly add boundary_1 and boundary_2 obtained in step 4.1 to cat_feat1 and cat_feat2 obtained in step 3.7 respectively, perform SeLayer attention calculation on the added results, strengthen the edge part of the feature result, and obtain enhanced prediction results bound_feat1 and bound_feat2;
[0062] Step 4.3: Use bound_feat1 and bound_feat2 obtained in step 4.2 according to the formula Loss1=α1·FL(p t 1 )+β1·DiceLoss 1 Loss2=α2·FL(p t 2 )+β2·DiceLoss 2 The weighted FocalLoss and DiceLoss loss values are calculated, where α1, α2, β1, and β2 are custom weight coefficients, and Loss1 and Loss2 are obtained. Weight_Loss=γ·Loss1+(1-γ)·Loss2 The Weight_Loss loss value is obtained by adding the weight ratios, where γ is the custom weight coefficient to adjust the parameter weight of the model. The Weight_Loss loss value is back-propagated through lossback to adjust the weights of each parameter of the network model to achieve the optimization effect of the model.
[0063] Step 5: Use the training set in step 1 to train the training model obtained in step 4 to obtain a prediction model;
[0064] Step 5.1: The experiment was run in the Windows 10 environment. During the training process, we used the NVIDIA Tesla T4 graphics card with CUDA 11.7, adopted single-machine multi-card parallelism, used single-precision training, and did not use any pre-trained models during the training process;
[0065] Step 5.2: Use non-frozen training, use Adma optimizer, initial learning rate = 0.0001, minimum learning rate = 0.000001. Momentum value = 0.9, weight decay = 0, and cosine learning rate descent.
[0066] Step 5.3: Save the verification results every 5 epochs. After each iteration, save the current optimal mIOU model as the prediction model. Train with batchsize = 4 batches, and train for 100 rounds in total. Semantic segmentation category n_classes = 3.
[0067] Step 6: Use the validation set in step 1 to predict the prediction model and extract the railway in the image.
[0068] Step 6.1: For each validation set original image (512×512×3), use the model trained in step 4 to test, set the output threshold of semantic segmentation to 0.5, and obtain the classification output of semantic segmentation;
[0069] Combination Figure 6 to Figure 7 To explain this embodiment, Figure 6 and Figure 7 In the figure, a) is the original image, (b) is the real label, (c) is the predicted image after the multi-scale feature extraction module is enhanced, (d) is the predicted image after the multi-scale feature fusion module is enhanced, and (e) is the predicted image after the Canny edge is enhanced. It can be seen that the design of the multi-scale feature extractor and the multi-scale feature fusion module can effectively improve the accuracy of rail extraction, maintain the connectivity and topology of the rail, and also perform well on the public road dataset.
[0070] Combination Figures 8 to 9 To explain this embodiment, Figure 6 and Figure 7 In the figure, (a) is the original image, (b) is the true label, (c) is the predicted image of the deeplabv3+ model, (d) is the predicted image of the Unet++ model, (e) is the predicted image of the SegNet model, and (f) is the predicted image of the MRC-Net model. It can be seen that the design of the multi-scale feature extractor and the multi-scale feature fusion module can better extract the rails in the aerial photography compared with other common semantic segmentation models, and even outperforms other semantic segmentation models on the public road dataset.
Claims
1. A method for extracting railways from drone aerial photography based on a multi-scale residual fusion codec structure network (MRC-Net), which is characterized by: The method is implemented by the following steps: Step 1: Obtain UAV railway aerial image data, use labelme software to mark the rails in the image, create a rail label dataset, and divide the image dataset to obtain a training set and a validation set; Step 2: Input the RGB image in the image dataset of step 1 into the MRC-Net network, and downsample it through the multi-scale feature encoder to obtain the high-level semantic feature information of the railroad tracks in the image; Step 3: Upsample the feature information obtained in step 2 to restore the feature size, and enhance the encoded features through the feature fusion module between the codec and then connect them to the decoder; Step 4: Perform edge detection on the last two layers of the result after connection in step 3 to enhance edge information, and calculate the loss function at the same time to obtain a MRC-Net network training model; Step 5: Use the training set in step 1 to train the training model obtained in step 4 to obtain a prediction model; Step 6: Use the validation set in step 1 to predict the prediction model and extract the railway in the image.
2. The method for extracting railways from drone aerial photography based on a multi-scale residual fusion codec network (MRC-Net) according to claim 1, characterized in that: In step 1, labelme is used to mark the rail area in the image, and a json file containing the rail pixel location information is generated to generate the corresponding rail label dataset. The railway dataset is divided into datasets, and each image is cropped using the sliding window method. The original image is cropped from 3648×4864 to 512×512, and the step size of the sliding window is set to 400 to obtain the training set and validation set respectively.
3. The method for extracting railways from drone aerial photography based on a multi-scale residual fusion codec structure network (MRC-Net) according to claim 1 is characterized in that: The specific process of step 2 is: Step 21: Set the RGB image to 512×512×3, the true label to 512×512×3, and input the original image and label image of the training set into the MRC-Net network; Step 22: The original image and the label image input into the MRC-Net network in step 21 are extracted from the image feature information in batches according to the value of the hyperparameter batchsize set before training; Step 2: Set the first-layer multi-scale feature extraction module of the MRC-Net network, with a three-layer residual block structure, a Conv convolution kernel size of 3×3, a step size of 1, a DWConv1 convolution kernel size of 1×1, a padding of 0, a DWConv3 convolution kernel size of 3×3, a padding of 1, a DWConv5 convolution kernel size of 5×5, a padding of 2, and a feature number of 64; Set the second-layer multi-scale feature extraction module, with a four-layer residual block structure, a Conv convolution kernel size of 3×3, a step size of 2, a DWConv1 convolution kernel size of 1×1, a padding of 0, a DWConv3 convolution kernel size of 3×3, a padding of 1, a DWConv5 convolution kernel size of 5×5, a padding of 2, and a feature number of 64. The number is 128; the third-layer multi-scale feature extraction module is set, the structure is a six-layer residual block, the Conv convolution kernel size is 3×3, the step size is 2, the DWConv1 convolution kernel size is 1×1, the padding is 0, the DWConv3 convolution kernel size is 3×3, the padding is 1, the DWConv5 convolution kernel size is 5×5, the padding is 2, and the number of features is 256; the fourth-layer multi-scale feature extraction module is set, the structure is a three-layer residual block, the Conv convolution kernel size is 3×3, the step size is 2, the DWConv1 convolution kernel size is 1×1, the padding is 0, the DWConv3 convolution kernel size is 3×3, the padding is 1, the DWConv5 convolution kernel size is 5×5, the padding is 2, and the number of features is 512; Set the last layer of multi-scale feature extraction module, the structure is a three-layer residual block Conv convolution kernel size of 3×3, step size of 2, DWConv1 convolution kernel size of 1×1, padding of 0, DWConv3 convolution kernel size of 3×3, padding of 1, DWConv5 convolution kernel size of 5×5, padding of 2, and feature number of 1024; The specific implementation of the residual block in step 24 and step 23 is as follows: X i =chunk(project_in(X)) The original feature input is mapped out through the Project_in operation to obtain hidden features. The feature size remains unchanged, and the number of channels becomes 1.5 times the original. Then the mapped features are divided into three equal parts through the chunk operation. The first, second, and third parts of the features are divided according to the formula The feature importance of the channel attention mechanism is extracted. After a series of operations such as global average pooling, convolution, and activation, the channel weight α of the feature map is obtained. α and F c The corresponding elements of each channel in are multiplied to get F s , where Conv represents the convolution operation, δ and σ represent the Relu function and the Sigmoid activation function respectively. Indicates element-by-element multiplication; then according to the formula Perform feature importance extraction of spatial pixel attention mechanism and obtain F s After convolution, activation and other operations, the spatial pixel weight β of the feature map is obtained, and the spatial pixel weight β and F s Multiply the corresponding elements in to get F o , where the obtained F o According to the formula X o =Cat(Dwconv(F o )) Perform Dwconv convolution calculation, perform 1×1 depth-separable convolution on the first layer of enhanced features, 3×3 depth-separable convolution on the second layer, and 5×5 depth-separable convolution on the third layer, and perform relu activation on the three layers of enhanced features; then use the cat function to splice the three layers of features in the channel dimension, and convert the spliced features into Perform channel importance learning of SENet, where W is the learned weight parameter, x i is the i-th channel of the input feature; the learned features are transformed into X o =Project_out(X o ) Map back to the original feature shape and return the enhanced feature; Step 25: First, perform the conv1 convolution operation on the batched images in step 22 to change the number of feature channels from the original 3 channels to 64 channels, and then perform the BatchNorm operation to normalize and the maximum pooling operation to downsample to a feature size of 128×128×64, and perform shallow feature information extraction on the input original image; Step 26: Use the first-layer multi-scale feature extraction module in step 23 to further extract feature information from the shallow features in step 24, and use the maximum pooling operation to keep the size of the feature map unchanged; use the second-layer multi-scale feature extraction module in step 23 to further extract feature information from the previous layer of features, and use the maximum pooling operation to change the feature map from 128×128×64 to 64×64×128; use the third-layer multi-scale feature extraction module in step 23 to further extract feature information from the previous layer of features, and use the maximum pooling operation to change the feature map from 16×16×512 to 8×8×1024.
4. The method for extracting railways from drone aerial images based on the MRC-Net network according to claim 1, characterized in that: Step 3: For the feature map obtained in step 2, the feature maps og_feat1, og_feat2, og_feat3, and og_feat4 from the first to the fourth layer are passed into the feature fusion module, and the features of the adjacent layers are combined according to the formula weight_fp i,i+1 =fuse_conv(α*fp i +(1-α)*f p+1 )+fp i+1 Perform pairwise splicing, where α is a custom weight coefficient, and gradually perform maximum pooling downsampling to the fourth layer feature size of 16×16×512, and then perform transposed convolution upsampling to restore to the first layer feature size of 64×128×128. The feature fusion module outputs the enhanced four layers of features to the decoding layer respectively; Step 32 and Step 31: The enhanced first to fourth layer features fuse_feat1, fuse_feat2, fuse_feat3, and fuse_feat4 are output to the decoding layer, and the fifth layer features 8×8×1024 are upsampled using transposed convolution, and in the upsampling process, each layer of features is concatenated with fuse_feat1, fuse_feat2, fuse_feat3, and fuse_feat4 output by the feature fusion module until the feature size is restored to the first layer feature size of 128×128×64; Step 3. The two branches perform upsampling operations through deconvolution, concatenate the feature maps of each layer with the output of the module layer of the same size as the downsampling, and perform convolution operations. Finally, the size of each layer of the upsampled image is: 128×128×64, 64×64×128, 32×32×256, 16×16×512.
5. The method for extracting rail tracks from aerial images based on the MRC-Net network according to claim 1, characterized in that: Step 4. Convert the last two outputs of the decoder, cat_feat1 and cat_feat2, into boundary=EdgeDetection(cat_feat) Perform Canny edge detection operator calculation to obtain enhanced edge information boundary_1 and boundary_2; Step 42: Combine the enhanced edge information boundary_1 and boundary_2 in step 41 with the original last two layers of decoder features cat_feat1 and cat_feat2 to enhance the edge of the feature result, so as to obtain enhanced prediction results bound_feat1 and bound_feat2; Step 43: The enhanced prediction results bound_feat1 and bound_feat2 obtained in step 42 are combined according to the formula Loss1=α1·FL(p t 1 )+β1·DiceLoss 1 Loss2=α2·FL(p t 2 )+β2·DiceLoss 2 Calculate the weighted loss function, where α1, α2, β1, and β2 are custom weight coefficients. The calculated loss1 and loss2 are calculated according to the formula Weight_Loss=γ·Loss1+(1-γ)·Loss2 Back propagation is performed according to the weight ratio, where γ is a custom weight coefficient to adjust the parameter weight of the model to achieve the optimization effect of the model.
6. The method for extracting rail tracks from aerial images based on the MRC-Net network according to claim 1, characterized in that: In step 5, the experiment was run in the Windows 10 environment. During the training process, we used NVIDIA Tesla T4 graphics card, with CUDA 11.7 version, adopted single machine multi-card parallelism, used single precision training, did not use any pre-trained model during the training process, used non-frozen training, used Adma optimizer, initial learning rate = 0.0001, minimum learning rate = 0.000001. Momentum value setting = 0.9, weight decay setting = 0, using cosine learning rate descent method, saving verification results every 5 epochs, and saving the current optimal mIOU model as the prediction model after each iteration. Training batchsize = 4 batches, a total of 100 rounds of training. Semantic segmentation category n_classes = 3.
7. The method for extracting rail tracks from aerial images based on the MRC-Net network according to claim 1, characterized in that: In step 6, each original image in the validation set is tested using the model trained in step 4, the output threshold of semantic segmentation is set, and the classification output of semantic segmentation is obtained.
