Image segmentation model training method and device, storage medium, and electronic device
By training a neural network branch network through pixel type labeling and multi-level dilation operations on sample images, the problem of slow convergence speed in the training process of linear object image segmentation models is solved, achieving faster training convergence and higher segmentation accuracy.
Patent Information
- Application Number
- CN202210577494.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-25
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2042-05-25
AI Technical Summary
In existing technologies, image segmentation models for linear objects have slow convergence speeds during training, making it difficult to effectively improve segmentation accuracy.
By labeling the pixel types of sample images, background segmentation is performed using a branch network of a neural network. The image segmentation model is trained by combining multi-level dilation operations, including the cascaded training of the first and second dilated images, and the dilation coefficient is adjusted to improve the segmentation accuracy.
It accelerates the convergence speed of the image segmentation model during the training process, improves the segmentation accuracy of linear objects, and solves the problem of slow convergence speed.
Smart Images

Figure CN117197444B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of image processing, in particular to a training method and device of an image segmentation model, a storage medium and an electronic device. BACKGROUND
[0002] At present, the segmentation processing of images is usually processed by using an image processing model. The segmentation annotation of linear objects, such as electric wires, yarns and data lines, has the characteristics of narrowness and dispersion compared with the segmentation annotation of other obstacles, and thus is not conducive to the convergence of the deep learning segmentation algorithm, so that the convergence speed of the image segmentation model in the training process is slow.
[0003] In the related art, there is no effective solution to the slow convergence speed of the image segmentation model for linear objects in the training process. SUMMARY
[0004] The embodiments of the present application provide a training method of a linear object image segmentation model, a robot, a storage medium and an electronic device to at least solve the problem of slow convergence speed of the image segmentation model for linear objects in the training process in the related art.
[0005] According to an optional embodiment of the present application, a training method of an image segmentation model is provided, including: labeling each pixel in a sample image according to a pixel type to obtain a sample labeled image, wherein the pixel type includes a background class and a target object class; performing background segmentation on the sample image through a first branch network in a neural network to obtain a first segmentation result, wherein the neural network includes the image segmentation model, the first branch network is an intermediate model obtained by training the image segmentation model using a first dilated image, and the first dilated image is an image obtained by dilating the sample labeled image according to a first dilation coefficient; training the image segmentation model using the first segmentation result and a second dilated image to obtain a target image segmentation model, wherein the second dilated image is an image obtained by dilating the sample labeled image according to a second dilation coefficient, the second dilation coefficient is smaller than the first dilation coefficient, and the segmentation accuracy of the target image segmentation model for the target object class and the background class in the sample image is greater than a preset threshold.
[0006] Optionally, the training of the image segmentation model using the first segmentation result and the second dilated image includes: using the first segmentation result as input and supervising the training of the image segmentation model using the second dilated image.
[0007] Optionally, training the image segmentation model using the first segmentation result and the second dilated image includes: during supervised training of the image segmentation model, calculating the loss value of the first branch network based on the first segmentation result and the first dilated image; and updating the parameters in the neural network using the loss value of the first branch network.
[0008] Optionally, training the image segmentation model using the first segmentation result and the second dilated image to obtain the target image segmentation model includes: performing background segmentation on the sample image using the second branch network in the neural network to obtain a second segmentation result, wherein the second branch network is an intermediate model obtained by supervised training of the image segmentation model using the first segmentation result and the second dilated image; and performing supervised training of the image segmentation model using the second segmentation result and the third dilated image to obtain the target image segmentation model, wherein the third dilated image is an image obtained by dilating the sample labeled image according to a third dilation coefficient, and the third dilation coefficient is smaller than the second dilation coefficient.
[0009] Optionally, the above-mentioned supervised training of the image segmentation model using the second segmentation result and the third dilated image includes: calculating the loss value of the second branch network based on the second segmentation result and the second dilated image; and updating the parameters in the neural network using the loss value of the second branch network to obtain the image segmentation model.
[0010] Optionally, the above-mentioned supervised training of the image segmentation model using the second segmentation result and the third dilated image to obtain the target image segmentation model further includes: obtaining the third segmentation result of the image segmentation model on the target object class and the background class in the sample image; calculating the loss value of the neural network based on the sample labeled image and the third segmentation result; and updating the parameters in the neural network based on the loss value of the neural network to obtain the target image segmentation model.
[0011] Optionally, the third expansion coefficient mentioned above is 1.
[0012] According to another embodiment of this application, a training apparatus for an image segmentation model is also provided, comprising: a labeling unit, configured to label each pixel in a sample image according to pixel type to obtain a sample labeled image, wherein the pixel type includes background class and target object class; a segmentation unit, configured to perform background segmentation on the sample image through a first branch network in a neural network to obtain a first segmentation result, wherein the neural network includes the image segmentation model, the first branch network is an intermediate model obtained by training the image segmentation model using a first dilated image, the first dilated image is an image obtained by dilating the sample labeled image according to a first dilation coefficient; and a training unit, configured to train the image segmentation model using the first segmentation result and a second dilated image to obtain a target image segmentation model, wherein the second dilated image is an image obtained by dilating the sample labeled image according to a second dilation coefficient, the second dilation coefficient is less than the first dilation coefficient, and the segmentation accuracy of the target image segmentation model for the target object class and the background class in the sample image is greater than a preset threshold.
[0013] According to yet another embodiment of this application, a storage medium is also provided, wherein a computer program is stored therein, and the computer program is configured to execute the steps in any of the above method embodiments when running.
[0014] According to yet another embodiment of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0015] This application describes a method for segmenting a sample image by labeling each pixel according to its pixel type. A labeled sample image is then obtained. A first branch network within a neural network is used to segment the sample image, yielding a first segmentation result. The neural network includes an image segmentation model. The first branch network is an intermediate model trained using a first dilated image. The first dilated image is obtained by dilating the labeled sample image according to a first dilation coefficient. The first segmentation result and a second dilated image are used to train the image segmentation model, resulting in a target image segmentation model. The second dilated image is obtained by dilating the labeled sample image according to a second dilation coefficient, where the second dilation coefficient is smaller than the first dilation coefficient. The target image segmentation model achieves a segmentation accuracy greater than a preset threshold for separating the target object class from the background class in the sample image. The first segmentation result, obtained by training the image segmentation model using the first dilated image with the first dilation coefficient, is combined with the second dilated image to train the image segmentation model again, accelerating the convergence speed of the image segmentation model during training. The use of multi-level cascaded dilation operations for training the image segmentation network further accelerates the training and convergence of the image segmentation network model. By adopting the above technical solution, the problem of slow convergence speed of image segmentation models for linear objects during training is solved, thereby improving the convergence speed of image segmentation models during training. Attached Figure Description
[0016] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0017] Figure 1 This is a hardware structure block diagram of the training method for the image segmentation model in the embodiments of this application;
[0018] Figure 2 This is a flowchart of the training method for the image segmentation model according to an embodiment of this application;
[0019] Figure 3 This is a schematic diagram of a sample labeled image according to an embodiment of this application;
[0020] Figure 4 This is a schematic diagram of an inflated image according to an embodiment of this application;
[0021] Figure 5 This is a schematic diagram of the neural network structure according to an embodiment of this application;
[0022] Figure 6 This is a structural block diagram of the training device for the image segmentation model according to an embodiment of this application. Detailed Implementation
[0023] The present application will be described in detail below with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the embodiments of the present application can be combined with each other.
[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0025] The methods and embodiments provided in this application can be executed on a mobile terminal, a computer terminal, or a similar computing device. Taking running on a computer terminal as an example, Figure 1 This is a hardware structure block diagram of the training method for the image segmentation model according to an embodiment of this application. The computer terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor (MCU) or a field-programmable gate array (FPGA)) and a memory 104 for storing data are also shown. The computer terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the computer terminal described above. For example, the computer terminal may also include components that are more complex than those described above. Figure 1 The more or fewer components shown, or having the same Figure 1 Equivalent functions or ratios shown Figure 1 The functions shown have more different configurations.
[0026] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the image segmentation model training method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thus implementing the above-described method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to a computer terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0027] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider for the computer terminal. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0028] Figure 2 This is a flowchart of a training method for an image segmentation model according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps:
[0029] Step S202: Label each pixel in the sample image according to the pixel type to obtain the labeled sample image, wherein the pixel type includes background class and target object class;
[0030] Step S204: The sample image is segmented by the first branch network in the neural network to obtain the first segmentation result. The neural network includes an image segmentation model. The first branch network is an intermediate model trained by the image segmentation model using a first dilated image. The first dilated image is an image obtained by dilating the sample labeled image according to a first dilation coefficient.
[0031] Step S206: The image segmentation model is trained using the first segmentation result and the second dilated image to obtain the target image segmentation model. The second dilated image is an image obtained by dilating the sample labeled image according to the second dilation coefficient. The second dilation coefficient is smaller than the first dilation coefficient. The segmentation accuracy of the target image segmentation model for the target object class and the background class in the sample image is greater than a preset threshold.
[0032] Pixel type refers to the type of each pixel in the image, and is not limited to background and target object types. The target object type is not limited to lines in the image, and the background type is not limited to multiple background types, such as ground, sky, and other background types. The sample labeled image is not limited to images obtained by labeling sample images according to pixel type; it is also the standard segmentation result of the sample image. Sample images and sample labeled images are not limited to... Figure 3 As shown, the target object class is linear objects, which are not limited to any linear objects, such as wires, yarn, data cables, etc. The background class is divided into ground and other backgrounds. Taking the ground and other backgrounds as examples, other backgrounds in the sample image are marked as white, the ground is marked as black, and linear objects are marked as gray, so as to obtain the sample labeled image corresponding to the sample image.
[0033] Image segmentation models are not limited to the parts of a neural network that separately label the target object class and the background class of an image. By determining the type of each pixel, the model can segment linear objects of the target object class from the background.
[0034] Neural networks are not limited to including encoders, decoders, and segmentation models. Encoders are not limited to feature extraction networks, and decoders are not limited to convolutional networks composed of multiple sampling operators cascaded together. Branch networks in a neural network are not limited to supervising the training of the segmentation model to accelerate its convergence and thus obtain a target image segmentation model that meets the preset image segmentation requirements more quickly. The number of branch networks in a neural network is not limited to one or more, and multiple branch networks are not limited to a cascaded relationship; multiple cascaded branch networks can further accelerate the convergence speed of the segmentation model.
[0035] Dilation operations on labeled images are not limited to dilating the target object class pixels within the labeled image. The dilation coefficient is not limited to being greater than or equal to 1; the larger the dilation coefficient, the greater the dilation of the target object class pixels. A dilation coefficient of 1 represents the original labeled image, while a dilation coefficient greater than 1 represents dilation of the target object class pixels according to that coefficient. The dilation operation on labeled images is not limited to... Figure 4 As shown, in the original image, black pixels represent the background and white pixels represent the target object. The dilation operation expands the area occupied by the target object pixels, turning the surrounding non-white pixels into white pixels.
[0036] In this embodiment, each pixel in the sample image is labeled according to pixel type to obtain a labeled sample image. The sample image is then segmented using a first branch network in a neural network to obtain a first segmentation result. The neural network includes an image segmentation model. The first branch network is an intermediate model trained using a first dilated image. The first dilated image is an image obtained by dilating the labeled sample image according to a first dilation coefficient. The image segmentation model is trained using the first segmentation result and a second dilated image to obtain a target image segmentation model. The second dilated image is an image obtained by dilating the labeled sample image according to a second dilation coefficient, where the second dilation coefficient is smaller than the first dilation coefficient. The target image segmentation model achieves a segmentation accuracy greater than a preset threshold for the target object class and background class in the sample image. The first segmentation result obtained by training the image segmentation model using the first dilated image with the first dilation coefficient is combined with the second dilated image to train the image segmentation model again, accelerating the convergence speed of the image segmentation model during training. The training of the image segmentation network utilizes a multi-level cascaded dilation operation, thereby accelerating the training convergence of the image segmentation network model. By adopting the above technical solution, the problem of slow convergence speed of image segmentation models for linear objects during training is solved, thereby improving the convergence speed of image segmentation models during training.
[0037] Optionally, the above-mentioned training of the image segmentation model using the first segmentation result and the second dilated image includes: taking the first segmentation result as input and using the second dilated image to perform supervised training of the image segmentation model.
[0038] The first branch network is not limited to supervised training of the image segmentation model using the first dilated image. The intermediate model that satisfies the first convergence condition is obtained. When the first branch network reaches the first convergence condition, the first segmentation result obtained by the first branch network to perform background segmentation on the sample image is obtained. The first segmentation result is the image obtained by the first branch network labeling each pixel in the sample image according to the target object class and the background class.
[0039] Using the first segmentation result as input and the second dilated image as a supervision image, the image segmentation model that has reached the first convergence condition is further trained under supervision to obtain a target image segmentation model with a segmentation accuracy greater than a preset threshold.
[0040] Optionally, the image segmentation model is trained using the first segmentation result and the second dilated image, including: during the supervised training of the image segmentation model, calculating the loss value of the first branch network based on the first segmentation result and the first dilated image; and updating the parameters in the neural network using the loss value of the first branch network.
[0041] Given the first segmentation result, the loss value of the first branch network is calculated based on the first segmentation result and the first dilated image. The parameters in the neural network are updated using the loss value of the first branch network. This update is not limited to updating the model parameters of the image segmentation model that has reached the first convergence condition using the loss value of the first branch network. Thus, the first segmentation result is used as input, and the updated image segmentation model is trained under supervision using the second dilated image.
[0042] Optionally, the image segmentation model is trained using the first segmentation result and the second dilated image to obtain the target image segmentation model, including: performing background segmentation on the sample image through a second branch network in the neural network to obtain a second segmentation result, wherein the second branch network is an intermediate model obtained by supervised training of the image segmentation model using the first segmentation result and the second dilated image; and supervising training of the image segmentation model using the second segmentation result and the third dilated image to obtain the target image segmentation model, wherein the third dilated image is an image obtained by dilating the sample labeled image according to a third dilation coefficient, and the third dilation coefficient is smaller than the second dilation coefficient.
[0043] The second branch network is not limited to an intermediate model that meets the second convergence condition, obtained by supervising the image segmentation model updated with the loss value of the first branch network using the first segmentation result and the second dilated image. The second dilated image is an image obtained by dilating the sample labeled image according to a second dilation coefficient smaller than the first dilation coefficient. The second segmentation result is an image obtained by the second branch network that meets the second convergence condition, which labels each pixel in the sample image according to the target object class and the background class.
[0044] Optionally, the image segmentation model can be trained under supervision using the second segmentation result and the third dilated image, including: calculating the loss value of the second branch network based on the second segmentation result and the second dilated image; and updating the parameters in the neural network using the loss value of the second branch network to obtain the image segmentation model.
[0045] After supervising the training of the image segmentation model updated with the loss value of the first branch network using the first segmentation result and the second dilated image, and obtaining the second branch network that meets the second convergence condition, the loss value of the second branch network is calculated based on the second segmentation result and the second dilated image. The loss value of the second branch network is then used to update the model parameters of the image segmentation model that meets the second convergence condition. Thus, the second segmentation result is used as input, and the updated image segmentation model is trained again using the third dilated image to obtain a target image segmentation model with a segmentation accuracy greater than a preset threshold.
[0046] Optionally, the image segmentation model is trained under supervision using the second segmentation result and the third dilated image to obtain the target image segmentation model. This also includes: obtaining the third segmentation result of the image segmentation model on the target object class and the background class in the sample image; calculating the loss value of the neural network based on the sample labeled image and the third segmentation result; and updating the parameters in the neural network based on the loss value of the neural network to obtain the target image segmentation model.
[0047] Using the second segmentation result as input, the updated image segmentation model is trained again under supervised supervision using the third dilated image to obtain an image segmentation model that meets the convergence condition. The third segmentation result, which labels the target object class and background class in the sample image, is obtained. The image segmentation model is updated based on the loss value calculated from the third segmentation result and the labeled sample image, until a target image network model with a segmentation accuracy higher than a preset threshold is obtained.
[0048] If the segmentation accuracy indicated by the loss value between the third segmentation result and the labeled sample image is higher than a preset threshold, the current image segmentation model is determined to have converged to the target image segmentation model. If the segmentation accuracy indicated by the loss value between the third segmentation result and the labeled sample image is equal to or less than the preset threshold, the model parameters of the current image segmentation model are updated using the loss value. The third segmentation result is then used as input, and the updated image segmentation model is further trained under supervised supervision using the third dilated image until the target image segmentation model is obtained.
[0049] Optionally, the third dilation coefficient is 1. Using a third dilation coefficient of 1 allows for supervised training of the previously trained image segmentation model using original sample labeled images, making the converged image segmentation model closer to the target image segmentation model, thereby further accelerating the convergence speed of the image segmentation model. The third dilation coefficient can also be any value close to 1; the degree to which the third dilation coefficient is close to 1 is not limited to factors affecting the convergence of the image segmentation model to the target image segmentation model.
[0050] The neural networks and image segmentation model structures involved in the training methods of the aforementioned image segmentation models are not limited to, for example, those described above. Figure 5As shown, the neural network consists of three application parts: an Encoder, a Decoder, and a segmentation model. Branch networks accelerate the training and convergence speed of the segmentation model. Supervised training of branch network 1 is performed using the dilated image 1, resulting in a converged branch network 1. The segmentation result 1 of branch network 1 on the sample image is obtained, and the segmentation result 1 and the dilated image 1 are compared to obtain Loss 1. The parameters of branch network 1 optimized by Loss 1 are used as the initial parameters of branch network 2. The segmentation result 1 is used as the input of branch network 2, and supervised training of branch network 2 is performed using the dilated image 2 until a converged branch network 2 is obtained. The segmentation result 2 of branch network 2 on the sample image is obtained, and the segmentation result 2 and the dilated image 2 are compared to obtain Loss 2. The parameters of branch network 2 optimized by Loss 2 are used as the initial parameters of the segmentation model. The segmentation result 2 is used as the input of the segmentation model, and supervised training of the segmentation model is performed using the dilated image 3, resulting in a converged segmentation model. Obtain the segmentation result 3 of the sample image from the segmentation model. Calculate Loss3 by comparing the segmentation result 3 with the dilated image 3. Optimize the segmentation model using Loss3 until the segmentation accuracy is greater than a preset threshold, thus obtaining the final segmentation model. With the segmentation model obtained, directly output the labeled segmentation results of the input image using the segmentation model.
[0051] This embodiment also provides a training apparatus for an image segmentation model, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0052] Figure 6 This is a structural block diagram of a training device for an image segmentation model according to an embodiment of the present invention, such as... Figure 6 As shown, the device includes:
[0053] The annotation unit 602 is used to annotate each pixel in the sample image according to the pixel type to obtain the sample annotation image, wherein the pixel type includes background class and target object class;
[0054] The segmentation unit 604 is used to perform background segmentation on the sample image through the first branch network in the neural network to obtain a first segmentation result. The neural network includes an image segmentation model, the first branch network is an intermediate model trained by the image segmentation model using a first dilated image, and the first dilated image is an image obtained by dilating the sample labeled image according to a first dilation coefficient.
[0055] Training unit 606 is used to train the image segmentation model using the first segmentation result and the second dilated image to obtain the target image segmentation model. The second dilated image is an image obtained by dilating the sample labeled image according to the second dilation coefficient. The second dilation coefficient is smaller than the first dilation coefficient. The segmentation accuracy of the target image segmentation model for the target object class and the background class in the sample image is greater than a preset threshold.
[0056] Optionally, the training unit 606 may further include using the first segmentation result as input and supervising the training of the image segmentation model using the second dilated image.
[0057] Optionally, the training unit 606 further includes: during the supervised training of the image segmentation model, calculating the loss value of the first branch network based on the first segmentation result and the first dilated image; and updating the parameters in the neural network using the loss value of the first branch network.
[0058] Optionally, the training unit 606 further includes: performing background segmentation on the sample image through a second branch network in the neural network to obtain a second segmentation result, wherein the second branch network is an intermediate model obtained by supervised training of the image segmentation model using the first segmentation result and the second dilated image; and performing supervised training of the image segmentation model using the second segmentation result and the third dilated image to obtain a target image segmentation model, wherein the third dilated image is an image obtained by dilating the sample labeled image according to the third dilation coefficient, and the third dilation coefficient is smaller than the second dilation coefficient.
[0059] Optionally, the training unit 606 described above uses the second segmentation result and the third dilated image to perform supervised training on the image segmentation model, including: calculating the loss value of the second branch network based on the second segmentation result and the second dilated image; and updating the parameters in the neural network using the loss value of the second branch network to obtain the image segmentation model.
[0060] Optionally, the training unit 606 described above uses the second segmentation result and the third dilated image to perform supervised training on the image segmentation model to obtain the target image segmentation model, and further includes: obtaining the third segmentation result of the image segmentation model on the target object class and the background class in the sample image; calculating the loss value of the neural network based on the sample labeled image and the third segmentation result; and updating the parameters in the neural network based on the loss value of the neural network to obtain the target image segmentation model.
[0061] Optionally, the third dilation coefficient in the training device of the above image segmentation model is 1.
[0062] In this embodiment, each pixel in the sample image is labeled according to pixel type to obtain a labeled sample image. The sample image is then segmented using a first branch network in a neural network to obtain a first segmentation result. The neural network includes an image segmentation model. The first branch network is an intermediate model trained using a first dilated image. The first dilated image is an image obtained by dilating the labeled sample image according to a first dilation coefficient. The image segmentation model is trained using the first segmentation result and a second dilated image to obtain a target image segmentation model. The second dilated image is an image obtained by dilating the labeled sample image according to a second dilation coefficient, where the second dilation coefficient is smaller than the first dilation coefficient. The target image segmentation model achieves a segmentation accuracy greater than a preset threshold for the target object class and background class in the sample image. The first segmentation result obtained by training the image segmentation model using the first dilated image with the first dilation coefficient is combined with the second dilated image to train the image segmentation model again, accelerating the convergence speed of the image segmentation model during training. The training of the image segmentation network utilizes a multi-level cascaded dilation operation, thereby accelerating the training convergence of the image segmentation network model. By adopting the above technical solution, the problem of slow convergence speed of image segmentation models for linear objects during training is solved, thereby improving the convergence speed of image segmentation models during training.
[0063] This embodiment also provides a robot for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "unit" can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0064] The optional embodiments of this application take a self-moving robot (e.g., a robotic vacuum cleaner) as an example. In the application of cleaning robots, an autonomous exploration scheme is usually used to discover special signs and signals in the environment. However, under this scheme, the self-moving robot suffers from long exploration time and unsatisfactory exploration success rate, resulting in low mapping efficiency or even failure to map. To solve this technical problem, the optional embodiments of this application provide the following technical solutions:
[0065] An optional embodiment of this application provides a technical solution for training an image segmentation model, comprising the following steps:
[0066] S1, label each pixel in the sample image according to the pixel type to obtain the sample labeled image, where the pixel type includes background class and target object class;
[0067] S2, the sample image is segmented by the first branch network in the neural network to obtain the first segmentation result. The neural network includes an image segmentation model. The first branch network is an intermediate model trained by the image segmentation model using the first dilated image. The first dilated image is an image obtained by dilating the sample labeled image according to the first dilation coefficient.
[0068] S3, the image segmentation model is trained using the first segmentation result and the second dilated image to obtain the target image segmentation model. The second dilated image is the image obtained by dilating the sample labeled image according to the second dilation coefficient. The second dilation coefficient is smaller than the first dilation coefficient. The segmentation accuracy of the target image segmentation model for the target object class and the background class in the sample image is greater than the preset threshold.
[0069] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0070] Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed.
[0071] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0072] Embodiments of the present invention also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.
[0073] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0074] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0075] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0076] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.
Claims
1. A training method for an image segmentation model, characterized in that, include: The pixels in the sample image are labeled according to pixel type to obtain a labeled sample image, wherein the pixel type includes background class and target object class; The first segmentation result is obtained by segmenting the background and target object of the sample image through the first branch network in the neural network. The neural network includes the image segmentation model, and the first branch network is an intermediate model obtained by training the image segmentation model using a first dilated image. The first dilated image is an image obtained by dilating the sample labeled image according to a first dilation coefficient. The image segmentation model is trained using the first segmentation result and the second dilated image to obtain a target image segmentation model. The second dilated image is obtained by dilating the labeled sample image according to a second dilation coefficient, which is smaller than the first dilation coefficient. The target image segmentation model achieves a segmentation accuracy greater than a preset threshold for the target object class and the background class in the sample image. The step of training the image segmentation model using the first segmentation result and the second dilated image includes: The first segmentation result is used as input, and the image segmentation model is trained under supervision using the second dilated image. During the supervised training of the image segmentation model, the loss value of the first branch network is calculated based on the first segmentation result and the first dilated image. The parameters in the neural network are updated using the loss value of the first branch network.
2. The method according to claim 1, characterized in that, The step of training the image segmentation model using the first segmentation result and the second dilated image to obtain the target image segmentation model includes: The sample image is segmented by the second branch network in the neural network to obtain a second segmentation result, wherein the second branch network is an intermediate model obtained by supervised training of the image segmentation model using the first segmentation result and the second dilated image; The image segmentation model is trained under supervision using the second segmentation result and the third dilated image to obtain the target image segmentation model. The third dilated image is an image obtained by dilating the sample labeled image according to a third dilation coefficient, and the third dilation coefficient is smaller than the second dilation coefficient.
3. The method according to claim 2, characterized in that, The supervised training of the image segmentation model using the second segmentation result and the third dilated image includes: Based on the second segmentation result and the second dilated image, calculate the loss value of the second branch network; The parameters in the neural network are updated using the loss value of the second branch network to obtain the image segmentation model.
4. The method according to claim 3, characterized in that, The step of supervising the image segmentation model using the second segmentation result and the third dilated image to obtain the target image segmentation model further includes: Obtain the third segmentation result of the image segmentation model for the target object class and the background class in the sample image; The loss value of the neural network is calculated based on the labeled sample image and the third segmentation result; The parameters in the neural network are updated based on the loss value of the neural network to obtain the target image segmentation model.
5. The method according to any one of claims 2 to 4, characterized in that, The third expansion coefficient is 1.
6. A training device for an image segmentation model, characterized in that, include: A labeling unit is used to label each pixel in the sample image according to pixel type to obtain a labeled sample image, wherein the pixel type includes background class and target object class; A segmentation unit is used to perform background segmentation on the sample image through a first branch network in a neural network to obtain a first segmentation result. The neural network includes the image segmentation model, and the first branch network is an intermediate model obtained by supervised training of the image segmentation model using a first dilated image. The first dilated image is an image obtained by dilating the sample labeled image according to a first dilation coefficient. The training unit is used to supervise the training of the image segmentation model using the first segmentation result and the second dilated image to obtain a target image segmentation model. The second dilated image is an image obtained by dilating the labeled sample image according to a second dilation coefficient, where the second dilation coefficient is smaller than the first dilation coefficient. The target image segmentation model achieves a segmentation accuracy greater than a preset threshold for the target object class and the background class in the sample image. The training unit further includes: taking the first segmentation result as input and using the second dilated image to perform supervised training on the image segmentation model; During the supervised training of the image segmentation model, the loss value of the first branch network is calculated based on the first segmentation result and the first dilated image. Update the parameters in the neural network using the loss value of the first branch network.
7. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, wherein the computer program is configured to execute the method described in any one of claims 1 to 5 when it is run.
8. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Indoor scene semantic segmentation method based on convolutional neural network
CN111563507A
Object segmentation method and device, computer equipment and storage medium
CN112330684A