Method, device, equipment, medium and product for detecting natural disasters in rail area
By extracting image differences and texture features in railroad area detection and using classification models to classify natural disasters, the problem of low detection accuracy caused by the small number of samples in the neural network model is solved, and the detection accuracy is improved while reducing the sample requirement.
Patent Information
- Application Number
- CN202510783970.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-12
- Publication Date
- 2025-10-14
Smart Images

Figure CN120783095A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of rail transit safety detection technology, and in particular to a method, device, equipment, medium and product for detecting natural disasters in a railway area. Background Art
[0002] Railway areas, due to complex terrain (such as mountainous areas and canyons) and frequent climate change, are vulnerable to natural disasters such as mudslides and flooding. my country currently has 33,500 potential mudslide sites, and 50% of major transportation routes are at risk. Early inspections relied primarily on manual patrols, but this was inefficient, had limited coverage, and made real-time monitoring difficult in harsh environments. Furthermore, while traditional sensors (such as displacement meters and rain gauges) can monitor some parameters, they lack the ability to comprehensively analyze complex scenarios.
[0003] Automatic detection of natural disasters along railway tracks has been a key research area in recent years in the field of railway safety. Some approaches use neural network models to identify natural disasters. However, actual cases of natural disasters such as debris flows and flooding along railway lines are rare, resulting in a small number of image samples, which in turn leads to low detection accuracy of neural network models. Summary of the Invention
[0004] The present application provides a method, device, equipment, medium and product for detecting natural disasters in railway areas, aiming to solve the problem of low detection accuracy caused by the small sample size of the existing neural network model used to detect natural disasters in railway areas.
[0005] In a first aspect, the present application provides a method for detecting natural disasters in a railway area, comprising: Extracting a first extracted image with the rail area as a boundary and a second extracted image with the rail area as a boundary from the first normal image and the image to be tested containing the same rail area respectively; obtaining a first target natural disaster image based on a difference between the first extracted image and the second extracted image; Extracting texture features from a first target natural disaster image; Input the texture features into the classification model to obtain the category of natural disasters; The classification model is obtained by training using texture feature samples and category labels corresponding to the texture feature samples.
[0006] As an embodiment, obtaining a first target natural disaster image based on a difference between the first extracted image and the second extracted image specifically includes: Subtracting the second extracted image from the first extracted image to obtain an area of the railroad track blocked by the natural disaster as a first natural disaster area; Based on the outline of the first natural disaster area, calculating the center point of the outline; Align the first natural disaster area with the image to be tested, determine the target area in the area aligned with the first natural disaster area in the image to be tested, and extract the image of the target area from the image to be tested as the first target natural disaster image; wherein the target area is centered on the center point, and the target area has a preset shape and a first preset size.
[0007] As an embodiment, before extracting the first extracted image and the second extracted image, the method further includes: reducing or enlarging the first normal image and the image to be measured to a second preset size; Furthermore, before aligning the first natural disaster area with the image to be measured, the method further includes: Enlarge or reduce the first natural disaster area back to the size of the image to be measured.
[0008] As an embodiment, the first extracted image and the second extracted image are extracted by a segmentation model; The segmentation model is used to identify the boundaries of the rail area in the image, thereby segmenting the image based on the rail area and extracting the local image containing the rail area from the image; The segmentation model is trained using multiple second normal images containing railroad track areas. The multiple second normal images are images containing railroad track areas collected under different weather conditions and different time periods in the absence of natural disasters.
[0009] As an embodiment, obtaining a classification data set for training a classification model specifically includes: Collect multiple natural disaster image samples containing both natural disaster areas and railroad areas; Pairing each natural disaster image sample with a different second normal image to form different data groups; A third extracted image and a fourth extracted image are extracted from the second normal image and the natural disaster image sample of each data group using a segmentation model, wherein the third extracted image and the fourth extracted image are both bounded by the railroad area; obtaining a second target natural disaster image based on a difference between the third extracted image and the fourth extracted image; Extracting texture features of the second target natural disaster image of each data group, and labeling the second target natural disaster image of each data group with a category label; Combining the texture features and category labels corresponding to each data group to form training data corresponding to each data group; The training data corresponding to all data groups are combined to form a classification data set for training the classification model.
[0010] In a second aspect, the present application further provides a natural disaster detection device for a railway area, comprising an image extraction module, a target image acquisition module, a feature extraction module, and a classification module; The image extraction module is used to extract a first extracted image with the rail area as the boundary and a second extracted image with the rail area as the boundary from the first normal image and the image to be tested containing the same rail area respectively; The target image acquisition module is used to obtain a first target natural disaster image based on the difference between the first extracted image and the second extracted image; The feature extraction module is used to extract texture features from the first target natural disaster image; The classification module is used to input texture features into the classification model to obtain the category of natural disasters; the classification model is obtained after training using texture feature samples and category labels corresponding to the texture feature samples.
[0011] As an embodiment, the target image acquisition module includes a subtraction module, a center point determination module, and a region image extraction module; The subtraction module is used to subtract the second extracted image from the first extracted image to obtain an area of the railroad track blocked by the natural disaster as a first natural disaster area; The center point determination module is used to calculate the center point of the outline based on the outline of the first natural disaster area; The regional image extraction module is used to align the first natural disaster area with the image to be tested, determine the target area in the area aligned with the first natural disaster area in the image to be tested, and extract the image of the target area from the image to be tested as the first target natural disaster image; wherein the target area is centered on the center point, and the target area has a preset shape and a first preset size.
[0012] In a third aspect, the present application also provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the computer program, it implements any of the above-mentioned natural disaster detection methods for railway areas.
[0013] In a fourth aspect, the present application also provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, any of the above-mentioned natural disaster detection methods for railway areas is implemented.
[0014] In a fifth aspect, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements any of the above-mentioned natural disaster detection methods for railway areas. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0016] Figure 1 This is one of the flow charts of the natural disaster detection method for the railway area provided by this application; Figure 2 This is the second flow chart of the natural disaster detection method for the railway area provided by this application; Figure 3 This is one of the flowcharts of obtaining the first target natural disaster image provided by this application; Figure 4 This is one of the flowcharts of obtaining a classification data set for training a classification model provided in this application; Figure 5 This is one of the structural diagrams of the natural disaster detection device for the railway area provided by this application; Figure 6 This is one of the structural diagrams of the target image acquisition module provided in this application; Figure 7 A schematic structural diagram of an electronic device provided in this application. DETAILED DESCRIPTION
[0017] To make the objectives, technical solutions, and advantages of this application more clear, the technical solutions of this application will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments of this application, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of this application.
[0018] It should be noted that, in the description of the present invention, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0019] The terms "first," "second," and so forth, used herein are used to distinguish similar objects, not to describe a specific order or precedence. It should be understood that such terms are interchangeable where appropriate, allowing embodiments of the present invention to be implemented in an order other than that illustrated or described herein. Furthermore, the terms "first," "second," and so forth generally distinguish objects of a single type, and do not limit the number of objects. For example, the first object may be one or more. Furthermore, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates an "or" relationship between the connected objects.
[0020] The following combination Figures 1 to 7 The present invention describes the method, device, equipment, medium and product for detecting natural disasters in railway areas.
[0021] It should be noted that the method for detecting natural disasters in railroad areas provided in the embodiments of the present application is implemented based on a natural disaster detection device for railroad areas. The input data of the classification model in the method for detecting natural disasters in railroad areas is the texture features of natural disasters. Therefore, there is no need to collect a large number of images containing natural disasters and railroad areas as a data set for training the model. Therefore, the input of texture features ensures the detection accuracy of the classification model while greatly reducing the sample requirement. In addition, when obtaining the target natural disaster image, the present application uses the first target natural disaster image with the center point and size limit extraction rules, and combines the extraction of texture features to obtain representative characteristics of natural disasters. While ensuring that the classification model accurately classifies according to texture features, it solves the problem of difficulty in image annotation caused by the irregularity of natural disasters.
[0022] In the embodiment of the present application, a natural disaster detection method for a railway area is described by taking a natural disaster detection device for a railway area as an example of an execution body.
[0023] Figure 1 This is one of the flow charts of the natural disaster detection method for the railway area provided in this application. Figure 2 This is the second flow chart of the natural disaster detection method for the railway area provided by this application.
[0024] like Figure 1 As shown, the natural disaster detection method for the railway area provided by this application includes: S110: extracting a first extracted image with the rail area as a boundary and a second extracted image with the rail area as a boundary from a first normal image and a test image containing the same rail area respectively.
[0025] S120: Obtain a first target natural disaster image according to the difference between the first extracted image and the second extracted image.
[0026] S130: Extracting texture features from the first target natural disaster image.
[0027] S140: Input the texture features into the classification model to obtain the category of the natural disaster.
[0028] The classification model is used to determine the corresponding natural disaster based on the texture features and output the category of the natural disaster. The classification model is obtained by training using texture feature samples and the category labels corresponding to the texture feature samples.
[0029] It can be understood that the first normal image is obtained by photographing the rail area when there is no natural disaster, and the image to be tested is obtained by photographing the same rail area as the first normal image when a natural disaster may occur.
[0030] Combine Figure 2 In an embodiment of the present application, the railroad area in the first normal image and the image to be tested is first identified, and a first extracted image with the railroad area as the boundary and a second extracted image with the railroad area as the boundary are extracted from the first normal image and the image to be tested, so that both focus on the railroad area. Subsequently, the first extracted image and the second extracted image are compared to determine the area where there is a difference between the two. This area is the area where the railroad is blocked by the natural disaster, and based on this area, a first target natural disaster image is extracted from the image to be tested. Feature extraction is then performed on the first target natural disaster image to obtain texture features, which reflect the characteristics of the natural disaster. Finally, the texture features are input into a classification model so that the classification model classifies the natural disasters based on the texture features.
[0031] Specifically, the natural disaster detection device for the railway track area first extracts a first extracted image and a second extracted image bounded by the railway track area from the first normal image and the image to be tested. Subsequently, the natural disaster detection device for the railway track area compares the first and second extracted images to determine the area of the railway track obscured by the natural disaster. Based on this area, the device extracts a first target natural disaster image from the image to be tested. The device then performs feature extraction on the first target natural disaster image to obtain texture features. Finally, the device inputs the texture features into a classification model to determine the natural disaster category.
[0032] The input data of the classification model in the embodiment of the present application is the texture feature of the natural disaster, instead of an image containing both the natural disaster and the rail area, so there is no need to collect a large number of images containing both the natural disaster and the rail area and label them. In the case of greatly reduced sample demand and labeling amount, the classification of the natural disaster is identified by means of the texture feature, ensuring the detection accuracy of the classification model. In addition, the complete rail area image segmented from the normal image is used as a reference to accurately extract the target natural disaster image in the rail area image segmented from the to-be-detected image, ensuring the identification accuracy of the natural disaster area.
[0033] In the prior art, the natural disaster area on an image containing both the natural disaster and the rail area is labeled, and the labeled image and the category label of the natural disaster in the image are used to form a classification data set of a classification model, and the classification model is trained. However, there are many types of natural disasters, and the boundaries of some natural disasters, such as mudslides and waterlogging, are irregular, so the labeling of such natural disasters is very difficult, resulting in low labeling accuracy, and ultimately poor prediction accuracy and precision of the classification model.
[0034] Based on such consideration, in one possible embodiment, as shown in Figure 3 In step S120, the first target natural disaster image is obtained according to the difference between the first extraction image and the second extraction image, specifically including: S1201: subtract the second extraction image from the first extraction image to obtain the area of the rail blocked by the natural disaster as the first natural disaster area.
[0035] S1202: calculate the center point of the contour based on the contour of the first natural disaster area.
[0036] S1203: align the first natural disaster area with the to-be-detected image (for example, align with the rail as the reference), determine the target area in the to-be-detected image aligned with the first natural disaster area, and extract the image of the target area from the to-be-detected image as the first target natural disaster image. The target area is centered on the center point, and the target area has a preset shape and a first preset size.
[0037] The center point of the first target natural disaster image extracted from the to-be-detected image is aligned with the center point of the identified first natural disaster area, thereby obtaining the best area reflecting the characteristics of the natural disaster.
[0038] The first target natural disaster image extracted in this embodiment of the application is a regular image defined by a preset shape and a first preset size, thereby avoiding the impact of the irregularity of the natural disaster's shape on natural disaster identification. Furthermore, the purpose of the first target natural disaster image is to extract its texture features for classification. This embodiment of the application captures an image near the center of the natural disaster, which can obtain representative texture features of the natural disaster. This ensures that the classification model receives accurate texture feature input while addressing the difficulty of image labeling caused by the irregularity of natural disasters.
[0039] In one possible embodiment, in step S110, a first extracted image and a second extracted image are extracted using a segmentation model. Specifically, the segmentation model is used to identify the boundary of a rail region in an image (e.g., a first normal image or an image to be tested), thereby segmenting the image (e.g., the first normal image or the image to be tested) based on the rail region as the boundary, thereby extracting a partial image having the rail region from the image (e.g., extracting a first extracted image from the first normal image or extracting a second extracted image from the image to be tested).
[0040] It should be noted that the segmentation model is trained using multiple second normal images containing railroad tracks. These second normal images are images of railroad tracks captured in different weather conditions (e.g., sunny, cloudy, rainy, foggy, etc.) and at different time periods, without natural disasters.
[0041] In an embodiment of the present application, the segmentation data set for training the segmentation model only requires images obtained by photographing the railway area in the absence of natural disasters. The difficulty of obtaining such images is relatively low, and the sample size is large. Therefore, the segmentation accuracy and precision of the segmentation model are relatively high.
[0042] Based on the above, after obtaining multiple second normal images, the railroad track area is annotated on each second normal image to construct a segmentation dataset. The segmentation model is iteratively trained using the segmentation dataset until the model converges, obtaining a trained segmentation model.
[0043] In one possible embodiment, the segmentation model includes: Encoder: This layer progressively extracts image features through multiple downsampling operations, reducing resolution and capturing high-level semantic information. Specifically, the encoder consists of multiple sequentially connected convolutional blocks with the same structure, which are used to implement downsampling. Each convolutional block sequentially contains two 3x3 convolutional layers, a ReLU activation function, and a 2x2 max pooling layer.
[0044] Decoder: The decoder gradually restores the spatial resolution through multiple upsampling steps, combines low-level details, and generates a segmentation mask. The decoder uses transposed convolution or bilinear interpolation to double the size of the feature map (e.g., 256x256 → 512x512) to achieve upsampling.
[0045] The feature map obtained by the encoder is concatenated with the feature map obtained by the decoder in the channel dimension to preserve detailed information. The concatenated feature map is passed through two 3x3 convolutional layers and a ReLU activation function to gradually restore feature details and obtain the final feature map.
[0046] Output layer: The number of channels of the final feature map is mapped to the number of target categories (such as 1 channel for binary classification) through 1x1 convolution.
[0047] Because image acquisition equipment obtains images with varying performance, such as resolution, in different weather conditions and at different times, the segmentation model's learning quality for different images varies. Based on this consideration, before inputting the training dataset into the segmentation model for training, the second normal image and its annotated region are also reduced or enlarged to a second preset size to ensure effective training for each sample.
[0048] Based on the above, in the inference phase of the segmentation model, the natural disaster detection method also includes: Before extracting the first and second extracted images (step S110), the first normal image and the image to be tested are reduced or enlarged to a second predetermined size (preset by the segmentation model) and then input into the segmentation model to ensure segmentation accuracy and precision. Furthermore, before aligning the first natural disaster area with the image to be tested (step S1203), the first natural disaster area is enlarged or reduced back to the original size of the image to be tested. The image of the target area is then extracted from the original-sized image to more accurately capture the first target natural disaster image.
[0049] In step S130 , in a possible embodiment, local binary patterns (LBP) texture features are extracted from the first target natural disaster image as input data for a classification model.
[0050] Extracting LBP texture features includes the following steps: Q1: Set the key parameters: the number of sampling points P and the radius of the circular neighborhood R. P means that P points are evenly selected on the circumference of the circle, and R means that the radius of the circle is R pixels.
[0051] Q2: Generate sampling point coordinates based on the above key parameters: With the current pixel as the center point, calculate the positions of P points on the circle with a radius of R as the sampling point coordinates.
[0052] Q3: Interpolating the grayscale values of sampling points: Since sampling points may be located at non-integer pixel locations (for example, when R = 2), the grayscale values of these points must be estimated through interpolation (such as bilinear interpolation). During interpolation, a weighted average of the surrounding actual pixels is used to ensure that valid values are obtained for sampling points with non-integer coordinates.
[0053] Q4: Binarization comparison: Compare the grayscale value of each sampling point with the grayscale value of the center point. If the grayscale value of the sampling point ≥ the grayscale value of the center point, it is recorded as 1; otherwise, it is recorded as 0. Finally, a binary sequence of length P is generated (such as 10110010).
[0054] Q5: Convert to decimal value: Convert the binary sequence to a decimal number and use it as the initial LBP value of the center point. For example, the binary value 10110010 corresponds to the decimal value 178.
[0055] Q6: Generate feature histogram: traverse the entire image, calculate the LBP value for each pixel, and then count the distribution histogram of all values as the feature vector describing the texture of the first target natural disaster image.
[0056] For classification models, such as Figure 4 As shown, in a possible embodiment, obtaining a classification data set for training a classification model specifically includes: S410: Collect multiple natural disaster image samples containing both natural disaster areas and railroad areas.
[0057] Since there are few actual cases of natural disasters along the railway, the number of natural disaster image samples collected is relatively small.
[0058] S420: Pair each natural disaster image sample with a different second normal image to form different data groups.
[0059] Since there is no direct correspondence between the second normal image and the natural disaster image samples, and each second normal image can represent the situation of the same railway track area in the absence of natural disasters, pairing each natural disaster image sample with a different second normal image can obtain a large amount of sample data, which has an incremental effect.
[0060] S430: Using the segmentation model, extracting a third extracted image and a fourth extracted image from the second normal image and the natural disaster image sample of each data group, wherein the third extracted image and the fourth extracted image are both bounded by the railroad area.
[0061] This step segments the railroad track area of the second normal image and the natural disaster image sample. Please refer to the above description of step S110.
[0062] S440: Obtain a second target natural disaster image based on the difference between the third extracted image and the fourth extracted image. For the specific implementation of step S440, please refer to the above description of step S120.
[0063] S450: Extracting texture features of the second target natural disaster image of each data group (please refer to the description of step S130 for details), and assigning a category label to the second target natural disaster image of each data group.
[0064] S460: Combining the texture features and category labels corresponding to each data group to form training data corresponding to each data group.
[0065] S470: The training data corresponding to all data groups are combined to form a classification data set for training the classification model, wherein a portion is used as a classification training set for training the classification model, and the other portion is used as a classification validation set for testing the classification effect of the classification model.
[0066] The embodiment of the present application increases the sample data of the classification model by pairing the second normal image with the natural disaster image sample, thereby obtaining rich data samples and improving the training accuracy of the classification model.
[0067] It is understandable that the classification dataset of the classification model can also be incremented by other existing incremental methods.
[0068] In one possible embodiment, the classification model uses a support vector machine (SVM) classifier. The goal of an SVM is to find a hyperplane that separates two data classes, and to position this hyperplane as far as possible from the nearest data point (i.e., the support vector). This distance is called the "margin." The larger the margin, the more tolerant the classification is and the less likely the model is to overfit. The position of the hyperplane is determined solely by the support vectors; other data points far from the dividing line have no effect on the model. This makes the SVM robust to noisy data (outliers far from the dividing line).
[0069] For a new sample, the SVM classifier calculates the similarity between the new sample and all support vectors, and then obtains the classification score of the new sample after weighted summation based on the weight of each support vector (determined during the training process) and the similarity. The category (such as positive or negative) is determined based on the positive or negative sign of the classification score.
[0070] This application uses the following examples to illustrate the effectiveness of the natural disaster detection method for the railway area provided by this application.
[0071] A total of 4,773 second-normal images were collected across 12 different weather conditions, including sunny, cloudy, rainy, and dark nights. The railroad tracks in each second-normal image were annotated. 3,818 of these images served as the training set for the segmentation model, and the remaining 955 images served as the validation set to measure the model's performance. The second-normal images and annotated masks in the training set were then scaled to a specific pixel size of 224*224 and fed into the segmentation model for training, yielding a trained segmentation model.
[0072] 3048 natural disaster image samples (pixel size 1920*1080) were collected and paired with at least one second normal image to form at least one data set. For each data set, the segmentation model was used to obtain the corresponding third and fourth extracted images. The fourth extracted image was subtracted from the third extracted image to obtain the area of the railroad track obscured by the natural disaster, which was used as the second natural disaster area. The outline of the second natural disaster area was extracted and the coordinates of the center point of the outline were found. , with the center point coordinates As the center, the second natural disaster area is scaled back to the pixel size of the natural disaster image sample 1920*1080, and a target frame of 64*64 pixels is intercepted in the second natural disaster area to obtain the target frame coordinates [ ], which are the horizontal and vertical coordinates of the upper left and lower right corners of the target frame. The second natural disaster area is then aligned with the image to be tested. A partial image of the target area with a size of 64*64 pixels is extracted from the natural disaster image sample based on the target frame coordinates to serve as the second target natural disaster image.
[0073] Then give each second target natural disaster image a category label , ∈[0, 1]. Where 0 corresponds to debris flow and 1 corresponds to flooding. Finally, 1287 debris flow image samples and 1761 flooding image samples were obtained. The LBP texture features of the second target natural disaster image were extracted, and each second target natural disaster image obtained a feature vector with a dimension of [1 * 26]. . Each data group corresponds to a training data [ ], all training data are combined to form a classification data set for the classification model. 80% of the data is divided into a classification training set, and 20% of the data is divided into a classification validation set. The classification training set is used to train the SVM classifier, and the classification validation set is used to test the SVM classifier's classification performance for debris flow and flooding. The detection method of this application achieves a classification accuracy rate of 93%, which is a significant improvement compared to the 86% accuracy of direct detection by YOLOv8n, as shown in Table 1: Table 1
[0074] Based on the above, the present application further provides a natural disaster detection device for a railway area. The natural disaster detection device for a railway area and the natural disaster detection method for a railway area can be referred to in a corresponding manner.
[0075] As an example, Figure 5 As shown, the natural disaster detection device for the rail area includes an image extraction module 510 , a target image acquisition module 520 , a feature extraction module 530 and a classification module 540 .
[0076] The image extraction module 510 is used to extract a first extracted image with the rail area as a boundary and a second extracted image with the rail area as a boundary from the first normal image and the image to be tested, respectively.
[0077] The target image acquisition module 520 is configured to acquire a first target natural disaster image based on the difference between the first extracted image and the second extracted image.
[0078] The feature extraction module 530 is used to extract texture features from the first target natural disaster image.
[0079] The classification module 540 is used to input the texture features into a classification model to obtain the category of the natural disaster. The classification model is obtained by training using texture feature samples and category labels corresponding to the texture feature samples.
[0080] In the embodiment of the present application, the input data of the classification model is the texture features of natural disasters, rather than images containing natural disasters and railroad areas. Therefore, there is no need to collect a large number of images containing natural disasters and railroad areas and label them. While the sample demand and labeling amount are greatly reduced, the category of natural disasters is identified with the help of texture features to ensure the detection accuracy of the classification model. In addition, the embodiment of the present application uses the complete railroad area image segmented from the normal image as a reference to identify the target natural disaster image within the railroad area image segmented from the image to be tested, thereby ensuring the recognition accuracy of natural disasters.
[0081] In one possible embodiment, Figure 6 As shown, the target image acquisition module 520 includes a subtraction module 5201 , a center point determination module 5202 , and a region image extraction module 5203 .
[0082] The subtraction module 5201 is used to subtract the second extracted image from the first extracted image to obtain an area where the rails are blocked by natural disasters as a first natural disaster area.
[0083] The center point determination module 5202 is used to calculate the center point of the outline based on the outline of the first natural disaster area.
[0084] The regional image extraction module 5203 is used to align the first natural disaster area with the image to be tested, determine the target area in the area aligned with the first natural disaster area in the image to be tested, and extract the image of the target area from the image to be tested as the first target natural disaster image; wherein, the target area is centered on the center point, and the target area has a preset shape and a first preset size.
[0085] The first target natural disaster image extracted in this embodiment of the present application has a preset shape and a first preset size, thereby avoiding the impact of the irregularity of the natural disaster's shape on natural disaster identification. Furthermore, the purpose of the first target natural disaster image is to extract its texture features for classification. This embodiment of the present application captures an image near the center of the natural disaster, which can obtain representative characteristics of the natural disaster. This ensures that the classification model obtains accurate texture features while addressing the difficulty of image annotation caused by the irregularity of natural disasters.
[0086] In one possible embodiment, the device for detecting natural disasters in a railroad area further includes a first scaling module and a second scaling module. The first scaling module is configured to reduce or enlarge the first normal image and the image to be detected to a second preset size before extracting the first extracted image and the second extracted image. The second scaling module is configured to enlarge or reduce the first natural disaster area back to the size of the image to be detected before aligning the first natural disaster area with the image to be detected.
[0087] The embodiment of the present application ensures the accuracy and precision of the segmentation by scaling the first normal image and the image to be tested and then inputting them into the segmentation model; and restores the original size before aligning the first natural disaster area with the image to be tested to more accurately capture the first target natural disaster image.
[0088] In a possible embodiment, the natural disaster detection device in the railway area further includes a classification data set acquisition module, which is specifically configured to: Collect multiple natural disaster image samples containing both natural disaster areas and railroad areas; Pairing each natural disaster image sample with a different second normal image to form different data groups; A third extracted image and a fourth extracted image are extracted from the second normal image and the natural disaster image sample of each data group using a segmentation model, wherein the third extracted image and the fourth extracted image are both bounded by the railroad area; obtaining a second target natural disaster image based on a difference between the third extracted image and the fourth extracted image; Extracting texture features of the second target natural disaster image of each data group, and labeling the second target natural disaster image of each data group with a category label; Combining the texture features and category labels corresponding to each data group to form training data corresponding to each data group; The training data corresponding to all data groups are combined to form a classification data set for training the classification model.
[0089] The embodiment of the present application increases the sample data of the classification model by pairing the second normal image with the natural disaster image sample, thereby obtaining rich data samples and improving the training accuracy of the classification model.
[0090] Figure 7 Schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 7 As shown, the electronic device may include: a processor 710, a communications interface 720, a memory 730, and a communications bus 740. The processor 710, the communications interface 720, and the memory 730 communicate with each other via the communications bus 740. The processor 710 may invoke logic instructions in the memory 730 to execute a method for detecting natural disasters in a railroad area. The method includes: extracting a first extracted image and a second extracted image with the railroad area as a boundary from a first normal image and an image to be detected, respectively, containing the same railroad area; obtaining a first target natural disaster image based on the difference between the first extracted image and the second extracted image; extracting texture features from the first target natural disaster image; and inputting the texture features into a classification model to obtain a natural disaster category. The classification model is trained using texture feature samples and category labels corresponding to the texture feature samples.
[0091] Furthermore, the logic instructions in the aforementioned memory 730 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product, stored in a storage medium, includes instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0092] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the natural disaster detection method for the rail area provided by the above-mentioned embodiments, the method including: extracting a first extracted image with the rail area as the boundary and a second extracted image with the rail area as the boundary from a first normal image and an image to be tested containing the same rail area; obtaining a first target natural disaster image based on the difference between the first extracted image and the second extracted image; extracting texture features from the first target natural disaster image; inputting the texture features into a classification model to obtain the category of the natural disaster; the classification model is obtained after training using texture feature samples and category labels corresponding to the texture feature samples.
[0093] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the natural disaster detection method for the rail area provided in the above-mentioned embodiments, the method comprising: extracting a first extracted image with the rail area as the boundary and a second extracted image with the rail area as the boundary from a first normal image and an image to be tested containing the same rail area, respectively; obtaining a first target natural disaster image based on the difference between the first extracted image and the second extracted image; extracting texture features from the first target natural disaster image; inputting the texture features into a classification model to obtain the category of the natural disaster; the classification model is obtained after training using texture feature samples and category labels corresponding to the texture feature samples.
[0094] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0095] Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented using software plus a necessary general-purpose hardware platform, or of course, hardware. Based on this understanding, the essence of the above technical solution, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, or an optical disk, and includes a number of instructions for causing a computer device (such as a personal computer, server, or network device) to execute the methods described in each embodiment or certain portions of the embodiments.
[0096] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course by hardware. Based on this understanding, the above technical solution, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a read-only memory (ROM) / random access memory (RAM), a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.
[0097] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for detecting natural disasters in a railway area, characterized in that: include: extracting a first extracted image with the rail area as a boundary and a second extracted image with the rail area as a boundary from a first normal image and a test image containing the same rail area respectively; obtaining a first target natural disaster image based on a difference between the first extracted image and the second extracted image; extracting texture features from the first target natural disaster image; Inputting the texture features into a classification model to obtain a category of natural disasters; The classification model is obtained after training using texture feature samples and category labels corresponding to the texture feature samples.
2. The method for detecting natural disasters in a railway area according to claim 1, wherein: Obtaining a first target natural disaster image according to a difference between the first extracted image and the second extracted image specifically includes: subtracting the second extracted image from the first extracted image to obtain an area of the rails blocked by the natural disaster as a first natural disaster area; Based on the outline of the first natural disaster area, calculating the center point of the outline; Align the first natural disaster area with the image to be tested, determine a target area within the area aligned with the first natural disaster area in the image to be tested, and extract an image of the target area from the image to be tested as the first target natural disaster image; wherein the target area is centered on the center point, and the target area has a preset shape and a first preset size.
3. The method for detecting natural disasters in a railway area according to claim 2, wherein: Before extracting the first extracted image and the second extracted image, the method further includes: reducing or enlarging the first normal image and the image to be measured to a second preset size; Furthermore, before aligning the first natural disaster area with the image to be measured, the method further includes: The first natural disaster area is enlarged or reduced back to the size of the image to be measured.
4. The method for detecting natural disasters in a railway area according to claim 1, wherein: extracting the first extracted image and the second extracted image by using a segmentation model; The segmentation model is used to identify the boundary of the rail area in the image, thereby segmenting the image based on the rail area as the boundary and extracting the local image containing the rail area from the image; The segmentation model is obtained by training using a plurality of second normal images containing the railroad area, wherein the plurality of second normal images are images containing the railroad area collected in different weather conditions and different time periods in the absence of natural disasters.
5. The method for detecting natural disasters in a railway area according to claim 4, wherein: Obtaining a classification data set for training the classification model specifically includes: Collecting a plurality of natural disaster image samples containing both the natural disaster area and the rail area; Pairing each natural disaster image sample with a different second normal image to form different data groups; Extracting a third extracted image and a fourth extracted image from the second normal image and the natural disaster image sample of each data group using the segmentation model, wherein the third extracted image and the fourth extracted image are both bounded by the rail area; obtaining a second target natural disaster image based on a difference between the third extracted image and the fourth extracted image; Extracting texture features of the second target natural disaster image of each data group, and labeling the second target natural disaster image of each data group with a category label; Combining the texture features and category labels corresponding to each data group to form training data corresponding to each data group; The training data corresponding to all data groups are combined to form a classification data set for training the classification model.
6. A natural disaster detection device for a railway area, characterized in that: It includes image extraction module, target image acquisition module, feature extraction module and classification module; The image extraction module is used to extract a first extracted image with the rail area as the boundary and a second extracted image with the rail area as the boundary from the first normal image and the image to be tested containing the same rail area respectively; The target image acquisition module is used to obtain a first target natural disaster image based on the difference between the first extracted image and the second extracted image; The feature extraction module is used to extract texture features from the first target natural disaster image; The classification module is used to input the texture features into a classification model to obtain the category of natural disasters; the classification model is obtained after training using texture feature samples and category labels corresponding to the texture feature samples.
7. The natural disaster detection device for a railway track area according to claim 6, characterized in that: The target image acquisition module includes a subtraction module, a center point determination module, and a region image extraction module; The subtraction module is used to subtract the second extracted image from the first extracted image to obtain an area of the railroad track blocked by the natural disaster as a first natural disaster area; The center point determination module is used to calculate the center point of the outline based on the outline of the first natural disaster area; The regional image extraction module is used to align the first natural disaster area with the image to be tested, determine a target area within the area aligned with the first natural disaster area in the image to be tested, and extract an image of the target area from the image to be tested as the first target natural disaster image; wherein, the target area is centered on the center point, and the target area has a preset shape and a first preset size.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the method for detecting natural disasters in a railway area according to any one of claims 1 to 5 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for detecting natural disasters in a railway area according to any one of claims 1 to 5 is implemented.
10. A computer program product, comprising a computer program, characterized in that: When the computer program is executed by a processor, the method for detecting natural disasters in a railway area according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Visual analysis based mountain railway side slope rockfall detecting method
CN105809679A
High-speed railway rockfall real-time detection method based on aggregation channel features and texture features
CN112949484A
Real-time rail defect detection method
CN114166855A
Method for evaluating damage degree of building in natural disaster by using remote sensing image
CN116645616A
Debris flow and landslide positioning and classifying method based on natural images
CN119107483A