Image processing method, device, electronic device and computer readable medium
Through multi-scale feature extraction and optimization processing, a salient object mask is generated, which solves the problem of poor segmentation accuracy of salient objects in the existing technology. The features of salient objects are more prominent and the image processing accuracy is improved.
Patent Information
- Application Number
- CN202010822524.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-14
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2040-08-14
AI Technical Summary
Existing salient object segmentation methods have poor accuracy when processing images, making it difficult to accurately distinguish salient objects from the background.
By obtaining the image to be processed, performing multi-scale feature extraction and optimization processing, a multi-scale enhanced feature map is obtained, and the image is restored to generate a salient object mask. The features of the salient objects are more prominent and the segmentation accuracy is improved.
The accuracy of the salient object mask is improved, which alleviates the problem of poor segmentation accuracy of salient objects in the existing technology and enhances the accuracy of image processing.
Smart Images

Figure CN112101376B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to an image processing method, device, electronic device and computer-readable medium. Background Art
[0002] Salient Object Segmentation is an important topic in Computer Vision. It has a wide range of applications in the fields of mobile phone autofocus, driverless driving, scene understanding, image editing, etc. The purpose of salient object segmentation is to distinguish the pixels of salient objects from other background pixels in an image. Unlike traditional semantic segmentation tasks, salient objects do not belong to the same category of objects and do not have semantically related labels. However, salient objects are often located in the middle of the image and have rich colors, as shown in Figure 1(a). Figure 1(b) is a schematic diagram of the salient object segmentation result corresponding to Figure 1(a).
[0003] Existing salient object segmentation methods are mainly divided into two categories. One of them is to analyze the texture of the image to determine the area with rich texture in the image, and then distinguish the object from other areas with single texture through clustering method. This method is limited by the clustering method and it is difficult to obtain high accuracy; the other is to regard salient object segmentation as a standard object segmentation problem. However, standard object segmentation is to segment objects of preset types in the image, for example, to segment people, cars, and dogs in the image, but these objects may not be salient objects for a specific image, or not all of them are salient objects, which leads to errors in the segmented salient objects.
[0004] In summary, the existing salient object segmentation methods have the technical problem of poor accuracy when processing images. Summary of the invention
[0005] In view of this, an object of the present invention is to provide an image processing method, device, electronic device and computer-readable medium to alleviate the technical problem of poor accuracy of existing salient object segmentation methods when processing images.
[0006] In a first aspect, an embodiment of the present invention provides an image processing method, comprising: obtaining an image to be processed, and performing feature extraction on the image to be processed to obtain a multi-scale feature map; performing enhancement processing on a portion corresponding to a salient object in the multi-scale feature map to obtain a multi-scale enhanced feature map; performing image restoration on the multi-scale enhanced feature map to obtain a salient object mask corresponding to the image to be processed.
[0007] Furthermore, extracting features from the image to be processed includes: performing multi-layer downsampling processing on the image to be processed to obtain a multi-scale original feature map; and optimizing the multi-scale original feature map to obtain the multi-scale feature map.
[0008] Furthermore, the optimization processing of the multi-scale original feature map includes: performing a first optimization processing on a target original feature map in the multi-scale original feature map to obtain a first optimized feature map, wherein the target original feature map is a feature map other than the highest-dimensional original feature map in the multi-scale original feature map; performing a second optimization processing on the highest-dimensional original feature map in the multi-scale original feature map to obtain a second optimized feature map; and using the first optimized feature map and the second optimized feature map as the multi-scale feature map.
[0009] Furthermore, performing a first optimization process on the target original feature map in the multi-scale original feature map includes: performing optimization process on the target original feature map using a first optimization module to obtain a first initial optimized feature map, wherein the first optimization module includes: a preset number of first convolutional layers; performing a sum operation on the first initial optimized feature map and its corresponding target original feature map to obtain the first optimized feature map.
[0010] Furthermore, performing a second optimization process on the highest-dimensional original feature map in the multi-scale original feature map includes: performing optimization process on the highest-dimensional original feature map using a second optimization module to obtain an optimization weight, wherein the second optimization module includes: a second convolutional layer, a global pooling layer, and a Sigmoid function processing layer; performing a product operation on the optimization weight and the highest-dimensional original feature map to obtain a second initial optimized feature map; performing a sum operation on the second initial optimized feature map and the highest-dimensional original feature map to obtain the second optimized feature map.
[0011] Furthermore, the part corresponding to the salient object in the multi-scale feature map is enhanced, including: obtaining an initial position of the salient object according to the multi-scale feature map; according to the initial position, cropping the highest-dimensional feature map in the multi-scale feature map with at least two different expansion scales to obtain multiple cropped feature maps, wherein the multiple cropped feature maps contain feature information of the salient object; using one or more of the multi-scale feature maps as target feature maps, using each of the target feature maps as a current target feature map, calculating the correlation between the multiple cropped feature maps and the current target feature map, and obtaining multiple correlation feature maps of the current target feature map that correspond one-to-one to the multiple cropped feature maps; and obtaining an enhanced feature map corresponding to the current target feature map according to the multiple correlation feature maps and the current target feature map.
[0012] Furthermore, obtaining the initial position of the salient object according to the multi-scale feature map includes: performing dimensionality reduction processing on the highest-dimensional feature map in the multi-scale feature map to obtain a single-channel feature map; performing binarization processing on the single-channel feature map to obtain a single-channel binary feature map; and determining the initial position of the salient object according to the single-channel binary feature map.
[0013] Furthermore, according to the initial position, cropping the highest-dimensional feature map in the multi-scale feature map with at least two different expansion scales includes: determining the pixel width and pixel height of the salient object according to the initial position; determining the expanded pixel width and the expanded pixel height according to the expansion scale, the pixel width and the pixel height; and cropping in the highest-dimensional feature map along the position after the initial position is expanded by the expanded pixel width and the expanded pixel height.
[0014] Furthermore, calculating the correlation between the multiple cropped feature maps and the current target feature map includes: scaling the multiple cropped feature maps to a preset scale to obtain multiple cropped feature maps of the preset scale; sliding the current target feature map using the preset scale as a sliding window; multiplying the feature map contained in the sliding window after each sliding with the multiple cropped feature maps of the preset scale, and obtaining multiple correlation feature maps of the current target feature map that correspond one-to-one to the multiple cropped feature maps according to the result of the multiplication operation.
[0015] Furthermore, according to the multiple correlation feature maps and the current target feature map, obtaining the enhanced feature map corresponding to the current target feature map includes: multiplying each correlation feature map in the multiple correlation feature maps with the current target feature map to obtain multiple first enhanced feature maps corresponding to the current target feature map; connecting the multiple first enhanced feature maps in series with the current target feature map to obtain a second enhanced feature map corresponding to the current target feature map; obtaining a position enhanced feature map corresponding to the current target feature map, and connecting the second enhanced feature map in series with the position enhanced feature map to obtain an enhanced feature map corresponding to the current target feature map, wherein the scale of the position enhanced feature map is the same as the scale of the second enhanced feature map.
[0016] Further, obtaining the position enhancement feature map corresponding to the current target feature map includes: determining the center line of the salient object in the X direction and the center line of the salient object in the Y direction based on the initial position of the salient object; setting the center line in the Y direction as a first target value, linearly transforming it to a second target value along the X direction, and obtaining the position enhancement feature map in the X direction; setting the center line in the X direction as the first target value, linearly transforming it to the second target value along the Y direction, and obtaining the position enhancement feature map in the Y direction; and using the position enhancement feature map in the X direction and the position enhancement feature map in the Y direction as the position enhancement feature map.
[0017] Furthermore, performing image restoration on the multi-scale enhanced feature map includes: up-sampling the multi-scale enhanced feature map to obtain a salient object mask corresponding to the image to be processed.
[0018] In the second aspect, an embodiment of the present invention also provides an image processing device, comprising: a feature extraction unit, used to obtain an image to be processed, and perform feature extraction on the image to be processed to obtain a multi-scale feature map; an enhancement processing unit, used to perform enhancement processing on the part corresponding to the salient object in the multi-scale feature map to obtain a multi-scale enhanced feature map; an image restoration unit, used to perform image restoration on the multi-scale enhanced feature map to obtain a salient object mask corresponding to the image to be processed.
[0019] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any one of the methods described in the first aspect when executing the computer program.
[0020] In a fourth aspect, an embodiment of the present invention provides a computer-readable medium having a non-volatile program code executable by a processor, wherein the program code enables the processor to execute the steps of the method described in any one of the first aspects above.
[0021] In an embodiment of the present invention, first, an image to be processed is obtained, and feature extraction is performed on the image to be processed to obtain a multi-scale feature map; then, the portion corresponding to the salient object in the multi-scale feature map is enhanced to obtain a multi-scale enhanced feature map; finally, the multi-scale enhanced feature map is restored to obtain a salient object mask corresponding to the image to be processed. From the above description, it can be seen that after the portion corresponding to the salient object in the multi-scale feature map is enhanced, the feature map corresponding to the salient object in the obtained multi-scale enhanced feature map is more prominent, and finally, after the multi-scale enhanced feature map is restored, the salient object mask obtained by segmentation is more accurate, which alleviates the technical problem of poor accuracy of the existing salient object segmentation method when processing images. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0023] FIG1( a) is a schematic diagram of an image to be processed provided by an embodiment of the present invention;
[0024] FIG1(b) is a schematic diagram of a salient object segmentation result corresponding to FIG1(a) provided by an embodiment of the present invention;
[0025] Figure 2 A schematic diagram of an electronic device provided by an embodiment of the present invention;
[0026] Figure 3 A flowchart of an image processing method provided by an embodiment of the present invention;
[0027] Figure 4 An overall schematic diagram of an image processing method provided by an embodiment of the present invention;
[0028] Figure 5 A schematic diagram of a first optimization process provided by an embodiment of the present invention;
[0029] Figure 6 A schematic diagram of a second optimization process provided by an embodiment of the present invention;
[0030] Figure 7 A flowchart of enhancing a portion corresponding to a salient object in a multi-scale feature map provided by an embodiment of the present invention;
[0031] Figure 8A flowchart of determining an enhanced feature map corresponding to a current target feature map provided by an embodiment of the present invention;
[0032] Fig. 9 A schematic diagram of a position enhancement feature map provided by an embodiment of the present invention;
[0033] Fig.10 A schematic diagram of enhancing a portion corresponding to a salient object in a multi-scale feature map provided by an embodiment of the present invention;
[0034] Fig.11 A schematic diagram of the results of training and testing the image processing method of the present invention and the existing salient object segmentation method on multiple public data sets provided in an embodiment of the present invention;
[0035] Fig.12 A schematic diagram of visualization results after an image to be processed is processed by the image processing method of the present invention and the existing salient object segmentation method provided in an embodiment of the present invention;
[0036] Fig.13 A schematic diagram of an image processing device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0037] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0038] Embodiment 1:
[0039] First, refer to Figure 2 An electronic device 100 for implementing an embodiment of the present invention is described. The electronic device can be used to execute the image processing method of each embodiment of the present invention.
[0040] like Figure 2 As shown, the electronic device 100 includes one or more processors 102, one or more memories 104, an input device 106, an output device 108, and a camera 110, and these components are interconnected via a bus system 112 and / or other forms of connection mechanisms (not shown). It should be noted that Figure 2 The components and structures of the electronic device 100 shown are merely exemplary and non-limiting. The electronic device may also have other components and structures as required.
[0041] The processor 102 can be implemented in at least one hardware form of a digital signal processor (DSP), a field programmable gate array (FPGA), a programmable logic array (PLA) and an ASIC (Application Specific Integrated Circuit). The processor 102 can be a central processing unit (CPU) or other forms of processing units with data processing capabilities and / or instruction execution capabilities, and can control other components in the electronic device 100 to perform desired functions.
[0042] The memory 104 may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 102 may run the program instructions to implement the client functions (implemented by the processor) and / or other desired functions in the embodiments of the present invention described below. Various applications and various data, such as various data used and / or generated by the application, may also be stored in the computer-readable storage medium.
[0043] The input device 106 may be a device used by a user to input instructions, and may include one or more of a keyboard, a mouse, a microphone, a touch screen, and the like.
[0044] The output device 108 may output various information (eg, images or sounds) to the outside (eg, a user), and may include one or more of a display, a speaker, and the like.
[0045] The camera 110 is used to acquire an image to be processed, wherein the image to be processed acquired by the camera is processed by the image processing method to obtain a salient object mask corresponding to the image to be processed. For example, the camera can capture an image desired by a user (such as a photo, video, etc.), and then process the image by the image processing method to obtain a salient object mask corresponding to the image to be processed. The camera can also store the captured image in the memory 104 for use by other components.
[0046] Exemplarily, the electronic device for implementing the image processing method according to the embodiment of the present invention may be implemented as an intelligent mobile terminal such as a smart phone, a tablet computer, etc.
[0047] Embodiment 2:
[0048] According to an embodiment of the present invention, an embodiment of an image processing method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0049] Figure 3 is a flowchart of an image processing method according to an embodiment of the present invention. Figure 3 As shown, the method comprises the following steps:
[0050] Step S302, obtaining an image to be processed, and performing feature extraction on the image to be processed to obtain a multi-scale feature map;
[0051] In an embodiment of the present invention, the multi-scale feature map represents a feature map of different sizes (i.e., different heights and widths). Feature extraction can be a downsampling process of multi-layer convolution. Each time the image to be processed undergoes a layer of downsampling, a feature map of a scale can be obtained. The feature map of this scale includes multiple sub-feature maps, which are actually multi-channel matrices (the matrix of each channel is a two-dimensional matrix). The matrix of each channel can correspond to a sub-feature map, wherein the number of elements in each row of the matrix represents the width of the sub-feature map corresponding to the channel, and the number of elements in each column of the matrix represents the height of the sub-feature map corresponding to the channel.
[0052] Step S304, performing enhancement processing on the portion corresponding to the salient object in the multi-scale feature map to obtain a multi-scale enhanced feature map;
[0053] The inventors consider that a salient object is only related to the pixel values of its neighborhood, and the more prominent the salient object is in the image, the higher the accuracy of the salient object mask obtained by segmentation. Therefore, after obtaining the multi-scale feature map, the part corresponding to the salient object in the multi-scale feature map is enhanced. After the part corresponding to the salient object is enhanced, its features are more prominent. In this way, after the multi-scale enhanced feature map is restored, the salient object mask obtained will be more accurate.
[0054] The strengthening process will be described in detail below and will not be elaborated here.
[0055] Step S306: performing image restoration on the multi-scale enhanced feature map to obtain a salient object mask corresponding to the image to be processed.
[0056] Specifically, enhanced feature maps of multiple scales are upsampled. During the upsampling process, enhanced feature maps of different scales are fused to obtain a salient object mask corresponding to the image to be processed.
[0057] In an embodiment of the present invention, first, an image to be processed is obtained, and feature extraction is performed on the image to be processed to obtain a multi-scale feature map; then, the portion corresponding to the salient object in the multi-scale feature map is enhanced to obtain a multi-scale enhanced feature map; finally, the multi-scale enhanced feature map is restored to obtain a salient object mask corresponding to the image to be processed. From the above description, it can be seen that after the portion corresponding to the salient object in the multi-scale feature map is enhanced, the feature map corresponding to the salient object in the obtained multi-scale enhanced feature map is more prominent, and finally, after the multi-scale enhanced feature map is restored, the salient object mask obtained by segmentation is more accurate, which alleviates the technical problem of poor accuracy of the existing salient object segmentation method when processing images.
[0058] The above content briefly introduces the image processing method of the present invention. The specific contents involved therein are described in detail below.
[0059] In an optional embodiment of the present invention, step S302, the step of extracting features from the image to be processed includes the following processes (1)-(2):
[0060] (1) Perform multi-layer downsampling on the image to be processed to obtain multi-scale original feature maps;
[0061] Specifically, refer to Figure 4 , multi-layer downsampling can be the downsampling of multi-layer convolution. After each layer of downsampling, an original feature map of one scale can be obtained. In this way, original feature maps of multiple scales can be obtained.
[0062] It should be noted that, through experiments, it is found that the high-dimensional original feature map in the multi-scale original feature map (such as the original feature map obtained by downsampling above the third layer) has a greater impact on the accuracy of image processing, and the low-dimensional original feature map (such as the original feature map obtained by downsampling the first layer and the second layer) has little effect on the accuracy of image processing. In order to improve the efficiency of image processing, the results of downsampling the first layer and the second layer can be ignored, that is, the subsequent process does not process the original feature map obtained by downsampling the first layer and the second layer, such as Figure 4 shown.
[0063] (2) Optimize the high-dimensional original feature map in the multi-scale original feature map to obtain a multi-scale feature map.
[0064] The specific process includes the following:
[0065] 21) performing a first optimization process on a target original feature map in the multi-scale original feature map to obtain a first optimized feature map, wherein the target original feature map is a high-dimensional original feature map in the multi-scale original feature map except for the highest-dimensional original feature map;
[0066] refer to Figure 4 , the high-dimensional original feature maps except the highest-dimensional original feature map in the multi-scale original feature map are first optimized, that is, Figure 4 The specific process of the first optimization process (SRB process) is: using the first optimization module to optimize the target original feature map to obtain a first initial optimized feature map, wherein the first optimization module includes: a preset number of first convolutional layers; adding the first initial optimized feature map and its corresponding target original feature map to obtain the first optimized feature map.
[0067] In the embodiment of the present invention, the preset number of first convolutional layers may be two 3x3 convolutional layers, referring to Figure 5 After the target original feature map passes through two 3x3 convolutional layers in series, a first initial optimized feature map is obtained, and then the first initial optimized feature map is added to the corresponding target original feature map to obtain the first optimized feature map.
[0068] The fact that the feature map is actually a multidimensional matrix has been explained above, so the process of adding the first initial optimized feature map and its corresponding target original feature map is actually the process of adding the corresponding elements in the multidimensional matrix.
[0069] 22) performing a second optimization process on the highest-dimensional original feature map in the multi-scale original feature map to obtain a second optimized feature map;
[0070] refer to Figure 4 , the second optimization process is performed on the highest dimensional original feature map in the multi-scale original feature map, that is, Figure 4 The specific process of the second optimization process (GRB process) is as follows: the second optimization module is used to optimize the original feature map of the highest dimension to obtain the optimization weight, wherein the second optimization module includes: a second convolution layer, a global pooling layer and a Sigmoid function processing layer; the optimization weight is multiplied by the original feature map of the highest dimension to obtain the second initial optimized feature map; the second initial optimized feature map and the original feature map of the highest dimension are added to obtain the second optimized feature map.
[0071] In the embodiment of the present invention, the second convolutional layer may be a 1x1 convolutional layer. Figure 6, the highest dimensional original feature map passes through the 1x1 convolution layer, the global pooling layer, the 1x1 convolution layer and the Sigmoid function in turn to obtain the optimized weight, which is then multiplied by the highest dimensional original feature map, and the result of the operation is added to the highest dimensional original feature map to obtain the second optimized feature map.
[0072] Similarly, the product operation is the process of multiplying the optimization weights with the elements in the two-dimensional matrix, and the sum operation is the process of summing the corresponding elements in the two-dimensional matrix.
[0073] 23) The first optimized feature map and the second optimized feature map are used as multi-scale feature maps.
[0074] The following is a detailed description of the process of enhancing the portion corresponding to the salient object in the multi-scale feature map.
[0075] In an alternative embodiment of the present invention, reference Figure 7 Step S304, the step of enhancing the portion corresponding to the salient object in the multi-scale feature map includes:
[0076] Step S701, obtaining the initial position of the salient object according to the multi-scale feature map;
[0077] Specifically, the process includes: performing dimensionality reduction processing on the highest-dimensional feature map in the multi-scale feature map to obtain a single-channel feature map; performing binarization processing on the single-channel feature map to obtain a single-channel binary feature map; and determining the initial position of the salient object according to the single-channel binary feature map.
[0078] refer to Figure 4 , the second optimized feature map (i.e., the highest dimensional feature map in the multi-scale feature map) after GRB processing (second optimization processing) is reduced in dimension through a convolutional layer to obtain a single-channel feature map (N*M, with 1 channel), and then the single-channel feature map is binarized to obtain a single-channel binary feature map (such as Figure 4 In the above single-channel binary feature map, the part represented by 1 is the part corresponding to the salient object, and then the initial position of the salient object can be determined according to the position of 1. The initial position can be the position determined by the leftmost 1, the rightmost 1, the topmost 1 and the bottommost 1 in the single-channel binary feature map.
[0079] Step S702, according to the initial position, at least two different expansion scales, cropping the highest-dimensional feature map in the multi-scale feature map to obtain a plurality of cropped feature maps, wherein the plurality of cropped feature maps contain feature information of the salient object;
[0080] Specifically, the process includes: determining the pixel width and pixel height of the salient object according to the initial position; determining the expanded pixel width and expanded pixel height according to the expansion scale, pixel width and pixel height; and cropping along the position after the initial position is expanded by the expanded pixel width and expanded pixel height in the highest-dimensional feature map. The cropped feature map is cropped with the initial position of the object as the center after a certain expansion, so it contains the salient object, and also contains the feature information of the salient object.
[0081] For example, when the expansion scale is 10%, if the pixel width and pixel height of the salient object are 30*30, then the expanded pixel width (i.e., 10% of 30) is 3 pixels, and the expanded pixel height (i.e., 10% of 30) is 3 pixels. That is, in the highest-dimensional feature map, the initial position is expanded (i.e., increased) by 3 background pixels to the left and right, and the initial position is expanded by 3 background pixels to the top and bottom, and then cropped. The reason for such expansion is that the feature map corresponding to the salient object obtained by direct binarization has poor accuracy and is not necessarily the entire salient object, so it needs to be expanded outward to include all the salient objects.
[0082] The above expansion scale can also be 30%, 50%, etc., and the embodiment of the present invention does not impose any specific restrictions on the above expansion scale. Different cropping feature maps will be cropped according to different expansion scales, so the number of expansion scales is equal to the number of cropping feature maps.
[0083] Step S703, taking one or more of the multi-scale feature maps as target feature maps, taking each target feature map as the current target feature map, calculating the correlation between the multiple cropping feature maps and the current target feature map, and obtaining multiple correlation feature maps of the current feature map that correspond one to one with the multiple cropping feature maps;
[0084] The above-mentioned target feature map may be one or more of the multi-scale feature maps, and the embodiment of the present invention does not impose any specific limitation on it.
[0085] Specifically, the process includes: scaling multiple cropped feature maps to a preset scale to obtain multiple cropped feature maps of the preset scale; taking each target feature map as the current target feature map one by one, and sliding the sliding window on the current target feature map with the preset scale; performing a product operation on the feature map included in the sliding window after each sliding and each cropped feature map in the multiple cropped feature maps of the preset scale, and obtaining multiple correlation feature maps of the current target feature map corresponding to the multiple cropped feature maps one by one according to the result of the product operation.
[0086] In order to better understand the process, the above process is described below with a specific example: if the cropped feature map of the preset scale is a 32*32*64 image B, and the current target feature map is a 64*64*128 image A.
[0087] To simplify the description, we first use a 32*32*1 B1 image and a 64*64*1 A1 image as an example. On the A1 image, a 32*32 sliding window is used to slide in sequence according to a preset sliding step. Each time a sliding window is used, a 32*32 small block is obtained. The small block is multiplied with the 32*32 B1 image to obtain a new 32*32 small block. After all sliding is completed, a correlation feature map of the A1 image and the B1 image can be obtained. The size of the correlation feature map is 64*64*1.
[0088] When calculating the correlation feature map of the 32*32*1 B2 map and the 64*64*128 A2 map, a 32*32 sliding window is used on each channel of the A2 map to slide in sequence according to the preset sliding step size. Each time it slides, a 32*32 small block can be obtained. The small block is multiplied with the 32*32 B2 map to obtain a new 32*32 small block. After all channels are slid, the correlation feature map of the A2 map and the B2 map can be obtained. The size of the correlation feature map is 64*64*128;
[0089] When calculating the correlation feature map of 32*32*64 image B and 64*64*128 image A, each dimension of 32*32*64 is calculated with 64*64*128 according to the above process to obtain a 64*64*128 correlation feature map, and then these 64 are added together to obtain a final 64*64*128 correlation feature map, which is the correlation feature map of image A and image B.
[0090] Step S704, obtaining an enhanced feature map corresponding to the current target feature map according to the multiple correlation feature maps and the current target feature map.
[0091] refer to Figure 8 , specifically including the following process:
[0092] Step S801, performing a product operation on each correlation feature map in the plurality of correlation feature maps and the current target feature map to obtain a plurality of first enhanced feature maps corresponding to the current target feature map;
[0093] After performing the above product operation, the part corresponding to the salient object in the current target feature map is enhanced.
[0094] Step S802, connecting the plurality of first enhanced feature maps in series with the current target feature map to obtain a second enhanced feature map corresponding to the current target feature map;
[0095] For example, multiple first enhanced feature maps are two 64*64*128 (corresponding to the width W*height H*number of channels C of the map), which are connected in series with the 64*64*128 target feature map to obtain a 64*64*384 second enhanced feature map. The series connection means adding the number of channels.
[0096] Step S803, obtaining a position enhancement feature map corresponding to the current target feature map, and connecting the second enhancement feature map and the position enhancement feature map in series to obtain an enhancement feature map corresponding to the target feature map, wherein the scale of the position enhancement feature map is the same as the scale of the second enhancement feature map.
[0097] The specific process is as follows:
[0098] a) on the target matrix, the center line of the salient object in the X direction and the center line of the salient object in the Y direction are determined based on the initial position of the salient object. The target matrix is a single-channel matrix with the same scale as the second enhanced feature map, and the value of each element of the target matrix can be 0;
[0099] b) setting the center line of the target matrix in the Y direction as the first target value, and linearly transforming it into the second target value along the X direction to obtain a position enhancement feature map in the X direction;
[0100] c) setting the center line of the target matrix in the X direction as the first target value, and linearly transforming it into the second target value along the Y direction to obtain a position enhancement feature map in the Y direction;
[0101] d) The position enhancement feature map in the X direction and the position enhancement feature map in the Y direction are used as the position enhancement feature map.
[0102] The first target value may be 1, and the second target value may be 0. A schematic diagram of obtaining a position enhancement feature map based on the initial position of a salient object is shown in FIG. Fig. 9 shown.
[0103] The above strengthening process (expressed in LCB) can be referred to Fig.10, according to the binary feature map of a single channel, the positioning information of the part corresponding to the salient object (including the initial position, pixel width, pixel height, center line in the X direction and center line in the Y direction of the salient object) is determined, and then according to the positioning information, the highest dimensional feature map in the multi-scale feature map is cropped with at least two different expansion scales to obtain multiple cropped feature maps. At the same time, a position enhancement feature map is determined according to the positioning information, and then a correlation feature map between the multiple cropped feature maps and the current target feature map in the multi-scale feature map is calculated, and the correlation feature map is multiplied with the current target feature map, and the result is connected in series with the current target feature map and the position enhancement feature map corresponding to the current target feature map, and finally the enhancement feature map corresponding to the current target feature map is obtained, thereby obtaining the enhancement feature map corresponding to each target feature map.
[0104] The enhanced feature map greatly enhances the characteristic part of the salient object therein, so that the accuracy of the salient object mask obtained by segmentation is higher.
[0105] In an optional embodiment of the present invention, upsampling the multi-scale enhanced feature maps to obtain a salient object mask corresponding to the image to be processed includes: fusing enhanced feature maps of different scales to obtain a salient object mask corresponding to the image to be processed.
[0106] In the embodiment of the present invention, the upsampling fusion process may be: Figure 4 As shown in FIG. 1 , the enhanced feature map of the 5th layer (i.e., the feature map obtained after downsampling the 5th layer is processed by GRB and then processed by LCB) must first be processed by SRB (SRB processing has been introduced above and will not be repeated here), and then upsampled. The upsampled feature map is added to the enhanced feature map of the 4th layer, and then processed by SRB. After processing, it is upsampled again, and the upsampled feature map is added to the enhanced feature map of the 3rd layer, and then processed by SRB, and finally enlarged by 4 times to obtain a significant object mask.
[0107] The inventors trained and tested the image processing method of the present invention (represented by LCANet) and the existing salient object segmentation method on multiple public datasets (including DUTS-TE dataset, ECSSD dataset, HKU-IS dataset, PASCAL-S dataset and DUT-OM dataset). The results are as follows: Fig.11 As shown in FIG. 1 , it is shown that when the image processing method of the present invention is used to process the image, the accuracy of the salient object mask obtained is higher ( Fig.11 For the maxF parameter, the larger its value, the higher the accuracy. For the MAE parameter, the smaller its value, the higher the accuracy. Fig.12,It can also be seen from the visualization results that the ,image processing method of the present invention has better accuracy. Fig.12 In the figure, the GT column represents the manually labeled salient object segmentation results, the LCANet column represents the salient object segmentation results of the present invention, and the other columns represent the salient object segmentation results obtained by other methods (the corresponding method is marked below each column). By comparison, it can be seen that the salient object segmentation results obtained by the method of the present invention are closer to the manually labeled salient object segmentation results, which means that the method of the present invention has better accuracy than other existing methods.
[0108] Embodiment 3:
[0109] The embodiment of the present invention further provides an image processing device, which is mainly used to execute the image processing method provided by the above content of the embodiment of the present invention. The image processing device provided by the embodiment of the present invention is specifically introduced below.
[0110] Fig.13 is a schematic diagram of an image processing device according to an embodiment of the present invention. Fig.13 As shown, the image processing device mainly includes: a feature extraction unit 10, an enhancement processing unit 20 and an image restoration unit 30, wherein:
[0111] A feature extraction unit is used to obtain an image to be processed, and perform feature extraction on the image to be processed to obtain a multi-scale feature map;
[0112] An enhancement processing unit, used for enhancing the portion corresponding to the salient object in the multi-scale feature map to obtain a multi-scale enhanced feature map;
[0113] The image restoration unit is used to restore the multi-scale enhanced feature map to obtain a salient object mask corresponding to the image to be processed.
[0114] In an embodiment of the present invention, first, an image to be processed is obtained, and feature extraction is performed on the image to be processed to obtain a multi-scale feature map; then, the portion corresponding to the salient object in the multi-scale feature map is enhanced to obtain a multi-scale enhanced feature map; finally, the multi-scale enhanced feature map is restored to obtain a salient object mask corresponding to the image to be processed. From the above description, it can be seen that after the portion corresponding to the salient object in the multi-scale feature map is enhanced, the feature map corresponding to the salient object in the obtained multi-scale enhanced feature map is more prominent, and finally, after the multi-scale enhanced feature map is restored, the salient object mask obtained by segmentation is more accurate, which alleviates the technical problem of poor accuracy of the existing salient object segmentation method when processing images.
[0115] Optionally, the feature extraction unit is further used to: perform multi-layer downsampling processing on the image to be processed to obtain a multi-scale original feature map; and perform optimization processing on the multi-scale original feature map to obtain a multi-scale feature map.
[0116] Optionally, the feature extraction unit is also used to: perform a first optimization process on a target original feature map in the multi-scale original feature map to obtain a first optimized feature map, wherein the target original feature map is a feature map other than the highest dimensional original feature map in the multi-scale original feature map; perform a second optimization process on the highest dimensional original feature map in the multi-scale original feature map to obtain a second optimized feature map; and use the first optimized feature map and the second optimized feature map as the multi-scale feature map.
[0117] Optionally, the feature extraction unit is also used to: use a first optimization module to optimize the target original feature map to obtain a first initial optimized feature map, wherein the first optimization module includes: a preset number of first convolutional layers; add the first initial optimized feature map and its corresponding target original feature map to obtain the first optimized feature map.
[0118] Optionally, the feature extraction unit is also used to: use a second optimization module to optimize the highest dimensional original feature map to obtain an optimized weight, wherein the second optimization module includes: a second convolutional layer, a global pooling layer, and a Sigmoid function processing layer; multiply the optimized weight by the highest dimensional original feature map to obtain a second initial optimized feature map; add the second initial optimized feature map and the highest dimensional original feature map to obtain a second optimized feature map.
[0119] Optionally, the enhancement processing unit is also used to: obtain an initial position of a salient object according to a multi-scale feature map; according to the initial position, crop the highest-dimensional feature map in the multi-scale feature map with at least two different expansion scales to obtain multiple cropped feature maps, and the multiple cropped feature maps contain feature information of the salient object; use one or more of the multi-scale feature maps as a target feature map, use each target feature map as a current target feature map one by one, calculate the correlation between the multiple cropped feature maps and the current target feature map, and obtain multiple correlation feature maps of the current target feature map that correspond one-to-one to the multiple cropped feature maps; and obtain an enhanced feature map corresponding to the current target feature map based on the multiple correlation feature maps and the current target feature map.
[0120] Optionally, the enhancement processing unit is also used to: perform dimensionality reduction processing on the highest dimensional feature map in the multi-scale feature map to obtain a single-channel feature map; perform binarization processing on the single-channel feature map to obtain a single-channel binary feature map; and determine the initial position of the salient object based on the single-channel binary feature map.
[0121] Optionally, the enhancement processing unit is also used to: determine the pixel width and pixel height of the salient object according to the initial position; determine the expanded pixel width and expanded pixel height according to the expansion scale, pixel width and pixel height; and perform cropping along the position after the initial position is expanded by the expanded pixel width and expanded pixel height in the highest dimensional feature map.
[0122] Optionally, the enhancement processing unit is also used to: scale multiple cropped feature maps to a preset scale to obtain multiple cropped feature maps of the preset scale; slide the preset scale as a sliding window on the current target feature map; multiply the feature map contained in the sliding window after each sliding with the multiple cropped feature maps of the preset scale, and obtain multiple correlation feature maps of the current target feature map that correspond one-to-one to the multiple cropped feature maps according to the result of the multiplication operation.
[0123] Optionally, the enhancement processing unit is also used to: multiply each correlation feature map in the multiple correlation feature maps with the current target feature map to obtain multiple first enhancement feature maps corresponding to the current target feature map; connect the multiple first enhancement feature maps in series with the current target feature map to obtain a second enhancement feature map corresponding to the current target feature map; obtain the position enhancement feature map corresponding to the current target feature map, and connect the second enhancement feature map in series with the position enhancement feature map to obtain an enhancement feature map corresponding to the current target feature map, wherein the scale of the position enhancement feature map is the same as the scale of the second enhancement feature map.
[0124] Optionally, the enhancement processing unit is further used to: determine the center line of the salient object in the X direction and the center line of the Y direction based on the initial position of the salient object; set the center line in the Y direction as a first target value, linearly transform it into a second target value along the X direction, and obtain a position enhancement feature map in the X direction; set the center line in the X direction as the first target value, linearly transform it into a second target value along the Y direction, and obtain a position enhancement feature map in the Y direction; use the position enhancement feature map in the X direction and the position enhancement feature map in the Y direction as the position enhancement feature map.
[0125] Optionally, the image restoration unit is further used to: upsample the multi-scale enhanced feature map to obtain a salient object mask corresponding to the image to be processed.
[0126] The image processing device provided in the embodiment of the present invention has the same implementation principle and technical effects as the method embodiment in the aforementioned embodiment 2. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.
[0127] In another embodiment, a computer-readable medium having a non-volatile program code executable by a processor is provided, wherein the program code enables the processor to execute the steps of the method described in any embodiment of the second embodiment.
[0128] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0129] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0130] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0131] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0132] 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 solution of this embodiment.
[0133] In addition, each functional unit in each embodiment of the present invention 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.
[0134] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0135] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. An image processing method, characterized in that: include: Acquire an image to be processed, and perform feature extraction on the image to be processed to obtain a multi-scale feature map; Performing enhancement processing on the portion corresponding to the salient object in the multi-scale feature map to obtain a multi-scale enhanced feature map; Performing image restoration on the multi-scale enhanced feature map to obtain a salient object mask corresponding to the image to be processed; The step of enhancing the portion corresponding to the salient object in the multi-scale feature map includes: Obtaining an initial position of a salient object according to the multi-scale feature map; According to the initial position, cropping the highest-dimensional feature map in the multi-scale feature map with at least two different expansion scales to obtain a plurality of cropped feature maps, wherein the plurality of cropped feature maps contain feature information of the salient object; Using one or more of the multi-scale feature maps as a target feature map, using each of the target feature maps as a current target feature map, calculating the correlation between the multiple cropping feature maps and the current target feature map, and obtaining a plurality of correlation feature maps of the current target feature map corresponding to the multiple cropping feature maps one by one; According to the multiple correlation feature maps and the current target feature map, an enhanced feature map corresponding to the current target feature map is obtained.
2. The method according to claim 1, characterized in that Extracting features from the image to be processed includes: Performing multi-layer downsampling processing on the image to be processed to obtain a multi-scale original feature map; The multi-scale original feature map is optimized to obtain the multi-scale feature map.
3. The method according to claim 1 or 2, characterized in that: Optimizing the multi-scale original feature map includes: Performing a first optimization process on a target original feature map in the multi-scale original feature map to obtain a first optimized feature map, wherein the target original feature map is a feature map in the multi-scale original feature map except for the highest-dimensional original feature map; Performing a second optimization process on the highest-dimensional original feature map in the multi-scale original feature map to obtain a second optimized feature map; The first optimized feature map and the second optimized feature map are used as the multi-scale feature maps.
4. The method according to claim 3, characterized in that Performing a first optimization process on the target original feature map in the multi-scale original feature map includes: Utilizing a first optimization module to optimize the target original feature map to obtain a first initially optimized feature map, wherein the first optimization module comprises: a preset number of first convolutional layers; The first initially optimized feature map is added to its corresponding target original feature map to obtain the first optimized feature map.
5. The method according to claim 3 or 4, characterized in that: The second optimization process of the highest-dimensional original feature map in the multi-scale original feature map includes: Utilizing a second optimization module to optimize the highest dimensional original feature map to obtain an optimized weight, wherein the second optimization module comprises: a second convolutional layer, a global pooling layer, and a Sigmoid function processing layer; Performing a product operation on the optimized weight and the highest-dimensional original feature map to obtain a second initial optimized feature map; The second initially optimized feature map and the highest dimensional original feature map are added to obtain the second optimized feature map.
6. The method according to claim 1, characterized in that Obtaining the initial position of the salient object according to the multi-scale feature map includes: Performing dimensionality reduction processing on the highest-dimensional feature map in the multi-scale feature map to obtain a single-channel feature map; Binarizing the single-channel feature map to obtain a binary feature map of the single channel; An initial position of the salient object is determined according to the binary feature map of the single channel.
7. The method according to claim 1 or 6, characterized in that: According to the initial position, cropping the highest-dimensional feature map in the multi-scale feature map at at least two different expansion scales includes: Determining a pixel width and a pixel height of the salient object according to the initial position; Determining an expanded pixel width and an expanded pixel height according to the expansion scale, the pixel width and the pixel height; In the highest-dimensional feature map, cropping is performed along the position after the initial position is expanded by the expanded pixel width and the expanded pixel height.
8. The method according to any one of claims 1, 6-7, characterized in that: Calculating the correlation between the multiple cropping feature maps and the current target feature map includes: Scaling the multiple cropping feature maps to a preset scale to obtain multiple cropping feature maps of the preset scale; Sliding the current target feature map using the preset scale as a sliding window; The feature map included in the sliding window after each sliding is multiplied by the multiple cropped feature maps of the preset scale, and a plurality of correlation feature maps corresponding to the multiple cropped feature maps of the current target feature map are obtained according to the result of the multiplication operation.
9. The method according to any one of claims 1, 6-8, characterized in that: Obtaining, according to the multiple correlation feature maps and the current target feature map, an enhanced feature map corresponding to the current target feature map comprises: Performing a product operation on each of the multiple correlation feature maps and the current target feature map to obtain multiple first enhanced feature maps corresponding to the current target feature map; Connecting the plurality of first enhanced feature maps in series with the current target feature map to obtain a second enhanced feature map corresponding to the current target feature map; A position enhancement feature map corresponding to the current target feature map is obtained, and the second enhancement feature map and the position enhancement feature map are connected in series to obtain an enhancement feature map corresponding to the current target feature map, wherein the scale of the position enhancement feature map is the same as the scale of the second enhancement feature map.
10. The method according to claim 9, characterized in that Obtaining the position enhancement feature map corresponding to the current target feature map includes: Determining a center line of the salient object in an X direction and a center line of the salient object in a Y direction based on an initial position of the salient object; The center line in the Y direction is set as a first target value, and linearly transformed into a second target value along the X direction to obtain a position enhancement feature map in the X direction; The center line in the X direction is set as the first target value, and linearly transformed into the second target value along the Y direction to obtain a position enhancement feature map in the Y direction; The position enhancement feature map in the X direction and the position enhancement feature map in the Y direction are used as the position enhancement feature map.
11. The method according to any one of claims 1 to 10, characterized in that: Performing image restoration on the multi-scale enhanced feature map includes: The multi-scale enhanced feature map is up-sampled to obtain a salient object mask corresponding to the image to be processed.
12. An image processing device, characterized in that: include: A feature extraction unit, used to obtain an image to be processed, and perform feature extraction on the image to be processed to obtain a multi-scale feature map; An enhancement processing unit, used for performing enhancement processing on the portion corresponding to the salient object in the multi-scale feature map to obtain a multi-scale enhanced feature map; An image restoration unit, used for performing image restoration on the multi-scale enhanced feature map to obtain a salient object mask corresponding to the image to be processed; Among them, the enhancement processing unit is also used to: obtain the initial position of the salient object according to the multi-scale feature map; according to the initial position, crop the highest dimensional feature map in the multi-scale feature map with at least two different expansion scales to obtain multiple cropped feature maps, and the multiple cropped feature maps contain feature information of the salient object; use one or more of the multi-scale feature maps as the target feature map, and use each of the target feature maps as the current target feature map one by one, calculate the correlation between the multiple cropped feature maps and the current target feature map, and obtain multiple correlation feature maps of the current target feature map that correspond one-to-one to the multiple cropped feature maps; according to the multiple correlation feature maps and the current target feature map, obtain the enhanced feature map corresponding to the current target feature map.
13. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 11 are implemented.
14. A computer readable medium having a non-volatile program code executable by a processor, characterized in that: The program code causes the processor to execute the steps of the method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Image semantic segmentation method and device, electronic device and computer-readable medium
CN109447990A
Saliency detection method and device
CN109741293A
Image labeling method and device based on multi-model fusion, computer equipment and storage medium
CN110097564A
Image recognition method and related device
CN111126258A
Dermatoscope image enhancement and classification method based on DCNNs and GANs
CN111179193A
