Image segmentation model training method, image segmentation method, medium and terminal
By constructing a training data set and loss function, the problem of false detection is corrected, and a more accurate image segmentation model is trained, which solves the problem of inaccurate image segmentation in the existing technology, especially in edge detection.
Patent Information
- Application Number
- CN201910533665.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-06-19
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2039-06-19
AI Technical Summary
Existing image segmentation technology based on deep networks has the problem of inaccurate segmentation, especially in edge detection.
By constructing a training data set, using an image segmentation algorithm to traverse pixel labels to find edge data, constructing a loss function to evaluate edge data, and introducing a penalty term to correct misdetections, a more accurate image segmentation model can be trained.
Improvements to existing algorithms are achieved, achieving higher image segmentation accuracy and reducing similar object confusion and small-size object segmentation errors.
Smart Images

Figure CN112116596B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an image segmentation model training method, an image segmentation method, a medium and a terminal. Background Art
[0002] Image segmentation is a classic computer vision task with a wide range of applications. Medical image segmentation can help doctors diagnose and treat, and image search based on image segmentation can help users search for unknown target objects. These are all examples of image segmentation applications.
[0003] Traditional image segmentation technologies mainly include pixel-based, edge-based, and region-based image segmentation. In recent years, due to the development of deep learning, a number of image segmentation algorithms based on deep networks have emerged. Thanks to big data, breakthroughs in key algorithms, and improvements in computing hardware, image segmentation algorithms based on deep networks have significantly improved their accuracy compared to traditional algorithms.
[0004] Although the emergence of deep networks has greatly improved the accuracy of image segmentation, the existing image segmentation technology based on deep networks still has the problem of inaccurate segmentation. Therefore, the existing technology needs to be improved and developed. Summary of the invention
[0005] The technical problem to be solved by the present invention is that, in view of the above-mentioned defects of the prior art, a training method for an image segmentation model, an image segmentation method, a medium and a terminal are provided, aiming to solve the problem of inaccurate image segmentation in the prior art.
[0006] The technical solution adopted by the present invention to solve the technical problem is as follows:
[0007] A training method for an image segmentation model, wherein the method comprises:
[0008] Constructing a training data set, wherein the training data set includes images with pixel labels;
[0009] Use the image segmentation algorithm to traverse the pixel labels of the images in the training data set, find the edge data of the image and output it;
[0010] Constructing a loss function, using the loss function to evaluate the edge data of the image, and outputting the evaluation result;
[0011] The evaluation results are fed back to the image segmentation algorithm for model training to obtain a trained image segmentation model.
[0012] The training method of the image segmentation model, wherein the training data set adopts ADE20K, the image segmentation algorithm adopts a baseline algorithm, and the baseline algorithm adopts a PSPnet algorithm.
[0013] The training method of the image segmentation model, wherein the pixel labels of the images in the training data set are traversed using a preset image segmentation algorithm, edge data of the images are found and output, comprises:
[0014] Obtaining a predefined pixel label, where the pixel label is used to indicate a characteristic of a pixel point;
[0015] Traverse each pixel on the image in the training data set and obtain the pixel label of each pixel;
[0016] The 48-connected area of each pixel is used as the adjacent area of the pixel to obtain the edge data of the image.
[0017] The training method of the image segmentation model, wherein the step of obtaining edge data of the image comprises:
[0018] Obtain an adjacent area of a pixel point and define the pixel point as a target pixel point;
[0019] Determine whether there is a pixel point in the adjacent area that has a pixel label different from that of the target pixel point;
[0020] If there is any pixel with a different pixel label, the target pixel is determined to be an edge pixel;
[0021] Get all edge pixels. The set of all edge pixels is the edge data of the image.
[0022] The training method of the image segmentation model, wherein the construction of the loss function comprises:
[0023] L2 regularization is introduced to construct a loss function with a regularization coefficient.
[0024] The training method of the image segmentation model, wherein the construction of the loss function further comprises:
[0025] Traverse the edge data of all images to determine whether there is any falsely detected edge data;
[0026] For the misdetected edge data, a penalty term is introduced and a loss function with a penalty term is constructed.
[0027] The training method of the image segmentation model, wherein the misdetected edge data represents pixel points that are not edges but are detected as edges and / or pixel points that are edges but are detected as not edges.
[0028] The training method of the image segmentation model, wherein the introduction of the penalty term specifically includes:
[0029] Different penalty items are introduced for different false detection situations.
[0030] An image segmentation method, comprising:
[0031] Get the segmented image;
[0032] The image to be segmented is input into a preset image segmentation model for segmentation to obtain a segmented image, wherein the image segmentation model is an image segmentation model trained by any of the above-mentioned image segmentation model training methods.
[0033] A storage medium having a plurality of instructions stored thereon, wherein the instructions are suitable for being loaded and executed by a processor to perform the training method for implementing any of the above-mentioned image segmentation models or the steps of the above-mentioned image segmentation method.
[0034] An intelligent terminal comprises: a processor and a storage medium communicatively connected to the processor, wherein the storage medium is suitable for storing multiple instructions; the processor is suitable for calling the instructions in the storage medium to execute the training method of the image segmentation model described in any one of the above or the steps of the image segmentation method described in the above.
[0035] Beneficial effects of the present invention: The present invention evaluates the edge data of an image by constructing a loss function, and trains a network model of an image segmentation algorithm according to the evaluation results, thereby improving the existing algorithm and obtaining an image segmentation model with higher accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 It is a flowchart of Example 1 of the training method of the image segmentation model provided by the present invention.
[0037] Figure 2 It is a flowchart of Example 2 of the training method of the image segmentation model provided by the present invention.
[0038] Figure 3 This is a flow chart of obtaining image edge data in the second embodiment.
[0039] Figure 4 It is a schematic diagram of the adjacent area of the present invention.
[0040] Figure 5 It is a schematic diagram of output edge data of the present invention.
[0041] Figure 6 This is an illustration of the false detection of edge data in the existing model. Figure 1.
[0042] Figure 7 This is an illustration of the false detection of edge data in the existing model. Figure 2 .
[0043] Figure 8 It is a flow chart of a preferred embodiment of the image segmentation method provided by the present invention.
[0044] Fig. 9 It is a functional principle diagram of the intelligent terminal provided by the present invention. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the present invention clearer and more specific, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0046] The training method of an image segmentation model provided by the present invention can be applied to a terminal. The terminal can be, but is not limited to, various personal computers, laptops, mobile phones, tablet computers, vehicle-mounted computers, and portable wearable devices. The terminal of the present invention adopts a multi-core processor. The processor of the terminal can be at least one of a central processing unit (CPU), a graphics processing unit (GPU), a video processing unit (VPU), etc.
[0047] In order to solve the problem of inaccurate edges of segmented images in the image segmentation technology based on the deep network algorithm in the prior art, the first embodiment provides a training method for an image segmentation model, specifically as follows: Figure 1 As shown in , the following steps are included:
[0048] Step S100: constructing a training data set, wherein the training data set includes images with pixel labels;
[0049] Step S200: Use a preset image segmentation algorithm to traverse the pixel labels of the images in the training data set, find the edge data of the image and output it;
[0050] Step S300: construct a loss function, use the loss function to evaluate the edge data of the image, and output the evaluation result;
[0051] Step S400: Feedback the evaluation results to the image segmentation algorithm for model training, and use the trained model to segment the image.
[0052] During the specific implementation, in this embodiment, it is first necessary to construct a training data set, which includes images with pixel labels. Preferably, this embodiment uses the ADE20K data set (ADE20K dataset, a data set released by MIT, which can be used for scene perception, parsing, segmentation, multi-object recognition and semantic understanding) as the training data set. The ADE20K data set covers a wide range of categories, with about 3,000 categories. Of course, in this field, there are many data sets to choose from, and those skilled in the art can also choose other data sets as training data sets, and predefine pixel labels in the images in the data set so that the training data set includes images with pixel labels.
[0053] Correspondingly, the preset image segmentation algorithm in this embodiment is a baseline algorithm, and the baseline algorithm preferably uses the PSPnet (Pyramid Scene Parsing Network) algorithm. The accuracy of the image segmentation model constructed by the PSPnet algorithm on the ADE20K-150 (a sub-dataset consisting of 150 commonly used categories selected from the original 3000 categories and with a large amount of data) data set is relatively high. Of course, in this field, there are many algorithms that can be used to construct image segmentation models, and those skilled in the art can also select other algorithms as image segmentation algorithms, and the present invention does not make specific limitations on this.
[0054] Please refer to the following Figure 2 , Figure 2 The figure shows a second embodiment of step S200 in the first embodiment. In the second embodiment, step S200 includes:
[0055] S110, obtaining a predefined pixel label, where the pixel label is used to indicate characteristics of a pixel point;
[0056] S120, traversing each pixel on the image, and obtaining a pixel label for each pixel;
[0057] S130 , taking the 48-connected area of each pixel as the adjacent area of the pixel, and acquiring edge data of the image.
[0058] In a specific implementation, a pixel label indicating the characteristics of a pixel point is predefined, and the characteristics of the pixel point can be various elements such as the RGB value, grayscale, transparency, etc. of the pixel point. When the RGB value, grayscale, transparency or other various elements of two pixels are relatively close, the labels of the two pixels are consistent, that is, the pixel labels can be used to determine whether the pixels have the same characteristics. Of course, those skilled in the art can make different specific definitions of pixel labels according to actual conditions, and ultimately only need to achieve the effect of determining whether the characteristics of the pixels are consistent through the labels.
[0059] In the second embodiment, the adjacent area of the pixel is further defined, and the 48-connected area of the pixel is taken as the adjacent area of the pixel. The 48-connected area of the pixel refers to the area within the range of 7*7 with one pixel as the center, such as Figure 4 As shown, Figure 4 The hollow pixel area is the 48-connected area of the solid pixel in the middle.
[0060] Embodiment 2 obtains edge data of an image based on the above two definitions.
[0061] Specifically, Figure 3 As shown, the obtaining of edge data includes:
[0062] S131, obtaining an adjacent area of a pixel point, and defining the pixel point as a target pixel point;
[0063] S132, determining whether there is a pixel point in the adjacent area that has a pixel label different from that of the target pixel point;
[0064] S133, if there is any pixel with a different pixel label in the adjacent area, determining that the target pixel is an edge pixel;
[0065] S134, obtaining all edge pixel points, where the set of all edge pixel points is the edge data of the image.
[0066] That is to say, since the training data set in this embodiment includes images with pixel labels, all pixels on the image are traversed, each pixel is judged to be an edge pixel, and a set of all edge pixels is obtained, that is, the edge data of the image is obtained.
[0067] When determining whether each pixel is an edge pixel, first obtain the adjacent area of the target pixel (such as Figure 4 As shown), and obtain the pixel labels of the target pixel and the pixels in the adjacent area. As mentioned above, the pixel label indicates the characteristics of the pixel. When the pixel labels are inconsistent, it indicates that the characteristics of the corresponding pixels are inconsistent. Then, in this embodiment, as long as there is a pixel in the adjacent area whose pixel label is different from the pixel label of the target pixel, it means that a characteristic change of the pixel has occurred in this adjacent area. This characteristic change identifies that the image in the adjacent area of this pixel has changed. Then the target pixel is defined as an edge pixel. After traversing all the pixels and making judgments, all the edge pixels on the image can be obtained, and the set of all the edge pixels can form the edge data of the image, such as Figure 5 shown.
[0068] Of course, in Example 2, the adjacent area is defined as the 48 connected areas of the target pixel point, but the present invention is not limited to the 48 connected areas as the adjacent areas. In other embodiments, other connected areas such as 24 connected areas and 8 connected areas can be selected as the adjacent areas of the image segmentation method based on edge data provided by the present invention.
[0069] Embodiment 3 provides an embodiment of the step S200. In the embodiment 3, in step S200, a loss function is constructed to evaluate the edge data. The loss function is:
[0070] Define the loss function as L mix1 :
[0071]
[0072] In formula (1), x refers to the horizontal coordinate position of the image, y refers to the vertical coordinate position of the image, w refers to the width of the image, and h refers to the height of the image. is the probability that the pixel is judged as the correct labeli, I function is the indicator function, im refers to the imfeature function, and α is the balance factor, which can be obtained by cross-validation. The definitions of other items are as follows:
[0073]
[0074]
[0075] Furthermore, in order to save time and effectively utilize the GPU (Graphics Processing Unit), the edge data output results of a group of pictures are generally used to evaluate them using the loss function. Therefore, in this embodiment, in order to prevent overfitting and improve the accuracy of the evaluation, L2 regularization is introduced to construct a loss function with a regularization coefficient. The specific formula is as follows:
[0076]
[0077] In formula (4), N is the batch size of the algorithm training (the batch size can be understood as the number of samples or images here), i refers to each image in the training data set, and λ is the regularization coefficient. That is the L2 regularization term, where j is the network training parameter and M is the total number of network training parameters.
[0078] In this way, a loss function formula with edge information added is obtained, and the edge data output by the image segmentation algorithm is evaluated using the loss function formula.
[0079] In S300 of the first embodiment, the evaluation result of the edge data made by using the loss function is fed back to the image segmentation algorithm, and the network model learns the quality of the image segmentation effect made by the image segmentation algorithm according to the evaluation result, and then improves the network model of the image segmentation algorithm according to the evaluation result, that is, performs model training to obtain an image segmentation model with more accurate image segmentation, and subsequently uses the obtained image segmentation model to segment the image to obtain a more accurate image segmentation result.
[0080] In existing image segmentation technologies, inaccurate segmentation often occurs, for example, the segmentation of similar types of objects is confused, such as Figure 6 The confusion of similar objects shown, and Figure 7 The above problem is actually the problem of false detection of edge data, that is, the problem of detecting edges when they are not edges and / or detecting edges when they are not edges. Figure 6 The leftmost image is the original image, the middle image is the correct segmentation result, and the rightmost image is the output result of the existing model. Figure 6 In the output results of the existing model shown, the segmentation results of the skyscraper and the building are mixed. In fact, the edge between the skyscraper and the building is detected as not an edge, and there is no segmentation edge on the surface of the skyscraper, but an edge is detected; Figure 7 The leftmost image is the original image, the middle image is the correct segmentation result, and the rightmost image is the output result of the existing model. Figure 7 In the output results of the existing model shown, the small-sized pillows are not segmented. In fact, the edges of the small-sized pillows are not detected. In order to solve the above problem, in other embodiments, all edge data are traversed, and penalty items are introduced for the misdetected edge data. A loss function with penalty items is constructed to evaluate the edge data, thereby better training the model of the baseline algorithm.
[0081] Embodiment 4 provides a solution to the problem that there are pixels in edge data that are not actually edges but are detected as edges.
[0082] In the fourth embodiment, the edge data output by the baseline algorithm is first traversed to obtain the pixel points that are not edges but are detected as edges, and the first penalty term L is introduced to these pixel point data. fp , the specific formula is as follows:
[0083]
[0084] Then, the loss function with the first penalty term added is:
[0085]
[0086] Among them, β is the penalty term balancing factor, and outim refers to out=im(), that is, the output imfeature function.
[0087] It can be seen that the error of the pixel points that are not edges but are detected as edges can be reflected by the loss function (6). Then, by feeding back the evaluation result obtained by (6) to the original image segmentation algorithm, the original image segmentation algorithm can learn the error of the pixel points that are not edges but are detected as edges, and then train a more accurate image segmentation model.
[0088] Embodiment 5 provides a solution to the problem that there are edges in edge data that are not detected as edges.
[0089] In the fifth embodiment, the edge data output by the baseline algorithm is first traversed to obtain the pixel points that are originally edges but are not detected as edges, and the second penalty term L is introduced to these pixel point data. fn , the specific formula is as follows:
[0090]
[0091] Then, the loss function with the second penalty term added is:
[0092]
[0093] Among them, γ is the penalty term balance factor.
[0094] It can be seen that the error of the pixel points that were originally edges but were not detected as edges can be reflected by the loss function (8). Then, by using the evaluation result obtained by (8) to feed back to the original image segmentation algorithm, the original image segmentation algorithm can learn the error of the pixel points that were originally edges but were not detected as edges, and then train a more accurate image segmentation model.
[0095] It can be seen from the combination of Example 4 and Example 5 that the spirit of introducing the penalty term in the present invention is to introduce corresponding penalty terms according to different false detection results, so that the final loss function can make corresponding evaluations on all false detection results. In this way, the more accurate the information fed back to the image segmentation algorithm, the more effective the model training.
[0096] At the same time, it can be seen that the image segmentation method based on edge data proposed in the present invention does not make major changes to the subject structure of the network model, but only makes appropriate modifications to the loss function of the model, evaluates the image segmentation algorithm based on the loss result, and trains the original network model. In other words, the training method of the image segmentation model proposed in the present invention can directly use the existing segmentation algorithm to improve its network model without making major changes to the framework, so that the image segmentation model can segment the image more accurately.
[0097] Based on the above embodiment, the present invention also provides an image segmentation method, specifically as follows Figure 8 As shown in , the image segmentation method includes the following steps:
[0098] Step 10: Obtain the image to be segmented;
[0099] Step 20: Input the image to be segmented into a preset image segmentation model for segmentation to obtain a segmented image.
[0100] Among them, the image segmentation model in this embodiment is an image segmentation model trained by the training method of the image segmentation model based on the above-mentioned embodiment. Since the image segmentation model evaluates the edge data of the image by constructing a loss function, and trains the network model of the image segmentation algorithm according to the evaluation results, and improves the existing algorithm, the image segmentation model can be used to perform more accurate segmentation.
[0101] Based on the above embodiments, the present invention further provides an intelligent terminal, whose principle block diagram can be shown as follows: Fig. 9 As shown. The intelligent terminal includes a processor, a memory, a network interface, a display screen, and a temperature sensor connected through a system bus. Among them, the processor of the intelligent terminal is used to provide computing and control capabilities. The memory of the intelligent terminal includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the intelligent terminal is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an image segmentation method based on edge data is implemented. The display screen of the intelligent terminal can be a liquid crystal display screen or an electronic ink display screen, and the temperature sensor of the intelligent terminal is pre-set inside the intelligent terminal to detect the current operating temperature of the internal device.
[0102] Those skilled in the art will understand that Fig. 9The principle block diagram shown in the figure is only a block diagram of a partial structure related to the scheme of the present invention, and does not constitute a limitation on the smart terminal to which the scheme of the present invention is applied. The specific smart terminal may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0103] In one embodiment, a smart terminal is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, at least the following steps can be implemented:
[0104] Construct a training data set, use the preset image segmentation algorithm to traverse the pixel labels of the images in the training data set, find the edge data of the image and output it;
[0105] Constructing a loss function, using the loss function to evaluate the edge data of the image, and outputting the evaluation result;
[0106] The evaluation results are fed back to the image segmentation algorithm for model training, and the trained model is used to segment the image.
[0107] In one of the embodiments, the processor may further implement the following steps when executing the computer program: using ADE20K as the training data set, using a baseline algorithm for the image segmentation algorithm, and using a PSPnet algorithm for the baseline algorithm.
[0108] In one of the embodiments, the processor can also implement the following steps when executing the computer program: predefine pixel labels, wherein the pixel labels are used to indicate the characteristics of the pixels; traverse each pixel on the image to obtain the pixel label of each pixel; and use the 48-connected area of each pixel as the adjacent area of the pixel to obtain the edge data of the image.
[0109] In one of the embodiments, the processor may further implement the following steps when executing the computer program: obtaining an adjacent area of a pixel point and defining the pixel point as a target pixel point;
[0110] Determine whether there is a pixel point in the adjacent area that has a pixel label different from that of the target pixel point;
[0111] If there is any pixel with a different pixel label, the target pixel is determined to be an edge pixel;
[0112] Get all edge pixels. The set of all edge pixels is the edge data of the image.
[0113] In one of the embodiments, the processor may further implement the following steps when executing the computer program: introducing L2 regularization and constructing a loss function with a regularization coefficient.
[0114] In one of the embodiments, the processor can also implement the following steps when executing the computer program: traverse the edge data of all images to determine whether there is falsely detected edge data; for the falsely detected edge data, introduce a penalty term and construct a loss function with a penalty term, wherein the falsely detected edge data represents pixel points that were not originally edges but were detected as edges and / or pixel points that were originally edges but were detected as not edges.
[0115] In one of the embodiments, the processor may further implement the following steps when executing the computer program: introducing different penalty items for different misdetection situations.
[0116] In one embodiment, when the processor executes the computer program, it can also implement accurate image segmentation using the image segmentation model trained by the above-mentioned image segmentation model training method.
[0117] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0118] In summary, the present invention discloses a training method for an image segmentation model, an image segmentation method, a medium and a terminal, wherein the method comprises: constructing a training data set, wherein the training data set comprises images with pixel labels; using a preset image segmentation algorithm to traverse the pixel labels of the images in the training data set, finding and outputting the edge data of the images; constructing a loss function, using the loss function to evaluate the edge data of the images, and outputting the evaluation result; feeding the evaluation result back to the image segmentation algorithm for model training to obtain a trained image segmentation model. The present invention can improve the existing algorithm by constructing a loss function to evaluate the edge data of the image, and training the network model of the image segmentation algorithm according to the evaluation result, so as to obtain an image segmentation model with higher accuracy.
[0119] It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.
Claims
1. A training method for an image segmentation model, characterized in that: The method comprises: Constructing a training data set, wherein the training data set includes images with pixel labels; Use the preset image segmentation algorithm to traverse the pixel labels of the images in the training data set, find the edge data of the image and output it; Constructing a loss function, using the loss function to evaluate the edge data of the image, and outputting the evaluation result; Feeding the evaluation results back to the image segmentation algorithm for model training to obtain a trained image segmentation model, wherein the image segmentation algorithm adopts a baseline algorithm; Construct a loss function, including: Traverse the edge data of all images to determine whether there is any falsely detected edge data; For the falsely detected edge data, different penalty items are introduced according to different false detection situations, and a loss function with penalty items is constructed; The misdetected edge data represent pixel points that are not edges but are detected as edges and / or pixel points that are edges but are detected as not edges; The loss function constructed for evaluating marginal data is defined as: , Among them, x refers to the horizontal coordinate position of the image, y refers to the vertical coordinate position of the image, w refers to the width of the image, h refers to the height of the image, I function is the indicator function, and im refers to the imfeature function. is the balancing factor, is the probability that the pixel is judged as the correct labeli; , , For the falsely detected edge data, different penalty items are introduced for different false detection situations, and a loss function with penalty items is constructed, including: Traverse the edge data output by the baseline algorithm, obtain the pixels that are not edges but are detected as edges, and introduce the first penalty term to these pixel data , the specific formula is: ; Where N is the number of images trained on the algorithm, i refers to each image in the training dataset, and outim refers to out=im(), the output of the imfeature function; The loss function with the first penalty term added is: Among them, β is the penalty term balance factor, is the regularization coefficient, is the L2 regularization term, where j is the network training parameter and M is the total number of network training parameters; Traverse the edge data output by the baseline algorithm, obtain the pixels that were originally edges but were not detected as edges, and introduce the second penalty term to these pixel data , the specific formula is: The loss function with the second penalty term added is: Among them, γ is the penalty term balance factor.
2. The image segmentation model training method according to claim 1, characterized in that: The training data set adopts ADE20K, and the baseline algorithm adopts the PSPnet algorithm.
3. The image segmentation model training method according to claim 1, characterized in that: The method of using a preset image segmentation algorithm to traverse the pixel labels of the images in the training data set, find the edge data of the images and output them includes: Obtaining a predefined pixel label, where the pixel label is used to indicate a characteristic of a pixel point; Traverse each pixel on the image in the training data set and obtain the pixel label of each pixel; The 48-connected area of each pixel is used as the adjacent area of the pixel to obtain the edge data of the image.
4. The image segmentation model training method according to claim 3, characterized in that: The step of obtaining edge data of an image includes: Obtain an adjacent area of a pixel point and define the pixel point as a target pixel point; Determine whether there is a pixel point in the adjacent area that has a pixel label different from that of the target pixel point; If there is any pixel with a different pixel label, the target pixel is determined to be an edge pixel; Get all edge pixels. The set of all edge pixels is the edge data of the image.
5. An image segmentation method, characterized in that: include: Obtain an image to be segmented; The image to be segmented is input into a preset image segmentation model for segmentation to obtain a segmented image, wherein the image segmentation model is an image segmentation model trained by the image segmentation model training method described in any one of claims 1 to 4.
6. A storage medium having a plurality of instructions stored thereon, characterized in that: The instructions are suitable for being loaded and executed by a processor to perform the steps of implementing the training method of the image segmentation model described in any one of claims 1 to 4 or the image segmentation method described in claim 5.
7. An intelligent terminal, comprising: A processor and a storage medium communicatively connected to the processor, characterized in that the storage medium is suitable for storing multiple instructions; the processor is suitable for calling the instructions in the storage medium to execute the training method of the image segmentation model described in any one of claims 1 to 4 or the steps of the image segmentation method described in claim 5.
Citation Information
Patent Citations
Novel convolutional neural network-based remote-sensing image road extraction method
CN107025440A
Blower fan blade protection film damage detection method based on edge segmentation
CN107153842A
Semantic segmentation network training method, image semantic segmentation method and devices
CN108537292A
Matting model training and image matting method, device and system and storage medium
CN108876804A
Image segmentation method and device and electronic device
CN109325954A
