Image processing method, device, electronic device and storage medium
Through multi-level processing of pre-trained matting models and image reconstruction models, the problem that matting performance depends on label quality in the existing technology is solved, and the image quality and resolution of image processing are improved.
Patent Information
- Application Number
- CN202210057041.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-18
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2042-01-18
AI Technical Summary
Existing image processing methods rely on masked data sets, and matting performance depends on labeling quality, resulting in low image quality after matting.
The backbone network of the pre-trained matting model is used for preliminary matting processing, the edge area of the initial foreground image is locally refined through the fine-tuning network, and the pre-trained image reconstruction model is used for super-resolution reconstruction, and finally the Image fusion of standard foreground and background images.
The quality of the target image after cutout is improved, the clarity and resolution of the foreground image are improved through multi-level processing, and the cutout effect is enhanced.
Smart Images

Figure CN114399454B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image processing method, device, electronic device and storage medium. Background Art
[0002] At present, many methods often rely on mask datasets to learn cutouts, such as context-aware cutouts, index cutouts, sampling-based cutouts, and opacity propagation-based cutouts. The performance of these methods depends on the quality of the labels, which often results in lower quality images after cutouts. Therefore, how to provide an image processing method that can improve the quality of images after cutouts has become a technical problem that needs to be solved urgently. Summary of the invention
[0003] The main purpose of the embodiments of the present application is to propose an image processing method, device, electronic device and storage medium, aiming to improve the image quality of the target image after cutout.
[0004] To achieve the above object, a first aspect of an embodiment of the present application provides an image processing method, the method comprising:
[0005] Obtain the original image to be processed;
[0006] Performing preliminary cutout processing on the original image through a backbone network of a pre-trained cutout model to obtain an initial foreground image;
[0007] Performing local refinement processing on the edge area of the initial foreground image through the fine-tuning network of the cutout model to obtain a target foreground image;
[0008] Performing super-resolution reconstruction processing on the target foreground image through a pre-trained image reconstruction model to obtain a standard foreground image, wherein the resolution of the standard foreground image is higher than the resolution of the target foreground image;
[0009] The standard foreground image and the preset background image are fused to obtain a target image.
[0010] In some embodiments, performing preliminary cutout processing on the original image through a preset cutout model backbone network to obtain an initial foreground image includes:
[0011] Performing convolution processing on the original image to obtain an original image matrix;
[0012] Performing feature extraction on the original image matrix to obtain a predicted foreground value;
[0013] The original image is subjected to preliminary cutout processing according to the predicted foreground value to obtain the initial foreground image.
[0014] In some embodiments, the step of performing local refinement processing on the edge region of the initial foreground image by using the fine-tuning network of the cutout model to obtain the target foreground image includes:
[0015] Obtaining an edge prediction value for each pixel in the initial foreground image;
[0016] Determining edge pixel points of the initial foreground image according to a magnitude relationship between the edge prediction value and a preset edge prediction threshold;
[0017] The edge pixels of the initial foreground image are filtered to obtain the target foreground image.
[0018] In some embodiments, the step of performing super-resolution reconstruction on the target foreground image using a pre-trained image reconstruction model to obtain a standard foreground image includes:
[0019] Performing super-resolution reconstruction processing on the target foreground image through the generative network of the image reconstruction model to obtain an intermediate foreground image;
[0020] The intermediate foreground image is optimized by using the discriminant network of the image reconstruction model and a preset reference foreground image to obtain a standard foreground image.
[0021] In some embodiments, the standard foreground image and the preset background image are fused to obtain a target image.
[0022] ,include:
[0023] Performing feature extraction on the standard foreground image to obtain a foreground feature value, and performing feature extraction on the background image to obtain a background feature value;
[0024] Performing an XOR calculation on a preset channel bitmap according to the foreground feature value and the background feature value to obtain a target channel bitmap;
[0025] The standard foreground image and the background image are fused according to the target channel bitmap to obtain a target image.
[0026] In some embodiments, before performing preliminary cutout processing on the original image through the backbone network of the preset cutout model to obtain the initial foreground image, the method further includes pre-training the cutout model, specifically including:
[0027] Acquire a sample image, wherein the resolution of the sample image is lower than the resolution of a preset reference image;
[0028] Inputting the sample image into the cutout model;
[0029] Performing convolution processing on the sample image through the backbone network to obtain a sample image matrix, and performing feature extraction on the sample image matrix to obtain a sample predicted foreground value;
[0030] Performing preliminary cutout processing on the sample image through the backbone network and the sample predicted foreground value to obtain a sample foreground image;
[0031] Obtaining a sample edge prediction value of each sample pixel point in the sample foreground image through the fine-tuning network;
[0032] Determining the number of sample edge pixel points according to the size relationship between the sample edge prediction value and a preset edge prediction threshold;
[0033] The loss function of the cutout model is optimized according to the number of edge pixels of the sample to update the cutout model.
[0034] In some embodiments, before performing super-resolution reconstruction processing on the target foreground image by using a pre-trained image reconstruction model to obtain a standard foreground image, the method further includes pre-training the image reconstruction model, specifically including:
[0035] Acquire a sample image, wherein the resolution of the sample image is lower than the resolution of a preset reference image;
[0036] Performing preliminary cutout processing and local refinement processing on the sample image to obtain a sample foreground image;
[0037] Inputting the sample foreground image into the initial model;
[0038] Performing super-resolution reconstruction processing on the sample foreground image through the generation network of the initial model to generate a sample intermediate foreground image corresponding to the sample foreground image, wherein the resolution of the sample intermediate foreground image is higher than that of the sample foreground image;
[0039] The discriminant network of the initial model calculates the similarity between the sample intermediate foreground image and the reference sample foreground image to obtain a similarity probability value;
[0040] The loss function of the initial model is optimized according to the similarity probability value to update the initial model and obtain the image reconstruction model.
[0041] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application provides an image processing device, the device comprising:
[0042] An original image acquisition module, used to acquire the original image to be processed;
[0043] A preliminary cutout module, used for performing initial cutout processing on the original image through a preset cutout model backbone network to obtain an initial foreground image;
[0044] A local refinement module, configured to perform local refinement processing on the edge area of the initial foreground image through the fine-tuning network of the cutout model to obtain a target foreground image;
[0045] A super-resolution reconstruction module, used to perform super-resolution reconstruction processing on the target foreground image through a pre-trained image reconstruction model to obtain a standard foreground image, wherein the resolution of the standard foreground image is higher than the resolution of the target foreground image;
[0046] The image fusion module is used to fuse the standard foreground image and the preset background image to obtain a target image.
[0047] To achieve the above-mentioned purpose, the third aspect of an embodiment of the present application proposes an electronic device, which includes a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for realizing connection and communication between the processor and the memory, and the program, when executed by the processor, implements the method described in the first aspect above.
[0048] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application proposes a storage medium, which is a computer-readable storage medium used for computer-readable storage, and the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the method described in the first aspect above.
[0049] The image processing method, device, electronic device and storage medium proposed in the present application obtain the original image to be processed; perform preliminary cutout processing on the original image through the backbone network of the pre-trained cutout model to obtain an initial foreground image; perform local refinement processing on the edge area of the initial foreground image through the fine-tuning network of the cutout model to obtain a target foreground image, so that a foreground image with a good cutout effect can be obtained through the cutout model. Furthermore, the target foreground image is subjected to super-resolution reconstruction processing through the pre-trained image reconstruction model to obtain a standard foreground image, wherein the resolution of the standard foreground image is higher than the resolution of the target foreground image, and a clearer standard foreground image can be obtained, which enhances the cutout effect from the visual effect. Finally, the standard foreground image and the preset background image are image fused to obtain the target image, so that the target image has a higher resolution, thereby improving the image quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 is a flowchart of an image processing method provided in an embodiment of the present application;
[0051] Figure 2 is another flow chart of the image processing method provided by an embodiment of the present application;
[0052] Figure 3 yes Figure 1 Flow chart of step S102 in FIG.
[0053] Figure 4 yes Figure 1 Flow chart of step S103 in FIG.
[0054] Figure 5 is another flow chart of the image processing method provided by an embodiment of the present application;
[0055] Figure 6 yes Figure 1 Flow chart of step S104 in FIG.
[0056] Figure 7 yes Figure 1 Flow chart of step S105 in FIG.
[0057] Figure 8 is a structural schematic diagram of an image processing device provided in an embodiment of the present application;
[0058] Fig. 9 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0059] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0060] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0061] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0062] First, some nouns involved in this application are analyzed:
[0063] Artificial intelligence (AI) is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. AI is a branch of computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a similar way to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing and expert systems. AI can simulate the information process of human consciousness and thinking. AI is also a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0064] Natural language processing (NLP): NLP uses computers to process, understand and apply human languages (such as Chinese, English, etc.). NLP is a branch of artificial intelligence and an interdisciplinary subject between computer science and linguistics. It is often referred to as computational linguistics. Natural language processing includes grammatical analysis, semantic analysis, and text comprehension. Natural language processing is commonly used in technical fields such as machine translation, handwritten and printed character recognition, speech recognition and text-to-speech conversion, information image processing, information extraction and filtering, text classification and clustering, public opinion analysis and opinion mining. It involves data mining related to language processing, machine learning, knowledge acquisition, knowledge engineering, artificial intelligence research, and linguistic research related to language computing.
[0065] Information Extraction (NER): A text processing technology that extracts specified types of entity, relationship, event and other factual information from natural language text and forms structured data output. Information extraction is a technology that extracts specific information from text data. Text data is composed of some specific units, such as sentences, paragraphs, and chapters. Text information is composed of some small specific units, such as characters, words, phrases, sentences, paragraphs, or a combination of these specific units. Extracting noun phrases, names, place names, etc. from text data are all text information extraction. Of course, the information extracted by text information extraction technology can be various types of information.
[0066] Computed Tomography (CT): It uses precisely collimated X-ray beams, gamma rays, ultrasound, etc., together with extremely sensitive detectors to perform cross-sectional scans around a certain part of the human body one by one. It has the characteristics of fast scanning time and clear images, and can be used to detect a variety of diseases. According to the different rays used, it can be divided into: X-ray CT (X-CT) and gamma-ray CT (γ-CT), etc.
[0067] Image matting refers to the process where the network can automatically extract the foreground part of a given image and delete the background part. It is a common method in the field of image enhancement.
[0068] Residual Network: Residual Network: Fully utilize all hierarchical features of the original LR image through residual dense blocks (RDBs). For a very deep network, it is difficult and impractical to directly extract the output of each convolutional layer in the LR space. Residual dense blocks (RDBs) are used as the building blocks of RDN. RDBs contain densely connected layers and local feature fusion (LFF) with local residual learning (LRL). Residual dense blocks also support continuous memory between RDBs. The output of one RDB can directly access the layers of the next RDB, allowing continuous state transfer. Each convolutional layer of RDB can access all subsequent layers to pass the information that needs to be retained. LFF extracts local dense features by adaptively preserving information by connecting the previous RDB with the states of all previous layers of the current RDB. In addition, LFF achieves extremely high growth rates by stabilizing the training of larger networks. After extracting multiple layers of local dense features, global feature fusion (GFF) is further performed to adaptively preserve hierarchical features in a global manner. Each layer has direct access to the original LR input, resulting in implicit deep supervised learning. The residual network is easy to optimize and can improve accuracy by increasing the depth. The residual block inside it uses skip connections to alleviate the gradient vanishing problem caused by increasing the depth in the deep neural network. The residual network is composed of a series of residual blocks. The residual block is divided into two parts: the direct mapping part and the residual part. The residual part is generally composed of two or three convolution operations.
[0069] Fully connected layer (FC): Each node of the fully connected layer is connected to all nodes of the previous layer, which is used to integrate the features extracted previously. Due to its fully connected characteristics, the fully connected layer generally has the most parameters. It plays the role of a "classifier" in the entire convolutional neural network. If the operations of the convolution layer, pooling layer, and activation function layer are to map the original data to the hidden layer feature space, the fully connected layer plays the role of mapping the learned "distributed feature representation" to the sample label space. In actual use, the fully connected layer can be implemented by convolution operations: the fully connected layer with a fully connected previous layer can be converted into a convolution with a convolution kernel of 1×1; and the fully connected layer with a convolution layer as the previous layer can be converted into a global convolution with a convolution kernel of H×W, where H and W are the height and width of the previous convolution result, respectively.
[0070] Image Super Resolution: Image super resolution refers to the restoration of a high-resolution image from a low-resolution image or image sequence. Image super-resolution technology is divided into super-resolution restoration and super-resolution reconstruction. Super-resolution (Super-Resolution) is to improve the resolution of the original image by hardware or software methods. The process of obtaining a high-resolution image through a series of low-resolution images is super-resolution reconstruction. The core idea of super-resolution reconstruction is to use time bandwidth (obtain a multi-frame image sequence of the same scene) in exchange for spatial resolution, and realize the conversion of time resolution to spatial resolution. Image super-resolution refers to the process of obtaining a corresponding high-resolution image by using a single or multiple low-resolution degraded image sequences. In many practical applications in the field of image processing, people often want to obtain high-resolution images, because high-resolution images mean higher pixel density, which can provide richer high-frequency detail information, thereby creating a good foundation for post-processing of images and accurate extraction and utilization of image information.
[0071] Back propagation: The general principle of back propagation is: input the training set data into the input layer of the neural network, pass through the hidden layer of the neural network, and finally reach the output layer of the neural network and output the result; since there is an error between the output result of the neural network and the actual result, the error between the estimated value and the actual value is calculated, and the error is backpropagated from the output layer to the hidden layer until it propagates to the input layer; in the process of back propagation, the values of various parameters are adjusted according to the error; the above process is continuously iterated until convergence.
[0072] XOR operation: In logic, the logical operator XOR (exclusive or) is a type of logical disjunction of two operands, with the symbol XOR or EOR or ⊕ (^ is commonly used in programming languages). However, unlike the general logical OR, the value of the XOR operator is true only when exactly one of the two operands is true and the other is false. Translated into a proposition, it means: "the two values are different" or "only one of them is true".
[0073] Image fusion refers to the process of extracting useful information from each channel to the maximum extent from the image data of the same target collected by multiple source channels through image processing and computer technology, and finally synthesizing it into a high-quality image to improve the utilization rate of image information, improve the accuracy and reliability of computer interpretation, and enhance the spatial resolution and spectral resolution of the original image, which is conducive to monitoring. Image fusion refers to the process of synthesizing multiple images into one image according to certain fusion rules after pre-processing such as denoising and registration. The fused image has a clearer and more accurate description of the target and is more suitable for subsequent image processing. (Multi-sensor image fusion (visible light image and infrared image fusion), single sensor multi-focus image fusion).
[0074] There are three basic principles that need to be followed for image fusion:
[0075] 1) The fused image should contain obvious salient information of all source images;
[0076] 2) No artificial information can be added to the fused image;
[0077] 3) Information that is not of interest in the source image, such as noise, should be suppressed as much as possible from appearing in the fused image.
[0078] According to the principle of information extraction level from low to high, it can be divided into three categories: pixel level image fusion, feature level image fusion and decision level image fusion.
[0079] Pixel-level fusion is a process that directly fuses the source images based on pixel features according to certain fusion rules and finally generates a fused image. It retains the most original information of the source image and has the highest fusion accuracy, but this type of method also has the disadvantages of the largest amount of information, high requirements for hardware equipment and registration, long calculation time and poor real-time processing.
[0080] Feature-level image fusion is a process that first performs simple preprocessing on the source image, then extracts the feature information of the source image such as corners, edges, and shapes through a certain model, selects them through appropriate fusion rules, and then selects and fuses these feature information according to certain fusion rules, and finally generates a fused image. The object of this type of fusion method is the feature information of the source image, so the requirements for the image registration link are not as strict as those for pixel-level fusion. At the same time, this type of method extracts the feature information of the source image, compresses the detailed information of the image, enhances its own real-time processing capability, and provides the required feature information for decision analysis as much as possible. Compared with the previous level of image fusion method, the accuracy of the feature-level image fusion method is average.
[0081] The decision-level image is that before fusion, each source image has independently completed its own decision-making tasks such as classification and recognition. The fusion process is a process of generating the global optimal decision and forming a fused image by comprehensively analyzing each previous independent decision result. This fusion method has the advantages of high flexibility, low communication volume, best real-time performance, strong fault tolerance, and strong anti-interference ability. However, decision-level image fusion requires making decisions and judgments on each image first, resulting in too many processing tasks before the final fusion and high pre-processing costs in the early stage.
[0082] Traditional non-learning-based matting algorithms require manual labeling of the three-color image and solving the alpha mask in the unknown area of the three-color image. At present, many methods often rely on mask datasets to learn matting, such as context-aware matting, indexed matting, sampling-based matting, and opacity propagation-based matting. The performance of these methods depends on the quality of the labeling, which often results in low quality of the image after matting. Therefore, how to provide an image processing method that can improve the quality of the image after matting has become a technical problem that needs to be solved urgently.
[0083] Based on this, the embodiments of the present application provide an image processing method, device, electronic device and storage medium, aiming to improve the image quality of the target image after cutout.
[0084] The image processing method, device, electronic device and storage medium provided in the embodiments of the present application are specifically described through the following embodiments. First, the image processing method in the embodiments of the present application is described.
[0085] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0086] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0087] The image processing method provided in the embodiment of the present application relates to the field of artificial intelligence technology. The image processing method provided in the embodiment of the present application can be applied to a terminal, can be applied to a server side, or can be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the image processing method, etc., but is not limited to the above forms.
[0088] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0089] Figure 1 is an optional flowchart of the image processing method provided in the embodiment of the present application. Figure 1 The method may include but is not limited to steps S101 to S105.
[0090] Step S101, obtaining an original image to be processed;
[0091] Step S102, performing preliminary cutout processing on the original image through the backbone network of the pre-trained cutout model to obtain an initial foreground image;
[0092] Step S103, performing local refinement processing on the edge area of the initial foreground image through the fine-tuning network of the cutout model to obtain a target foreground image;
[0093] Step S104, performing super-resolution reconstruction processing on the target foreground image through a pre-trained image reconstruction model to obtain a standard foreground image, wherein the resolution of the standard foreground image is higher than the resolution of the target foreground image;
[0094] Step S105, performing image fusion on the standard foreground image and the preset background image to obtain a target image.
[0095] In steps S101 to S105 shown in the embodiment of the present application, the original image is subjected to preliminary cutout processing by the backbone network of the pre-trained cutout model to obtain an initial foreground image; the edge area of the initial foreground image is locally refined by the fine-tuning network of the cutout model to obtain a target foreground image. In this way, a foreground image with a better cutout effect can be obtained by the cutout model. Furthermore, the target foreground image is subjected to super-resolution reconstruction processing by the pre-trained image reconstruction model to obtain a standard foreground image, wherein the resolution of the standard foreground image is higher than the resolution of the target foreground image, and a clearer standard foreground image can be obtained, which enhances the cutout effect from a visual perspective. Finally, the standard foreground image and the preset background image are subjected to image fusion to obtain a target image, so that the target image has a higher resolution, thereby improving the image quality.
[0096] In step S101 of some embodiments, the original image to be processed may be a three-dimensional image; in some embodiments, the three-dimensional image may be obtained through computed tomography (CT); in another embodiment, the three-dimensional image may be obtained through magnetic resonance imaging (MRI).
[0097] In some medical application scenarios, the above-mentioned original image to be processed may be a medical image, and the type of object contained in the original image is a lesion, that is, a part of the body where a disease occurs. Medical images refer to internal tissues obtained in a non-invasive manner for medical treatment or medical research, such as CT (Computed Tomography), MRI (Magnetic Resonance Imaging), US (ultrasonic), X-ray images, and images generated by medical instruments using optical photographic lights.
[0098] See also Figure 2 In some embodiments, before step S102, the image processing method further includes pre-training a cutout model, specifically including but not limited to steps S201 to S207:
[0099] Step S201, obtaining a sample image, wherein the resolution of the sample image is lower than the resolution of a preset reference image;
[0100] Step S202, inputting the sample image into the cutout model;
[0101] Step S203, performing convolution processing on the sample image through the backbone network to obtain a sample image matrix, and performing feature extraction on the sample image matrix to obtain a sample predicted foreground value;
[0102] Step S204, performing preliminary cutout processing on the sample image through the backbone network and the sample predicted foreground value to obtain a sample foreground image;
[0103] Step S205, obtaining a sample edge prediction value of each sample pixel in the sample foreground image by fine-tuning the network;
[0104] Step S206, determining the number of sample edge pixel points according to the size relationship between the sample edge prediction value and a preset edge prediction threshold;
[0105] Step S207, optimizing the loss function of the cutout model according to the number of edge pixels of the sample to update the cutout model.
[0106] Specifically, in step S201, a sample image can be obtained by computed tomography (CT) or magnetic resonance imaging (MRI), wherein the resolution of the sample image is lower than the resolution of a preset reference image, that is, the sample image is a low-resolution image.
[0107] Further, step S202 is executed to input the sample image into the cutout model.
[0108] It should be noted that the cutout model can include the open source cutout network Background Matting V2, which is mainly composed of two parts, namely a backbone network and a fine-tuning network, wherein the backbone network is a residual network that has been adjusted and deformed, and the backbone network includes 3 convolutional layers (namely the first convolutional layer, the second convolutional layer, and the third convolutional layer), and the convolution kernel size of each convolutional layer is set to 3×3, and the backbone network contains six input channels.
[0109] Further, by executing steps S203 and S204, the sample image is convolved by the first convolution layer of the backbone network to obtain a sample image matrix of the same size as the sample image, wherein the matrix values of the sample image matrix include 0 and 1, wherein 0 represents the background and 1 represents the foreground. The sample image matrix is feature extracted by the second convolution layer to obtain all matrix values of 1, and these matrix values of 1 are included in the same set, and the matrix values in the set are the sample predicted foreground values. The pixel values of the predicted foreground value of 1 are cut out from the original image by the third convolution layer of the backbone network, and the image composed of these pixel values is the sample foreground image.
[0110] Further, when executing steps S205 and S206, since the sample edge prediction information of each sample pixel can be calculated when the sample image is preliminarily cut out through the backbone network, the sample edge prediction value contained in the sample edge prediction information can be obtained, and the degree to which the sample pixel belongs to the edge can be identified by the sample edge prediction value. By presetting the edge prediction threshold, the sample edge prediction value is compared with the edge prediction threshold, so as to screen the sample pixel points in the edge area of the sample foreground image. If the sample edge prediction value is less than or equal to the edge prediction threshold, it indicates that the sample pixel point belongs to the sample foreground image; if the sample edge prediction value is greater than the edge prediction threshold, it indicates that the sample pixel point does not belong to the sample foreground image, and the sample pixel point is used as a sample edge pixel point, so as to statistically determine the number of sample edge pixels.
[0111] Finally, step S207 is executed to compare the number of sample edge pixels with the preset threshold of the number of sample edge pixels, calculate the model loss of the cutout model, and back-propagate the model loss. For example, back-propagation can be performed according to the loss function to update the cutout model by optimizing the loss function, mainly to update the internal parameters of the cutout model (i.e., loss parameters). It is understandable that the back-propagation principle can apply the conventional back-propagation principle, which is not limited in the embodiment of the present application. By continuously repeating the above process, until the number of sample edge pixels is less than or equal to the threshold of the number of sample edge pixels, or the number of iterations meets the preset number of times, the loss function of the cutout model is optimized and the cutout model is stopped from being updated.
[0112] See also Figure 3 In some embodiments, step S102 may include but is not limited to steps S301 to S303:
[0113] Step S301, performing convolution processing on the original image to obtain an original image matrix;
[0114] Step S302, extracting features from the original image matrix to obtain a predicted foreground value;
[0115] Step S303, performing preliminary cutout processing on the original image according to the predicted foreground value to obtain an initial foreground image.
[0116] Specifically, in step S301, the original image is input into the cutout model, and the original image is convolved by the first convolution layer of the backbone network of the cutout model, so as to obtain an original image matrix of the same size as the original image, and the matrix value of the original image matrix includes 0 and 1, where 0 represents the background and 1 represents the foreground. It should be noted that the equal size here means that the width and height of the original image matrix are the same as the width and height of the original image.
[0117] In step S302, the feature extraction is performed on the original image matrix through the second convolution layer to obtain all matrix values with a value of 1, and these matrix values with a value of 1 are included in the same set. The matrix values in the set are the predicted foreground values.
[0118] In step S303, the pixel values with predicted foreground values of 1 are cut out from the original image through the third convolutional layer of the backbone network. The image composed of these pixel values is the initial foreground image, thereby achieving preliminary cutout processing of the original image and obtaining the initial foreground image.
[0119] See also Figure 4 In some embodiments, step S103 may include but is not limited to steps S401 to S403:
[0120] Step S401, obtaining the edge prediction value of each pixel in the initial foreground image;
[0121] Step S402, determining edge pixel points of the initial foreground image according to the size relationship between the edge prediction value and a preset edge prediction threshold;
[0122] Step S403, filtering the edge pixels of the initial foreground image to obtain a target foreground image.
[0123] Specifically, in order to improve the accuracy of the cutout, it is necessary to further divide the pixel points in the edge area of the initial foreground image that are difficult to distinguish by cutout. First, step S401 is executed. When the original image is subjected to preliminary cutout processing through the backbone network, the edge prediction information of each pixel point can be calculated. Therefore, in the process of local refinement processing of the initial foreground image, the edge prediction value contained in the edge prediction information can be obtained, and the degree to which the pixel point belongs to the edge can be identified by the edge prediction value.
[0124] Further, step S402 and step S403 are executed, and the edge prediction threshold is preset, and the edge prediction value is compared with the edge prediction threshold, so as to screen the pixel points in the edge area. For example, the preset edge prediction threshold may be 0.5, 0.3, etc. If the edge prediction value is less than or equal to the edge prediction threshold, it indicates that the pixel point belongs to the initial foreground image; if the edge prediction value is greater than the edge prediction threshold, it indicates that the pixel point does not belong to the initial foreground image, and the pixel point is regarded as an edge pixel point, and the edge pixel point is removed to achieve filtering and removing impurities from the pixel points of the initial foreground image, and the image composed of the remaining pixels is used as the target foreground image, thereby achieving local refinement of the initial foreground image and improving the image quality of the target foreground image.
[0125] See also Figure 5In some embodiments, before step S104, the image processing method further includes pre-training an image reconstruction model, specifically including but not limited to steps S501 to S506:
[0126] Step S501, obtaining a sample image, wherein the resolution of the sample image is lower than the resolution of a preset reference image;
[0127] Step S502, performing preliminary cutout processing and local thinning processing on the sample image to obtain a sample foreground image;
[0128] Step S503, inputting the sample foreground image into the initial model;
[0129] Step S504, performing super-resolution reconstruction processing on the sample foreground image through the generative network of the initial model to generate a sample intermediate foreground image corresponding to the sample foreground image, wherein the resolution of the sample intermediate foreground image is higher than that of the sample foreground image;
[0130] Step S505, calculating the similarity between the sample intermediate foreground image and the reference sample foreground image through the discriminant network of the initial model to obtain a similarity probability value;
[0131] Step S506, optimizing the loss function of the initial model according to the similarity probability value to update the initial model and obtain an image reconstruction model.
[0132] Specifically, by executing step S501, a sample image can be obtained by computed tomography (CT) or magnetic resonance imaging (MRI), wherein the resolution of the sample image is lower than the resolution of a preset reference image, that is, the sample image is a low-resolution image.
[0133] Further, step S502 is performed to perform preliminary cutout processing and local optimization processing on the sample image through the backbone network and fine-tuning network of the pre-trained cutout model to obtain a sample foreground image. The specific process is the same as the cutout processing process of the original image, and will not be repeated here.
[0134] Furthermore, step S503 is executed to input the sample image into the initial model.
[0135] It should be noted that the initial model is the SRGAN network, which is a generative adversarial network for super-resolution reconstruction. The SRGAN network mainly consists of two parts: a generator and a discriminator. The generator is mainly used to convert the input image into a high-definition image, and the discriminator is mainly used to judge the authenticity of the generated high-definition image, that is, to calculate the similarity probability between the generated high-definition image and the reference image.
[0136] Further, step S504 is performed, and the low-resolution sample foreground image can be converted into a higher-resolution sample intermediate foreground image by using a generation function in the generation network, wherein the generation function of the generation network can be expressed as shown in formula (1):
[0137]
[0138] Among them, G() represents the sample middle foreground image, I HR represents the high-resolution reference foreground image, I LR Represents the low-resolution sample foreground image, I SR Represents other losses, such as perceptual loss, etc., n = 1, 2..., n represents each image, the results of each image are accumulated and then divided by the total number of images.
[0139] Further, step S505 is executed to compare the sample intermediate foreground image with the reference foreground image through the discriminant network. In order to minimize the comparison difference, the sample intermediate foreground image can be continuously optimized by calculating the similarity probability that the sample intermediate foreground image is true, so that the sample intermediate foreground image is as similar as possible to the reference foreground image. When comparing, the difference between the reference foreground image and the intermediate foreground image can be determined by calculating the mean square error (MSE) between the two; wherein the calculation formula is shown in formula (2):
[0140]
[0141] Among them, min refers to the minimum model loss of the generated network, and max refers to the maximum model loss of the discriminant network; D refers to the discriminant network, G refers to the generated network, D(G(I LR )) refers to the discriminant network judging the authenticity of the sample middle foreground image generated by the generative network, obtaining a similar probability value that the sample middle foreground image is true, and continuously optimizing the sample middle foreground image according to the similar probability value.
[0142] Finally, step S506 is executed to calculate the model loss of the initial model according to the similarity probability value, that is, the loss value, and then the gradient descent method is used to back-propagate the loss value, and the loss value is fed back to the initial model to modify the model parameters of the initial model. The above process is repeated until the loss value meets the preset iteration condition, where the preset iteration condition is that the number of iterations can reach the preset value, or the variance of the loss function is less than the preset threshold. When the loss value meets the preset iteration condition, the back-propagation can be stopped, the final model parameters are used as the final model parameters, and the update of the initial model is stopped to obtain the image reconstruction model.
[0143] Through the above process, an image reconstruction model for reconstructing a low-resolution image to generate a high-resolution image can be obtained. The image reconstruction model can achieve the purpose of improving image quality by using a super-resolution reconstruction method.
[0144] See also Figure 6 In some embodiments, step S104 further includes but is not limited to steps S601 to S602:
[0145] Step S601, performing super-resolution reconstruction processing on the target foreground image through the generative network of the image reconstruction model to obtain an intermediate foreground image;
[0146] Step S602 , optimizing the intermediate foreground image through the discriminant network of the image reconstruction model and the preset reference foreground image to obtain a standard foreground image.
[0147] Specifically, in step S601, the low-resolution target foreground image can be converted into a higher-resolution intermediate foreground image by using a generation function in the generation network, wherein the generation function of the generation network can be expressed as shown in formula (3):
[0148]
[0149] Among them, G() represents the intermediate foreground image, I HR represents the high-resolution reference foreground image, I LR Represents the low-resolution target foreground image, I SR Represents other losses, such as perceptual loss, etc., n = 1, 2..., n represents each image, the results of each image are accumulated and then divided by the total number of images.
[0150] In step S602 of some embodiments, the intermediate foreground image is compared with the reference foreground image through the discriminant network. In order to minimize the comparison difference, the probability of the intermediate foreground image being true can be calculated, and the intermediate foreground image can be continuously optimized so that the intermediate foreground image is as similar as possible to the reference foreground image. When comparing, the difference between the reference foreground image and the intermediate foreground image can be determined by calculating the mean square error (MSE) between the two. The calculation formula is shown in formula (4):
[0151]
[0152] Among them, min refers to the minimum model loss of the generated network, and max refers to the maximum model loss of the discriminant network; D refers to the discriminant network, G refers to the generated network, D(G(I LR)) refers to the discriminant network judging the authenticity of the intermediate foreground image generated by the generative network, obtaining a similarity probability value that the intermediate foreground image is true, and continuously optimizing the intermediate foreground image according to the similarity probability value until the similarity probability value is greater than or equal to a preset similarity probability threshold, and outputting a standard foreground image. The similarity between the output standard foreground image and the reference foreground image can meet the requirements.
[0153] The above method can conveniently perform super-resolution reconstruction on the target foreground image, so that the target foreground image has a higher resolution and the image quality can be improved.
[0154] See also Figure 7 In some embodiments, step S105 may also include but is not limited to steps S701 to S703:
[0155] Step S701, extracting features from the standard foreground image to obtain foreground feature values, and extracting features from the background image to obtain background feature values;
[0156] Step S702, performing an XOR calculation on a preset channel bitmap according to the foreground feature value and the background feature value to obtain a target channel bitmap;
[0157] Step S703, performing image fusion on the standard foreground image and the background image according to the target channel bitmap to obtain a target image.
[0158] Specifically, firstly, step S701 is executed to extract features of the standard foreground image and the background image through the sigmoid function, and the foreground feature value of the standard foreground image is transformed to between 0 and 1, and the background feature value of the background image is transformed to between 0 and 1. In this case, the foreground feature value of the pixel point on the standard foreground image is represented as 1, and the background feature value of the pixel point on the background image is represented as 0, which is consistent with the representation method of the foreground prediction value mentioned above.
[0159] Further, step S702 is executed to pre-construct an alpha channel bitmap, which is consistent with the size of the original image, that is, the height, width and number of channels of the channel bitmap and the original image are the same. According to the foreground feature value and the background feature value, the alpha channel bitmap is XORed with 0 and 1, that is, a value of 0 or 1 is marked at each pixel position on the alpha channel bitmap, and the value is used to indicate whether the pixel at the position is displayed. Through this process, the target channel bitmap can be obtained.
[0160] Finally, step S703 is executed. When the standard foreground image and the background image are fused, it is convenient to determine whether the pixels of the standard foreground image or the background image are displayed on the new image according to the mark on the target channel bitmap, and finally the target image is obtained.
[0161] The embodiment of the present application obtains the original image to be processed; performs preliminary cutout processing on the original image through the backbone network of the pre-trained cutout model to obtain an initial foreground image; performs local refinement processing on the edge area of the initial foreground image through the fine-tuning network of the cutout model to obtain a target foreground image. In this way, the cutout model can obtain a foreground image with a better cutout effect. Furthermore, the target foreground image is subjected to super-resolution reconstruction processing through the pre-trained image reconstruction model to obtain a standard foreground image, wherein the resolution of the standard foreground image is higher than the resolution of the target foreground image, and a clearer standard foreground image can be obtained, which enhances the cutout effect from the visual effect. Finally, the standard foreground image and the preset background image are image fused to obtain the target image, so that the target image has a higher resolution, thereby improving the image quality.
[0162] See also Figure 8 The embodiment of the present application further provides an image processing device, which can implement the above-mentioned image processing method, and the image processing device includes:
[0163] The original image acquisition module 801 is used to acquire the original image to be processed;
[0164] The initial cutout module 802 is used to perform initial cutout processing on the original image through a preset cutout model backbone network to obtain an initial foreground image;
[0165] A local refinement module 803 is used to perform local refinement processing on the edge area of the initial foreground image through the fine-tuning network of the cutout model to obtain a target foreground image;
[0166] A super-resolution reconstruction module 804 is used to perform super-resolution reconstruction processing on the target foreground image through a pre-trained image reconstruction model to obtain a standard foreground image, wherein the resolution of the standard foreground image is higher than the resolution of the target foreground image;
[0167] The image fusion module 805 is used to perform image fusion on the standard foreground image and the preset background image to obtain a target image.
[0168] The specific implementation of the image processing device is basically the same as the specific implementation of the above-mentioned image processing method, and will not be repeated here.
[0169] The embodiment of the present application also provides an electronic device, the electronic device comprising: a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for realizing connection and communication between the processor and the memory, and the program is executed by the processor to realize the above-mentioned image processing method. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0170] See also Fig. 9 , Fig. 9The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:
[0171] The processor 901 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0172] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 902, and the processor 901 calls and executes the image processing method of the embodiment of this application;
[0173] Input / output interface 903, used to implement information input and output;
[0174] Communication interface 904, used to realize communication interaction between the device and other devices, which can be realized by wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);
[0175] A bus 905 that transmits information between various components of the device (e.g., the processor 901, the memory 902, the input / output interface 903, and the communication interface 904);
[0176] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .
[0177] An embodiment of the present application also provides a storage medium, which is a computer-readable storage medium used for computer-readable storage. The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the above-mentioned image processing method.
[0178] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0179] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0180] It can be understood by those skilled in the art that Figure 1-7 The technical solutions shown in the figure do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than those shown in the figure, or a combination of certain steps, or different steps.
[0181] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0182] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0183] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0184] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0185] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. 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. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0186] The units described above 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.
[0187] 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.
[0188] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, 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 multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0189] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. An image processing method, characterized in that: The method comprises: Obtain the original image to be processed; Performing preliminary cutout processing on the original image through a backbone network of a pre-trained cutout model to obtain an initial foreground image; Performing local refinement processing on the edge area of the initial foreground image through the fine-tuning network of the cutout model to obtain a target foreground image; Performing super-resolution reconstruction processing on the target foreground image through a pre-trained image reconstruction model to obtain a standard foreground image, wherein the resolution of the standard foreground image is higher than the resolution of the target foreground image; Performing image fusion on the standard foreground image and the preset background image to obtain a target image; Wherein, the backbone network includes a first convolutional layer, a second convolutional layer and a third convolutional layer; The pre-trained cutout model backbone network performs preliminary cutout processing on the original image to obtain an initial foreground image, including: Performing convolution processing on the original image based on the first convolution layer to obtain an original image matrix, wherein the original image matrix has the same height and width as the original image, and the original image matrix includes multiple matrix values; Performing feature extraction on the original image matrix based on the second convolutional layer to obtain a matrix value with a value of 1, and integrating multiple matrix values with a value of 1 into a predicted foreground value; Based on the third convolutional layer, the original image is subjected to preliminary cutout processing according to the predicted foreground value, and pixel values whose predicted foreground value is 1 are deducted to obtain the initial foreground image; The step of locally refining the edge area of the initial foreground image by using the fine-tuning network of the cutout model to obtain a target foreground image includes: Obtaining an edge prediction value for each pixel in the initial foreground image; According to the size relationship between the edge prediction value and a preset edge prediction threshold, determining the edge pixel points of the initial foreground image as the pixel points whose edge prediction value is greater than the edge prediction threshold; The edge pixels of the initial foreground image are filtered to obtain the target foreground image.
2. The image processing method according to claim 1, characterized in that: The method of performing super-resolution reconstruction processing on the target foreground image by using a pre-trained image reconstruction model to obtain a standard foreground image includes: Performing super-resolution reconstruction processing on the target foreground image through the generative network of the image reconstruction model to obtain an intermediate foreground image; The intermediate foreground image is optimized by using the discriminant network of the image reconstruction model and a preset reference foreground image to obtain a standard foreground image.
3. The image processing method according to any one of claims 1 to 2, characterized in that: The step of fusing the standard foreground image and the preset background image to obtain a target image includes: Performing feature extraction on the standard foreground image to obtain a foreground feature value, and performing feature extraction on the background image to obtain a background feature value; Performing an XOR calculation on a preset channel bitmap according to the foreground feature value and the background feature value to obtain a target channel bitmap; The standard foreground image and the background image are fused according to the target channel bitmap to obtain a target image.
4. The image processing method according to any one of claims 1 to 2, characterized in that: Before performing preliminary cutout processing on the original image through the backbone network of the pre-trained cutout model to obtain the initial foreground image, the method further includes pre-training the cutout model, including: Acquire a sample image, wherein the resolution of the sample image is lower than the resolution of a preset reference image; Inputting the sample image into the cutout model; Performing convolution processing on the sample image through the backbone network to obtain a sample image matrix, and performing feature extraction on the sample image matrix to obtain a sample predicted foreground value; Performing preliminary cutout processing on the sample image through the backbone network and the sample predicted foreground value to obtain a sample foreground image; Obtaining a sample edge prediction value of each sample pixel point in the sample foreground image through the fine-tuning network; Determining the number of sample edge pixel points according to the size relationship between the sample edge prediction value and a preset edge prediction threshold; The loss function of the cutout model is optimized according to the number of edge pixels of the sample to update the cutout model.
5. The image processing method according to any one of claims 1 to 2, characterized in that: Before performing super-resolution reconstruction processing on the target foreground image by using a pre-trained image reconstruction model to obtain a standard foreground image, the method further includes pre-training the image reconstruction model, including: Acquire a sample image, wherein the resolution of the sample image is lower than the resolution of a preset reference image; Performing preliminary cutout processing and local refinement processing on the sample image to obtain a sample foreground image; Inputting the sample foreground image into the initial model; Performing super-resolution reconstruction processing on the sample foreground image through the generation network of the initial model to generate a sample intermediate foreground image corresponding to the sample foreground image, wherein the resolution of the sample intermediate foreground image is higher than that of the sample foreground image; The discriminant network of the initial model calculates the similarity between the sample intermediate foreground image and the reference sample foreground image to obtain a similarity probability value; The loss function of the initial model is optimized according to the similarity probability value to update the initial model and obtain the image reconstruction model.
6. An image processing device, characterized in that: The device comprises: An original image acquisition module, used to acquire the original image to be processed; A preliminary cutout module, used for performing initial cutout processing on the original image through a backbone network of a pre-trained cutout model to obtain an initial foreground image; A local refinement module, configured to perform local refinement processing on the edge area of the initial foreground image through the fine-tuning network of the cutout model to obtain a target foreground image; A super-resolution reconstruction module, used to perform super-resolution reconstruction processing on the target foreground image through a pre-trained image reconstruction model to obtain a standard foreground image, wherein the resolution of the standard foreground image is higher than the resolution of the target foreground image; An image fusion module is used to fuse the standard foreground image and the preset background image to obtain a target image; Wherein, the backbone network includes a first convolutional layer, a second convolutional layer and a third convolutional layer; The pre-trained cutout model backbone network performs preliminary cutout processing on the original image to obtain an initial foreground image, including: Performing convolution processing on the original image based on the first convolution layer to obtain an original image matrix, wherein the original image matrix has the same height and width as the original image, and the original image matrix includes multiple matrix values; Performing feature extraction on the original image matrix based on the second convolutional layer to obtain a matrix value with a value of 1, and integrating multiple matrix values with a value of 1 into a predicted foreground value; Based on the third convolutional layer, the original image is subjected to preliminary cutout processing according to the predicted foreground value, and pixel values whose predicted foreground value is 1 are deducted to obtain the initial foreground image; The step of locally refining the edge area of the initial foreground image by using the fine-tuning network of the cutout model to obtain a target foreground image includes: Obtaining an edge prediction value for each pixel in the initial foreground image; According to the size relationship between the edge prediction value and a preset edge prediction threshold, determining the edge pixel points of the initial foreground image as the pixel points whose edge prediction value is greater than the edge prediction threshold; The edge pixels of the initial foreground image are filtered to obtain the target foreground image.
7. An electronic device, characterized in that: The electronic device includes a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for realizing connection and communication between the processor and the memory. When the program is executed by the processor, the image processing method according to any one of claims 1 to 5 is realized.
8. A storage medium, the storage medium being a computer-readable storage medium, used for computer-readable storage, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the image processing method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Image processing method, terminal and computer readable storage medium
CN112598678A
