Image segmentation device and training method, device and system thereof and image segmentation method, device and system
By combining the deviation prediction module and the down-sampling mask prediction module in the image segmentation technology, a down-sampling corrected mask map with higher accuracy is generated, which solves the problem of mask map contour distortion after down-sampling in the existing technology, and improves the detection accuracy. Segmentation effect on edges of small and medium objects.
Patent Information
- Application Number
- CN202410677974.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-29
- Publication Date
- 2024-10-01
AI Technical Summary
Existing real-time image segmentation technology causes contour distortion of the mask image after downsampling, especially the edge segmentation effect of small and medium-sized objects is poor, especially when the width/height only accounts for 1/10 or less of an image or the pixel is 32*32 and below small object images.
Using the encoding module, the down-sampling mask prediction module, the deviation prediction module and the combined prediction module, the deviation results predicted by the deviation prediction module are combined with the down-sampling mask map to generate a down-sampling corrected mask map with higher accuracy.
On the basis of ensuring real-time performance, the accuracy of the mask map is improved, and the edge segmentation effect of small and medium-sized objects is improved.
Smart Images

Figure CN118736210A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image segmentation technology, and in particular to an image segmenter and its training, an image segmentation method, a device and a system. Background Art
[0002] For existing real-time segmentation technologies such as yolov8-seg, Yolox, yolov5, yolov6, yolov7, etc., these segmentation technologies mainly adopt the encoder-decoder structure, which has a relatively good segmentation effect while ensuring the real-time reasoning speed. However, since the input image needs to be downsampled by a preset multiple (for example: 8 times) to reduce the amount of calculation, a lot of accuracy is often lost, making the contour of the mask after downsampling seriously distorted, resulting in poor edge segmentation effect for medium and small objects during real-time reasoning (for example: for small object images whose width / height is only 1 / 10 or less of a picture, or whose pixels are 32*32 or less). Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide an image segmenter and its training, image segmentation method, device and system to improve the accuracy of image segmentation.
[0004] In a first aspect, an embodiment of the present application provides an image segmenter, which adopts the following technical solution:
[0005] An image segmenter, comprising: an encoding module, a downsampling mask prediction module, a deviation prediction module and a combined prediction module;
[0006] The encoding module is used to take the target image as input and output the encoding of the target image;
[0007] The down-sampling mask prediction module is used to perform a first decoding on the encoding of the target image to obtain a down-sampling mask image after the original mask image is down-sampled by a first preset multiple;
[0008] A deviation prediction module is used to perform a second decoding on the encoding of the target image to obtain a deviation result; wherein the deviation result is a deviation result between a reference mask image and a downsampled reference mask restoration image; the downsampled reference mask restoration image is a mask image restored by downsampling the reference mask image by a second preset multiple; the reference mask image is a mask image restored by downsampling the original mask image by a fourth preset multiple;
[0009] A combination prediction module is used to combine the down-sampling mask map output by the down-sampling mask prediction module and the deviation result output by the deviation prediction module, so as to obtain a down-sampling correction mask map of the down-sampling mask map.
[0010] Further, in one embodiment, the downsampling mask prediction module is a first decoder; and / or,
[0011] The deviation prediction module is a second decoder; and / or,
[0012] The fourth preset multiple*the second preset multiple=the first preset multiple.
[0013] Furthermore, in one embodiment, a third preset downsampling multiple corresponding to the downsampling correction mask image is greater than, less than or equal to the first preset downsampling multiple.
[0014] Further, in one embodiment, the first preset downsampling multiple is N and the third preset downsampling multiple is N / 2; or,
[0015] The first preset downsampling multiple is N and the third preset downsampling multiple is N; wherein N is an integer greater than or equal to 2.
[0016] In a second aspect, an embodiment of the present application provides a training method for an image segmentor based on any one of the above items, characterized in that the method comprises:
[0017] Obtain training sample images;
[0018] Obtain the label downsampling correction mask image, label downsampling mask image and label deviation result corresponding to the training sample image; wherein the label downsampling correction mask image is the mask image after the label original mask image is downsampled by the third preset multiple; the label downsampling mask image is the mask image after the label original mask image is downsampled by the first preset multiple; the label encoding deviation result is the deviation result between the label reference mask image and the label downsampling mask restoration image; the label downsampling mask restoration image is the mask image after the label reference mask image is downsampled by the second preset multiple and then restored; the label reference mask image is the mask image after the label original mask image is downsampled by the fourth preset multiple;
[0019] The label downsampling correction mask image, the label downsampling mask image and the label deviation result are used as annotations, and the image segmentor is iteratively trained based on the training sample image as an image segmentor until a termination condition is met.
[0020] Furthermore, in one embodiment, the step of iteratively training the image segmenter based on the training sample image as an image segmenter using the label downsampling correction mask image, the label downsampling mask image and the label deviation result as annotations until a termination condition is met includes the following steps:
[0021] The image segmenter is iteratively trained based on a first difference between the downsampled mask map output by the downsampled mask prediction module and the label downsampled mask map; a second difference between the deviation result output by the deviation prediction module and the label deviation result; and a third difference between the downsampled corrected mask map output by the combined prediction module and the label downsampled corrected mask map until the termination condition is met.
[0022] In a third aspect, an embodiment of the present application provides an image segmentation method, the method comprising:
[0023] Get the target image;
[0024] The target image is used as the input of the image segmenter described above, and the down-sampled corrected mask image of the target object is obtained as output.
[0025] In a fourth aspect, an embodiment of the present application provides a segmentation device, the device comprising:
[0026] An image acquisition module, used for acquiring a target image;
[0027] The image segmentation module is used to use the target image as the input of the image segmenter mentioned above, and output the down-sampled corrected mask image of the target object.
[0028] In a fifth aspect, an embodiment of the present application provides an image segmentation training device, the device comprising:
[0029] A sample acquisition module is used to acquire training sample images;
[0030] A label acquisition module, used to acquire a label down-sampling correction mask image, a label down-sampling mask image and a label deviation result corresponding to the training sample image; wherein the label down-sampling correction mask image is a mask image obtained by down-sampling the original label mask image by the third preset multiple; the label down-sampling mask image is a mask image obtained by down-sampling the original label mask image by the first preset multiple; the label encoding deviation result is a deviation result between a label reference mask image and a label down-sampling mask restoration image; the label down-sampling mask restoration image is a mask image restored after down-sampling the label reference mask image by the second preset multiple; the label reference mask image is a mask image obtained by down-sampling the original label mask image by the fourth preset multiple;
[0031] The model training module is used to iteratively train the image segmentor based on the training sample image as an image segmentor using the label downsampling correction mask image, the label downsampling mask image and the label deviation result as annotations until a termination condition is met.
[0032] In a sixth aspect, an embodiment of the present application provides an image segmentation system, the system comprising: an image sensor and a controller;
[0033] The image sensor is communicatively connected with the controller;
[0034] The controller is used to implement the model training method described above; and / or the steps of the image segmentation method described above.
[0035] In the seventh aspect, an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the model training and / or image segmentation method described above are implemented.
[0036] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the model training and / or image segmentation method described above are implemented.
[0037] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0038] The image segmenter of the embodiment of the present application adopts a branch deviation prediction module. The deviation result predicted by the deviation prediction module can reflect where there are large deviations in the down-sampled mask image. Therefore, by combining the down-sampled mask image with the predicted deviation result, a more accurate down-sampled corrected mask image can be finally predicted, thereby improving the accuracy of the final mask image while ensuring real-time performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0040] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;
[0041] Figure 2 is a structural schematic diagram of an embodiment of the image segmenter of the present application;
[0042] Figure 3 is a structural schematic diagram of another embodiment of the image segmenter of the present application;
[0043] Figure 4 is a schematic diagram of an embodiment of a label deviation result generation process of the present application;
[0044] Figure 5 is a flow chart of an embodiment of a segmenter training method of the present application;
[0045] Figure 6 is a flowchart of an embodiment of the image segmentation method of the present application;
[0046] Figure 7 is a structural block diagram of an embodiment of a segmenter training device of the present application;
[0047] Figure 8 is a structural block diagram of an embodiment of the image segmentation device of the present application;
[0048] Fig. 9 It is a structural diagram of an embodiment of a computer device of the present application. DETAILED DESCRIPTION
[0049] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0050] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0051] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0052] like Figure 1 As shown, Figure 1 is an exemplary system architecture diagram to which the present application can be applied.
[0053] An embodiment of the present application provides an image segmentation system 100 , which includes: an image sensor 110 and a controller 120 .
[0054] Image Sensor
[0055] It should be noted that the image sensor in the embodiments of the present application can be a monocular or multi-camera (such as an RGB camera, a depth camera or a point cloud camera, etc.), a video camera, or a mobile phone, tablet computer, laptop computer, desktop computer or other device that includes a camera or a video camera.
[0056] Controller
[0057] The controller 120 is connected to the image sensor 110 in a wired or wireless communication manner.
[0058] For the limitations of the controller, please refer to the limitations of the model training method and / or image segmentation method in the following embodiments.
[0059] Specifically, the controller 120 may generate program instructions according to a pre-fixed program in combination with data signals collected by external image sensors.
[0060] It should be noted that the above-mentioned wireless connection methods may include but are not limited to 3G / 4G / 5G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods currently known or to be developed in the future.
[0061] The controller provided in the embodiments of the present application may be, but is not limited to: a computer terminal (Personal Computer, PC); an industrial control computer terminal (Industrial Personal Computer, IPC); a mobile terminal; a server; a system including a terminal and a server, and implemented through the interaction between the terminal and the server; a programmable logic controller (Programmable Logic Controller, PLC); a field programmable gate array (Field-Programmable Gate Array, FPGA); a digital signal processor (Digital Signal Processer, DSP) or a microcontroller unit (Microcontroller unit, MCU) and the like. Specifically, the controller may be, for example, Fig. 9 Computer equipment shown.
[0062] The controller described in the embodiments of the present application may be provided separately, or may be partially or fully integrated into other devices such as an image sensor, and all of these fall within the scope of protection of the present application.
[0063] It should be noted that the image sensor and the like mentioned in the embodiments of the present application can be a real object in a real environment or a virtual object in a simulation platform, and the simulation environment is used to achieve the effect of connecting to the real object. The controller trained in a virtual environment can be transplanted to a real environment to control or retrain the real object, which can save resources and time in the training process.
[0064] like Figure 2 and Figure 3 As shown, Figure 2 is a structural block diagram of an embodiment of the image segmenter of the present application; Figure 3 It is a structural block diagram of another embodiment of the image segmenter of the present application.
[0065] Based on the system described in the above embodiment, the embodiment of the present application provides an image segmenter 200. The image segmenter 200 includes: an encoding module 210, a down-sampling mask prediction module 220, a deviation prediction module 230 and a combined prediction module 240.
[0066] The encoding module 210 is used to output the encoding of the target image based on the input target image.
[0067] For example, Figure 3 As shown, the target image is input into the encoding module encoder, so as to encode the target image.
[0068] The down-sampling mask prediction module 220 is used to perform a first decoding on the encoding of the target image to obtain a down-sampling mask image after being down-sampled by a first preset multiple.
[0069] For example, continue as Figure 3 As shown, the encoding of the target image output by the encoder is used as the input of the downsampling mask prediction module decoder1, so that the mask image corresponding to the target image can be obtained after 4 times downsampling of the original mask image, that is, the original mask image is downsampled to 1 / 4 of the mask image.
[0070] The original mask image is a mask image corresponding to the target image without any downsampling process.
[0071] The deviation prediction module 230 is used to perform a second decoding on the encoding of the target image to obtain a deviation result; wherein the deviation result is the deviation result between the reference mask image and the downsampled reference mask restoration image; the downsampled reference mask restoration image is a mask image restored after the reference mask image is downsampled by a second preset multiple; the reference mask image is a mask image after the original mask image is downsampled by a fourth preset multiple.
[0072] Specifically, the above-mentioned "fourth preset multiple" can be arbitrarily set as needed, for example: the fourth preset multiple can be 1, then the reference mask image is the original mask image mask; or the fourth preset multiple can be 2, then the reference mask image is 1 / 2mask.
[0073] In one embodiment, usually the fourth preset multiple * the second preset multiple = the first preset multiple. For example: decoder1 outputs a 4-fold (i.e., first preset multiple) downsampled mask image; for the deviation module, the reference mask image (set to be the mask image after the original mask image is downsampled by 2 times (i.e., the fourth preset multiple)) is downsampled by 2 times (i.e., the second preset multiple) (in this case 2*2=4 = the first preset multiple), and then restored to 2 times downsampled (i.e., the downsampled reference mask restoration image), and the reference mask image and the downsampled reference mask restoration image are compared to obtain the deviation result bias, which can better form a corresponding reference, thereby improving the accuracy of the final downsampled mask image. In addition, the fourth preset multiple * the second preset multiple may not be equal to the first preset multiple as needed, and all of them belong to the scope of protection of this application.
[0074] For example, continue as Figure 3 As shown, the encoding of the target image output by the encoder is used as the input of the deviation prediction module decoder2, and the deviation result bias can be output. For the training of the deviation prediction module, please refer to the following embodiment.
[0075] It should be noted that the encoder, decoder1 and decoder2 mentioned above can adopt various network structures with corresponding functions that are currently available or will be developed in the future as needed.
[0076] Specifically, the encoder can adopt various encoders that are currently available or will be developed in the future. Taking the yolov8-seg image segmenter as an example, the encoder module of the image segmenter is usually based on a commonly used convolutional neural network architecture, such as Darknet or ResNet. The network is responsible for performing a series of convolution and pooling operations on the image to gradually reduce the size of the feature map and extract high-level semantic features.
[0077] In one embodiment, decoder1 may adopt a decoder based on an FPN network. Exemplarily, it may include the following structure: conv+bn+rule and a convolutional neural network (conv).
[0078] Among them, batch normalization (bn) is a common regularization technique in deep learning. It normalizes the input data of each batch during the training of the neural network to accelerate the training process and improve the robustness and generalization ability of the model. Rule (Rectified Linear Unit) is a commonly used activation function. For example, the rule function can be defined as: f(x) = max(0, x), where x is the input value and f(x) is the output value of the ReLU function.
[0079] In one embodiment, decoder2 may also use a decoder based on an FPN network. Exemplarily, it may include the following structure: conv+bn+rule and conv.
[0080] It should be noted that the network model structures of the above decoder1 and decoder2 may be the same or different.
[0081] The combination prediction module 240 is used to combine the down-sampling mask map output by the down-sampling mask prediction module and the deviation result output by the deviation prediction module, so as to obtain a down-sampling corrected mask map of the target object.
[0082] For example, continue as Figure 3 As shown, the embodiment of the present application uses the mask map output by the downsampling mask prediction module 220 and the deviation result output by the deviation prediction module 230 as inputs of the combined prediction module, thereby outputting a corrected downsampling corrected mask map.
[0083] Specifically, the combined prediction module may be, but is not limited to, concat+conv, or other existing or future developed network structures with similar functions. concat is a combination function used to combine the down-sampled mask image and the deviation result, and then the combined result is input into conv, so as to output the final down-sampled corrected mask image.
[0084] Among them, Concat (short for Concatenate) refers to the concatenation of multiple tensors along a certain dimension. This operation is used to concatenate multiple tensors along a specified dimension to achieve feature fusion and information combination. Therefore, it can enrich the representation ability of the model and provide more flexibility for solving complex tasks. For example, concat a 16*16*5 matrix and a 16*16*3 matrix in dimension 2 to become 16*16*8.
[0085] In this application, decoder1 predicts a rough down-sampled mask image after down-sampling by a first preset multiple, and its edge is relatively poor. However, because decoder2 predicts a deviation result based on the reference mask image, the deviation result can reflect where the mask image after down-sampling has a large deviation, thereby providing the rough down-sampled mask image with a relatively poor edge. Figure 1 The edge information reference is used, so that the combination of the two can optimize a corrected down-sampling mask image with better edges.
[0086] It should be noted that the third preset downsampling multiple of the downsampling correction mask image finally obtained based on the above-mentioned segmenter relative to the original mask image can be greater than, less than or equal to the first downsampling preset multiple, that is, the downsampling multiple of the downsampling correction mask image finally output by the entire image segmenter can be the same as or different from the downsampling multiple of the downsampling mask image output by decoder1.
[0087] Furthermore, in one embodiment, the third preset multiple can be set to be smaller than the first preset multiple, so as to improve the efficiency of calculation. For example, the first preset downsampling multiple is N, and the third preset downsampling multiple is N / 2.
[0088] Exemplarily, the first preset multiple is set to 4 and the third preset multiple is set to 2. The original mask image can be output by decoder 1 to obtain a downsampled mask image after being downsampled by 4 times (the first preset multiple), and a downsampled modified mask image with a downsample of 2 times (the third preset multiple) can be obtained by combining the downsampled mask image and the deviation result.
[0089] Furthermore, in one embodiment, the first preset downsampling multiple can also be set to N, and the third preset downsampling multiple corresponding to the final downsampling correction mask image can be set to N; wherein N is an integer greater than or equal to 2, which can improve the final segmentation accuracy.
[0090] In an embodiment of the present application, the image segmenter adopts a branched deviation prediction module. Compared with the original image segmenter which only generates a downsampling segmentation mask map of the target image based on the downsampling mask prediction module, by combining the deviation results, it can reflect where there are large deviations in the downsampling mask map, and can obtain more useful information from multiple information sources, understand which areas may be poorly predicted, and make targeted corrections to better adjust and improve the prediction ability of the image segmenter, thereby obtaining a more accurate downsampling mask map.
[0091] The image segmenter of the embodiment of the present application adopts a branch deviation prediction module. The deviation result predicted by the deviation prediction module can reflect where there are large deviations in the down-sampled mask image. Therefore, by combining the down-sampled mask image with the predicted deviation result, a more accurate down-sampled corrected mask image can be finally predicted, thereby improving the accuracy of the final mask image while ensuring real-time performance.
[0092] Based on the image segmenter and segmentation system of the above embodiments, an embodiment of the present application provides a training method for an image segmenter, which is generally executed by the controller 120 .
[0093] Specifically, the image segmenter can be trained using various existing or future developed methods as needed, such as supervised learning, semi-supervised learning, etc.
[0094] like Figure 5 As shown, Figure 5 1 is a flow chart of an embodiment of the segmenter training method of the present application. In one embodiment, taking supervised learning as an example, the image segmenter training method may include the following method steps:
[0095] Step 310 obtains a training sample image.
[0096] In one embodiment, the controller may obtain, according to a preset address, a training sample image from a sample image set captured by an image sensor from a memory or a server.
[0097] It should be noted that the above-mentioned training sample images are the same or similar to the scenes and objects involved in the target image described in the embodiment of the present application, so that the final segmentation map of the target image (that is, the down-sampling corrected mask map described in the embodiment of the present application) can be generated by a segmentor trained based on the training sample images.
[0098] Step 320 obtains the label downsampling correction mask map, label downsampling mask map and label deviation result corresponding to the training sample image; wherein, the label downsampling correction mask map is the mask map after the label original mask map is downsampled by the third preset multiple; the label downsampling mask map is the mask map after the label original mask map is downsampled by the first preset multiple; the label deviation result is the deviation result between the label reference mask map and the label downsampling mask restoration map; the label downsampling mask restoration map is the mask map after the label reference mask map is downsampled by the second preset multiple and then restored.
[0099] Specifically, the “label reference mask image” is a mask image obtained by downsampling the original label mask image by a fourth preset multiple, and the fourth preset multiple can be arbitrarily set as needed.
[0100] For example, Figure 4As shown, the label original mask image (omitted in the figure) is downsampled by 2 times (i.e., downsampled by the fourth preset multiple) to obtain the label reference mask image mask0 described in the embodiment of the present application; the label reference mask image mask0 is downsampled by 2 times (i.e., downsampled by the second preset multiple) to obtain mask1, and then upsampled by 2 times to restore the label downsampled mask restoration image mask2, and mask0 and mask2 are compared to obtain the label deviation result bias.
[0101] Specifically, the label original mask image can be obtained by manual labeling, that is, clicking the edge of an object in a training sample image one by one with a mouse to combine them into a contour to form a label original mask image. In addition, other existing or future developed manual or automatic methods can also be used to obtain the label original mask image as needed.
[0102] Step 330 uses the label downsampling correction mask image, the label downsampling mask image and the label deviation result as annotations, and iteratively trains the image segmenter based on the training sample image until the termination condition is met.
[0103] It should be noted that the above modules can be trained separately and then combined together; in addition, the training of each module can also be completed synchronously with the entire image segmenter as a whole, which all falls within the scope of protection of this application.
[0104] For ease of understanding, the following example takes the image segmenter as a whole and completes the training of each module synchronously.
[0105] In one embodiment, step 330 may include: iteratively training the segmenter based on the difference loss1 between the downsampled mask image output by the downsampled mask prediction module 220 and the label downsampled mask image; the difference loss2 between the bias result output by the bias prediction module 230 and the label bias result (bias); and iteratively training the segmenter based on the difference loss3 between the downsampled corrected mask image output by the prediction module 240 and the label downsampled corrected mask image, that is, iteratively training the image segmentor based on loss1, loss2 and loss3 until the termination condition is met.
[0106] Specifically, the termination condition can be set arbitrarily as needed, for example: the iteration meets the preset number requirement, or loss1, loss2 and loss3 simultaneously meet the corresponding preset threshold requirements.
[0107] The embodiment of the present application can improve the image segmentation accuracy of the trained image segmentor by performing overall or separate training based on a downsampling mask prediction module, a deviation prediction module, and a combined prediction module.
[0108] For other related descriptions about the segmenter training method, reference may be made to the related descriptions in the above embodiments, which will not be repeated here.
[0109] Based on the image segmenter and segmentation system of the above embodiments, an embodiment of the present application provides an image segmentation method, which is generally executed by the controller 120 .
[0110] like Figure 6 As shown, Figure 6 : is a flowchart of an embodiment of the image segmentation method of the present application; the above-mentioned image segmentation method may include the following method steps:
[0111] Step 410 acquires a target image.
[0112] In one embodiment, the controller obtains the target image captured by the image sensor or the target image after some preprocessing from the memory or the server according to the preset address.
[0113] Step 420 uses the target image as the input of the segmenter and outputs a down-sampled corrected mask image.
[0114] In one embodiment, the controller uses the target image as the input of the encoding module 210 of the segmenter, so as to finally output a down-sampled corrected mask image of the target object.
[0115] The embodiment of the present application adopts the image segmenter described in the above embodiment. The segmenter adopts a branch deviation prediction module. The deviation result predicted by the deviation prediction module can reflect where the down-sampled mask image has a large deviation. Therefore, the down-sampled mask image is combined with the predicted deviation result to ultimately predict a down-sampled corrected mask image with higher accuracy, thereby improving the accuracy of the final mask image while ensuring real-time performance.
[0116] For other related descriptions about the image segmentation method, reference may be made to the related descriptions in the above embodiments, which will not be repeated here.
[0117] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0118] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0119] Further references Figure 7 , as a response to the above Figure 5 In order to realize the method shown in the figure, the present application provides an embodiment of a segmentation device, and the embodiment of the device is Figure 5 Corresponding to the method embodiment shown, the device can be specifically applied in a controller.
[0120] like Figure 5 As shown, an image segmentation training device, the device comprises:
[0121] The sample acquisition module 310 is used to acquire training sample images;
[0122] The label acquisition module 320 is used to obtain the label down-sampling correction mask map, the label down-sampling mask map and the label deviation result corresponding to the training sample image; wherein, the label down-sampling correction mask map is the mask map after the label original mask map is down-sampled by the third preset multiple; the label down-sampling mask map is the mask map after the label original mask map is down-sampled by the first preset multiple; the label encoding deviation result is the deviation result between the label reference mask map and the label down-sampling mask restoration map; the label down-sampling mask restoration map is the mask map after the label reference mask map is down-sampled by the second preset multiple and then restored; the label reference mask map is the mask map after the label original mask map is down-sampled by the fourth preset multiple;
[0123] The model training module 330 is used to iteratively train the image segmenter based on the training sample image as the image segmenter using the label downsampling correction mask image, the label downsampling mask image and the label deviation result as annotations until the termination condition is met.
[0124] Further references Figure 8 , as a response to the above Figure 6 The present application provides an embodiment of an image segmentation device, and the device embodiment is similar to Figure 6 Corresponding to the method embodiment shown, the device can be specifically applied in a controller.
[0125] like Figure 8As shown, the image segmentation device 400 of this embodiment includes:
[0126] An image acquisition module 410 is used to acquire a target image;
[0127] The image segmentation module 420 is used to take the target image as the input of the segmentation device and output a down-sampled corrected mask image.
[0128] In order to solve the above technical problems, the present application also provides a Fig. 9 Computer equipment shown.
[0129] The computer device can be a terminal or a server.
[0130] Among them, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as basic cloud computing services such as big data and artificial intelligence platforms. The terminal can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected by wired or wireless communication, which is not limited in this application.
[0131] The computer device 6 includes a memory 61, a processor 62, and a network interface 63 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 6 with components 61-63, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.
[0132] The memory 61 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 61 can be an internal storage unit of the computer device 6, such as a hard disk or memory of the computer device 6. In other embodiments, the memory 61 can also be an external storage device of the computer device 6, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. equipped on the computer device 6. Of course, the memory 61 can also include both the internal storage unit of the computer device 6 and its external storage device. In this embodiment, the memory 61 is generally used to store the operating system and various application software installed on the computer device 6, such as the program code of the model training and / or image segmentation method, etc. In addition, the memory 61 can also be used to temporarily store various types of data that have been output or are to be output.
[0133] The processor 62 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 62 is generally used to control the overall operation of the computer device 6. In this embodiment, the processor 62 is used to run the program code stored in the memory 61 or process data, such as running the program code for model training and / or segmentation.
[0134] The network interface 63 may include a wireless network interface or a wired network interface. The network interface 63 is generally used to establish a communication connection between the computer device 6 and other electronic devices.
[0135] The present application also provides another embodiment, namely, providing a computer-readable storage medium, which stores a control program for model training and / or segmentation, and the model training and / or segmentation program can be executed by at least one processor so that the at least one processor performs the steps of the above-mentioned model training and / or image segmentation method.
[0136] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0137] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.
Claims
1. An image segmenter, characterized in that: The image segmenter comprises: an encoding module, a downsampling mask prediction module, a deviation prediction module and a combined prediction module; The encoding module is used to take the target image as input and output the encoding of the target image; The down-sampling mask prediction module is used to perform a first decoding on the encoding of the target image to obtain a down-sampling mask image after the original mask image is down-sampled by a first preset multiple; A deviation prediction module is used to perform a second decoding on the encoding of the target image to obtain a deviation result; wherein the deviation result is a deviation result between a reference mask image and a downsampled reference mask restoration image; the downsampled reference mask restoration image is a mask image restored by downsampling the reference mask image by a second preset multiple; the reference mask image is a mask image restored by downsampling the original mask image by a fourth preset multiple; A combination prediction module is used to combine the down-sampling mask map output by the down-sampling mask prediction module and the deviation result output by the deviation prediction module, so as to obtain a down-sampling correction mask map of the down-sampling mask map.
2. The image segmenter according to claim 1, characterized in that The down-sampling mask prediction module is a first decoder; and / or, The deviation prediction module is a second decoder; and / or, The fourth preset multiple*the second preset multiple=the first preset multiple.
3. The image segmenter according to claim 1 or 2, characterized in that: The third preset downsampling multiple corresponding to the downsampling correction mask image is greater than, less than or equal to the first preset downsampling multiple.
4. The image segmenter according to claim 3, characterized in that The first preset downsampling multiple is N and the third preset downsampling multiple is N / 2; or, The first preset downsampling multiple is N and the third preset downsampling multiple is N; wherein N is an integer greater than or equal to 2.
5. A training method for an image segmenter according to any one of claims 1 to 4, characterized in that: The method comprises: Obtain training sample images; Obtain the label downsampling correction mask image, label downsampling mask image and label deviation result corresponding to the training sample image; wherein the label downsampling correction mask image is the mask image after the label original mask image is downsampled by the third preset multiple; the label downsampling mask image is the mask image after the label original mask image is downsampled by the first preset multiple; the label encoding deviation result is the deviation result between the label reference mask image and the label downsampling mask restoration image; the label downsampling mask restoration image is the mask image after the label reference mask image is downsampled by the second preset multiple and then restored; the label reference mask image is the mask image after the label original mask image is downsampled by the fourth preset multiple; The label downsampling correction mask image, the label downsampling mask image and the label deviation result are used as annotations, and the image segmentor is iteratively trained based on the training sample image as an image segmentor until a termination condition is met.
6. The image segmentation training method according to claim 5, characterized in that: The step of taking the label downsampling correction mask image, the label downsampling mask image and the label deviation result as annotations and iteratively training the image segmenter based on the training sample image as an image segmenter until a termination condition is met comprises the following steps: Combine the first difference between the down-sampling mask map output by the down-sampling mask prediction module and the label down-sampling mask map; the second difference between the deviation result output by the deviation prediction module and the label deviation result; And the image segmenter is iteratively trained based on the third difference between the down-sampled modified mask image output by the combined prediction module and the label down-sampled modified mask image until the termination condition is met.
7. An image segmentation method, characterized in that: The method comprises: Get the target image; The target image is used as an input of the image segmenter according to any one of claims 1 to 4, and the down-sampled corrected mask image of the target object is obtained as an output.
8. A splitting device, characterized in that: The device comprises: An image acquisition module, used for acquiring a target image; An image segmentation module is used to use the target image as an input of the image segmenter according to any one of claims 1 to 4, and output the down-sampled corrected mask image of the target object.
9. An image segmentation training device, characterized in that: The device comprises: A sample acquisition module is used to acquire training sample images; A label acquisition module, used to acquire a label down-sampling correction mask image, a label down-sampling mask image and a label deviation result corresponding to the training sample image; wherein the label down-sampling correction mask image is a mask image obtained by down-sampling the original label mask image by the third preset multiple; the label down-sampling mask image is a mask image obtained by down-sampling the original label mask image by the first preset multiple; the label encoding deviation result is a deviation result between a label reference mask image and a label down-sampling mask restoration image; the label down-sampling mask restoration image is a mask image restored after down-sampling the label reference mask image by the second preset multiple; the label reference mask image is a mask image obtained by down-sampling the original label mask image by the fourth preset multiple; The model training module is used to iteratively train the image segmentor based on the training sample image as an image segmentor using the label downsampling correction mask image, the label downsampling mask image and the label deviation result as annotations until a termination condition is met.
10. An image segmentation system, characterized in that: The system comprises: an image sensor and a controller; The image sensor is communicatively connected with the controller; The controller is used to implement the model training method described in claim 5 or 6; and / or the steps of the image segmentation method described in claim 7.
