Point switch gap detection method and system
Through deep learning and image processing technology, pre-trained detection models and multi-scale fusion network models are used to detect gaps in the switch machine, solving the problems of inefficient and low accuracy of traditional detection methods, and achieving efficient and accurate gap detection.
Patent Information
- Application Number
- CN202510012938.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-06
- Publication Date
- 2025-05-16
AI Technical Summary
The traditional switch machine notch detection method is inefficient, has limited accuracy, and is easily disturbed by stains, oil, dust, etc., resulting in low detection accuracy.
Deep learning and image processing technology are used to pre-treat and detect the gap image of the switch machine through pre-training detection models, and a multi-scale fusion network model is used to avoid the impact of oil and stains on the detection results.
It significantly improves detection efficiency and accuracy, reduces the risks and costs of manual operations, overcomes the problems of environmental interference in traditional detection methods, and can capture gap edge information more accurately.
Smart Images

Figure CN120013873A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of detection technology and artificial intelligence, and in particular to a switch gap detection method and system. Background Art
[0002] The switch machine is one of the important equipment in railway transportation. It is mainly responsible for controlling the switching of the turnout state, which can enable the train to quickly and smoothly switch the direction of travel at the railway intersection or branch track, ensure that the train runs according to the predetermined route, and avoid train deviation or derailment accidents. ZYJ7 is an important type of switch machine. The size of its internal gap reflects the degree of close fit between the turnout point rail and the base rail. Therefore, it is of great significance to accurately detect the gap of the switch machine.
[0003] The traditional method of detecting the gap of the switch machine by manpower is not only inefficient, but also has limited accuracy and brings safety risks to the staff. With the maturity of image processing technology, the extraction of gap edges through image processing methods has been widely used, but it requires manual calibration, and when the gap image is partially overexposed or there is oil or dust in the switch machine, it will greatly affect the detection accuracy. Different image processing related parameters need to be set for different monitoring situations.
[0004] In switch gap detection, it is very important to remove the influence of stains and adopt automated detection based on deep learning, which can not only reduce manual operations but also significantly improve detection efficiency and accuracy. Currently, there are relatively few studies on switch gap edge detection. Summary of the invention
[0005] The purpose of this section is to summarize some aspects of embodiments of the present invention and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section and the specification abstract and the invention title of this application to avoid blurring the purpose of this section, the specification abstract and the invention title, and such simplifications or omissions cannot be used to limit the scope of the present invention.
[0006] In view of the above existing problems, the present invention is proposed.
[0007] Therefore, the present invention provides a switch gap detection method and system, which can solve the problems mentioned in the background technology.
[0008] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0009] In a first aspect, the present invention provides a switch machine gap detection method, comprising:
[0010] Acquire a target first gap image, and perform a first preprocessing on the first gap image, wherein the first gap image at least includes a target switch machine gap image;
[0011] Pre-training a first detection model, and using the first pre-processed first notch image as an input of the first detection model;
[0012] The output of the first detection model is obtained, and the switch gap detection is completed according to the output.
[0013] As a preferred solution of the switch gap detection method of the present invention, the first detection model includes:
[0014] The first detection model is any model that takes as input the first gap image and outputs the switch gap edge information or can directly or indirectly obtain relevant parameters of the switch gap edge information.
[0015] As a preferred solution of the switch gap detection method of the present invention, the first preprocessing of the first gap image includes:
[0016] performing a first marking operation on the first notch image;
[0017] Generate a first data set from the first gap image after the first annotation operation;
[0018] A first removal operation is performed on the first data set.
[0019] As a preferred solution of the switch machine gap detection method of the present invention, the first removal operation includes:
[0020] Performing feature extraction on the first data set;
[0021] Dividing the first data set after the feature extraction operation into a first category;
[0022] The first data set divided into the first category is color filled to complete the first removal operation.
[0023] As a preferred solution of the switch gap detection method described in the present invention, wherein: the first detection model also includes a plurality of convolutional layers, and the plurality of convolutional layers are divided into five stages;
[0024] The last convolutional layer in each stage leads to the side output layer;
[0025] Upsample the side output layer of each stage to obtain an edge map of the same size as the original image;
[0026] The output of the first detection model is obtained by performing feature fusion on the five side output layers.
[0027] As a preferred solution of the switch gap detection method described in the present invention, the plurality of convolutional layers are divided into five stages including:
[0028] After the second stage, the third stage, and the fourth stage, an optimized receptive field module is added, wherein the receptive field module includes a first type of receptive field module and a second type of receptive field module;
[0029] The upsampled output of the third stage is fused with the side outputs of the first and fifth stages for image features.
[0030] As a preferred solution of the switch gap detection method of the present invention, the first type of receptive field module and the second type of receptive field module include:
[0031] The first type of receptive field module includes five parallel branches of convolution, a bottleneck structure consisting of 1×1 convolution layers is used in the first to fourth branches, and the fifth branch is a residual structure;
[0032] The second type of receptive field module includes four parallel convolution branches.
[0033] In a second aspect, the present invention provides a switch gap detection system, comprising:
[0034] A data acquisition and processing module, used for acquiring a target first gap image and performing a first preprocessing on the first gap image, wherein the first gap image at least includes a target switch machine gap image;
[0035] A model building module, used for pre-training a first detection model, and using the first pre-processed first notch image as an input of the first detection model;
[0036] The detection module is used to obtain the output of the first detection model and complete the switch gap detection according to the output.
[0037] In a third aspect, the present invention provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned method when executing the computer program.
[0038] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the method described above when executed by a processor.
[0039] Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention proposes a switch gap detection method and system, obtains a target first gap image, and performs a first preprocessing on the first gap image, wherein the first gap image at least includes a target switch gap image; pre-trains a first detection model, and uses the first preprocessed first gap image as the input of the first detection model; obtains the output of the first detection model, and completes the switch gap detection according to the output. Compared with the traditional method of detecting switch gaps by manpower, the present invention not only significantly improves the detection efficiency, but also reduces the risk and cost of manual operation. At the same time, by introducing deep learning and image processing technology, the present invention can overcome the problem that traditional detection methods are susceptible to interference from stains, oil stains, dust, etc., and improve the accuracy and stability of detection. By improving the traditional HED multi-scale fusion network model, the influence of oil stains and stains on the detection results can be avoided, and the gap edge information can be captured more accurately and clearly, solving the problem of cumbersome calibration and susceptibility to environmental influences in traditional image processing algorithms. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. Among them:
[0041] Figure 1 A method flow chart of a switch machine gap detection method and system provided by one embodiment of the present invention;
[0042] Figure 2 A multi-scale fusion network structure diagram of edge detection of a switch gap detection method and system provided by an embodiment of the present invention;
[0043] Figure 3 A diagram showing a structure of a first-class receptive field module after optimization of a switch gap detection method and system provided by an embodiment of the present invention;
[0044] Figure 4 A structural diagram of the optimized second type receptive field module of a switch gap detection method and system provided by an embodiment of the present invention;
[0045] Figure 5 A DySample up-sampling structure diagram of a switch gap detection method and system provided by an embodiment of the present invention;
[0046] Figure 6 An internal structural diagram of a computer device of a switch gap detection method and system provided in accordance with an embodiment of the present invention. DETAILED DESCRIPTION
[0047] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
[0048] Example 1
[0049] Reference Figure 1-Figure 6 , which is the first embodiment of the present invention, provides a switch gap detection method and system, including:
[0050] Before describing the embodiments of the present application in detail, some related concepts are first explained for the sake of clarity.
[0051] HED network: HED (Holistically-Nested Edge Detection) is a deep learning model for edge detection. It predicts the edges in the image through a deep neural network, which can generate multi-scale edge maps and fuse them to obtain the final edge detection result. The traditional HED network uses VGG as the backbone network, and performs multi-scale feature fusion through multiple side output layers to finally obtain a high-quality edge map.
[0052] VGG network: VGG is the abbreviation of Visual Geometry Group, which refers to a series of convolutional neural network structures proposed by the Computer Vision Group of Oxford University. The VGG network is characterized by its simple and consistent architecture, using only a small 3x3 convolution kernel and a 2x2 maximum pooling layer. In the improved switch gap detection method, VGG is used as the backbone feature extraction network, responsible for extracting different levels of features from the input image.
[0053] RFB module: RFB (Receptive Field Block) is a module used to expand the receptive field and enhance the feature extraction effect. In the improved multi-scale fusion network, an optimized RFB module is added after certain layers of the VGG backbone feature extraction network to help capture a wider range of contextual information. RFB modules usually contain multiple branches, each with a different expansion rate, which allows them to process a wider range of information without increasing too much computational cost.
[0054] DySample upsampling: DySample is a dynamic upsampling technique used to restore the spatial resolution lost after downsampling. In this improved switch gap detection method, DySample is used to fuse the upsampled output of the third layer with the first and fifth layers through concat (splicing) and BN (batch normalization) to achieve effective combination of multi-scale features.
[0055] BN (batch normalisation): BN is a technique used to speed up the training process. It can also reduce the sensitivity to the choice of initialization weights and help alleviate the problem of gradient disappearance or explosion. In the improved multi-scale fusion network, BN is applied to the process of image feature fusion to ensure the consistency and stability of feature distribution.
[0056] ZYJ7 switch machine: ZYJ7 is a type of hydraulic switch machine used in China's railway system. It is an electro-hydraulic type switch machine, mainly used to control the state conversion of the turnout to ensure that the train runs along the scheduled route. For this type of switch machine, the size of the internal gap reflects the degree of close fit between the turnout point rail and the base rail, so accurate detection of the gap is crucial to maintaining railway safety.
[0057] There are some problems in the existing related technologies, such as low detection accuracy, poor adaptability to complex environments, and insufficient detection capabilities for small gaps.
[0058] The present application provides a method that can effectively solve the above-mentioned problems. Next, how to implement the switch machine gap detection method will be described in detail in combination with multiple embodiments;
[0059] Figure 1 A method flow chart of a switch machine gap detection method and system is shown, including:
[0060] S101, acquiring a target first gap image, and performing a first preprocessing on the first gap image, wherein the first gap image at least includes a target switch machine gap image;
[0061] In an optional embodiment, the first gap image can be an image of the target switch gap-related position, which is captured by a high-definition camera to ensure image clarity and details. The high-definition camera can be installed near the switch machine and can obtain the state of the switch gap in real time.
[0062] In an optional embodiment, when training the model, the first gap image can be historical data, which can be obtained through a historical image database, which stores a large amount of image data of switch gaps, covering gap images under different lighting conditions, different weather conditions, and different usage conditions. These data are used to train the deep learning model, so that the model can learn the characteristics of the switch gap and improve the accuracy and robustness of detection. By using these historical data, the model can better adapt to complex environments and can also accurately detect small gaps, thereby effectively improving the reliability and efficiency of switch gap detection.
[0063] In an optional embodiment, there are many types of switch machines, for example, ZDJ9, S700K, ZYJ7, etc.
[0064] In this embodiment, the target first gap image collected is the gap image of the ZYJ7 switch machine.
[0065] It should be noted that the present application does not limit the method for acquiring the target first notch image, and relevant technical personnel can design the acquisition method according to actual needs.
[0066] In an optional embodiment, the first preprocessing may include steps such as image denoising, image enhancement, and image resizing to ensure that the image data input to the model has high quality, thereby improving the accuracy of gap detection.
[0067] In another optional embodiment, image denoising can effectively remove noise points in the image to avoid interference of noise on gap feature extraction; image enhancement can enhance the contrast of the image to make the gap edge clearer;
[0068] In another optional embodiment, image resizing may unify images of different sizes into the same size for the convenience of subsequent processing.
[0069] It should be noted that these pretreatment steps can be selected and adjusted according to actual conditions to achieve the best treatment effect.
[0070] In an optional embodiment, the first preprocessing may also be to grayscale the input ZYJ7 switch machine gap image to convert the color image into a grayscale image. Grayscale processing can simplify image information and reduce the amount of calculation while retaining the main features of the image, such as gap shape and edge information. This step helps to improve the efficiency and accuracy of subsequent gap detection.
[0071] In the embodiment of the present application, performing a first preprocessing on the first notch image includes:
[0072] Performing a first marking operation on the first notch image;
[0073] Generate a first data set from the first gap image after the first annotation operation;
[0074] A first removal operation is performed on the first data set.
[0075] In an optional embodiment, the first annotation operation is to mark the input ZYJ7 switch machine gap image in order to distinguish the gap part and the non-gap part in the image. This step is the basis for subsequent image processing and analysis, and can help the system more accurately identify the position and shape of the gap, thereby improving the accuracy and reliability of gap detection. Through the first annotation operation, useful reference information can be provided for subsequent image processing steps.
[0076] In an optional embodiment, the first marking operation can be implemented by a manual marking tool or an automatic marking algorithm. The manual marking tool allows the operator to manually mark the gap portion and clearly distinguish the gap from the non-gap area by specifying a color, line or other marking symbol. Although this method is time-consuming, it can ensure the accuracy and flexibility of the marking.
[0077] In another optional embodiment, the automatic annotation algorithm automatically identifies and marks the gap part based on machine learning and image processing technology, which greatly improves the processing efficiency and is particularly suitable for processing large-scale image data. The automatic annotation algorithm learns the gap features through the training model, and can automatically adapt to different lighting conditions, gap shapes and background interference to achieve efficient and accurate gap annotation.
[0078] In the embodiment of the present application, the first marking operation is not limited, and relevant technical personnel can select different marking operations according to actual needs.
[0079] In an optional embodiment, generating a first data set from the first notch image after the first annotation operation is to generate a training set, a validation set and a test set, and provide relevant data for the following model that needs to be trained;
[0080] In an embodiment of the present application, the first gap image after the first annotation operation is divided into a training set, a validation set, and a test set in a ratio of 7:2:1, and the training set data is enhanced by using rotation, scaling, flipping, translation, and other methods to increase the number of training set images, so that the neural network has better generalization capabilities.
[0081] It should be noted that after the first data set is generated for the first time, when the target first gap image is obtained for the second or more times and the first gap image is subjected to the first preprocessing, the first preprocessing no longer generates the first data set, and the model trained the last time can be used for detection;
[0082] It should also be noted that a judgment criterion can be set for the model to determine whether the first data set needs to be regenerated. For example, when the output result of the model has an error greater than a certain threshold, the process of re-performing the first annotation operation and generating a new first data set is triggered to ensure the accuracy and reliability of the model.
[0083] In an optional embodiment, the first removal operation is to remove oil stains, stains, and other impurities or interference factors that may affect the gap detection in the image. Through this step, the image quality can be ensured and the accuracy of the gap detection can be improved.
[0084] In an optional embodiment, in order to implement the first removal operation, an image processing algorithm, such as filtering, morphological processing, etc., can be used. These algorithms can effectively remove unnecessary parts in the image while retaining key features of the gap.
[0085] In another optional embodiment, the first removal operation may also be combined with hardware devices, such as a high-definition camera, an image acquisition card, etc., to obtain higher quality image data, thereby providing a more reliable basis for subsequent gap detection.
[0086] In the embodiment of the present application, the first removal operation includes:
[0087] Performing feature extraction on the first data set;
[0088] Dividing the first data set after the feature extraction operation into a first category;
[0089] The first data set divided into the first category is color filled to complete the first removal operation.
[0090] In an optional embodiment, feature extraction is an operation to determine where similar features such as background color and stain color exist in the first data set, and this step is crucial for distinguishing the background from the actual gap in the image. Through feature extraction, the system can more accurately identify which parts are gap features that need to be retained and which parts are impurities that need to be removed.
[0091] In an optional embodiment, the first category division is to divide pixels containing similar features such as background color and stain color into different categories according to the different colors and texture features of each part of the image, so as to effectively distinguish the background color, stain color and other possible areas, which can significantly improve the accuracy of subsequent gap detection. Through the first category division, the system can classify different parts of the image, making the color filling operation more accurate and avoiding accidental damage to the gap features. This fine division not only helps to remove impurities in the image, but also retains the key features of the gap, providing strong support for subsequent detection work.
[0092] Exemplarily, the first category division can be achieved by using color space conversion and clustering algorithms. Specifically, the system first converts the image from the RGB color space to the Lab color space, which is easier to distinguish color differences, and then uses clustering algorithms such as K-means to divide the pixels into different categories according to their positions in the Lab color space. In this way, pixels with similar color features will be classified into one category, thereby achieving effective distinction between background color, stain color, etc.
[0093] In the embodiment of the present application, the first removal operation is specifically performed as follows:
[0094] First, the image is converted to the LAB color space, which is more consistent with the visual perception of the human eye.
[0095] Then, according to the different color and texture characteristics of each part of the image, pixels containing similar features such as background color and stain color are divided into different categories, thereby effectively distinguishing the background color, stain color and other possible areas.
[0096] After that, one or more small blocks representing background features are extracted from the area identified as background color. These blocks contain typical background texture and color information in the image and can better reflect the original background of the image.
[0097] Finally, the texture and color information extracted from the background area is filled into the previously identified stain area, thereby effectively removing the stain and restoring the overall visual effect of the image.
[0098] It should be noted that obtaining the target first gap image and performing the first preprocessing on the first gap image can improve the accuracy and efficiency of subsequent image processing. Through the first preprocessing, the noise in the image can be removed, the image contrast can be enhanced, the image brightness can be adjusted, etc., so that the target first gap image is clearer, which is conducive to the subsequent gap feature extraction and recognition. In addition, the preprocessing step can also unify the image format and size, provide standardized input for the subsequent processing steps, and ensure the stability and reliability of the entire detection process.
[0099] S102, pre-training a first detection model, and using the first pre-processed first notch image as an input of the first detection model;
[0100] In the embodiment of the present application, the first detection model includes:
[0101] The first detection model is any model whose input is the first gap image and whose output is the switch gap edge information or the relevant parameters that can directly or indirectly obtain the switch gap edge information.
[0102] In an optional embodiment, the first detection model can be constructed using a deep learning algorithm, such as a convolutional neural network (CNN) or a recurrent neural network (RNN). These models are trained with a large amount of image data and can automatically identify and locate the position of the switch gap.
[0103] In another optional embodiment, other advanced image processing technologies, such as edge detection, morphological processing, etc., may be integrated to further improve the accuracy and robustness of gap detection.
[0104] In another optional embodiment, the first detection model can also be trained and optimized by other methods. For example, the model pre-trained on a large-scale data set can be transferred to a specific switch gap detection task by using transfer learning technology, and the model parameters can be fine-tuned to adapt to the specific scenario.
[0105] In another optional embodiment, it is also possible to combine semi-supervised learning or unsupervised learning methods and use unlabeled or a small amount of labeled data to improve the generalization ability of the model. The comprehensive application of these methods can further improve the detection performance of the first detection model in complex environments and ensure the accuracy and stability of switch gap detection.
[0106] In the embodiment of the present application, the first detection model further includes a plurality of convolutional layers, and the plurality of convolutional layers are divided into five stages;
[0107] The last convolutional layer in each stage leads to the side output layer;
[0108] Upsample the side output layer of each stage to obtain an edge map of the same size as the original image;
[0109] The output of the first detection model is obtained by performing feature fusion on the five side output layers. In the embodiment of the present application, the convolutional layers are divided into five stages including:
[0110] After the second stage, the third stage, and the fourth stage, an optimized receptive field module is added, and the receptive field module includes a first type of receptive field module and a second type of receptive field module;
[0111] The upsampled output of the third stage is fused with the side outputs of the first and fifth stages for image features.
[0112] In the embodiment of the present application, the first type of receptive field module and the second type of receptive field module include:
[0113] The first type of receptive field module includes five parallel convolution branches. The first to fourth branches use a bottleneck structure consisting of a 1×1 convolution layer, and the fifth branch is a residual structure.
[0114] The second type of receptive field module consists of four parallel convolution branches.
[0115] In an embodiment of the present application, an improved deep learning algorithm is used to construct a model. Specifically, a multi-scale fusion network improved from the network structure of HED is used for construction. The specific improvement is as follows: the network structure of HED uses VGG as the backbone feature extraction network, which is divided into five stages by 13 convolutional layers. The last convolutional layer of each stage leads to a side output layer. The side output layer of each stage needs to be upsampled to obtain an edge map of the same size as the original image. Finally, the five side output layers are feature-fused to obtain the final edge map.
[0116] It should be noted that the VGG backbone feature extraction network is a five-layer convolutional layer connected in sequence. The first convolutional layer contains two convolutions of size 64*3*3, the second convolutional layer contains two convolutions of size 128*3*3, the third convolutional layer contains three convolutions of size 256*3*3, the fourth convolutional layer contains three convolutions of size 512*3*3, and the fifth convolutional layer contains three convolutions of size 512*3*3, as shown in Figure 2 shown.
[0117] In the embodiment of the present application, based on the above HED network structure, the maximum pooling layer of the backbone feature extraction network is replaced, and the optimized RFB module is added to expand the receptive field to enhance the feature extraction effect, and the image features are multi-scale fused through the concat and BN (batch normalisation) structures, specifically including:
[0118] In the embodiment of the present application, the embodiment adopts a multi-scale feature fusion strategy, and uses a dilated convolution to replace the maximum pooling layer of the third and fourth convolution layers of the VGG backbone feature extraction network, which can help the model better retain spatial information and reduce computational complexity, thereby improving the performance of the model edge detection. The optimized RFB module is added after the last convolution block of the second, third, and fourth layers to expand the receptive field and enhance the feature extraction effect, and then DySample upsampling is used to fuse the upsampled output of the third layer with the first and fifth layers through concat and BN (batch normalization) for image feature, such as Figure 2 shown.
[0119] In the embodiment of the present application, the RFB module introduced in this example is composed of multiple parallel convolution branches, each branch has a different receptive field, and uses convolution kernels of different sizes and different expansion rates to better capture contextual information at different scales. There are two main RFB modules used, and their structures are slightly different. RFB_a (i.e., the first type of receptive field module) has five parallel convolutions. The first to fourth branches use a bottleneck structure composed of a 1×1 convolution layer, and then perform multiple convolution operations respectively. The void convolution void rates are 1, 3, 5, and 7 respectively. After that, they are spliced through the Concat operation, and then the number of channels is adjusted through 1×1 convolution. Finally, they are merged with the fifth branch, where the fifth branch is a residual structure, such as Figure 3 RFB_b (i.e., the second type of receptive field module) has four parallel convolutions. The dilated convolution rates of the first to third branches are 3, 3, and 5, respectively. After several layers of convolution, they are spliced through the Concat operation, and then the number of channels is adjusted through 1×1 convolution. Finally, the output of the fourth branch connected by shortcut is added, as shown in Figure 4 shown.
[0120] In the embodiment of the present application, concat and BN (batch normalisation) image feature fusion, firstly, the third layer and the fifth layer are restored to the size of the original feature map by upsampling, and the DySample upsampling method is selected. Then, the upsampled feature map of the third layer is concatenated with the feature maps of the first layer and the fifth layer respectively by concat, and then processed by batch normalization (BN) to form a new feature map. This new feature map contains multi-scale information, which helps the model to better understand and identify the target in the image and improve the performance of the model in edge detection.
[0121] It should be noted that DySample is a lightweight and efficient upsampling method. Figure 5 As shown, first, the input feature map χ is resampled by the sampling point generator to generate a sampling set S, which is the generated offset O and the original sampling grid position The sampling point generator is a static range factor, the offset is generated by the linear layer, and finally the upsampled feature map χ′ is generated by the grid_sample function and the sampling set S. The process expression is:
[0122] Ο=linear(χ)
[0123]
[0124] χ′=gridsample(χ,S)
[0125] In an optional embodiment, the loss function of the multi-scale fusion network is a weighted cross entropy loss function, and the loss function expression is:
[0126]
[0127] In the formula, W represents the set of network parameters, w represents the parameters of the output layer, and Y + and Y - is the set of edge pixels and non-edge pixels in the image, β represents the weight coefficient, β=|Y - | / |Y + |,X is the input image, Pr(y j |X,W,w) is calculated by the Sigmoid function for pixel j.
[0128] It should be noted that pre-training the first detection model and using the first pre-processed first gap image as the input of the first detection model can effectively improve the detection accuracy and efficiency. By using the pre-trained first detection model, the system can more accurately identify the key features in the switch gap image, thereby achieving more accurate and rapid gap detection. In addition, the pre-training process can also enhance the generalization ability of the model, so that it can better adapt to gap detection tasks under different environments and conditions.
[0129] S103, obtaining the output of the first detection model, and completing the switch gap detection according to the output.
[0130] In an optional embodiment, the output of the first detection model may be the switch gap edge information or the related parameters that can directly or indirectly obtain the switch gap edge information, wherein the switch gap edge information includes but is not limited to the pixel coordinates, edge length, edge direction, etc. of the gap edge. Such information is crucial for subsequent processing and analysis. The system can use such edge information to further calculate the key parameters of the gap such as size and shape, so as to accurately evaluate the state of the gap.
[0131] In an optional embodiment, the relevant parameters that can directly or indirectly obtain the switch gap edge information can be the grayscale value, color information, texture features, etc. of the switch gap image. These relevant parameters not only enrich the dimension of switch gap detection, but also provide the system with more information about the gap status.
[0132] It should be noted that by comprehensively analyzing and processing these parameters, the system can more comprehensively evaluate the status of the gap and improve the accuracy and reliability of detection.
[0133] It should also be noted that these relevant parameters can also serve as the basis for subsequent processing and decision-making, providing strong support for the maintenance and servicing of switch machines.
[0134] In an optional embodiment, subsequent operations may be further generated based on the detected results. For example, when the system detects that the switch gap size exceeds a preset range, an alarm message may be automatically generated to notify relevant personnel to handle it in a timely manner.
[0135] In an optional embodiment, the system can also automatically adjust the working parameters of the switch machine according to the detected gap status information to prevent potential safety hazards. These subsequent operations not only improve the practicality of the detection system, but also provide a strong guarantee for the safe operation of the switch machine.
[0136] In summary, the present invention proposes a switch gap detection method, which obtains a target first gap image, and performs a first preprocessing on the first gap image, wherein the first gap image at least includes a target switch gap image; pre-trains a first detection model, and uses the first preprocessed first gap image as the input of the first detection model; obtains the output of the first detection model, and completes the switch gap detection according to the output. Compared with the traditional method of detecting switch gaps by manpower, the present invention not only significantly improves the detection efficiency, but also reduces the risk and cost of manual operation. At the same time, by introducing deep learning and image processing technology, the present invention can overcome the problem that traditional detection methods are susceptible to interference from stains, oil stains, dust, etc., and improve the accuracy and stability of detection. By improving the traditional HED multi-scale fusion network model, the influence of oil stains and stains on the detection results can be avoided, and the gap edge information can be captured more accurately and clearly, solving the problem of cumbersome calibration and susceptibility to environmental influences in traditional image processing algorithms.
[0137] Example 2
[0138] This embodiment also provides a switch machine gap detection system, including:
[0139] A data acquisition and processing module, used for acquiring a target first gap image and performing a first preprocessing on the first gap image, wherein the first gap image at least includes a target switch machine gap image;
[0140] A model building module, used for pre-training a first detection model, and using the first pre-processed first gap image as an input of the first detection model;
[0141] The detection module is used to obtain the output of the first detection model and complete the switch gap detection according to the output.
[0142] The above-mentioned unit modules may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to the above-mentioned modules.
[0143] This embodiment also provides a computer device, which may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 6 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a switch gap detection method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0144] This embodiment further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0145] Acquire a target first gap image, and perform a first preprocessing on the first gap image, wherein the first gap image at least includes a target switch machine gap image;
[0146] Pre-training a first detection model, and using the first pre-processed first gap image as an input of the first detection model;
[0147] The output of the first detection model is obtained, and the switch gap detection is completed according to the output.
[0148] Example 3
[0149] In a preferred embodiment, a switch machine gap detection method is provided. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through experiments.
[0150] In this embodiment, for the constructed multi-scale fusion network, in order to verify the performance of this method, a comparative experiment is conducted between it and the original HED network. The evaluation indicators are fixed contour threshold ODS, single image optimal threshold OIS and average accuracy AP. The experimental results are shown in the following table:
[0151]
[0152] It can be seen from the above experiments that the method proposed in this embodiment has improvements in ODS, OIS and AP, and improves the accuracy of detection, indicating the applicability of multi-scale fusion.
[0153] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
[0154] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of complete hardware embodiments, complete software embodiments, or embodiments in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code. The scheme in the embodiments of the present application can be implemented in various computer languages, for example, object-oriented programming language Java and literal scripting language JavaScript, etc.
[0155] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0156] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0157] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0158] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0159] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A switch machine gap detection method, characterized in that: include: Acquire a target first gap image, and perform a first preprocessing on the first gap image, wherein the first gap image at least includes a target switch machine gap image; Pre-training a first detection model, and using the first pre-processed first notch image as an input of the first detection model; The output of the first detection model is obtained, and the switch gap detection is completed according to the output.
2. The switch machine notch detection method according to claim 1, characterized in that: The first detection model comprises: The first detection model is any model that takes as input the first gap image and outputs the switch gap edge information or can directly or indirectly obtain relevant parameters of the switch gap edge information.
3. The switch machine notch detection method according to claim 2, characterized in that: The performing a first preprocessing on the first notch image comprises: performing a first marking operation on the first notch image; Generate a first data set from the first gap image after the first annotation operation; A first removal operation is performed on the first data set.
4. The switch machine notch detection method according to claim 3, characterized in that: The first removal operation comprises: Performing feature extraction on the first data set; Dividing the first data set after the feature extraction operation into a first category; The first data set divided into the first category is color filled to complete the first removal operation.
5. The switch machine notch detection method according to claim 4, characterized in that: The first detection model further includes a plurality of convolutional layers, and the plurality of convolutional layers are divided into five stages; The last convolutional layer in each stage leads to the side output layer; Upsample the side output layer of each stage to obtain an edge map of the same size as the original image; The output of the first detection model is obtained by performing feature fusion on the five side output layers.
6. The switch machine notch detection method according to claim 5, characterized in that: The several convolutional layers are divided into five stages including: After the second stage, the third stage, and the fourth stage, an optimized receptive field module is added, wherein the receptive field module includes a first type of receptive field module and a second type of receptive field module; The upsampled output of the third stage is fused with the side outputs of the first and fifth stages for image features.
7. The switch machine notch detection method according to claim 6, characterized in that: The first type of receptive field module and the second type of receptive field module include: The first type of receptive field module includes five parallel branches of convolution, a bottleneck structure consisting of 1×1 convolution layers is used in the first to fourth branches, and the fifth branch is a residual structure; The second type of receptive field module includes four parallel convolution branches.
8. A switch gap detection system, characterized in that: include: A data acquisition and processing module, used for acquiring a target first gap image and performing a first preprocessing on the first gap image, wherein the first gap image at least includes a target switch machine gap image; A model building module, used for pre-training a first detection model, and using the first pre-processed first notch image as an input of the first detection model; The detection module is used to obtain the output of the first detection model and complete the switch gap detection according to the output.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.