Method, device and computer-readable storage medium for detecting significant objects
Through the salient target detection method, the encoding layer, feature fusion layer and decoding layer in the target segmentation network are used to extract and enhance features of the image to be detected and the optical flow image, solving the problem of object segmentation with unfixed categories and achieving high-precision Target object segmentation.
Patent Information
- Application Number
- CN202110910457.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-09
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-08-09
AI Technical Summary
It is difficult for the existing technology to effectively segment objects whose categories are not fixed in target detection, and the segmentation process is complicated and cannot improve the segmentation accuracy.
A salient target detection method is adopted to obtain the image to be detected and the optical flow image, input them into the trained target segmentation network, use the encoding layer, feature fusion layer and decoding layer to perform feature extraction and enhanced fusion, and output the target object segmentation result. , simplify the segmentation process and improve segmentation accuracy.
This method can simplify the segmentation complexity of target objects without requiring category recognition, significantly improve the segmentation accuracy of target objects, and is suitable for objects whose categories are not fixed.
Smart Images

Figure CN113724286B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of salient object segmentation, and in particular to a detection method, a detection device and a computer-readable storage medium for salient objects. Background Art
[0002] In target detection technology, images are usually segmented. Image segmentation is the technology and process of dividing an image into several specific regions with unique properties and proposing targets of interest.
[0003] In the related art, objects are usually identified by category and then segmented, which is not suitable for objects with unstable categories. Summary of the invention
[0004] The main technical problem solved by the present application is to provide a detection method, a detection device and a computer-readable storage medium for significant targets, which can simplify the complexity of segmenting the target object, eliminate the need for category identification of the target object, and improve the segmentation accuracy of the target object.
[0005] In order to solve the above problems, a technical solution adopted in the present application is to provide a method for detecting salient targets, which method includes: obtaining an image to be detected and a corresponding optical flow image; inputting the image to be detected and the optical flow image into a trained target segmentation network to output the target object segmentation result; wherein the target segmentation network includes a coding layer, a feature fusion layer and a decoding layer, and the feature fusion layer is used to enhance and fuse the features of each level extracted by the coding layer, and output them to the decoding layer.
[0006] Among them, obtaining the image to be detected and the corresponding optical flow image includes: extracting the key frame image from the image to be detected; inputting the current key frame image and the previous key frame image into the optical flow network to obtain the optical flow image corresponding to the current key frame image; inputting the image to be detected and the optical flow image into the trained target segmentation network to output the target object segmentation result, including: inputting the current key frame image and the optical flow image into the trained target segmentation network to output the target object segmentation result.
[0007] Among them, the encoding layer is divided into a first type of encoding layer and a second type of encoding layer; the current key frame image and the optical flow image are input into the trained target segmentation network to output the target object segmentation result, including: using the first type of encoding layer to extract features of the current key frame image to obtain the first feature map corresponding to each level, and input the first feature map into the attention mechanism layer; using the second type of encoding layer to extract features of the optical flow image to obtain the second feature map corresponding to each level, and input the second feature map into the attention mechanism layer; using the attention mechanism layer to extract features from the first feature map and the second feature map according to the corresponding level to obtain the third feature map corresponding to each level; inputting the third feature map corresponding to each level into the feature fusion layer for enhanced fusion to obtain the fourth feature map corresponding to each level; inputting the fourth feature map corresponding to each level into the decoding layer to obtain the target object segmentation result.
[0008] Among them, the attention mechanism layer is used to extract features from the first feature map and the second feature map according to the corresponding levels to obtain the third feature map corresponding to each level, including: using the attention mechanism layer to perform a convolution operation on the first feature map to obtain a first target feature map, and inputting the first target feature map to the next encoding layer of the first type of encoding layer; using the attention mechanism layer to perform a convolution operation on the second feature map to obtain a second target feature map, and inputting the second target feature map to the next encoding layer of the second type of encoding layer; performing feature fusion on the first target feature map and the second target feature map to obtain the third feature map.
[0009] Among them, the first feature map is convolved by using the attention mechanism layer to obtain a first target feature map, and the first target feature map is input into the next coding layer of the first type of coding layer, including: using the attention mechanism layer to convolve the first feature map to obtain the first feature map after operation; classifying the first feature map after operation to obtain the classified first feature map; classifying the second target feature map to obtain the classified second target feature map; processing the classified first feature map and the classified second target feature map to obtain a second reference feature map; using the attention mechanism to process the first feature map after operation and the second reference feature map to obtain the first target feature map; inputting the first target feature map into the next coding layer of the second type of coding layer.
[0010] Among them, the third feature maps corresponding to each level are input into the feature fusion layer for enhanced fusion to obtain the fourth feature maps corresponding to each level, including: performing ST feature enhancement, GT feature enhancement and RT feature enhancement on each third feature map to obtain multiple enhanced third reference feature maps; multiple third reference feature maps are arranged according to the size of the corresponding third feature map, and feature fusion is performed with the third feature map to obtain the fourth feature maps corresponding to each level.
[0011] Among them, each third feature map is respectively subjected to ST feature enhancement, GT feature enhancement, and RT feature enhancement to obtain multiple enhanced third reference feature maps, including: performing same-level interaction on each third feature map to obtain a third reference feature map enhanced at the same level, and the scale of the third reference feature map enhanced at the same level is the same as that of the third feature map; performing top-down interaction on each third feature map according to the level, using high-level features to enhance low-level features, and obtaining multiple top-down enhanced third reference feature maps, and the scale of the top-down enhanced third reference feature map is the same as that of the third feature map at the low level during interaction; performing bottom-up interaction on each third feature map according to the level, using low-level features to enhance high-level features, and obtaining a bottom-up enhanced third reference feature map, and the scale of the bottom-up enhanced third reference feature map is the same as that of the third feature map at the high level during interaction.
[0012] Among them, the fourth feature map corresponding to each level is input into the decoding layer to obtain the target object segmentation result, including: performing a convolution operation on the fourth feature map corresponding to each level to obtain the first fourth reference feature map after the operation; using the Nth decoding layer to upsample the Nth fourth reference feature map and the fourth feature map to obtain the N+1th fourth reference feature map; wherein N is a positive integer; using the N+1th fourth reference feature map as the target object segmentation result.
[0013] Among them, each decoding layer includes a dilated spatial convolution pooling pyramid and a convolution layer; the Nth fourth reference feature map and the fourth feature map are upsampled by the Nth decoding layer to obtain the N+1th fourth reference feature map, including: using the convolution layer to perform convolution calculation on the Nth fourth reference feature map, and performing region division on the fourth reference feature map after the convolution calculation to obtain the Nth initial reference feature map; using the dilated spatial convolution pooling pyramid to sample the Nth fourth reference feature map, and fusing the sampling result with the Nth initial reference feature map to obtain a fusion result; using the Nth decoding layer to upsample the fourth feature map to obtain an upsampled result; fusing the fusion result with the upsampled result to obtain the N+1th fourth reference feature map.
[0014] The method further includes: obtaining a training image, wherein the training image is annotated with target object information and background information; and inputting the training image into a target segmentation network to train the target segmentation network.
[0015] Among them, the training image is input into the target segmentation network to train the target segmentation network, including: inputting the training image into the target segmentation network to output the target object segmentation result; obtaining the classification error of each pixel in the training image as a first loss value; obtaining the target pixel in the training image whose confidence is lower than a preset confidence, and calculating the second loss value based on the confidence of the target pixel; obtaining the accuracy and recall rate of each pixel classification, and obtaining a first control value based on the accuracy and recall rate; obtaining the intersection-and-union ratio between the segmentation results of each pixel in the target object segmentation result, and obtaining a second control value based on the intersection-and-union ratio; using the first control value and the second control value to obtain a third loss value; using the first loss value, the second loss value and the third loss value to adjust the network parameters of the target segmentation network.
[0016] The method further includes: after the target segmentation network training is completed, pruning the target segmentation network to delete the convolution kernels in the target segmentation network that meet the preset conditions.
[0017] Among them, a pruning operation is performed on the target segmentation network, including: obtaining a target feature map corresponding to the output of each convolution kernel in each coding layer, feature fusion layer and / or each decoding layer; calculating the average rank of each target feature map to obtain a set of average ranks corresponding to each coding layer, feature fusion layer and / or each decoding layer; wherein the average ranks in the average rank set are sorted from high to low; obtaining a compression rate in each coding layer, feature fusion layer and / or each decoding layer; performing average rank filtering on each average rank set according to the corresponding compression rate, and filtering out the convolution kernel corresponding to the average rank to obtain a target segmentation network with an updated convolution kernel; and using the training image to train the target segmentation network with the updated convolution kernel again to adjust the network parameters of the target segmentation network until the segmentation accuracy of the target segmentation network meets the preset conditions.
[0018] In order to solve the above-mentioned problem, another technical solution adopted in the present application is to provide a detection device, which includes a processor and a memory coupled to the processor; wherein the memory is used to store a computer program, and the processor is used to execute the computer program to implement the method provided by the above-mentioned technical solution.
[0019] In order to solve the above problem, another technical solution adopted by the present application is to provide a computer-readable storage medium, which is used to store a computer program. When the computer program is executed by a processor, it is used to implement the method provided by the above technical solution.
[0020] The beneficial effects of the present application are as follows: Different from the prior art, the present application provides a method, a detection device and a computer-readable storage medium for detecting a significant target. The method inputs the image to be detected and the optical flow image into a trained target segmentation network, and uses the encoding layer, the feature fusion layer and the decoding layer in the target segmentation network to extract features from the image to be detected and the optical flow image to output the target object segmentation result. The features of each level extracted by the encoding layer are enhanced and fused through the feature fusion layer, so that the features of different levels fuse the low-resolution, strong semantic features with the high-resolution, weak semantic features. Then, the features output by the feature fusion layer to the decoding layer retain more information, which greatly improves the segmentation accuracy of the decoding layer when performing target object segmentation. Therefore, the detection method provided in this embodiment can simplify the segmentation complexity of the target object, without the need to classify the target object, and improve the segmentation accuracy of the target object. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0022] Figure 1 It is a flowchart of an embodiment of a method for detecting a significant target provided by the present application;
[0023] Figure 2 It is a flowchart of another embodiment of the method for detecting a significant target provided by the present application;
[0024] Figure 3 It is a flowchart of an embodiment of step 23 provided by the present application;
[0025] Figure 4 It is a flowchart of another embodiment of the method for detecting a significant target provided by the present application;
[0026] Figure 5 is a flowchart of an embodiment of step 46 provided by the present application;
[0027] Figure 6 is a flowchart of an embodiment of step 49 provided by the present application;
[0028] Figure 7 It is a flowchart of an embodiment of step 491 provided by the present application;
[0029] Figure 8 is a flowchart of an embodiment of step 50 provided by the present application;
[0030] Fig. 9 It is a flowchart of an embodiment of step 502 provided by this application;
[0031] Fig.10 It is a flowchart of another embodiment of the method for detecting a significant target provided by the present application;
[0032] Fig.11 It is a structural diagram of an embodiment of a target segmentation network provided by the present application;
[0033] Fig.12 It is a structural diagram of an embodiment of the attention mechanism layer provided by the present application;
[0034] Fig.13 It is a structural schematic diagram of an embodiment of a feature fusion layer provided by the present application;
[0035] Fig.14 It is a structural diagram of an embodiment of a decoding layer provided by the present application;
[0036] Fig.15 It is a flowchart of an embodiment of step 102 provided by the present application;
[0037] Fig.16 It is a flowchart of another embodiment of the method for detecting a significant target provided by the present application;
[0038] Fig.17 It is a structural schematic diagram of an embodiment of a detection device provided by the present application;
[0039] Fig.18 It is a structural schematic diagram of an embodiment of a computer-readable storage medium provided by the present application;
[0040] Figure 19-Figure 24 This is a schematic diagram of a scenario in which the significant target detection method provided in the present application is applied to a hanging object workshop. DETAILED DESCRIPTION
[0041] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It will be understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for ease of description, only some but not all structures related to the present application are shown in the drawings. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0042] The terms "first", "second", etc. in this application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0043] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0044] See also Figure 1 , Figure 1 1 is a flow chart of an embodiment of a method for detecting a significant target provided by the present application. The method comprises:
[0045] Step 11: Obtain the image to be detected and the corresponding optical flow image.
[0046] The image to be detected may be collected in real time by an image acquisition device, or may not be collected in real time. For example, the image collected in real time by the monitoring device installed in the production workshop can be used as the image to be detected.
[0047] The optical flow image is generated by the movement of the foreground object in the scene, the movement of the camera, or the joint movement of the two. That is, the corresponding optical flow image can be determined based on the adjacent image frames in the image to be detected.
[0048] Step 12: Input the image to be detected and the optical flow image into the trained target segmentation network to output the target object segmentation result.
[0049] Among them, the target segmentation network includes a coding layer, a feature fusion layer and a decoding layer. The feature fusion layer is used to enhance and fuse the features of each level extracted by the coding layer and output them to the decoding layer.
[0050] The target object can be a moving object or a stationary object, which can be specifically determined when training the target segmentation network.
[0051] In some embodiments, the target segmentation network may include multiple encoding layers, feature fusion layers, and multiple decoding layers. Multiple encoding layers, feature fusion layers, and multiple decoding layers are connected in a cascade manner, each encoding layer is connected to the feature fusion layer, the output of each encoding layer is used as the input of the feature fusion layer, the feature fusion layer is connected to each decoding layer, and the output of the feature fusion layer is used as the input of each decoding layer. The output of each encoding layer will be output to the next encoding layer, the output of each decoding layer will be output to the next decoding layer, and the output of the last decoding layer will be used as the target object segmentation result.
[0052] Since the scale of each coding layer is different, the extracted feature levels are different. The feature fusion layer can be used to enhance the fusion of the features of each level extracted by the coding layer, so that the features of different levels can fuse the low-resolution, strong semantic features with the high-resolution, weak semantic features. The output features retain more information and greatly improve the segmentation accuracy. The decoding layer can segment the target object more accurately when performing target object segmentation.
[0053] In the target object segmentation result, the pixels corresponding to the target object and the background information may be represented by different colors, for example, the pixels corresponding to the target object may be displayed in white, and the pixels corresponding to the background information may be displayed in black.
[0054] In this embodiment, the image to be detected and the optical flow image are input into the trained target segmentation network, and the encoding layer, feature fusion layer and decoding layer in the target segmentation network are used to extract features of the image to be detected and the optical flow image to output the target object segmentation result. The features of each level extracted by the encoding layer are enhanced and fused through the feature fusion layer, so that the features of different levels fuse the low-resolution, strong semantic features with the high-resolution, weak semantic features. Then, the features output by the feature fusion layer to the decoding layer retain more information, which greatly improves the segmentation accuracy of the decoding layer when performing target object segmentation. Therefore, the detection method provided in this embodiment can simplify the segmentation complexity of the target object, without the need to classify the target object, and improve the segmentation accuracy of the target object.
[0055] See also Figure 2 , Figure 2 FIG. 1 is a flow chart of another embodiment of a method for detecting a significant target provided by the present application. The method comprises:
[0056] Step 21: Extract key frame images from the image to be detected.
[0057] It can be understood that when the image to be detected is a video stream image, it is necessary to extract key frame images from the video stream image. Specifically, it can be set according to the parameters of the image acquisition device.
[0058] For example, the key frame images can be selected every ten frames of the image to be detected. In other embodiments, the time interval can be set according to the actual speed of the target object. For example, in a workshop where an overhead crane is used to lift objects, the speed of the overhead crane is usually within a preset range, and the time interval for extracting the key frame images can be set according to the speed of the overhead crane.
[0059] Step 22: Input the current key frame image and the previous key frame image into the optical flow network to obtain the optical flow image corresponding to the current key frame image.
[0060] The optical flow network is mainly used to capture the target object in the scene corresponding to the image to be detected, so that the target segmentation network can analyze the target object and quickly focus on accurately segmenting it from the background.
[0061] In some embodiments, the optical flow network may use PWCNet, which has higher accuracy and speed and can improve overall performance.
[0062] Step 23: Input the current key frame image and the optical flow image into the trained target segmentation network to output the target object segmentation result.
[0063] Among them, the target segmentation network includes a coding layer, a feature fusion layer and a decoding layer. The feature fusion layer is used to enhance and fuse the features of each level extracted by the coding layer and output them to the decoding layer.
[0064] The coding layer is divided into a first type of coding layer and a second type of coding layer. The first type of coding layer and the second type of coding layer can be used to extract features of the key frame image and the optical flow image respectively.
[0065] Optionally, see Figure 3 , step 23 may be as follows:
[0066] Step 231: Use the first type of encoding layer to extract features of the current key frame image, obtain the first feature map corresponding to each level, and input the first feature map into the attention mechanism layer.
[0067] Specifically, the first type of coding layer includes multiple coding layers, the first feature map output by each coding layer is used as the input of the attention mechanism layer, and the output of the attention mechanism layer is used as the input of the next coding layer in the first type of coding layer. The first type of coding layer extracts features from the key frame, and the extracted first feature map has the appearance information of the target object of the key frame image.
[0068] In other embodiments, the first encoding layer in the first type of encoding layer and the second type of encoding layer is not connected to the attention mechanism layer, but is only connected to the next encoding layer.
[0069] Since the scale of each coding layer is different, first feature maps of different scales will be formed accordingly, which are represented by different levels here.
[0070] Step 232: Use the second type of encoding layer to extract features from the optical flow image, obtain the second feature map corresponding to each level, and input the second feature map into the attention mechanism layer.
[0071] Specifically, the second type of coding layer includes multiple coding layers, and the second feature map output by each coding layer is used as the input of the attention mechanism layer, and the output of the attention mechanism layer is used as the input of the next coding layer in the second type of coding layer. The second type of coding layer extracts features from the key frames, and the extracted second feature map has the motion information of the target object in the optical flow image.
[0072] Since the scale of each coding layer is different, a second feature map of different scales will be formed accordingly, which is represented by different levels here.
[0073] In some embodiments, the number of encoding layers of the first type of encoding layer and the second type of encoding layer is the same, and the scales of the first type of encoding layer and the second type of encoding layer at the corresponding levels are the same, then the scales of the first feature map and the second feature map input to the attention mechanism layer are the same, which facilitates processing by the attention mechanism layer.
[0074] Step 233: Use the attention mechanism layer to extract features from the first feature map and the second feature map according to the corresponding levels to obtain the third feature map corresponding to each level.
[0075] In some embodiments, the number of attention mechanism layers is the same as the number of encoding layers of the first type of encoding layer, the input end of each attention mechanism layer is connected to an encoding layer of the first type of encoding layer and an encoding layer of the second type of encoding layer, and the output end of each attention mechanism layer is connected to an encoding layer of the first type of encoding layer, an encoding layer of the second type of encoding layer, and a feature fusion layer. The output end of the last attention mechanism layer is only connected to the feature fusion layer.
[0076] Step 234: Input the third feature maps corresponding to each level into the feature fusion layer for enhanced fusion to obtain the fourth feature maps corresponding to each level.
[0077] For example, the third feature map of the low level may be enhanced and fused with the third feature map of the high level, and the third feature map of the high level may be enhanced and fused with the third feature map of the low level.
[0078] In this way, the corresponding fourth feature map will have more feature information.
[0079] Step 235: Input the fourth feature map corresponding to each level into the decoding layer to obtain the target object segmentation result.
[0080] Among them, this embodiment includes multiple decoding layers, each decoding layer is connected in sequence, and the output of each decoding layer is used as the input of the next decoding layer, and the fourth feature map corresponding to each level is used as the input of each decoding layer, that is, each decoding layer has two inputs, and the output of the last decoding layer is used as the target object segmentation result.
[0081] In this embodiment, the first type of coding layer is used to extract features from the key frame image to obtain a first feature map with the appearance information of the target object, and the second type of coding layer is used to extract features from the optical flow image to obtain a second feature map with the motion information of the target object, and the first feature map and the second feature map are fused by the attention mechanism layer to obtain the third feature map corresponding to each level, and input to the feature fusion layer. The attention mechanism layer combines motion information with appearance information, reduces the ambiguity of the appearance of the target object, and enhances the learning ability of the network to represent the target object, especially in the scene where the target object is visually similar to the surrounding environment. And the features of each level extracted by the coding layer are enhanced and fused through the feature fusion layer, so that the features of different levels fuse low-resolution, strong semantic features and high-resolution, weak semantic features, then the features output by the feature fusion layer to the decoding layer retain more information, greatly improving the segmentation accuracy of the decoding layer when segmenting the target object. Therefore, the detection method provided in this embodiment can simplify the segmentation complexity of the target object, without the need to classify the target object, and improve the segmentation accuracy of the target object.
[0082] See also Figure 4 , Figure 4 FIG. 1 is a flow chart of another embodiment of a method for detecting a significant target provided by the present application. The method comprises:
[0083] Step 41: extracting a key frame image from the image to be detected.
[0084] Step 42: Input the current key frame image and the previous key frame image into the optical flow network to obtain an optical flow image corresponding to the current key frame image.
[0085] Step 43: Input the current key frame image and the optical flow image into the trained target segmentation network to output the target object segmentation result.
[0086] Step 44: Use the first type of encoding layer to extract features of the current key frame image, obtain the first feature map corresponding to each level, and input the first feature map into the attention mechanism layer.
[0087] Step 45: Use the second type of encoding layer to extract features of the optical flow image, obtain the second feature map corresponding to each level, and input the second feature map into the attention mechanism layer.
[0088] Step 41 to step 45 have the same or similar technical solutions as those in the above embodiment, and will not be described in detail here.
[0089] Step 46: Use the attention mechanism layer to perform a convolution operation on the first feature map to obtain a first target feature map, and input the first target feature map into the next encoding layer of the first type of encoding layer.
[0090] In some embodiments, see Figure 5 , step 46 may be as follows:
[0091] Step 461: Use the attention mechanism layer to perform a convolution operation on the first feature map to obtain the first feature map after the operation.
[0092] For example, the attention mechanism layer uses a 1*1 convolution to perform a convolution operation on the first feature map to obtain the first feature map after the operation.
[0093] Step 462: Classify the calculated first feature map to obtain a classified first feature map.
[0094] Here, the softmax and full connection methods can be used to classify the first feature map after operation.
[0095] Step 463: Classify the second target feature map to obtain a classified second target feature map.
[0096] Here, the softmax and full connection methods can be used to classify the second feature map after operation.
[0097] Step 464: Process the classified first feature map and the classified second target feature map to obtain a second reference feature map.
[0098] The classified first feature map and the classified second target feature map are multiplied to obtain a second reference feature map.
[0099] Step 465: Use the attention mechanism to process the calculated first feature map and the second reference feature map to obtain a first target feature map.
[0100] In some embodiments, it is necessary to perform softmax processing on the second reference feature map, and then use the attention mechanism to process the calculated first feature map and the second reference feature map processed by softmax to obtain the first target feature map.
[0101] Since the second feature map represents the motion features in the optical flow image, and the second reference feature map represents the fusion features of the optical flow image and the key frame image, the attention mechanism is used to fuse the two feature maps. The attention mechanism can infer the area of interest based on the motion features in the optical flow image, and then use the attention mechanism to select the appearance features in the key frame image from the second reference feature map. By considering the information flow from motion to appearance, the ambiguity of the appearance of the target object is reduced, and the network's learning ability to represent the target object is enhanced, especially in scenes where the object is visually similar to the surrounding environment.
[0102] Step 466: Input the first target feature map to the next encoding layer of the second type encoding layer.
[0103] Step 47: Use the attention mechanism layer to perform a convolution operation on the second feature map to obtain a second target feature map, and input the second target feature map into the next encoding layer of the second type of encoding layer.
[0104] In some embodiments, the attention mechanism layer uses a 1*1 convolution to perform a convolution operation on the second feature map to obtain a second target feature map, and the second target feature map is input into the next encoding layer of the second type of encoding layer. Then, the next encoding layer performs feature extraction on the second target feature map to obtain a corresponding second feature map, and the second feature map is input into its corresponding attention mechanism layer.
[0105] It can be understood that step 46 and step 47 can be performed simultaneously, and the second target feature map of step 47 needs to be used in step 46.
[0106] Step 48: Fusing the first target feature map and the second target feature map to obtain a third feature map.
[0107] Here, concat can be used to perform feature fusion on the first target feature map and the second target feature map.
[0108] Step 49: Input the third feature maps corresponding to each level into the feature fusion layer for enhanced fusion to obtain the fourth feature maps corresponding to each level.
[0109] Through the connection between the encoding layer and the attention mechanism layer, the attention mechanism layer will output the third feature map corresponding to each level, and use the third feature map corresponding to each level as the input of the feature fusion layer.
[0110] In some embodiments, see Figure 6 , step 49 may be the following process:
[0111] Step 491: Perform ST feature enhancement, GT feature enhancement, and RT feature enhancement on each third feature map to obtain a plurality of enhanced third reference feature maps.
[0112] ST (self-transformer) is based on non-local interaction of feature maps in the same layer, and the output has the same scale as the input.
[0113] GT (Groundng Transformer) uses high-level features to enhance low-level features in a top-down manner, and the output has the same scale as the low-level feature map.
[0114] RT (Rendering Transformer) uses low-level features to enhance high-level features in a bottom-up manner, and the scale of the output is the same as the scale of the high-level feature map.
[0115] In some embodiments, see Figure 7 , step 491 may be as follows:
[0116] Step 4911: Perform same-level interaction on each third feature map to obtain a third reference feature map after same-level enhancement, and the scale of the third reference feature map after same-level enhancement is the same as that of the third feature map.
[0117] Step 4912: For each third feature map, interact from top to bottom according to the hierarchy, use high-level features to enhance low-level features, and obtain multiple top-down enhanced third reference feature maps. The scale of the top-down enhanced third reference feature map is the same as that of the third feature map of the lower level during interaction.
[0118] Step 4913: Perform bottom-up interaction on each third feature map according to the hierarchy, use the low-level features to enhance the high-level features, and obtain a bottom-up enhanced third reference feature map. The bottom-up enhanced third reference feature map has the same scale as the high-level third feature map during the interaction.
[0119] Step 492: Arrange the plurality of third reference feature maps according to the size of the corresponding third feature map, and perform feature fusion with the third feature map to obtain fourth feature maps corresponding to each level.
[0120] The fourth feature map obtained at this time combines low-resolution, strong semantic features with high-resolution, weak semantic features, which well preserves the low-level information without loss and can greatly improve the segmentation accuracy.
[0121] Step 50: Input the fourth feature map corresponding to each level into the decoding layer to obtain the target object segmentation result.
[0122] Since there are multiple decoding layers, the multiple decoding layers are connected layer by layer and connected to the feature fusion layer.
[0123] In some embodiments, see Figure 8, step 50 may be the following process:
[0124] Step 501: Perform a convolution operation on the fourth feature map corresponding to each level to obtain the first fourth reference feature map after the operation.
[0125] In this embodiment, a 3*3 convolution is set before the decoding layer, and a convolution operation is performed on the fourth feature map corresponding to each level to further integrate the fourth feature map corresponding to each level to obtain the first fourth reference feature map after the operation.
[0126] Step 502: Use the Nth decoding layer to upsample the Nth fourth reference feature map and the fourth feature map to obtain the N+1th fourth reference feature map.
[0127] In one embodiment, each decoding layer includes a dilated spatial convolutional pooling pyramid and a convolutional layer.
[0128] Optional, see Fig. 9 , step 502 may be the following process:
[0129] Step 5021: Use a convolution layer to perform convolution calculation on the Nth fourth reference feature map, and perform region division on the fourth reference feature map after the convolution calculation to obtain the Nth initial reference feature map.
[0130] The convolution layer of the Nth decoding layer performs convolution calculation on the Nth fourth reference feature map. For example, the first convolution calculation is performed on the Nth fourth reference feature map using a 3*3 convolution, and the result is then output to a 1*1 convolution, and a second convolution calculation is performed in the 1*1 convolution, and then the activation function is used to calculate the fourth reference feature map after the two convolutions, and the region is divided, which is essentially to distinguish the target object and the background in the fourth reference feature map.
[0131] Step 5022: Use the dilated spatial convolution pooling pyramid to sample the Nth fourth reference feature map, and fuse the sampling result with the Nth initial reference feature map to obtain a fusion result.
[0132] The Nth fourth reference feature map is sampled in parallel with dilated convolutions at different sampling rates using a dilated spatial convolution pooling pyramid, and then the sampling result is fused with the Nth initial reference feature map using concat to obtain a fused result.
[0133] Step 5023: Use the Nth decoding layer to upsample the fourth feature map to obtain an upsampling result.
[0134] At the same time, the decoding layer will upsample the fourth feature map input by the feature fusion layer to obtain the upsampling result.
[0135] Step 5024: Fuse the fusion result and the upsampling result to obtain the N+1th fourth reference feature map.
[0136] In this process, the fusion result needs to be convolved, pooled and other operations again, and then fused with the upsampling result. The fusion result is convolved, pooled and other operations are performed again to obtain the N+1th fourth reference feature map.
[0137] Wherein, N is a positive integer.
[0138] Step 503: Use the N+1th fourth reference feature map as the target object segmentation result.
[0139] In this way, each decoding layer can explicitly utilize the multi-scale features of the target object. After upsampling at each decoding layer, the resolution of the feature map is gradually improved by compensating the high-level semantic features with low-level details. The fourth reference feature map output at the end will be the most refined feature map.
[0140] In this embodiment, the first type of coding layer is used to extract features from the key frame image to obtain a first feature map with the appearance information of the target object, and the second type of coding layer is used to extract features from the optical flow image to obtain a second feature map with the motion information of the target object, and the first feature map and the second feature map are fused by the attention mechanism layer to obtain the third feature map corresponding to each level, and input to the feature fusion layer. The attention mechanism layer combines motion information with appearance information to reduce the ambiguity of the appearance of the target object and enhance the learning ability of the network to represent the target object, especially in the scene where the target object is visually similar to the surrounding environment. And the features of each level extracted by the coding layer are enhanced and fused by ST feature enhancement, GT feature enhancement and RT feature enhancement through the feature fusion layer, so that the features of different levels fuse low-resolution, strong semantic features with high-resolution, weak semantic features, then the features output by the feature fusion layer to the decoding layer retain more information, greatly improving the segmentation accuracy of the decoding layer when performing target object segmentation. Therefore, the detection method provided in this embodiment can simplify the segmentation complexity of the target object, without the need to classify the target object, and improve the segmentation accuracy of the target object.
[0141] See also Fig.10 , Fig.10 FIG. 1 is a flow chart of another embodiment of a method for detecting a significant target provided by the present application. The method comprises:
[0142] This embodiment is used to describe a training method for the target segmentation network mentioned in this application.
[0143] Step 101: Acquire a training image, wherein the training image is annotated with target object information and background information.
[0144] The training images can be collected in advance by an image acquisition device. For example, the monitoring equipment set up in the production workshop, the images collected by the monitoring equipment can be used as training images. Then the training images can be annotated to distinguish the target object information from the background information. In some embodiments, the production workshop can be a hanging workshop, and there are objects such as overhead cranes, hanging objects, and hanging ropes in the hanging workshop. When annotating, the hanging objects and hanging ropes hanging in the collected hanging workshop images are annotated as target object information, and the rest are used as background information.
[0145] Step 102: Input the training image into the target segmentation network to train the target segmentation network.
[0146] In some embodiments, before performing step 102, it is necessary to extract key frame images from the training images, and input adjacent key frame images into the optical flow network to obtain corresponding optical flow images.
[0147] The optical flow images and key frame images are enhanced by data transformation such as rotation, flipping, color, etc. to obtain more training images.
[0148] The optical flow image and the key frame image are then input into the object segmentation network to train the object segmentation network.
[0149] In one application scenario, the target segmentation network includes an encoding layer, a feature fusion layer, and a decoding layer. Fig.11 Description: The encoding layer adopts a dual-stream structure to jointly encode the appearance features and motion features of the target object.
[0150] exist Fig.11 middle, I a represents the key frame image, I m represents the optical flow image, I a and I m Has the same coding layer structure. a and I m Input to the corresponding Conv1 for convolution, then input the convolution feature map to the corresponding Res2, and then input the convolution feature map in Res2 to MAT, where the two Res2 inputs will be fused to obtain three outputs. The first output will be input to I a In the corresponding Res3, the second output will be input to I m In the corresponding Res3, the third output will be input to the feature fusion layer. a and I mThe corresponding Res3, Res4, Res5 and MAT will be processed in the above manner, which will not be repeated here. Among them, Conv1, Res2, Res3, Res4 and Res5 downsample the input feature map, and the downsampling sampling rate is different, so each MAT will input feature maps with different scales to the feature fusion layer.
[0151] Combination Fig.12 Explain the internal process in MAT:
[0152] The first feature map V a Perform a 1*1 convolution operation to obtain the first feature map after the operation The first feature map after operation Perform softmax+FC classification processing to obtain the first feature map after classification
[0153] At the same time, the second feature map V m Perform 1*1 convolution operation to obtain the second target feature map The second target feature map Input to the next encoding layer of the second type of encoding layer. And the second target feature map Perform softmax+FC classification processing to obtain the second target feature map after classification
[0154] The first feature map after classification And the second target feature map after classification Perform multiplication to obtain the second reference feature map S, and perform softmax classification on the second reference feature map S to obtain the second reference feature map S r At this time, the second reference feature map S has the feature information of the key frame image and the optical flow image.
[0155] Use the attention mechanism to operate on the first feature map and the second reference feature map S r Processing is performed to obtain the first target feature map U a ;
[0156] The first target feature map U a Input to the next encoding layer of the second type of encoding layer.
[0157] The first target feature map U a and the second target feature map Perform feature fusion to obtain a third feature map U, and input the third feature map U into the feature fusion layer FPT.
[0158] After receiving the feature maps of each level, the feature fusion layer FPT will enhance and fuse them. Fig.13 Describe the internal process in the feature fusion layer:
[0159] Select the input feature maps a, b and c for illustration:
[0160] Feature maps a, b, and c are enhanced by ST feature enhancement, GT feature enhancement, and RT feature enhancement, respectively, to obtain multiple enhanced third reference feature maps. ST (self-transformer) is based on non-local interaction of feature maps of the same layer, and the output has the same scale as the input. GT (Groundng Transformer) uses high-level features to enhance low-level features in a top-down manner, and the output has the same scale as the low-level feature map. RT (Rendering Transformer) uses low-level features to enhance high-level features in a bottom-up manner, and the output has the same scale as the high-level feature map.
[0161] Multiple third reference feature maps are arranged according to the sizes of the corresponding feature maps a, b and c, and feature fused with the corresponding feature maps a, b and c, and then convolution outputs the fused feature maps a, b and c.
[0162] Understandably, Fig.11 When the input is a feature map of 4 levels, in the feature fusion layer FPT, the fusion is enhanced by traversing three feature maps. For example, feature maps a, b, c, and d are enhanced and fused in the feature fusion layer FPT in the manner of a, b and c, b, c and d, and a, c and d.
[0163] The decoding layer takes the features of different scales learned by the feature fusion layer as input, and gradually refines the coarse features to obtain accurate segmentation results. It consists of a cascade of four boundary-aware BAR modules, each of which explicitly exploits the multi-scale features of objects. From BAR5 to BAR2, after four upsamplings, the resolution of the feature map gradually increases by compensating high-level semantic features with low-level details. BAR2 generates the finest feature map with a resolution of 1 / 4 the size of the input image.
[0164] Combination Fig.14 Describe the internal process in each decoding layer:
[0165] Use 3*3 convolutional layer and 3*3 convolutional layer to transform the feature map F i Perform convolution calculation, and then use the activation function Sigmoid to convolute the feature map F i Calculations are performed and area division is performed to obtain a boundary map.
[0166] Use the Atrous Spatial Convolution Pooling Pyramid (ASPP) to convolution the feature map F i The sampling is performed in parallel using dilated convolutions with different sampling rates, and then the sampling results are fused with the boundary map using concat to obtain the fused result.
[0167] The decoding layer will input the feature map Z of the feature fusion layer i Upsampling is performed to obtain an upsampling result.
[0168] First, the fusion result is convolved and pooled again, and then fused with the upsampling result. The fusion result is convolved and pooled again to obtain the feature map F. i-1 . Feature map F i-1 It can be input to the next decoding layer. If the current decoding layer is the last one, the feature map F i-1 The segmentation result is output.
[0169] In some embodiments, see Fig.15 , step 102 may be the following process:
[0170] Step 1021: Input the training image into the target segmentation network to output the target object segmentation result.
[0171] Step 1021 is the same or similar to the above-mentioned technical solution and will not be described in detail here.
[0172] Step 1022: Obtain the classification error of each pixel in the training image as the first loss value.
[0173] When the target object is segmented, each pixel will get the corresponding classification error through the calculation of the target segmentation network, and the classification error will be used as the first loss value.
[0174] In some embodiments, a binary cross entropy loss function may be used to calculate the first loss value.
[0175] Step 1023: Obtain a target pixel in the training image whose confidence is lower than a preset confidence, and calculate a second loss value based on the confidence of the target pixel.
[0176] For example, pixels whose classification confidence is lower than a preset confidence are taken as target pixels.
[0177] In an application scenario, there are situations where the background information is similar to the target object, and these pixels in the background information and the target object are identified as difficult pixels. In order to correctly distinguish difficult pixels, the Ohem loss function is used to calculate the loss. In the Ohem loss function, pixels with very low classification confidence are selected as target pixels to calculate the loss. This method of automatically selecting difficult pixels to add to the training during the training process makes the training more effective and faster.
[0178] Step 1024: Obtain the accuracy and recall rate of each pixel classification, and obtain a first control value based on the accuracy and recall rate.
[0179] Step 1025: Obtain an intersection-and-union ratio between the segmentation results of each pixel in the target object segmentation result, and obtain a second control value based on the intersection-and-union ratio.
[0180] Step 1026: Obtain a third loss value using the first control value and the second control value.
[0181] The applicant has found that since the background information in the key frame image is usually relatively broad and the target object is relatively small, in the scenario where the area of the target object is much smaller than the area of the background information, it is extremely important to determine the target boundary. The third loss value can be calculated according to steps 1024 to 1026.
[0182] Specifically, steps 1024 to 1026 can be expressed by the following formula:
[0183]
[0184]
[0185]
[0186] Among them, L boundary Represents the third loss value, where w∈[0,1] is the scaling factor, is the boundary loss, L IOU is the IoU loss function, P and R represent the classification precision and recall, TP, FP and FN represent the number of true positive, false positive and false negative results, respectively. During the training process, as the training cycle increases, w gradually increases to promote the accuracy of boundary segmentation, which refers to the boundary between the target object and the background in the image.
[0187] Step 1027: Use the first loss value, the second loss value, and the third loss value to adjust the network parameters of the target segmentation network.
[0188] In some embodiments, the final loss value obtained by using the first loss value, the second loss value, and the third loss value may be expressed by the following formula:
[0189] L=L BCE +L ohem +L boundary .
[0190] Among them, L BCE Represents the first loss value, L ohem Represents the second loss value, L boundary Represents the third loss value.
[0191] The target segmentation network is iteratively trained using training images, the network parameters of the target segmentation network are adjusted, and when the loss value meets the requirement of segmentation accuracy, the training of the target segmentation network is terminated, and the target segmentation network is applied to the detection method of the salient target in any of the above embodiments.
[0192] In some application scenarios, since video images are composed of continuous frame sequences, the amount of calculation required for segmentation is relatively large. In order to meet the real-time requirements, this application proposes that the trained target segmentation network needs to be pruned to reduce the number of parameters and the amount of calculation, so that the target segmentation network can achieve efficient target object segmentation based on fewer parameters and calculations in the detection of target objects.
[0193] Based on this, the present application also proposes to perform a pruning operation on the target segmentation network after the target segmentation network training is completed to delete the convolution kernels that meet the preset conditions in the target segmentation network. By deleting unimportant convolution kernels, the amount of calculation between the convolution kernels can be reduced, so that the target segmentation network can finally detect the target object and achieve efficient target object segmentation based on a smaller amount of parameters and calculations. It can be understood that the importance of the convolution kernel is positively correlated with the rank of the output feature map, and the high-order feature map contains more information than the low-order feature map.
[0194] For specific implementation methods, see Fig.16 , Fig.16 FIG. 1 is a flow chart of another embodiment of a method for detecting a significant target provided by the present application. The method comprises:
[0195] Step 161: Obtain a target feature map corresponding to the output of each convolution kernel in each encoding layer, feature fusion layer and / or each decoding layer.
[0196] The target feature maps obtained in step 161 are generated during the last training of the target segmentation network. Therefore, these target feature maps can better represent the importance of the convolution kernel.
[0197] Step 162: Calculate the average rank of each target feature map, and obtain a set of average ranks corresponding to each encoding layer, feature fusion layer and / or each decoding layer.
[0198] The average ranks in the average rank set are sorted from high to low.
[0199] It can be understood that the data in the target feature map is not uniform and needs to be represented by the average rank so that each target feature map can be compared.
[0200] The target feature map corresponding to a higher average rank can be identified as a high-order feature map.
[0201] Step 163: Obtain the compression ratio in each encoding layer, feature fusion layer and / or each decoding layer.
[0202] The compression rate indicates the filtering ratio of the convolution kernels in the corresponding encoding layer, feature fusion layer and / or decoding layer. For example, if the compression rate is 0.1, it means that 10% of the convolution kernels need to be filtered out.
[0203] Step 164: Perform average rank filtering on each average rank set according to the corresponding compression rate, and filter out the convolution kernel corresponding to the average rank to obtain a target segmentation network with an updated convolution kernel.
[0204] Since the average ranks in the average rank set are sorted from high to low, they are filtered out according to the compression rate from low to high. If there are 1-100 average ranks in the average rank set and the compression rate is 0.1, the 91st to 100th average ranks are filtered out.
[0205] Step 165: Use the training image to train the target segmentation network with the updated convolution kernel again to adjust the network parameters of the target segmentation network until the segmentation accuracy of the target segmentation network meets the preset conditions.
[0206] After filtering is completed, the target segmentation network with updated convolution kernel is trained again using the training image. The specific training method can refer to the above process and will not be repeated here.
[0207] During the training process, the network parameters of the target segmentation network are adjusted until the segmentation accuracy of the target segmentation network meets a preset condition. The preset condition can be set to the segmentation accuracy of the target segmentation network before the convolution kernel is filtered out.
[0208] In other embodiments, the HRank algorithm may be used to perform a pruning operation on the target segmentation network.
[0209] In one application scenario, since the number of parameters of the dual-stream backbone network as the coding layer is much larger than that of the coding layer, the coding layer can be pruned mainly. In order to make the pruned target segmentation network still maintain a high segmentation accuracy as much as possible, combined with Fig.11 illustrate, Fig.11The encoding layer in can use the ResNet-101 network. Combined with the average rank size of the output feature map of different convolution kernels, the selected compression rate is [0.1]+[0.2]*3+[0.3]*4+[0.5]*23+[0.1]*3, where 0.1 represents the compression rate of ResNet-101 network conv1, 0.2, 0.3, 0.5, 0.1 represent the compression rates of the convolution kernels in the Res2, Res3, Res4, and Res5 layers, respectively. The number of parameters after pruning is about 60% of the number of parameters before pruning.
[0210] The target segmentation network trained at this time is applied to the method for detecting salient targets in any of the above embodiments to segment the target object. In addition to having any of the above beneficial effects, the speed of segmenting the target object can also be improved.
[0211] See also Fig.17 , Fig.17 1 is a schematic diagram of a structure of an embodiment of a detection device provided by the present application. The detection device 170 includes a processor 171 and a memory 172 coupled to the processor 171; wherein the memory 172 is used to store a computer program, and the processor 171 is used to execute the computer program to implement the following method:
[0212] Acquire the image to be detected and the corresponding optical flow image; input the image to be detected and the optical flow image into the trained target segmentation network to output the target object segmentation result; wherein the target segmentation network includes an encoding layer, a feature fusion layer and a decoding layer, and the feature fusion layer is used to enhance and fuse the features of each level extracted by the encoding layer, and output them to the decoding layer.
[0213] It can be understood that the processor 171 is also used to execute a computer program to implement the method provided by any of the above embodiments. Please refer to any of the above embodiments for details and will not be repeated here.
[0214] See also Fig.18 , Fig.18 1 is a schematic diagram of a computer readable storage medium according to an embodiment of the present application. The computer readable storage medium 180 is used to store a computer program 181. When the computer program 181 is executed by a processor, it is used to implement the following method:
[0215] Acquire the image to be detected and the corresponding optical flow image; input the image to be detected and the optical flow image into the trained target segmentation network to output the target object segmentation result; wherein the target segmentation network includes an encoding layer, a feature fusion layer and a decoding layer, and the feature fusion layer is used to enhance and fuse the features of each level extracted by the encoding layer, and output them to the decoding layer.
[0216] It can be understood that when the computer program 181 is executed by the processor, it is also used to implement the method provided by any of the above embodiments. Please refer to any of the above embodiments for details and will not be repeated here.
[0217] In one application scenario, the inventors found that the main problem in the detection of overhead crane hoisted objects is that the types of hoisted objects are not fixed, which makes many detection methods inapplicable and difficult to detect. The cost of the method of collecting signals by installing sensors on the equipment is relatively high, and the traditional image processing method can only determine the basic information such as the size of the hoisted objects by comparing the existing types of hoisted objects in the database when detecting hoisted objects. The application is limited and the detection process is complicated and time-consuming. Therefore, the technical solution of the present application is proposed, using images related to overhead crane hoisted objects as training samples, training the target segmentation network, and then using the trained target segmentation network in any of the above embodiments. The overhead crane hoisted objects are detected and segmented by the technical solution of any of the above embodiments, which effectively improves the segmentation accuracy of hoisted objects with no fixed types. The target segmentation network is mainly trained by using images related to overhead crane hoisted objects. By adding a feature fusion layer between the encoding layer and the decoding layer, the features extracted by the encoding layer at different levels are enhanced, which can improve the segmentation accuracy. In addition, for the scene of overhead crane hoisting objects, a new loss function calculation method is constructed when training the target segmentation network, which adds the loss calculation of difficult pixels and boundary pixels in the scene image of overhead crane hoisting objects, which can reduce the misclassification of pixels and optimize the fineness of boundaries. In addition, by pruning the model of the target segmentation network, the network parameters and calculation amount of the target segmentation network can be reduced, and the forward prediction speed of the target segmentation network can be improved.
[0218] Combination Figure 19-Figure 24 The effect of the technical solution of this application is demonstrated:
[0219] Will Fig.19 According to the technical solution of this application, the target object is detected, and the Fig. 20 The target object segmentation result is shown in Figure 2. Fig.19 If the object in the suspension is in a suspended state, that is, the object and the suspension rope are moving, the object and the suspension rope can be accurately moved from Fig.19 It is separated from the workshop background.
[0220] Will Fig.21 According to the technical solution of this application, the target object is detected, and the Fig. 22 The target object segmentation result is shown. Fig.21 The load in the rope has been lowered, the load is not detected, but the rope can be accurately moved from Fig.21 It is separated from the workshop background.
[0221] Will Fig.23 According to the technical solution of this application, the target object is detected, and the Fig.24 The target object segmentation result is shown. Fig.23 The workshop background in the image contains a large number of objects that are the same as the suspended objects. The method of the present application can also accurately segment the suspended objects suspended by the overhead crane. In summary, it can be seen that in a complex workshop environment, the technical solution of the present application can accurately detect the suspended objects of the overhead crane.
[0222] In summary, the technical solution of the present application can simplify the complexity of segmenting the target object, eliminates the need to identify the category of the target object, and improves the segmentation accuracy of the target object. Furthermore, when applied to overhead crane hoisting objects, it can quickly and accurately segment the overhead crane hoisting objects from the workshop background, which facilitates subsequent further analysis of whether there are safety hazards in the operation of the overhead crane by employees, such as whether the hoisting objects are crooked or tilted, whether the hoisting objects are moving too fast, etc.
[0223] In the several embodiments provided in this application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only illustrative, for example, the division of the modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0224] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0225] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0226] If the integrated units in the above other embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), disk or optical disk and other media that can store program code.
[0227] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for detecting a salient target, characterized in that: The method comprises: Acquire a current key frame image in the image to be detected and an optical flow image corresponding to the current key frame image; Inputting the current key frame image and the optical flow image into a trained target segmentation network to output a target object segmentation result; The target segmentation network includes a coding layer, a feature fusion layer and a decoding layer, wherein the feature fusion layer is used to enhance and fuse the features of each level extracted by the coding layer and output them to the decoding layer; The coding layer is divided into a first type of coding layer and a second type of coding layer; The step of inputting the current key frame image and the optical flow image into a trained target segmentation network to output a target object segmentation result includes: Using the first type of encoding layer to extract features of the current key frame image, obtain a first feature map corresponding to each level, and input the first feature map into the attention mechanism layer; Using the second type of encoding layer to extract features from the optical flow image, obtain a second feature map corresponding to each level, and input the second feature map into the attention mechanism layer; Using the attention mechanism layer, extracting features from the first feature map and the second feature map according to corresponding levels to obtain third feature maps corresponding to each level; Inputting the third feature maps corresponding to each level into the feature fusion layer for enhanced fusion to obtain the fourth feature maps corresponding to each level; The fourth feature map corresponding to each level is input into the decoding layer to obtain the target object segmentation result.
2. The method according to claim 1, characterized in that The step of acquiring a current key frame image in the image to be detected and an optical flow image corresponding to the current key frame image includes: Extracting a key frame image from the image to be detected; The current key frame image and the previous key frame image are input into the optical flow network to obtain the optical flow image corresponding to the current key frame image.
3. The method according to claim 1, characterized in that The using the attention mechanism layer to extract features from the first feature map and the second feature map according to corresponding levels to obtain third feature maps corresponding to each level includes: Performing a convolution operation on the first feature map using an attention mechanism layer to obtain a first target feature map, and inputting the first target feature map into a next encoding layer of the first type of encoding layer; Performing a convolution operation on the second feature map using an attention mechanism layer to obtain a second target feature map, and inputting the second target feature map into a next encoding layer of the second type of encoding layer; The first target feature map and the second target feature map are feature-fused to obtain the third feature map.
4. The method according to claim 3, characterized in that The method of using the attention mechanism layer to perform a convolution operation on the first feature map to obtain a first target feature map, and inputting the first target feature map to a next encoding layer of the first type of encoding layer, includes: Performing a convolution operation on the first feature map using an attention mechanism layer to obtain a first feature map after the operation; Performing classification processing on the first feature map after the operation to obtain the classified first feature map; Performing classification processing on the second target feature map to obtain a classified second target feature map; Processing the classified first feature map and the classified second target feature map to obtain a second reference feature map; Using an attention mechanism to process the calculated first feature map and the second reference feature map to obtain the first target feature map; The first target feature map is input to the next encoding layer of the second type encoding layer.
5. The method according to claim 1, characterized in that The step of inputting the third feature maps corresponding to each level into the feature fusion layer for enhanced fusion to obtain the fourth feature maps corresponding to each level includes: Performing ST feature enhancement, GT feature enhancement, and RT feature enhancement on each third feature map to obtain a plurality of enhanced third reference feature maps; The plurality of third reference feature maps are arranged according to the size of the corresponding third feature map, and feature fusion is performed with the third feature map to obtain the fourth feature map corresponding to each level.
6. The method according to claim 5, characterized in that The step of performing ST feature enhancement, GT feature enhancement, and RT feature enhancement on each third feature map to obtain a plurality of enhanced third reference feature maps includes: Performing same-level interaction on each third feature map to obtain a third reference feature map enhanced at the same level, wherein the third reference feature map enhanced at the same level has the same scale as the third feature map; For each third feature map, the high-level features are used to enhance the low-level features according to the top-down interaction, and a plurality of top-down enhanced third reference feature maps are obtained, wherein the scale of the top-down enhanced third reference feature map is the same as that of the third feature map of the lower level during the interaction; For each third feature map, bottom-up interaction is performed according to the hierarchy, and the low-level features are used to enhance the high-level features to obtain a third reference feature map after bottom-up enhancement. The scale of the third reference feature map after bottom-up enhancement is the same as that of the third feature map of the high level during interaction.
7. The method according to claim 1, characterized in that The step of inputting the fourth feature map corresponding to each level into the decoding layer to obtain the target object segmentation result includes: Perform a convolution operation on the fourth feature map corresponding to each level to obtain a first fourth reference feature map after the operation; Upsampling the Nth fourth reference feature map and the fourth feature map by using the Nth decoding layer to obtain an N+1th fourth reference feature map; wherein N is a positive integer; The N+1th fourth reference feature map is used as the target object segmentation result.
8. The method according to claim 7, characterized in that Each decoding layer consists of a dilated spatial convolutional pooling pyramid and a convolutional layer; The method of upsampling the Nth fourth reference feature map and the fourth feature map by using the Nth decoding layer to obtain the N+1th fourth reference feature map comprises: Using the convolution layer to perform convolution calculation on the Nth fourth reference feature map, and performing region division on the fourth reference feature map after the convolution calculation to obtain an Nth initial reference feature map; Using the atrous spatial convolution pooling pyramid to sample the Nth fourth reference feature map, and fusing the sampling result with the Nth initial reference feature map to obtain a fusion result; Upsampling the fourth feature map using the Nth decoding layer to obtain an upsampling result; The fusion result and the upsampling result are fused to obtain the N+1th fourth reference feature map.
9. The method according to claim 1, characterized in that: The method further comprises: Acquire a training image, wherein the training image is annotated with target object information and background information; The training image is input into the object segmentation network to train the object segmentation network.
10. The method according to claim 9, characterized in that The step of inputting the training image into the target segmentation network to train the target segmentation network comprises: Inputting the training image into the target segmentation network to output a target object segmentation result; Obtaining a classification error of each pixel in the training image as a first loss value; Acquire a target pixel in the training image whose confidence is lower than a preset confidence, and calculate a second loss value based on the confidence of the target pixel; Obtaining the accuracy and recall rate of each pixel classification, and obtaining a first control value based on the accuracy and the recall rate; Obtaining an intersection-and-union ratio between segmentation results of each pixel in the target object segmentation result, and obtaining a second control value based on the intersection-and-union ratio; Obtaining a third loss value using the first control value and the second control value; The first loss value, the second loss value, and the third loss value are used to adjust network parameters of the target segmentation network.
11. The method according to claim 9, characterized in that The method further comprises: After the target segmentation network is trained, a pruning operation is performed on the target segmentation network to delete convolution kernels in the target segmentation network that meet preset conditions.
12. The method according to claim 11, characterized in that The pruning operation on the target segmentation network includes: Obtain a target feature map corresponding to the output of each convolution kernel in each encoding layer, the feature fusion layer and / or each decoding layer; Calculate the average rank of each target feature map to obtain an average rank set corresponding to each encoding layer, the feature fusion layer and / or each decoding layer; wherein the average ranks in the average rank set are sorted from high to low; Obtaining a compression rate in each encoding layer, the feature fusion layer and / or each decoding layer; Performing average rank filtering on each average rank set according to the corresponding compression rate, and filtering out the convolution kernel corresponding to the average rank, to obtain the target segmentation network with the updated convolution kernel; The target segmentation network with the updated convolution kernel is trained again using the training image to adjust the network parameters of the target segmentation network until the segmentation accuracy of the target segmentation network meets the preset conditions.
13. A detection device, characterized in that: The detection device includes a processor and a memory coupled to the processor; The memory is used to store a computer program, and the processor is used to execute the computer program to implement the method according to any one of claims 1 to 12.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, the computer program is used to implement the method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Image processing method and device, storage medium and electronic equipment
CN110473141A
Image semantic segmentation method and device based on codec
CN111292330A
Saliency object detection method and device, storage medium and electronic equipment
CN111428805A
Image saliency target detection method and system based on multi-depth feature fusion
CN112132156A
Target tracking and semantic segmentation method and device for sports video, and plug-in
CN112347852A
Cited By
Modal guidance enhanced RGB-D video feature fusion and saliency target detection method
CN122023994A
