Image processing method, device, electronic device, medium and computer program product
By training the cascaded neural network model based on the reference mask, the problem of low target object mask accuracy in image processing is solved, and the effect and accuracy of image completion are improved.
Patent Information
- Application Number
- CN202110247381.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-05
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2041-03-05
AI Technical Summary
In the image processing of the existing technology, the accuracy of the target complete mask of the target object is not high, resulting in unsatisfactory image completion effect.
Using a cascaded neural network model, based on the original image sample, the reference visible area mask and the reference complete mask training of the target object sample, the feature map and the target object are predicted through the first target neural network model and the second target neural network model. Target complete masking to improve masking accuracy.
Through the application of the cascade neural network model, the accuracy of the target complete mask of the target object is significantly improved, thereby improving the effect and accuracy of image completion.
Smart Images

Figure CN112967200B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to an image processing method, device, electronic device, medium and computer program product. Background Art
[0002] In the field of image processing, it is usually necessary to complete some partially occluded target objects in an image. The target object can be a human body or other objects. Taking the human body as an example, if a part of the human body is occluded by an occluder in an image, a series of image processing is required to complete the occluded part of the human body and obtain a complete human body. Usually, in the process of completing the target object, it is usually necessary to predict the target complete mask of the target object.
[0003] In the prior art, the original image is usually input into an instance segmentation network, a mask of the visible area of the target object is obtained through the instance segmentation network, and then a complete target mask of the target object is obtained through a neural network model based on the mask of the visible area of the target object.
[0004] However, the accuracy of obtaining a complete target mask of a target object using the existing technology is not high. Summary of the invention
[0005] In order to solve the above technical problems, the present disclosure provides an image processing method, apparatus, electronic device, medium and computer program product.
[0006] In a first aspect, the present disclosure provides an image processing method, the method comprising:
[0007] Acquire a first mask of a visible area of a target object in an original image, wherein the original image contains the target object and a part of the target object is blocked by an occluder;
[0008] The original image and the first mask are stacked and input into a first target neural network model to obtain a first feature map corresponding to the target object;
[0009] Inputting the first feature map into a second target neural network model to obtain a target complete mask of the target object;
[0010] The first target neural network model and the second target neural network model are trained based on original image samples, reference visible area masks of target object samples and reference complete masks of target object samples, wherein the original image samples contain the target object samples and part of the target object samples is blocked by occluders.
[0011] Optionally, the method further includes:
[0012] The first feature map is processed by a multi-layer convolutional network to obtain a second mask of the visible area of the target object.
[0013] Optionally, also include:
[0014] The target complete mask of the target object is subtracted from the second mask to obtain a mask of the invisible area of the target object.
[0015] Optionally, before acquiring the first mask of the visible area of the target object in the original image, the method further includes:
[0016] Obtaining a third mask of a visible area of the target object sample in the original image sample;
[0017] The original image sample and the third mask are stacked and input into a first neural network model to obtain a second feature map corresponding to the target object sample;
[0018] Inputting the second feature map into a second neural network model to obtain a target complete mask of the target object sample;
[0019] The reference complete mask of the target object sample and the reference visible area mask of the target object sample are used as supervisory signals to train the first neural network model and the second neural network model until the first neural network model and the second neural network model converge, and the converged first neural network model is used as the first target neural network model, and the converged second neural network model is used as the second target neural network model.
[0020] Optionally, the using the reference complete mask of the target object sample and the reference visible area mask of the target object sample as supervisory signals to train the first neural network model and the second neural network model includes:
[0021] Processing the second feature map through a multi-layer convolutional network to obtain a fourth mask of the visible area of the target object sample;
[0022] Acquire a first loss function according to a fourth mask of the visible area of the target object sample and a reference visible area mask of the target object sample;
[0023] Acquire a second loss function according to the target complete mask of the target object sample and the reference complete mask of the target object sample;
[0024] The first neural network model and the second neural network model are trained according to the first loss function and the second loss function.
[0025] Optionally, obtaining a first mask of a visible area of the target object in the original image includes:
[0026] The first mask of the visible area of the target object in the original image is obtained through the instance segmentation network.
[0027] Optionally, inputting the first feature map into a second target neural network model to obtain a target complete mask of the target object includes:
[0028] The first feature map is input into a second target neural network model to obtain a third feature map;
[0029] The third feature map is processed by a multi-layer convolutional network to obtain a complete target mask of the target object.
[0030] Optionally, inputting the first feature map into a second target neural network model to obtain a target complete mask of the target object includes:
[0031] The first feature map and the second mask of the visible area of the target object are stacked and input into the second target neural network model to obtain a third feature map;
[0032] The third feature map is processed by a multi-layer convolutional network to obtain a complete target mask of the target object.
[0033] In a second aspect, the present disclosure provides an image processing device, the device comprising:
[0034] An acquisition module, configured to acquire a first mask of a visible area of a target object in an original image, wherein the original image contains the target object and a part of the target object is blocked by an occluder;
[0035] A processing module, configured to stack the original image and the first mask and input the stacked image into a first target neural network model to obtain a first feature map corresponding to the target object;
[0036] The processing module is further used to input the first feature map into a second target neural network model to obtain a target complete mask of the target object;
[0037] The first target neural network model and the second target neural network model are trained based on original image samples, reference visible area masks of target object samples and reference complete masks of target object samples, wherein the original image samples contain the target object samples and part of the target object samples is blocked by occluders.
[0038] Optionally, the processing module is further used to process the first feature map through a multi-layer convolutional network to obtain a second mask of the visible area of the target object.
[0039] Optionally, the processing module is further configured to subtract the target complete mask of the target object from the second mask to obtain a mask of the invisible area of the target object.
[0040] Optionally, the processing module is also used to obtain a third mask of the visible area of the target object sample in the original image sample; stack the original image sample and the third mask and input them into the first neural network model to obtain a second feature map corresponding to the target object sample; input the second feature map into the second neural network model to obtain a target complete mask of the target object sample; use the reference complete mask of the target object sample and the reference visible area mask of the target object sample as supervisory signals to train the first neural network model and the second neural network model until the first neural network model and the second neural network model converge, and use the converged first neural network model as the first target neural network model, and use the converged second neural network model as the second target neural network model.
[0041] Optionally, the processing module is specifically used to process the second feature map through a multi-layer convolutional network to obtain a fourth mask of the visible area of the target object sample; obtain a first loss function based on the fourth mask of the visible area of the target object sample and a reference visible area mask of the target object sample; obtain a second loss function based on the target complete mask of the target object sample and the reference complete mask of the target object sample; and train the first neural network model and the second neural network model based on the first loss function and the second loss function.
[0042] Optionally, the acquisition module is specifically used to acquire a first mask of a visible area of the target object in the original image through an instance segmentation network.
[0043] Optionally, the processing module is specifically used to input the first feature map into a second target neural network model to obtain a third feature map; and process the third feature map through a multi-layer convolutional network to obtain a complete target mask of the target object.
[0044] Optionally, the processing module specifically stacks the first feature map and the second mask of the visible area of the target object and inputs them into the second target neural network model to obtain a third feature map; and processes the third feature map through a multi-layer convolutional network to obtain a complete target mask of the target object.
[0045] In a third aspect, the present disclosure provides an electronic device, comprising: a processor, wherein the processor is used to execute a computer program stored in a memory, wherein the computer program implements the steps of any one of the methods described in the first aspect when executed by the processor.
[0046] In a fourth aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of any one of the methods described in the first aspect.
[0047] In a fifth aspect, the present disclosure provides a computer program product, which, when executed on a computer, enables the computer to execute the image processing method described in any one of the first aspects.
[0048] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:
[0049] Since the first target neural network model and the second target neural network model are trained based on the original image samples, the reference visible area masks of the target object samples and the reference complete masks of the target object samples, that is, they are trained for the target objects, therefore, the original image and the first mask are stacked and input into the first target neural network model to obtain the first feature map corresponding to the target object, and the first feature map has higher accuracy. The first feature map with higher accuracy is input into the second target neural network model to obtain the target complete mask of the target object, which can improve the accuracy of the target complete mask of the target object. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0052] Figure 1 A schematic diagram of an image processing system provided by the present disclosure;
[0053] Figure 2 A schematic diagram of an image processing process provided by the present disclosure;
[0054] Figure 3 A schematic diagram of another image processing process provided by the present disclosure;
[0055] Figure 4A schematic diagram of another image processing process provided by the present disclosure;
[0056] Figure 5 A structural schematic diagram of an image processing device is provided in the present disclosure. DETAILED DESCRIPTION
[0057] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0058] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0059] The original image of the present disclosure contains a target object, wherein a part of the target object is blocked by an occluder. For the convenience of description, the area of the target object blocked by the occluder is described as an invisible area of the target object. The area of the target object not blocked by the occluder is described as a visible area of the target object. The target object may be a human body, an animal or other object, which is not limited by the present disclosure.
[0060] In the process of completing the invisible area of the target object in the original image, it is necessary to predict the mask of the invisible area of the target object and complete the target object based on the mask of the invisible area of the target object, so as to achieve image processing tasks such as target tracking, target detection and image segmentation.
[0061] The mask of the invisible region of the target object is usually obtained by subtracting the target complete mask of the target object and the mask of the visible region of the target object. Therefore, the accuracy of the target complete mask of the target object directly affects the accuracy of the mask of the invisible region of the target object.
[0062] In order to improve the accuracy of the target complete mask of the target object obtained, the present invention designs a cascaded neural network model, and trains the cascaded neural network model based on the original image samples, the reference visible area mask of the target object samples and the reference complete mask of the target object samples. The converged cascaded neural network model is applied to the process of obtaining the target complete mask of the target object, thereby improving the accuracy of the target complete mask of the target object obtained.
[0063] The original image sample includes a target object sample, and a part of the target object sample is blocked by an occluder. The reference visible area mask of the target object sample refers to the accurate visible area mask of the target object sample obtained, and the reference complete mask of the target object sample refers to the accurate target complete mask of the target object sample obtained. For example, the reference visible area mask of the target object sample and the reference complete mask of the target image sample can be obtained in the following manner: first, an image including the target object sample is taken, wherein the target object sample is not blocked by any occluder, and then, while the posture of the target object sample remains unchanged, an occluder is placed to block a part of the target object sample, and then another image is taken. By performing cutout or other image processing on the target object sample in the first image, the reference complete mask of the target object sample can be obtained, and by performing cutout or other image processing on the target object sample in the second image, the reference visible area mask of the target object sample can be obtained.
[0064] The target object of the present disclosure may be a human body, an animal, or other objects. The following embodiments of the present disclosure are described and illustrated using the human body as an example. Other target objects are similar to the human body and are not described in detail.
[0065] The image processing method disclosed in the present invention is performed by an electronic device. The electronic device may be a tablet computer, a mobile phone (such as a folding screen mobile phone, a large screen mobile phone, etc.), a wearable device, a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a smart TV, a smart screen, a high-definition TV, a 4K TV, a smart speaker, a smart projector, and other Internet of Things (IOT) devices. The present disclosure does not impose any restrictions on the specific types of electronic devices.
[0066] Figure 1 A schematic diagram of an image processing system provided by the present disclosure, such as Figure 1 As shown, the system includes:
[0067] A first target neural network model 101 and a second target neural network model 102, wherein the first target neural network model 101 includes multiple network layers, the second target neural network model 102 includes multiple network layers, and the first target neural network model 101 and / or the second target neural network model 102 can be an hourglass network. The input signal of the first target neural network model 101 is the stacked result of the first mask 103 of the visible area of the target object of the original image and the original image 104, and the output of the first target neural network model 101 is the first feature map 105 of the target object; the input signal of the second target neural network model 102 is the first feature map 105, and the first feature map 105 can be processed by a multi-layer convolutional network (also called a segmentation head) 108 to obtain a second mask 107, and the output signal of the second target neural network model 102 is a third feature map 109, and the third feature map 109 can be processed by a multi-layer convolutional network (also called a segmentation head) 110 to obtain a target complete mask 106 of the target object.
[0068] The present invention predicts the first feature map of the target object and the target complete mask of the target object by cascading two target neural network models. The two target neural network models have more parameters and stronger processing capabilities. Therefore, the result of predicting the target complete mask of the target object can also be more accurate.
[0069] Figure 2 A schematic diagram of an image processing process provided by the present disclosure, combined with Figure 1 , the method of this embodiment is as follows:
[0070] S201: Obtain a first mask of a visible area of a target object in an original image.
[0071] The original image contains a target object, and a part of the target object is blocked by an occluder. The visible area of the target object refers to the area of the target object displayed in the original image. The original image generally contains a background, a target object, and an occluder.
[0072] by Figure 1 Take for example, where the target object is a human body, the occluder is grass, the legs and feet of the human body are blocked by the occluder, and the head, upper body and part of the legs are visible areas of the human body.
[0073] Exemplarily, the size of the original image may be H×W×3, where H is the height, W is the width, and 3 is the number of channels.
[0074] Optionally, the first mask of the visible area of the target object in the original image can be obtained through the instance segmentation network. The size of the first mask is H×W×1, and the values in the first mask obey the distribution of 0 to 1. However, since the instance segmentation network does not handle occlusion, that is, the instance segmentation network is used to segment various objects and is not designed for target objects. Therefore, if the target object is occluded, the first mask of the visible area of the target object in the original image obtained by the instance segmentation network may be incomplete or partially wrong, and the accuracy is not high.
[0075] In this step, the original image can be recorded as: s , the instance segmentation network is recorded as: N i (), the first mask is recorded as: M i ,but,
[0076] M i =N i (I s )
[0077] S202: Stack the original image and the first mask and input them into a first target neural network model to obtain a first feature map corresponding to the target object.
[0078] Specifically, the original image and the first mask may be stacked to obtain a stacking result, and the stacking result may be input into the first target neural network model to obtain a first feature map corresponding to the target object. Combined with the description in S201, the stacking result is an H×W×4 image, that is, the stacking result is a four-channel image.
[0079] The first target neural network model is recorded as: The first feature map is denoted as: F m , Indicates stacking processing, then:
[0080]
[0081] The purpose of this step is to correct the first mask through the first target neural network model.
[0082] Among them, the first target neural network model is trained based on the reference visible area mask of the target object sample as the supervisory signal. The first target neural network model is trained for the target object. Therefore, the first feature map of the target object output by the first target neural network model has higher accuracy.
[0083] S203: Input the first feature map into the second target neural network model to obtain a target complete mask of the target object.
[0084] Among them, one implementation method is to input the first feature map into the second target neural network model to obtain a third feature map, and process the third feature map through a multi-layer convolutional network to obtain a target complete mask of the target object.
[0085] Specifically, it is assumed that the second target neural network model is recorded as: The target complete mask of the target object is denoted as M a ,but:
[0086]
[0087] Among them, the second target neural network model is trained based on the reference complete mask of the target object sample as the supervisory signal, and the first target neural network model is trained for the target object. Therefore, the target complete mask of the target object output by the second target neural network model has higher accuracy.
[0088] The first target neural network model and the second target neural network model in the present disclosure are trained in a cascade network structure based on the original image sample, the reference visible area mask of the target object sample, and the reference complete mask of the target object sample. Therefore, the accuracy of the output of the first target neural network model and the second target neural network model can be further improved.
[0089] In this embodiment, since the first target neural network model and the second target neural network model are trained based on the original image samples, the reference visible area masks of the target object samples and the reference complete masks of the target object samples, that is, they are trained for the target objects, therefore, the original image and the first mask are input into the first target neural network model to obtain the first feature map corresponding to the target object, and the first feature map has higher accuracy, the first feature map with higher accuracy is input into the second target neural network model to obtain the target complete mask of the target object, which can improve the accuracy of the target complete mask of the target object.
[0090] Figure 3 A schematic diagram of another image processing process provided by the present disclosure, Figure 3 is Figure 2 On the basis of the embodiment shown, further, it also includes:
[0091] S204: Process the first feature map through a multi-layer convolutional network to obtain a second mask of the visible area of the target object.
[0092] In some scenarios, the mask of the visible area can be used for image processing. For example, in a target tracking scenario, assuming that the target object is a human body, the target tracking can be performed based only on the upper body of the human body.
[0093] Therefore, the present disclosure also processes the first feature map through a multi-layer convolutional network to obtain a second mask of the visible area of the target object, so as to facilitate image processing in some scenarios and improve the accuracy of image processing.
[0094] Furthermore, the visible area mask of the target object and the target complete mask of the target object can be obtained simultaneously through the cascade network of the first target neural network model and the second neural network model. For scenes where the visible area mask of the target object and the target complete mask of the target object are simultaneously applied for image processing, the efficiency of image processing can be improved.
[0095] Optionally, another implementation method of S203 is: stack the first feature map and the second mask of the visible area of the target object and input them into the second target neural network model to obtain a third feature map; process the third feature map through a multi-layer convolutional network to obtain a complete target mask of the target object.
[0096] Specifically, the second mask is recorded as: M m , then accordingly, the target complete mask of the target object is:
[0097]
[0098] The first feature map and the second mask of the visible area of the target object are stacked and input into the second target neural network model to obtain a third feature map; the third feature map is processed by a multi-layer convolutional network to obtain a target complete mask of the target object. The accuracy of the obtained target complete mask of the target object can be further improved.
[0099] Optionally, further, in a scenario where a mask of a visible area of a target object and a target complete mask of a target object are simultaneously applied to perform image processing, for example, in a scenario where target object completion is performed, it is necessary to complete the target object based on a mask of an invisible area, wherein the mask of the invisible area needs to be obtained by combining the target complete mask of the target object and the mask of the visible area, and since the accuracy of the target complete mask of the target object and the mask of the visible area are relatively high, the accuracy of the obtained mask of the invisible area is also relatively high.
[0100] The method further comprises:
[0101] S205: Subtract the target complete mask of the target object from the second mask to obtain a mask of the invisible area of the target object.
[0102] In the present disclosure, since the accuracy of the target complete mask and the second mask are improved, the accuracy of the mask of the invisible area of the target object obtained by subtracting the target complete mask from the second mask will also be improved. Image completion and other processing can be performed based on the obtained mask of the invisible area, thereby further improving the effect of image completion.
[0103] Figure 4 A schematic diagram of another image processing process provided by the present disclosure is shown below: Figure 4 is Figure 2 or Figure 3 On the basis of the embodiment shown, further, it also includes: a process of obtaining the first target neural network model and the second target neural network model, that is, a process of obtaining the first target neural network model and the second target neural network model through machine learning, such as Figure 4 As shown:
[0104] S401: Obtain a third mask of a visible area of a target object sample in an original image sample.
[0105] The original image sample includes the target object sample, and part of the target object sample is blocked by the occluder. The visible area of the target object sample refers to the area of the target object sample displayed in the original image sample. The original image sample generally includes the background, the target object sample and the occluder.
[0106] Optionally, a third mask of the visible area of the target object sample in the original image sample can be obtained through an instance segmentation network.
[0107] S402: The original image sample and the third mask are stacked and input into the first neural network model to obtain a second feature map corresponding to the target object sample.
[0108] S403: Input the second feature map into the second neural network model to obtain a target complete mask of the target object sample.
[0109] S404: Using a reference complete mask of a target object sample and a reference visible area mask of the target object sample as supervisory signals, training the first neural network model and the second neural network model until the first neural network model and the second neural network model converge, using the converged first neural network model as the first target neural network model, and using the converged second neural network model as the second target neural network model.
[0110] Among them, the reference complete mask of the target object sample and the reference visible area mask of the target object sample are used as supervisory signals to train the first neural network model and the second neural network model, that is, the reference visible area mask of the target object sample is used as the supervisory signal of the first neural network model, and the reference complete mask of the target object sample is used as the supervisory signal of the second neural network model, and the cascaded first neural network model and the second neural network model are trained.
[0111] Specifically, a possible implementation is:
[0112] The second feature map is processed by a multi-layer convolutional network to obtain a fourth mask of the visible area of the target object sample.
[0113] A first loss function is obtained according to a fourth mask of the visible area of the target object sample and a reference visible area mask of the target object sample. A second loss function is obtained according to a target complete mask of the target object sample and a reference complete mask of the target object sample. The first neural network model and the second neural network model are trained according to the first loss function and the second loss function. That is, the parameters of the first neural network model and the second neural network model are adjusted according to the first loss function and the second loss function until the first neural network model and the second neural network model converge, that is, until the first loss function and the second loss function meet the preset requirements, that is, until the accuracy of the output fourth mask of the visible area of the target object sample and the target complete mask of the target object sample meets the requirements, then the first neural network model and the second neural network model are considered to converge. The converged first neural network model is used as the first target neural network model, and the second neural network model is used as the second target neural network model.
[0114] Specifically, the first neural network model and the second neural network model can be trained based on the gradient descent method according to the first loss function and the second loss function until the first neural network model and the second neural network model converge.
[0115] In this embodiment, the mask of the visible area output by the first neural network model is supervised based on the reference visible area mask, so that the accuracy of the mask of the visible area output by the first neural network model can be improved. The target complete mask output by the second neural network model is supervised based on the reference complete mask, so that the accuracy of the target complete mask output by the second neural network model can be improved. Based on the reference visible area mask of the target object sample and the reference complete mask of the target object sample as the supervision signal, the cascade network composed of the first neural network model and the second neural network model is trained, so that the accuracy of the mask of the visible area output by the first neural network model and the accuracy of the target complete mask output by the second neural network model can be further improved. The target complete mask of the target object is predicted by the cascade network after convergence, so that the accuracy of the predicted target complete mask can be improved.
[0116] Figure 5 The present invention provides a structural schematic diagram of an image processing device, such as Figure 5 As shown, the device of this embodiment includes: an acquisition module 501 and a processing module 502, wherein:
[0117] An acquisition module 501 is used to acquire a first mask of a visible area of a target object in an original image, wherein the original image contains the target object and a part of the target object is blocked by an occluder;
[0118] A processing module 502 is used to stack the original image and the first mask and input them into a first target neural network model to obtain a first feature map corresponding to the target object;
[0119] The processing module 502 is further configured to input the first feature map into a second target neural network model to obtain a target complete mask of the target object;
[0120] The first target neural network model and the second target neural network model are trained based on original image samples, reference visible area masks of target object samples and reference complete masks of target object samples, wherein the original image samples contain the target object samples and part of the target object samples is blocked by occluders.
[0121] Optionally, the processing module 502 is further used to process the first feature map through a multi-layer convolutional network to obtain a second mask of the visible area of the target object.
[0122] Optionally, the processing module 502 is further configured to perform a subtraction between the target complete mask of the target object and the second mask to obtain a mask of the invisible region of the target object.
[0123] Optionally, the processing module 502 is also used to obtain a third mask of the visible area of the target object sample in the original image sample; stack the original image sample and the third mask and input them into the first neural network model to obtain a second feature map corresponding to the target object sample; input the second feature map into the second neural network model to obtain a target complete mask of the target object sample; use the reference complete mask of the target object sample and the reference visible area mask of the target object sample as supervisory signals to train the first neural network model and the second neural network model until the first neural network model and the second neural network model converge, and use the converged first neural network model as the first target neural network model, and use the converged second neural network model as the second target neural network model.
[0124] Optionally, the processing module 502 is specifically used to process the second feature map through a multi-layer convolutional network to obtain a fourth mask of the visible area of the target object sample; obtain a first loss function based on the fourth mask of the visible area of the target object sample and a reference visible area mask of the target object sample; obtain a second loss function based on the target complete mask of the target object sample and the reference complete mask of the target object sample; and train the first neural network model and the second neural network model based on the first loss function and the second loss function.
[0125] Optionally, the acquisition module 501 is specifically configured to acquire a first mask of a visible area of a target object in an original image through an instance segmentation network.
[0126] Optionally, the processing module 502 is specifically used to input the first feature map into a second target neural network model to obtain a third feature map; and process the third feature map through a multi-layer convolutional network to obtain a complete target mask of the target object.
[0127] Optionally, the processing module 502 is specifically used to stack the first feature map and the second mask of the visible area of the target object and input them into the second target neural network model to obtain a third feature map; and process the third feature map through a multi-layer convolutional network to obtain a complete target mask of the target object.
[0128] The device of this embodiment corresponds to the technical solution that can be used to execute the above method embodiment. Its implementation principle and technical effects are similar and will not be repeated here.
[0129] The present disclosure also provides an electronic device, comprising: a processor, the processor is used to execute a computer program stored in a memory, the computer program is executed by the processor to achieve Figure 2-Figure 4The steps of any of the method embodiments described in any one of the preceding claims. It should be noted that the processor may be a graphics processing unit (GPU), that is, the program algorithm of the present disclosure may be completely implemented by a GPU. Exemplarily, it may be implemented using PyTorch of a unified computing device architecture (CUDA).
[0130] The present disclosure provides a computer-readable storage medium having a computer program stored thereon, which implements Figure 2-Figure 4 The steps of any of the method embodiments described above.
[0131] The present disclosure provides a computer program product, when the computer program product is run on a computer, so that the computer executes Figure 2-Figure 4 The steps of any of the method embodiments described above.
[0132] In the above embodiments, all or part of the functions can be implemented by software, hardware, or a combination of software and hardware. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present disclosure is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integrated. Available media can be magnetic media, (e.g., floppy disks, hard disks, tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid state disks (SSDs)), etc.
[0133] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0134] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An image processing method, characterized in that: The method comprises: Acquire a first mask of a visible area of a target object in an original image, wherein the original image contains the target object and a part of the target object is blocked by an occluder; The original image and the first mask are stacked and input into a first target neural network model to obtain a first feature map corresponding to the target object; Inputting the first feature map into a second target neural network model to obtain a target complete mask of the target object; Among them, the first target neural network model is trained based on the original image sample as input and the reference visible area mask of the target object sample as a supervisory signal, and the second target neural network model is trained based on the second feature map corresponding to the target object sample as input and the reference complete mask of the target object sample as a supervisory signal, wherein the original image sample contains the target object sample, part of the target object sample is blocked by an occluder, and the second feature map corresponding to the target object sample is output by the first target neural network model.
2. The method according to claim 1, characterized in that The method further comprises: The first feature map is processed by a multi-layer convolutional network to obtain a second mask of the visible area of the target object.
3. The method according to claim 2, characterized in that Also includes: The target complete mask of the target object is subtracted from the second mask to obtain a mask of the invisible area of the target object.
4. The method according to any one of claims 1 to 3, characterized in that: Before obtaining the first mask of the visible area of the target object in the original image, the method further includes: Obtaining a third mask of a visible area of the target object sample in the original image sample; The original image sample and the third mask are stacked and input into a first neural network model to obtain a second feature map corresponding to the target object sample; Inputting the second feature map into a second neural network model to obtain a target complete mask of the target object sample; The reference complete mask of the target object sample and the reference visible area mask of the target object sample are used as supervisory signals to train the first neural network model and the second neural network model until the first neural network model and the second neural network model converge, and the converged first neural network model is used as the first target neural network model, and the converged second neural network model is used as the second target neural network model.
5. The method according to claim 4, characterized in that The using the reference complete mask of the target object sample and the reference visible area mask of the target object sample as supervisory signals to train the first neural network model and the second neural network model comprises: Processing the second feature map through a multi-layer convolutional network to obtain a fourth mask of the visible area of the target object sample; Acquire a first loss function according to a fourth mask of the visible area of the target object sample and a reference visible area mask of the target object sample; Acquire a second loss function according to the target complete mask of the target object sample and the reference complete mask of the target object sample; The first neural network model and the second neural network model are trained according to the first loss function and the second loss function.
6. The method according to any one of claims 1 to 3, characterized in that: The step of inputting the first feature map into a second target neural network model to obtain a target complete mask of the target object includes: Inputting the first feature map into a second target neural network model to obtain a third feature map; The third feature map is processed by a multi-layer convolutional network to obtain a complete target mask of the target object.
7. The method according to claim 2 or 3, characterized in that: The step of inputting the first feature map into a second target neural network model to obtain a target complete mask of the target object includes: The first feature map and the second mask of the visible area of the target object are stacked and input into the second target neural network model to obtain a third feature map; The third feature map is processed by a multi-layer convolutional network to obtain a complete target mask of the target object.
8. An image processing device, characterized in that: The device comprises: An acquisition module, configured to acquire a first mask of a visible area of a target object in an original image, wherein the original image contains the target object and a part of the target object is blocked by an occluder; A processing module, configured to stack the original image and the first mask and input the stacked image into a first target neural network model to obtain a first feature map corresponding to the target object; The processing module is further used to input the first feature map into a second target neural network model to obtain a target complete mask of the target object; Among them, the first target neural network model is trained based on the original image sample as input and the reference visible area mask of the target object sample as a supervisory signal, and the second target neural network model is trained based on the second feature map corresponding to the target object sample as input and the reference complete mask of the target object sample as a supervisory signal, wherein the original image sample contains the target object sample, part of the target object sample is blocked by an occluder, and the second feature map corresponding to the target object sample is output by the first target neural network model.
9. An electronic device, characterized in that: include: A processor, wherein the processor is used to execute a computer program stored in a memory, wherein the computer program, when executed by the processor, implements the steps of the method described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
11. A computer program product, characterized in that When the computer program product is run on a computer, the computer is enabled to execute the image processing method according to any one of claims 1 to 7.
