A moving target anomaly detection method based on image super-resolution reconstruction
Through the combination of image super-resolution reconstruction and anomaly detection network, the problem of underground coal mine image data quality is solved and higher anomaly detection accuracy and robustness are achieved.
Patent Information
- Application Number
- CN202410614161.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-17
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-05-17
AI Technical Summary
The harsh working environment in coal mines leads to the loss of collected image information, more noise, and low data quality, which affects the accuracy of anomaly detection.
The moving target anomaly detection method uses fused image super-resolution reconstruction to enhance the image resolution through the image super-resolution reconstruction network. Combined with the anomaly detection network, feature extraction and difference map data are used to determine the abnormal area and improve the robustness and accuracy of detection. .
It reduces image noise interference, improves the accuracy and reliability of anomaly detection, and enhances the positioning accuracy of abnormal areas.
Smart Images

Figure CN118212696B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer vision technology, and in particular to a method for detecting abnormal motion targets using fused image super-resolution reconstruction. Background Art
[0002] Due to the harsh working environment in coal mines, production operations are usually faced with various potential risks. Therefore, in order to ensure the safety of workers and enterprise production activities, the detection of abnormal conditions underground becomes crucial. However, the underground environment usually leads to problems such as loss of collected image information, high noise, and low image data quality, which in turn affects the accuracy of detection.
[0003] Therefore, there is an urgent need for a moving target anomaly detection method that can enhance the resolution of the detection image. Summary of the invention
[0004] The present application aims to solve one of the technical problems in the related art at least to some extent.
[0005] To this end, the purpose of this application is to propose a moving target anomaly detection method that integrates image super-resolution reconstruction, which can reduce the interference of noise in the image, improve the robustness of anomaly detection, and improve the accuracy of anomaly detection.
[0006] To achieve the above-mentioned purpose, the method for detecting abnormal motion targets by super-resolution reconstruction of fused images proposed in the first aspect of the present application includes:
[0007] Acquire first image data to be detected;
[0008] Inputting the first image data into a pre-constructed image super-resolution reconstruction network to obtain second image data with enhanced resolution;
[0009] Performing feature extraction on the second image data to obtain first feature map data corresponding to the second image data;
[0010] Determining first difference graph data between the first feature graph data and reference feature graph data;
[0011] An abnormal area corresponding to the first image data is determined according to the first differential image data and the first feature image data.
[0012] To achieve the above-mentioned purpose, the training method of the anomaly detection network proposed in the second aspect of the present application includes:
[0013] Acquire a training data set, wherein the training data set includes training samples and labeling information of actual abnormal areas corresponding to each training sample;
[0014] Inputting the training sample into an initial anomaly detection network to obtain an anomaly prediction region corresponding to the training sample output by the initial anomaly detection network;
[0015] Determine a first difference and a second difference between the abnormal prediction region and the annotation information, wherein the first difference and the second difference are obtained based on different loss functions;
[0016] Determining a target loss function based on the first difference and the second difference;
[0017] Based on the target loss function, the initial anomaly detection network is modified until an anomaly detection network is obtained.
[0018] The method for detecting abnormal motion targets by super-resolution reconstruction of fused images provided in this application has the following beneficial effects:
[0019] In the present application, the resolution of the image to be detected is improved by fusing an image super-resolution reconstruction network, the interference of noise in the image is reduced, the robustness of anomaly detection is improved, and conditions are provided for improving the accuracy of anomaly detection. In addition, the abnormal area in the image to be detected is determined by differential data between the features of the image to be detected and the reference image, thereby improving the accuracy and reliability of anomaly detection.
[0020] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0022] Figure 1 A schematic diagram of a flow chart of a method for detecting abnormal motion targets by super-resolution reconstruction of fused images provided in an embodiment of the present application;
[0023] Figure 2 A schematic diagram of the structure of an image super-resolution reconstruction network provided in an embodiment of the present application;
[0024] Figure 3 A schematic diagram of a flow chart of another method for detecting abnormal motion targets by super-resolution reconstruction of fused images provided in an embodiment of the present application;
[0025] Figure 4 A schematic diagram of a flow chart of another method for detecting abnormal motion targets by super-resolution reconstruction of fused images provided in an embodiment of the present application;
[0026] Figure 5A schematic diagram of a flow chart of another method for detecting abnormal motion targets by super-resolution reconstruction of fused images provided in an embodiment of the present application;
[0027] Figure 6 A schematic diagram of the structure of a multi-scale residual block provided in an embodiment of the present application;
[0028] Figure 7 A flowchart of a method for training an anomaly detection network provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] Embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0030] The following describes the moving target anomaly detection method based on super-resolution reconstruction of fused images in an embodiment of the present application with reference to the accompanying drawings.
[0031] Figure 1 A flowchart of a method for detecting anomalies of moving targets by super-resolution reconstruction of fused images provided in an embodiment of the present application.
[0032] The moving target anomaly detection method of the fused image super-resolution reconstruction in the embodiment of the present application is jointly implemented by the image super-resolution reconstruction network and the anomaly detection network provided in the embodiment of the present application.
[0033] like Figure 1 As shown, the moving target anomaly detection method of the fused image super-resolution reconstruction includes:
[0034] Step 101: Acquire first image data to be detected.
[0035] It should be noted that the first image data may be a single image or multiple images collected in real time, or may be an image to be detected input by a user, etc., and the present disclosure does not limit this.
[0036] Step 102: input the first image data into a pre-constructed image super-resolution reconstruction network to obtain second image data with enhanced resolution.
[0037] In this application, the pre-constructed image super-resolution reconstruction network is built based on a multi-layer U-Net network architecture, which may include a two-level back-projection structure, a three-level back-projection structure, and a residual projection attention module.
[0038] It should be noted that the structure of the image super-resolution reconstruction network in this application can be as follows: Figure 2 As shown, Figure 2 is a schematic diagram of the structure of an image super-resolution reconstruction network provided in an embodiment of the present application. Figure 2 It can be seen that in the two-level back-projection structure and the three-level back-projection structure, each level can contain two corresponding residual projection attention modules, namely the Residual Down-projection Attention Module (RDAM) and the Residual Up-projection Attention Module (RUAM), to keep the feature map size constant in the feature map channel expansion path.
[0039] In the two-stage back-projection structure, two residual down-projection attention modules can be used to perform down-sampling in sequence to extract feature maps corresponding to the first image data that contain different depth information (such as color, texture or shape, etc.). And each time a residual down-projection attention module is used for down-sampling, the number of feature channels in the image can be doubled, so that the next-stage residual down-projection attention module can sample deeper feature information. For example, two residual down-projection attention modules can increase the channel dimension from 64 dimensions to 128 dimensions, and then to 256 dimensions. Then, two residual up-projection attention modules can be used to perform up-sampling in sequence to gradually restore the channel dimension in the image, and the feature maps extracted during down-sampling are fused through the jump connections in each stage, and feature mapping cascade is performed to obtain image data with the same channel dimension as the first image data, but with clearer feature information.
[0040] Similarly, in the three-level back-projection structure, three residual down-projection attention modules can be used to perform down-sampling in sequence, and the channel dimension in the image can be increased to extract feature maps corresponding to the first image data containing different depth information (such as color, texture or shape, etc.). For example, three residual down-projection attention modules can increase the channel dimension from 64 dimensions to 128 dimensions, then to 256 dimensions, and finally to 512 dimensions. Then, up-sampling is performed in sequence through three residual up-projection attention modules to gradually restore the channel dimension in the image, and the feature maps extracted during down-sampling are fused through the jump connections in each level, and feature mapping cascade is performed to obtain image data with the same channel dimension as the first image data, but with further increased feature information.
[0041] In an embodiment of the present application, after obtaining the image data output by the two-level back-projection structure and the three-level back-projection structure respectively, the results of the two back-projection structures with different levels can be fused, so that the features of different depths in the first image data can be extracted while ensuring that the channel dimension and size of the first image data remain unchanged, so as to improve the resolution of the first image data and obtain the second image data with enhanced resolution.
[0042] Optionally, before the first image data is input into the image super-resolution reconstruction network, the first image data may be pre-processed by edge fusion to enhance the edge signal in the first image data, so as to make the boundary line of the object in the first image data clearer, and provide more accurate data for feature extraction and image resolution enhancement. Therefore, the edge image data corresponding to the first image data may be extracted first, and then the edge image data may be superimposed with the first image data to obtain the first image data with enhanced edge signal.
[0043] In an embodiment of the present application, the first image data may be downsampled twice to filter out details in the first image data and highlight the edges. Then, the Sobel operator may be used to extract the edge signal of the first image data from the area where the pixel value in the downsampled first image data transitions by locating the gradient value greater than the neighboring pixels, thereby obtaining edge image data corresponding to the first image data. The edge image data may then be upsampled twice using a bilinear interpolation method, and then linearly superimposed with the first image data to obtain the first image data with enhanced edge signals. After that, the first image data with enhanced edge signals may be input into the image super-resolution reconstruction network to enhance the image resolution.
[0044] In the embodiment of the present application, after obtaining the second image data with enhanced resolution, the second image data can be input into an anomaly detection network for anomaly detection to determine the abnormal area in the image data.
[0045] Step 103: extract features from the second image data to obtain first feature map data corresponding to the second image data.
[0046] In an embodiment of the present application, after the second image data is input into the anomaly detection network, the convolution block in the anomaly detection network can be used to extract features of the second image data to obtain first feature map data corresponding to the second image data.
[0047] It should be noted that in the present disclosure, the anomaly detection network may include multiple convolution blocks of different layers, and feature maps of different resolutions may be obtained through multiple convolution blocks, such as feature map data with resolutions of 64×64×64, 128×32×32, and 256×16×16. Thus, feature information of different scales and levels in the second image data may be obtained, so that the image content can be understood and analyzed more comprehensively and accurately, and the detection performance and effect can be improved.
[0048] Step 104: determine first differential graph data between the first feature graph data and the reference feature graph data.
[0049] The reference feature map data refers to the data obtained after feature extraction of reference samples that do not contain abnormal situations. It can be pre-stored in the memory pool of the anomaly detection network, and then can be directly called in the memory pool when performing anomaly detection.
[0050] The first differential image data refers to differential information between the first feature image data and the most similar reference feature image data.
[0051] In the embodiment of the present application, the shape, texture, color and other information contained in the reference sample can be extracted in advance using a pre-trained residual network and stored as reference feature map data. Then, after obtaining the first feature map data corresponding to the second image data, the reference feature map data in the memory pool can be used to match the first feature map data, calculate the Euclidean distance between the first feature map data and each reference feature map data, and obtain the difference map data between the two feature map data to determine the difference and change between each pixel in the first feature map data and the normal state.
[0052] In the present application, the difference map data set between the first feature map data and the reference feature map data can be expressed as follows (1):
[0053] (1)
[0054] Among them, DI represents differential image data, MI represents reference feature image data, II represents first feature image data, and N is the number of reference feature image data for feature matching with the first feature image data.
[0055] It should be noted that when N is greater than 1, for N differential map data, the minimum value of the sum of all elements in each differential map data can be calculated to determine the best differential map data between the first feature map data and all reference feature map data. Because the elements in the differential map data are the differences between the pixels at the same position of the first feature map data and each reference feature map data, when the sum of all elements in the differential map data is the smallest, the corresponding reference feature map data is most similar to the first feature map data, and the differential map data determined based on the reference feature map data is most consistent with the abnormal situation in the first feature map data, and can be determined as the first differential map data between the first feature map data and the reference feature map data. The first differential map data can be expressed by the following formula (2):
[0056] (2)
[0057] Among them, the value range of i is [1, N], x represents the value of each element in the differential map data, and the larger the difference between the pixels at each position in the differential map data, the higher the abnormal probability of the area corresponding to the position in the first feature map data.
[0058] Step 105: Determine an abnormal area corresponding to the first image data according to the first differential image data and the first characteristic image data.
[0059] In the embodiment of the present application, the abnormal prediction probability of each area in the first feature map data can be determined by comparing the difference values corresponding to each element in the first differential map data, thereby determining the abnormal area in the first image data.
[0060] Optionally, the first differential image data and the first feature image data may be concatenated to obtain second feature image data, and then an abnormality prediction image corresponding to the first image data may be generated based on the second feature image data, wherein the abnormal area corresponding to the first image data is marked in the abnormality prediction image.
[0061] In the embodiment of the present application, the first differential image data and the first feature image data can be spliced in series to obtain the second feature image data, so that feature embedding can be achieved, and the differential information of each pixel in the first image data can be matched with the feature information, so as to have a higher precision positioning effect on the abnormal area of the moving target. Then the second feature image data can be input into the decoder for decoding to generate an abnormal prediction image containing the abnormal area corresponding to the marked first image data.
[0062] It should be noted that, according to actual application needs, the abnormal area in the abnormal prediction image can be marked by filling with special colors or thickening the border, etc., and the present disclosure does not limit this.
[0063] Optionally, the difference corresponding to each pixel point in the second feature map data in the first differential map data can be determined first, and then the similarity corresponding to each pixel point can be determined based on the difference, and then the abnormal area corresponding to the first image data can be determined based on the similarity and a preset similarity threshold, so as to generate an abnormal prediction image corresponding to the first image data.
[0064] Among them, the preset similarity threshold can be determined according to actual needs, and the present disclosure does not limit this.
[0065] It should be noted that the larger the difference, the lower the similarity between the corresponding pixel and the normal state. When the similarity is lower, the probability of abnormality at the position corresponding to the pixel is higher, and the more likely it is the abnormal area corresponding to the first image data. Therefore, one or more abnormal areas corresponding to the first image data can be determined based on all adjacent pixels whose corresponding similarities are less than the similarity threshold, and then marked at the corresponding positions of the first image data to obtain the abnormal prediction image corresponding to the first image data.
[0066] In the present application, firstly, the first image data to be detected is obtained, and the first image data is input into a pre-constructed image super-resolution reconstruction network to obtain the second image data after resolution enhancement, and then the second image data is subjected to feature extraction to obtain the first feature map data corresponding to the second image data, and then the first difference map data between the first feature map data and the reference feature map data is determined, and then the abnormal area in the first image data is determined according to the first difference map data and the first feature map data. Thus, by fusing the image super-resolution reconstruction network to improve the resolution of the image to be detected, the interference of noise in the image during abnormality detection can be greatly reduced, the robustness of abnormality detection is improved, and conditions are provided for improving the accuracy of abnormality detection, and the abnormal area in the image to be detected is determined by the difference data between the features of the image to be detected and the reference image, thereby improving the accuracy and reliability of abnormality detection and positioning in the image.
[0067] Figure 3 A flowchart of another method for detecting anomalies of moving targets by super-resolution reconstruction of fused images provided in an embodiment of the present application.
[0068] like Figure 3 As shown, the moving target anomaly detection method of the fused image super-resolution reconstruction includes:
[0069] Step 301: Acquire first image data to be detected.
[0070] Step 302: input the first image data into a pre-constructed image super-resolution reconstruction network to obtain second image data with enhanced resolution.
[0071] Step 303: extract features from the second image data to obtain first feature map data corresponding to the second image data.
[0072] Step 304: determine first differential graph data between the first feature graph data and the reference feature graph data.
[0073] Step 305: concatenate the first differential map data with the first feature map data to obtain second feature map data.
[0074] In the present application, the specific implementation process of steps 301 to 305 can be found in the detailed description of any embodiment of the present application and will not be repeated here.
[0075] Step 306: pool the second feature map data to obtain channel attention features and spatial attention features corresponding to the second feature map data.
[0076] In the embodiment of the present application, the second feature map data can be input into the hybrid attention module for pooling processing. First, the second feature map data is average pooled and max pooled on a one-dimensional channel to obtain and , where CI represents the second feature map data. Then and Input into a shared weight multilayer perceptron network (MLP, Multilayer Perceptron), and introduce the dimension reduction coefficient r to reduce the amount of calculation, then the output channel attention feature can be calculated as follows (3) :
[0077] (3)
[0078] in, Represents the Sigmoid function.
[0079] Then, the second feature map data can be average pooled and max pooled on the two-dimensional channel to obtain a two-dimensional feature map , .Will and The two two-dimensional feature maps are concatenated and the Sigmoid activation function is used to obtain a two-dimensional spatial attention map, that is, the weight value of each feature point in the second feature map data (the value is 0-1).
[0080] Finally, the weight value can be weighted channel by channel by multiplication to the feature layer of the second feature map data input, and the spatial attention feature is obtained by the following formula (4):
[0081] (4)
[0082] in, Represents a 7×7 convolution kernel, because when extracting spatial attention, the convolution kernel must be large enough to have stronger global perception capabilities.
[0083] Step 307: Update the second feature map data based on the second feature map data, the channel attention features, and the spatial attention features.
[0084] In the embodiment of the present application, the updated second feature map data is calculated based on the second feature map data, the channel attention feature and the spatial attention feature, which can be shown in the following formula (5):
[0085] (5)
[0086] in, Represents element-wise multiplication, and can use broadcasting mechanism for dimension transformation and matching.
[0087] Step 308: Generate an abnormality prediction image corresponding to the first image data according to the updated second feature map data.
[0088] In the present application, the specific implementation process of step 308 can be found in the detailed description of any embodiment of the present application and will not be repeated here.
[0089] In the present application, after the first differential map data and the first feature map data are concatenated to obtain the second feature map data, the second feature map data is pooled to obtain the channel attention features and spatial attention features corresponding to the second feature map data, and then the second feature map data is updated based on the second feature map data, the channel attention features and the spatial attention features. Thus, by combining the hybrid attention module to perform pooling on the feature map data, the effects of the features corresponding to the image to be detected in the two dimensions of channel attention and spatial attention are enhanced, so that the network can better utilize the data in the feature map, further improving the performance and accuracy of anomaly detection.
[0090] Figure 4 A flowchart of another method for detecting anomalies of moving targets by super-resolution reconstruction of fused images provided in an embodiment of the present application.
[0091] like Figure 4 As shown, the moving target anomaly detection method of the fused image super-resolution reconstruction includes:
[0092] Step 401: Acquire first image data to be detected.
[0093] Step 402: input the first image data into a pre-constructed image super-resolution reconstruction network to obtain second image data with enhanced resolution.
[0094] In the present application, the specific implementation process of step 401-step 402 can be found in the detailed description of any embodiment of the present application, and will not be repeated here.
[0095] Step 403: extract features from the second image data to obtain a plurality of first feature map data corresponding to the second image data.
[0096] In the embodiment of the present application, when the anomaly detection network includes multiple convolution blocks of different layers, the second image data can be downsampled by multiple convolution blocks to obtain first feature map data of multiple different dimensions corresponding to the second image data, for example, the multiple dimensions can be 64×64×64, 128×32×32, and 256×16×16, etc. Therefore, more abundant feature information in the image data to be detected can be determined from different dimensions, and the image content can be understood and analyzed more comprehensively, further improving the accuracy of anomaly detection.
[0097] Step 404: Obtain N reference feature map data in a dimension corresponding to any first feature map data.
[0098] Among them, N is a positive integer, which can be the number of all reference feature map data of the same dimension stored in the memory pool, or it can be the matching number of reference feature map data determined according to actual application needs, etc., and the present disclosure does not limit this.
[0099] It should be noted that when extracting reference feature map data for a reference sample, features of different dimensions can also be extracted through residual blocks of different sizes in the pre-trained residual network. In other words, one reference sample can also correspond to reference feature map data of multiple different dimensions.
[0100] In the embodiment of the present application, when performing feature matching, it is necessary to ensure that the dimensions of the two feature map data are the same, otherwise it is impossible to compare the feature points at the corresponding positions and calculate the difference. Therefore, after obtaining multiple first feature map data corresponding to the second image data, the reference feature map data of the same dimension can be determined and obtained in the memory pool according to the dimension of any first feature map data to perform feature matching.
[0101] Step 405 , matching any first feature map data with N reference feature map data respectively to obtain N second difference map data.
[0102] In an embodiment of the present application, the Euclidean distance between each first feature map data and each corresponding reference feature map data can be calculated to obtain N second differential map data to determine the difference and change of each pixel point in the first feature map data compared with the normal situation.
[0103] In the present application, a set of N second difference map data between the first feature map data and the N reference feature map data can be expressed as the following formula (6):
[0104] (6)
[0105] Among them, DI represents the second differential map data, MI represents the reference feature map data, and II represents the first feature map data.
[0106] Step 406: Determine the sum of all elements in each second differential map data.
[0107] The element in the second differential image data refers to the difference value corresponding to each pixel point in the second differential image data.
[0108] In the embodiment of the present application, the sum of all elements in each second differential image data may be obtained by adding the values of the elements in each second differential image data.
[0109] Step 407: determine the corresponding element and the smallest second differential graph data as the first differential graph data corresponding to any first feature graph data.
[0110] In the embodiment of the present application, the sum of all elements in each second differential map data can be compared. When the sum of all elements in any second differential map data is the smallest, the corresponding reference feature map data is most similar to the first feature map data. Therefore, the second differential map data determined based on the reference feature map data is most consistent with the abnormal situation in the first feature map data and can be determined as the first differential map data corresponding to any first feature map data. The first differential map data can be expressed by the following formula (7):
[0111] (7)
[0112] Among them, the value range of i is [1, N], x represents the value of each element in the second differential map data, and the larger the difference between the pixels at each position in the differential map data, the higher the abnormal probability of the area corresponding to the position in the first feature map data.
[0113] Step 408 : concatenate the first difference map data and the first feature map data of the same dimension to obtain a plurality of second feature map data.
[0114] In an embodiment of the present application, after determining the first differential information between each first feature map data and the reference feature map data of the same dimension, each first feature map data and its corresponding first differential map data can be concatenated to complete the splicing, thereby obtaining multiple second feature map data.
[0115] It should be noted that after obtaining multiple second feature map data, the multiple second feature map data can be input into the hybrid attention module in sequence to perform pooling processing on them respectively to obtain multiple updated second feature map data. The pooling process of each second feature image data is the same, and the detailed description of step 306 and step 307 in the above embodiment can be referred to, which will not be repeated here.
[0116] Step 409: Generate an abnormality prediction image corresponding to the first image data according to the plurality of second feature map data.
[0117] In an embodiment of the present application, multiple second feature map data can be input into the decoder together for fusion and decoding, and an abnormal prediction image corresponding to the first image data can be output.
[0118] It should be noted that the abnormal area marked in the abnormal prediction image can be determined by fusing the difference values of multiple first differential image data, determining the similarity corresponding to each pixel point based on the fused value, and then determining the abnormal area based on the size between the similarity and the similarity threshold.
[0119] In this application, feature map data of different dimensions are extracted from the image to be detected, and then differential information is determined based on the feature map data of each dimension to generate an abnormality prediction image and determine the abnormal area corresponding to the image to be detected, so as to more comprehensively understand and analyze the image content and further improve the accuracy and performance of abnormality detection.
[0120] Figure 5 A flowchart of another method for detecting anomalies of moving targets by super-resolution reconstruction of fused images provided in an embodiment of the present application.
[0121] like Figure 5 As shown, the moving target anomaly detection method of the fused image super-resolution reconstruction includes:
[0122] Step 501: Acquire first image data to be detected.
[0123] In the present application, the specific implementation process of step 501 can be found in the detailed description of any embodiment of the present application and will not be repeated here.
[0124] Combine the following Figure 2 The structural schematic diagram of the image super-resolution reconstruction network shown in the figure illustrates the process of how the image super-resolution reconstruction network processes the first image data to obtain the second image data with enhanced resolution.
[0125] Step 502: input the first image data into a pre-constructed image super-resolution reconstruction network to obtain third feature map data output by the projection attention module at each level of residual in the image super-resolution reconstruction network.
[0126] In the embodiment of the present application, the first-level residual projection attention module in the image super-resolution reconstruction network can perform feature extraction on the first image data to obtain the third feature map data output by the first-level residual projection attention module. When the number of layers N included in the image super-resolution reconstruction network is greater than or equal to 2, the third feature map data output by the i-1-th level residual projection attention module can be input into the i-th level residual projection attention module for feature extraction to obtain the third feature map data output by the i-th level residual projection attention module. Wherein, the value of i is 2, ..., N.
[0127] In this application, the residual down-projection attention module and the residual up-projection attention module at each level are composed of multi-scale residual blocks, projection and attention blocks.
[0128] Among them, the projection and attention blocks jointly complete the channel dimension operation, which is used to increase or decrease the channel dimension in the downsampling process or upsampling process of the back-projection structure. The multi-scale residual block can fuse different levels of features to restore the details of the input image. The structure of the multi-scale residual block can be as follows Figure 6 shown.
[0129] It should be noted that the number and size of convolutional layers in each layer of the multi-scale residual block can be adjusted according to the needs of different tasks. Figure 6 The 3×3, 5×5, and 7×7 convolutional layers shown in the figure are only exemplary and are optimal structures designed through experimental adjustments and should not be construed as limiting the present application.
[0130] In the embodiment of the present application, the multi-scale residual block can perform feature extraction at different levels on the input feature map data in the first layer, and its formula can be shown as follows (8), (9) and (10):
[0131] (8)
[0132] (9)
[0133] (10)
[0134] Among them, X represents the image data input into the residual projection attention module. Represents the weight of the convolutional layer, which can be determined according to actual needs. Represents the bias of the convolutional layer. and The superscript indicates the number of layers, and the subscript indicates the kernel size of the convolutional layer. Represents the Rectified Linear Unit (ReLU) function.
[0135] Then, the channels can be compressed along the channel dimension using a convolutional layer with a kernel size of 1×1 to make the number of channels consistent with the number of channels of the input feature map data. Figure 6 As shown in Figure 1, adding short skip connections to each layer of the multi-scale residual block and fusing the input and output of this layer can alleviate the gradient vanishing problem, improve the network's expressiveness and performance, bypass a large amount of low-frequency information, and recover more useful information. The output of the first layer can be shown in the following formula (11):
[0136] (11)
[0137] The second layer of the multi-scale residual block is then used for feature extraction. Figure 6 It can be seen that the second layer structure is similar to the first layer structure, so the corresponding calculation formula can be shown as follows (12), (13), (14) and (15):
[0138] (12)
[0139] (13)
[0140] (14)
[0141] (15)
[0142] Then, in the second layer, after compressing the channel using a convolutional layer with a kernel size of 1×1, the compressed channel features can be fused using a 3×3 convolutional layer to retain the feature dimension information while capturing more spatial information. In addition, long skip connections can be used to fuse the original input data of the multi-scale residual block, which helps the network capture richer and more comprehensive context information, improve the feature representation capability of the input data, and recover more useful information. The output of the second layer can be shown as follows (16):
[0143] (16)
[0144] Step 503: input the third feature map data output by the N-th level residual down-projection attention module into the N-th level residual up-projection attention module to obtain the fourth feature map data output by the N-th level residual up-projection attention module.
[0145] Where N is the number of layers of the residual network contained in the image super-resolution reconstruction network.
[0146] In an embodiment of the present application, after obtaining the third feature map data output by the projection attention module under the Nth level residual, the extracted third feature map data can be upsampled to restore the size of the image data to obtain resolution-enhanced image data.
[0147] Depend on Figure 2 It can be seen that the third feature map data output by the N-th level residual down-projection attention module can be directly input into the N-th level residual up-projection attention module, and processed by the N-th level residual up-projection attention module to reduce the channel dimension in the feature map data, and obtain the fourth feature map data output by the N-th level residual up-projection attention module.
[0148] Step 504, input the third feature map data output by the N-1th level residual down-projection attention module and the fourth feature map data output by the N-1th level residual up-projection attention module into the N-1th level residual up-projection attention module to obtain the fourth feature map data output by the N-1th level residual up-projection attention module, and repeat the operation of obtaining the fourth feature map data until the fourth feature map data output by the 1st level residual up-projection attention module is obtained.
[0149] Depend on Figure 2It can be seen that the residual down-projection attention module and the residual up-projection attention module at the same level can be connected through a jump connection, and the third feature map data output by the residual down-projection attention module can be input into the residual up-projection attention module for feature fusion, which can compensate for the image information lost in the downsampling process and reduce the loss of image information in the continuous convolution process.
[0150] Step 505: The third feature map data output by the first-level residual up-projection attention module and the fourth feature map data output by the first-level residual up-projection attention module are fused to obtain second image data.
[0151] It should be noted that if Figure 2 The image super-resolution reconstruction network shown can include multiple layers of back-projection structures, that is, the value of N can be either 2 or 3. Therefore, when the value of N is 2 or 3, the above steps can be taken to process the first image data respectively to obtain the third feature map data output by the first-level residual up-projection attention module and the fourth feature map data output by the first-level residual up-projection attention module corresponding to each back-projection structure. Figure 2 It can be seen that the two-level back-projection structure and the three-level back-projection structure can share the first-level residual up-projection attention module. Therefore, when the feature map data is finally fused, the third feature map data output by the first-level residual up-projection attention module can be fused with the fourth feature map data output by the two first-level residual up-projection attention modules to obtain the second image data.
[0152] Step 506: extract features from the second image data to obtain first feature map data corresponding to the second image data.
[0153] Step 507: determine first differential graph data between the first feature graph data and the reference feature graph data.
[0154] Step 508: Determine the abnormal area corresponding to the first image data according to the first differential image data and the first feature image data.
[0155] In the present application, the specific implementation process of steps 506 to 508 can be found in the detailed description of any embodiment of the present application and will not be repeated here.
[0156] In this application, by using a residual projection attention module containing multi-scale residual blocks in the image super-resolution reconstruction network, the acquisition of image features of different scales can be ensured. At the same time, in the feature channel, the circulation ability of low-frequency and high-frequency details is improved, thereby better improving the super-resolution reconstruction effect of the network.
[0157] Figure 7 A flowchart of a method for training an anomaly detection network provided in an embodiment of the present application.
[0158] like Figure 7 As shown, the training method of the anomaly detection network includes:
[0159] Step 701, obtaining a training data set.
[0160] The training data set includes training samples and annotation information of the actual abnormal area corresponding to each training sample.
[0161] Step 702: input the training sample into the initial anomaly detection network to obtain the anomaly prediction region corresponding to the training sample output by the initial anomaly detection network.
[0162] It should be noted that in order to facilitate the initial anomaly detection network to perform anomaly detection on the training samples, the training samples can be processed after obtaining the training data set and converted into the form of N*H*W*C. Among them, N is the number of training samples input into the anomaly detection network each time. Because the number of training samples in the training data set may be too large, the anomaly detection network cannot detect too many samples at the same time, so they can be input in batches. H and W are the height and width of the image respectively, and C is the number of channels.
[0163] In an embodiment of the present application, one or more training samples may be input into an initial anomaly detection network for anomaly detection to obtain an anomaly prediction region corresponding to each training sample output by the initial anomaly detection network.
[0164] Step 703: Determine a first difference and a second difference between the abnormal prediction region and the annotation information.
[0165] The first difference and the second difference are obtained based on different loss functions.
[0166] In the embodiment of the present disclosure, in order to facilitate the calculation of the loss between the abnormal prediction area and the annotation information, the annotation information can be converted into the form of N*1, where N represents the number of annotation information in each training, which is the same as the number of training samples, 1 represents the true label, and 0 or 1 can be used to distinguish whether the category of the corresponding training sample is normal or abnormal.
[0167] It should be noted that, in the present application, the first difference and the second difference between the abnormal prediction area and the annotation information can be calculated using the L1 norm loss function and the Focal loss function respectively.
[0168] Among them, the first difference It is calculated by the L1 norm loss function and is the mean absolute error. It is more sensitive to the larger error between the abnormal prediction area and the annotation information, and can be more robust to data sets with outliers or abnormal values. Its calculation formula is shown in the following formula (17):
[0169] (17)
[0170] In addition, the second difference It is calculated by the Focal loss function. A coefficient factor can be added on the basis of the standard cross entropy loss. Its calculation formula can be shown in the following equations (18) and (19):
[0171] (18)
[0172] (19)
[0173] Among them, the value of y is 0 or 1 to represent different categories. represents the predicted probability of the true category of the sample, is a hyperparameter for adjusting the weight factor.
[0174] It is understandable that for the second difference ,When the difference is smaller, it means the prediction is more accurate, and the loss weight is reduced. On the contrary, the loss weight is increased, and the larger γ is, the greater the adjustment strength.
[0175] Step 704: determine a target loss function based on the first difference and the second difference.
[0176] In an embodiment of the present application, the first difference and the second difference may be fused to determine a target loss function to quantitatively evaluate the prediction results output by the anomaly detection network.
[0177] Optionally, a first weight corresponding to the first difference and a second weight corresponding to the second difference may be determined first, and then the first difference and the second difference may be fused based on the first weight and the second weight to obtain a target loss function.
[0178] It should be noted that the first weight corresponding to the first difference and the second weight corresponding to the second difference can be adjusted and determined through experience, and the present disclosure does not limit this. The values of the first weight and the second weight do not exceed 1.
[0179] In the embodiment of the present application, the calculation formula of the target loss function can be shown as follows (20):
[0180] (20)
[0181] in, represents the first weight, Represents the second weight.
[0182] Step 705: based on the target loss function, the initial anomaly detection network is modified until an anomaly detection network is obtained.
[0183] In an embodiment of the present application, the parameters in the initial anomaly detection network can be adjusted according to the target loss function using gradient descent or other methods to minimize the result of calculating the target loss function, thereby completing the training process of the anomaly detection network and obtaining the optimal anomaly detection network for actual anomaly detection.
[0184] In the present application, a training data set is first obtained, and the training samples are input into the initial anomaly detection network to obtain the anomaly prediction area corresponding to the training samples output by the initial anomaly detection network. Then the first difference and the second difference between the anomaly prediction area and the annotation information are determined, and the target loss function is determined based on the first difference and the second difference. Thereafter, the initial anomaly detection network is corrected based on the target loss function until the anomaly detection network is obtained. Thus, by combining the difference values calculated by the two loss functions, the initial anomaly detection network is trained, so that the anomaly detection network can better capture the difference between abnormal data and normal data, thereby improving the accuracy and robustness of anomaly detection.
[0185] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0186] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0187] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A method for detecting abnormal motion targets by fusion image super-resolution reconstruction, characterized in that: The method comprises: Acquire first image data to be detected; extracting edge image data corresponding to the first image data; Superimposing the edge image data with the first image data to obtain the first image data after edge signal enhancement; Inputting the first image data into a pre-constructed image super-resolution reconstruction network to obtain second image data after resolution enhancement, wherein the pre-constructed image super-resolution reconstruction network is built based on a multi-layer U-Net network architecture, including a two-level back-projection structure, a three-level back-projection structure, and a residual projection attention module; Performing feature extraction on the second image data to obtain first feature map data corresponding to the second image data; Determine first differential graph data between the first feature graph data and reference feature graph data, wherein the reference feature graph data is data obtained after feature extraction of a reference sample that does not contain abnormal conditions, and the first differential graph data is differential information between the first feature graph data and the reference feature graph data that is most similar to the first feature graph data; Determine an abnormal area corresponding to the first image data according to the first difference image data and the first feature image data; Wherein, determining the abnormal area corresponding to the first image data according to the first differential image data and the first feature image data includes: splicing the first difference map data with the first feature map data to obtain second feature map data; generating an abnormality prediction image corresponding to the first image data according to the second feature map data, wherein the abnormal area in the first image data is marked in the abnormality prediction image; The step of inputting the first image data into a pre-constructed image super-resolution reconstruction network to obtain second image data with enhanced resolution includes: Inputting the first image data into a pre-constructed image super-resolution reconstruction network to obtain third feature map data output by the projection attention module at each level of residual in the image super-resolution reconstruction network; Inputting the third feature map data output by the N-th level residual down-projection attention module into the N-th level residual up-projection attention module to obtain the fourth feature map data output by the N-th level residual up-projection attention module, wherein N is the number of layers of the residual network included in the image super-resolution reconstruction network; Inputting the third feature map data output by the N-1th level residual down-projection attention module and the fourth feature map data output by the N-1th level residual up-projection attention module into the N-1th level residual up-projection attention module to obtain the fourth feature map data output by the N-1th level residual up-projection attention module, and repeatedly performing the operation of obtaining the fourth feature map data until the fourth feature map data output by the 1st level residual up-projection attention module is obtained; The third feature map data output by the first-level residual down-projection attention module and the fourth feature map data output by the first-level residual up-projection attention module are fused to obtain the second image data.
2. The method according to claim 1, characterized in that The step of generating an abnormality prediction image corresponding to the first image data according to the second feature map data includes: Determine a difference value corresponding to each pixel in the second feature map data in the first difference map data; Determine the similarity corresponding to each pixel point according to the difference; According to the similarity and a preset similarity threshold, an abnormal region corresponding to the first image data is determined to generate an abnormality prediction image corresponding to the first image data.
3. The method according to claim 1, characterized in that After the first differential map data and the first feature map data are concatenated to obtain the second feature map data, the method further includes: Performing pooling processing on the second feature map data to obtain channel attention features and spatial attention features corresponding to the second feature map data; Based on the second feature map data, the channel attention features and the spatial attention features, the second feature map data is updated.
4. The method according to claim 1, characterized in that The second image data corresponds to first feature map data in multiple dimensions, and the determining of first difference map data between the first feature map data and reference feature map data includes: Obtain N reference feature map data under the dimension corresponding to any first feature map data, where N is a positive integer; Matching any of the first feature map data with the N reference feature map data respectively to obtain N second difference map data; Determine the sum of all elements in each of the second difference map data; The corresponding element and the smallest second differential image data are determined as the first differential image data corresponding to any one of the first feature image data.
5. The method according to claim 4, characterized in that The determining, according to the first differential image data and the first feature image data, an abnormal area corresponding to the first image data includes: Concatenate the first difference map data and the first feature map data of the same dimension to obtain a plurality of second feature map data; An abnormality prediction image corresponding to the first image data is generated according to the multiple second feature map data, wherein the abnormal area in the first image data is marked in the abnormality prediction image.
