Segmentation network training method, device, computer equipment and storage medium

By constructing a target loss function and combining regional feature loss and geometric feature loss, the segmentation network is trained, which solves the problem of low accuracy of traditional image segmentation methods and improves the precision and accuracy of image segmentation.

CN113592876BActive Publication Date: 2024-09-06TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110049449.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-14
Publication Date
2024-09-06
Estimated Expiration
2041-01-14

AI Technical Summary

Technical Problem

Traditional image segmentation methods easily reduce the accuracy of image segmentation during multiple down-sampling and up-sampling processes, and are difficult to effectively utilize multi-scale information.

Method used

By obtaining the sample image of the target geometric figure, determine the labeled geometric area and predicted geometric area, calculate the regional feature loss and geometric feature loss, construct the target loss function, and train the segmentation network until the training stop condition is reached, improving the accuracy and accuracy of image segmentation. accuracy.

Benefits of technology

It achieves higher precision and accuracy in the image segmentation process, can accurately locate the target geometry and its vertex information in the image, and fully considers the impact of multi-faceted losses on the segmentation network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113592876B
    Figure CN113592876B
Patent Text Reader

Abstract

The present application relates to a training method, device, computer equipment and storage medium for a segmentation network. The method includes: obtaining a sample image including a target geometric figure and a corresponding annotated geometric region; performing target segmentation processing on the sample image through a segmentation network to be trained to obtain a predicted geometric region and corresponding predicted vertex information corresponding to the target geometric figure; determining the corresponding regional feature loss according to the predicted geometric region and the annotated geometric region; determining the corresponding geometric feature loss according to the predicted geometric region and the predicted polygonal region determined by the predicted vertex information; training the segmentation network to be trained based on the target loss function constructed by the regional feature loss and the geometric feature loss until the training stop condition is reached, and obtaining a trained target segmentation network; the target segmentation network is used to segment the target geometric figure from the image to be processed. The present method can improve the segmentation precision and accuracy of the segmentation network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a training method, apparatus, computer device and storage medium for a segmentation network. Background Art

[0002] With the development of computer technology, deep learning has been widely used in various fields, such as image recognition and image segmentation. Image recognition and image segmentation can segment the area or information required by the user from the image.

[0003] However, image segmentation is a pixel-level prediction, which often requires multiple downsampling and upsampling, and multi-scale information is needed in the recognition and segmentation process. The traditional method reduces the parameters by reducing the number of upsampling and downsampling and the number of channels, but it is easy to reduce the accuracy of image segmentation. Summary of the invention

[0004] Based on this, it is necessary to provide a training method, device, computer equipment and storage medium for a segmentation network that can improve the precision and accuracy of image segmentation in order to address the above technical problems.

[0005] A training method for a segmentation network, the method comprising:

[0006] Acquire a sample image including a target geometric figure, and determine a marked geometric area corresponding to the target geometric figure based on the sample image;

[0007] Performing target segmentation processing on the sample image through the segmentation network to be trained to obtain a predicted geometric region corresponding to the target geometric figure, and determining predicted vertex information corresponding to the target geometric figure based on image features in the target segmentation processing;

[0008] Determining a corresponding regional feature loss according to the predicted geometric region and the annotated geometric region;

[0009] Determining a corresponding geometric feature loss according to the predicted geometric area and the predicted polygon area determined by the predicted vertex information;

[0010] Based on the regional feature loss and the geometric feature loss, construct a target loss function;

[0011] The segmentation network to be trained is trained by the target loss function until the training stop condition is reached, thereby obtaining a trained target segmentation network; the target segmentation network is used to segment target geometric figures from the image to be processed.

[0012] In one embodiment, the target vertex information includes target vertex coordinates; the method further includes:

[0013] Determine a target polygonal area formed by the target vertex coordinates;

[0014] Determine the intersection-and-union ratio between the area of ​​the target polygonal region and the area of ​​a preset region;

[0015] When the intersection-over-union ratio is greater than or equal to a threshold, segmenting a target polygonal area formed by the target vertex coordinates from the image to be processed;

[0016] Corresponding business processing is performed based on the target polygonal area.

[0017] A training device for a segmentation network, the device comprising:

[0018] An acquisition module, used for acquiring a sample image including a target geometric figure, and determining a marked geometric area corresponding to the target geometric figure based on the sample image;

[0019] A prediction module, used for performing target segmentation processing on the sample image through the segmentation network to be trained, obtaining a predicted geometric region corresponding to the target geometric figure, and determining predicted vertex information corresponding to the target geometric figure based on image features in the target segmentation processing;

[0020] A regional feature loss determination module, used to determine the corresponding regional feature loss according to the predicted geometric region and the marked geometric region;

[0021] A geometric feature loss determination module, configured to determine a corresponding geometric feature loss according to the predicted geometric region and the predicted polygon region determined by the predicted vertex information;

[0022] A construction module, used to construct a target loss function based on the regional feature loss and the geometric feature loss;

[0023] The training module is used to train the segmentation network to be trained by the target loss function until the training stop condition is reached, thereby obtaining a trained target segmentation network; the target segmentation network is used to segment the target geometric figure from the image to be processed.

[0024] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0025] Acquire a sample image including a target geometric figure, and determine a marked geometric area corresponding to the target geometric figure based on the sample image;

[0026] Performing target segmentation processing on the sample image through the segmentation network to be trained to obtain a predicted geometric region corresponding to the target geometric figure, and determining predicted vertex information corresponding to the target geometric figure based on image features in the target segmentation processing;

[0027] Determining a corresponding regional feature loss according to the predicted geometric region and the annotated geometric region;

[0028] Determining a corresponding geometric feature loss according to the predicted geometric area and the predicted polygon area determined by the predicted vertex information;

[0029] Based on the regional feature loss and the geometric feature loss, construct a target loss function;

[0030] The segmentation network to be trained is trained by the target loss function until the training stop condition is reached, thereby obtaining a trained target segmentation network; the target segmentation network is used to segment target geometric figures from the image to be processed.

[0031] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:

[0032] Acquire a sample image including a target geometric figure, and determine a marked geometric area corresponding to the target geometric figure based on the sample image;

[0033] Performing target segmentation processing on the sample image through the segmentation network to be trained to obtain a predicted geometric region corresponding to the target geometric figure, and determining predicted vertex information corresponding to the target geometric figure based on image features in the target segmentation processing;

[0034] Determining a corresponding regional feature loss according to the predicted geometric region and the annotated geometric region;

[0035] Determining a corresponding geometric feature loss according to the predicted geometric area and the predicted polygon area determined by the predicted vertex information;

[0036] Based on the regional feature loss and the geometric feature loss, construct a target loss function;

[0037] The segmentation network to be trained is trained by the target loss function until the training stop condition is reached, thereby obtaining a trained target segmentation network; the target segmentation network is used to segment target geometric figures from the image to be processed.

[0038] The training method, device, computer equipment and storage medium of the segmentation network can obtain the predicted geometric region corresponding to the target geometric figure predicted by the segmentation network through the segmentation network to be trained. Based on the image features in the target segmentation process, the predicted vertex information of the target geometric figure predicted by the segmentation network in the sample image can be obtained. According to the regional feature loss between the predicted geometric region and the annotated geometric region, and the geometric feature loss between the predicted geometric region and the predicted polygonal region determined by the predicted vertex information, a target loss function is constructed, so that the target loss function contains multiple loss features. Based on the multiple losses, the segmentation network to be trained is trained, and the influence of various losses on the recognition and segmentation of the segmentation network can be fully considered, so that the recognition and segmentation precision and accuracy of the segmentation network can be improved through training. The trained target segmentation network can accurately identify and segment the target geometric figure from the image. And the vertex information of the target geometric figure in the image can be accurately output, so as to accurately locate the target geometric figure in the image. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 A diagram of an application environment of a training method for a segmentation network in one embodiment;

[0040] Figure 2 A schematic diagram of a flow chart of a training method for a segmentation network in one embodiment;

[0041] Figure 3 A schematic diagram of a flow chart of a step of determining predicted vertex information corresponding to a target geometric figure in one embodiment;

[0042] Figure 4 A schematic flow chart of a step of determining a corresponding regional feature loss according to a predicted geometric region and an annotated geometric region in an embodiment;

[0043] Figure 5 A schematic flow chart of the steps of determining a first color value corresponding to a predicted geometric region and marking a second color value corresponding to a marked geometric region in one embodiment;

[0044] Figure 6 A schematic flow chart of a step of determining a corresponding geometric feature loss according to a predicted geometric region and a predicted polygon region determined by predicted vertex information in one embodiment;

[0045] Figure 7 A schematic diagram of a flow chart of a test for segmenting a network in one embodiment;

[0046] Figure 8 A diagram of a training architecture for a segmentation network in one embodiment;

[0047] Fig. 9 A schematic diagram of a flow chart of an application for segmenting a network in one embodiment;

[0048] Fig.10 is a structural block diagram of a training device for segmenting a network in one embodiment;

[0049] Fig.11 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0050] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0051] The present application relates to the field of artificial intelligence (AI) technology, wherein artificial intelligence is the theory, method, technology and application system of simulating, extending and expanding human intelligence, perceiving the environment, acquiring knowledge and using knowledge to obtain the best results using digital computers or machines controlled by digital computers. In other words, artificial intelligence is a comprehensive technology of computer science, which attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that the machines have the functions of perception, reasoning and decision-making. The scheme provided in the embodiment of the present application relates to the training method of the segmentation network of artificial intelligence, which is specifically described by the following embodiments.

[0052] The training method of the segmentation network provided in this application can be applied to Figure 1 The segmentation network training system shown in Figure 2 is shown in Figure 2. Figure 1As shown, the segmentation network training system includes a terminal 110 and a server 120. In one embodiment, the terminal 110 and the server 120 can each independently perform the training method of the segmentation network provided in the embodiment of the present application. The terminal 110 and the server 120 can also be used in conjunction to perform the training method of the segmentation network provided in the embodiment of the present application. When the terminal 110 and the server 120 are used in conjunction to perform the training method of the segmentation network provided in the embodiment of the present application, the terminal 110 obtains a sample image including a target geometric figure, and determines a labeled geometric region corresponding to the target geometric figure based on the sample image. The terminal 110 sends the sample image and the corresponding labeled geometric region to the server 120. The server 120 performs target segmentation processing on the sample image through the segmentation network to be trained, obtains a predicted geometric region corresponding to the target geometric figure, and determines the predicted vertex information corresponding to the target geometric figure based on the image features in the target segmentation processing. The server 120 determines the corresponding regional feature loss based on the predicted geometric region and the labeled geometric region. The server 120 determines the corresponding geometric feature loss based on the predicted geometric region and the predicted polygon region determined by the predicted vertex information. The server 120 constructs a target loss function based on the regional feature loss and the geometric feature loss. The server 120 trains the segmentation network to be trained by the target loss function until the training stop condition is reached, and obtains a trained target segmentation network; the target segmentation network is used to segment the target geometric figure from the image to be processed.

[0053] The terminal 110 uploads the image to be processed to the server 120. The server 120 performs target segmentation processing on the image to be processed through the trained segmentation network to obtain the target geometric figures and target vertex information in the image to be processed. The server 120 returns the target geometric figures and target vertex information to the terminal 110. Figure 1 As shown in 112 in FIG. 112 , the target geometry is as follows Figure 1 As shown in 114.

[0054] The terminal 110 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices, and the server 120 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The terminal 110 and the server 120 may be directly or indirectly connected via wired or wireless communication, which is not limited in this application.

[0055] In one embodiment, Figure 2 As shown, a training method for a segmentation network is provided, and the method is applied to a computer device (the computer device may be specifically Figure 1The terminal or server in the example is used to illustrate, including the following steps:

[0056] Step S202: acquiring a sample image including a target geometric figure, and determining a marked geometric region corresponding to the target geometric figure based on the sample image.

[0057] The target geometry refers to the vector diagram formed by the outer contour lines of the target area in the sample image, and the target area refers to the area of ​​interest to the user. For example, the target geometry is a rectangle, trapezoid, circle, ellipse, polygon, and a certificate or receipt in the shape of a geometric figure, but is not limited thereto. The sample image may be an image containing an identity document, then the target area is the area where the identity document is located, and the target geometry is the figure formed by the outer contour lines of the identity document. The identity document is a document used to characterize the identity of the user, such as the resident identity card, Hong Kong and Macao pass or temporary residence permit corresponding to different regions.

[0058] The annotated geometric region refers to the region where the pre-annotated target geometric figure is located. The annotated geometric region can be the region where the pre-annotated target geometric figure is located in the sample image, or it can be the mask image corresponding to the pre-annotated sample image. The mask image is an image filter template used to identify the target geometric figure in the image, which can block other parts of the image and filter out the target geometric figure in the image. For example, the mask image is obtained by binarizing the sample image so that each pixel point in the region where the target geometric figure is located in the sample image is represented by 1, and each pixel point in the region where the non-target geometric figure is located is represented by 0. The region formed by the pixels represented by 1 is the annotated geometric region.

[0059] Specifically, the computer device obtains a sample image including a target geometric figure, in which the target geometric figure is pre-marked. Alternatively, the computer device obtains a sample image including a target geometric figure and obtains a corresponding mask image, in which the area where the target geometric figure is located is marked.

[0060] For example, if the sample image is an image containing a target certificate, the area where the target certificate is located in the sample image is pre-marked, and the area where the target certificate is located is the marked geometric area. Alternatively, the image containing the target certificate is binarized to obtain a corresponding mask image, and the pixel points in the area where the target certificate is located in the mask image are represented by 1, and the pixel points in the area where the non-target certificate is located are represented by 0, so that the area where the target certificate is located in the mask image is used as the marked geometric area.

[0061] Step S204, performing target segmentation processing on the sample image through the segmentation network to be trained, obtaining a predicted geometric region corresponding to the target geometric figure, and determining predicted vertex information corresponding to the target geometric figure based on the image features in the target segmentation processing.

[0062] The predicted vertex information refers to the key points predicted by the segmentation network that constitute the outer contour of the target geometric figure in the sample image. The predicted vertex information may include vertex positions, vertex numbers, vertex pixels, etc. The vertex positions may include vertex coordinates. The predicted vertex information can determine the shape and size of the figure.

[0063] Specifically, when the sample image includes a labeled geometric region, the computer device inputs the sample image into the segmentation network to be trained. When the target geometric figure is not labeled in the sample image, the computer device inputs the sample image including the target geometric figure and the labeled geometric region corresponding to the target geometric figure into the segmentation network to be trained.

[0064] The segmentation network to be trained extracts features from the sample image to obtain a corresponding feature map, and predicts the region where the target geometric figure in the sample image is located based on the feature map to obtain a predicted geometric region. Further, the segmentation network to be trained segments the predicted geometric region from the sample image.

[0065] The segmentation network to be trained predicts vertex information forming an outer contour of a target geometric figure in a sample image based on the extracted feature map to obtain predicted vertex information.

[0066] Step S206, determining the corresponding regional feature loss according to the predicted geometric region and the marked geometric region.

[0067] The regional feature loss includes at least one of a regional color loss between the predicted geometric region and the labeled geometric region and a regional segmentation loss between the predicted geometric region and the labeled geometric region.

[0068] Specifically, the computer device may determine the color of the predicted geometric region and the color of the labeled geometric region, and determine the regional color loss between the predicted geometric region and the labeled geometric region based on the color of the predicted geometric region and the color of the labeled geometric region. The computer device uses the regional color loss as the regional feature loss between the predicted geometric region and the labeled geometric region.

[0069] In one embodiment, the computer device may obtain a first region area corresponding to the predicted geometric region and a second region area corresponding to the annotated geometric region, and calculate a region segmentation loss between the predicted geometric region and the annotated geometric region based on the first region area and the second region area. The computer device uses the region segmentation loss as a region feature loss between the predicted geometric region and the annotated geometric region.

[0070] In one embodiment, the computer device uses the regional color loss and the regional segmentation loss between the predicted geometric region and the labeled geometric region as the regional feature loss between the predicted geometric region and the labeled geometric region.

[0071] Step S208, determining the corresponding geometric feature loss according to the predicted geometric area and the predicted polygon area determined by the predicted vertex information.

[0072] The geometric feature loss includes at least one of a geometric area loss between the predicted geometric region and the predicted polygonal region, and a geometric centroid loss between the predicted geometric region and the predicted polygonal region.

[0073] Specifically, the computer device determines the predicted polygonal area in the sample image according to the predicted vertex information. The computer device may determine the area of ​​the third region corresponding to the predicted polygonal area, and calculate the geometric area loss between the predicted geometric area and the predicted polygonal area according to the area of ​​the first region and the area of ​​the third region. The computer device may use the geometric area loss as the geometric feature loss between the predicted geometric area and the predicted polygonal area.

[0074] In one embodiment, the computer device may determine the second centroid position corresponding to the predicted polygonal area based on the predicted vertex information, and determine the first centroid position of the predicted geometric area. The computer device determines the geometric centroid loss between the predicted geometric area and the predicted polygonal area based on the second centroid position and the first centroid position. The computer device may use the geometric centroid loss as the geometric feature loss between the predicted geometric area and the predicted polygonal area.

[0075] In one embodiment, the computer device may calculate the geometric area loss and the geometric centroid loss between the predicted geometric region and the predicted polygonal region, and the geometric feature loss between the predicted geometric region and the predicted polygonal region.

[0076] Step S210, constructing a target loss function based on the regional feature loss and the geometric feature loss.

[0077] Specifically, the computer device can obtain the weights corresponding to the regional feature loss and the geometric feature loss, respectively, and construct a target loss function according to the regional feature loss, the geometric feature loss, and the corresponding weights.

[0078] In one embodiment, the computer device performs weighted calculation on the regional feature loss and the geometric feature loss to obtain the target loss function. Alternatively, the computer device may also perform multiplication or logarithm addition on the regional feature loss and the geometric feature loss, or perform other mathematical operations to obtain the target loss function.

[0079] Step S212, training the segmentation network to be trained by the target loss function until the training stop condition is reached, thereby obtaining a trained target segmentation network; the target segmentation network is used to segment the target geometric figures from the image to be processed.

[0080] Specifically, the computer device can train the segmentation network to be trained through the target loss function, adjust the parameters of the segmentation network during the training process and continue the training until the segmentation network meets the training stop condition, thereby obtaining a trained target segmentation network.

[0081] In this embodiment, the training stop condition can be at least one of the loss value of the segmentation network being less than or equal to the loss threshold, reaching a preset number of iterations, reaching a preset iteration time, and the segmentation performance of the network reaching a preset indicator.

[0082] For example, the loss value generated in each training is calculated through the target loss function, and the parameters of the segmentation network are adjusted based on the difference between the loss value and the loss threshold, and the training is continued until the training stops, thereby obtaining a trained target segmentation network.

[0083] The terminal calculates the number of iterations of the segmentation network during the training process. When the number of iterations of the terminal in the training process reaches a preset number of iterations, the training is stopped to obtain a trained segmentation network.

[0084] In one embodiment, a preset number of sample images, such as 32 sample images, may be used for each training of the segmentation network. During the training process, the computer device may update the parameters of the segmentation network based on the gradient descent method of Adam, the initial learning rate of the segmentation network is set to 0.05, and betas in Adam = (0.95, 0.9995). The segmentation network can predict the category of each pixel and obtain a predicted geometric area, the size of which is the same as the size of the target geometric figure. In addition, the segmentation network can output the predicted vertex information corresponding to the target geometric figure. The error gradient is calculated based on the target loss function and the gradient of the segmentation network is updated by back propagation, thereby obtaining a trained target segmentation network.

[0085] In the training method of the segmentation network, the segmentation network to be trained performs target segmentation processing on a sample image including a target geometric figure, and a predicted geometric region corresponding to the target geometric figure predicted by the segmentation network can be obtained. Based on the image features in the target segmentation processing, the predicted vertex information of the target geometric figure predicted by the segmentation network in the sample image can be obtained. According to the regional feature loss between the predicted geometric region and the annotated geometric region, and the geometric feature loss between the predicted geometric region and the predicted polygonal region determined by the predicted vertex information, a target loss function is constructed, so that the target loss function contains multiple loss features. Based on multiple losses, the segmentation network to be trained is trained, and the influence of various losses on the recognition and segmentation of the segmentation network can be fully considered, so that the recognition and segmentation precision and accuracy of the segmentation network can be improved through training. The trained target segmentation network can accurately identify and segment the target geometric figure from the image. And the vertex information of the target geometric figure in the image can be accurately output, so as to accurately locate the target geometric figure in the image.

[0086] In one embodiment, Figure 3 As shown, the target segmentation processing is performed on the sample image through the segmentation network to be trained to obtain the predicted geometric area corresponding to the target geometric figure, and based on the image features in the target segmentation processing, the predicted vertex information corresponding to the target geometric figure is determined, including:

[0087] Step S302: Perform sampling processing on the sample image to obtain a corresponding sample sampling image.

[0088] Among them, the sampling process includes upsampling and downsampling. Upsampling refers to enlarging the sample image through image interpolation, and the enlarged image has a higher resolution. Downsampling, also known as downsampling, refers to scaling the image to obtain the required image resolution. The sample sampling image refers to the image obtained by upsampling or downsampling, including the sample upsampling image and the sample downsampling image. When the sample image is downsampled, the sample sampling image is the sample downsampling image, and when the sample image is upsampled, the sample sampling image is the sample upsampling image.

[0089] Specifically, the computer device performs down-sampling processing on the sample image to obtain a corresponding sample down-sampled image. Alternatively, the computer device performs up-sampling processing on the sample image to obtain a corresponding sample up-sampled image.

[0090] In one embodiment, the computer device may perform sampling processing on the sample image through the segmentation network to be trained to obtain a corresponding sample sampling image. Further, the sample image may be upsampled or downsampled through the segmentation network to be trained to obtain a corresponding sample upsampled image or sample downsampled image.

[0091] Step S304: extract features from the sample image and the sample sampling image respectively through the segmentation network to be trained to obtain a first feature map corresponding to the sample image and a second feature map corresponding to the sample sampling image.

[0092] Specifically, the segmentation network to be trained performs multi-layer feature extraction on the sample image to obtain a first feature map corresponding to the sample image. Further, the segmentation network to be trained performs feature extraction on the sample image through multiple convolutional layers, and uses the first feature map output by the previous convolutional layer as the input of the next convolutional layer to obtain the first feature map output by each convolutional layer.

[0093] The segmentation network to be trained performs multi-layer feature extraction on the sample sampling image to obtain a second feature map corresponding to the sample sampling image. Further, the segmentation network to be trained performs feature extraction on the sample sampling image through multiple convolutional layers, and uses the second feature map output by the previous convolutional layer as the input of the next convolutional layer to obtain the second feature map output by each convolutional layer.

[0094] In one embodiment, the segmentation network to be trained includes two encoders, each of which includes multiple convolutional layers. The segmentation network to be trained inputs the sample image and the sample sampling image into the two encoders respectively, extracts features from the sample image and the sample sampling image respectively, and obtains the corresponding first feature map and second feature map.

[0095] Step S306: fuse the first feature map and the second feature map, and obtain a predicted geometric area corresponding to the target geometric figure based on the sample fusion feature map after the fusion process.

[0096] Specifically, the segmentation network to be trained fuses the first feature map and the second feature map to obtain a sample fused feature map. The segmentation network to be trained performs 1*1 convolution on the sample fused feature map, and performs sampling on the feature map after the 1*1 convolution to obtain a predicted geometric region in the sample image.

[0097] In this embodiment, fusing the first feature map and the second feature map may be splicing or superimposing the first feature map and the second feature map. Splicing refers to splicing the first feature map and the second feature map to obtain a feature map. Superimposing refers to summing and averaging the grayscale values ​​of corresponding pixels in the first feature map and the second feature map to obtain a feature map.

[0098] It can be understood that the sampling process after the 1*1 convolution process is opposite to the sampling process when the sample sampling image is obtained. For example, if the sample image is downsampled to obtain the sample sampling image, the sampling process after the 1*1 convolution process is upsampling. If the sample image is upsampled to obtain the sample sampling image, the sampling process after the 1*1 convolution process is downsampling.

[0099] Step S308, performing convolution and full connection processing on the second feature map to obtain predicted vertex information corresponding to the target geometric figure.

[0100] Specifically, the segmentation network to be trained performs 1*1 convolution processing on the second feature map output by the last convolution layer, and outputs the feature map obtained by the 1*1 convolution processing to the fully connected layer. The feature map is fully connected through the fully connected layer to obtain the predicted vertex information corresponding to the target geometric figure in the sample sampling image.

[0101] In one embodiment, the segmentation network to be trained may perform convolution and full connection processing on the first feature map to obtain predicted vertex information corresponding to the target geometric figure.

[0102] In one embodiment, the predicted vertex information includes predicted vertex coordinates. The segmentation network to be trained performs convolution and full connection processing on the first feature map or the second feature map output by the last convolution layer to obtain predicted vertex coordinates corresponding to the target geometric figure.

[0103] In this embodiment, the sample image is sampled to obtain a sample sampling image, and the sample image and the sample sampling image are respectively subjected to feature extraction by the segmentation network to be trained, so that the features of images with different resolutions can be obtained. Based on the extracted first feature map and the second feature map, a fusion process is performed, and the predicted geometric region where the target geometric figure in the sample image is located can be more accurately predicted based on the image features of different resolutions. Based on the full connection process of the second feature map, the predicted vertex information corresponding to the target geometric figure is output, so that the segmentation network is trained based on the predicted geometric region and predicted vertex information obtained by different processes.

[0104] In one embodiment, Figure 4 As shown, according to the predicted geometric area and the labeled geometric area, the corresponding regional feature loss is determined, including:

[0105] Step S402, determining a first color value corresponding to the predicted geometric region and a second color value corresponding to the marked geometric region.

[0106] Specifically, the computer device may determine each pixel in the predicted geometric area and obtain the first grayscale value corresponding to each pixel. The computer device obtains the color value corresponding to each pixel, and calculates the first color value corresponding to the predicted geometric area based on the color value corresponding to each pixel and the first grayscale value.

[0107] The computer device obtains the second grayscale value corresponding to each pixel in the annotated geometric area, and obtains the color value corresponding to each pixel. The computer device obtains the color value corresponding to each pixel, and calculates the second color value corresponding to the annotated geometric area based on the color value corresponding to each pixel and the second grayscale value.

[0108] Step S404: determining a regional color loss between the predicted geometric region and the marked geometric region based on a difference between the first color value and the second color value.

[0109] The difference between the first color value and the second color value may be represented by a contrast value between the first color value and the second color value, and the contrast value may be at least one of a difference, an absolute value of the difference, a logarithm of the difference, a ratio, and a percentage.

[0110] Specifically, the computer device calculates the difference between the first color value and the second color value, and determines the difference between the first color value and the second color value as the regional color loss between the predicted geometric region and the annotated geometric region. Further, the difference between the first color value and the second color value can be a contrast value between the first color value and the second color value.

[0111] In one embodiment, the contrast value refers to the difference between the first color value and the second color value. The computer device calculates the difference between the first color value and the second color value, and uses the difference as the regional color loss between the predicted geometric region and the marked geometric region.

[0112] In one embodiment, the contrast value refers to the absolute value of the difference between the first color value and the second color value. The computer device calculates the difference between the first color value and the second color value, and uses the absolute value of the difference as the regional color loss between the predicted geometric region and the annotated geometric region. For example, the regional color loss between the predicted geometric region and the annotated geometric region is calculated using the following formula:

[0113] Loss3=|C0-C| (1)

[0114] Among them, Loss1 is the regional color loss, C0 is the second color value corresponding to the marked geometric area, and C is the first color value corresponding to the predicted geometric area.

[0115] In one embodiment, the contrast value refers to a ratio between the first color value and the second color value. The computer device calculates the ratio between the first color value and the second color value, and uses the ratio as the regional color loss between the predicted geometric region and the marked geometric region.

[0116] Step S406, determining the area of ​​the first region corresponding to the predicted geometric region and the area of ​​the second region corresponding to the marked geometric region.

[0117] Specifically, the computer device can obtain the first grayscale value corresponding to each pixel point in the predicted geometric area, and calculate the first region area corresponding to the predicted geometric area based on the first grayscale value corresponding to each pixel point.

[0118] The computer device obtains the second grayscale value corresponding to each pixel point in the annotated geometric region, and calculates the area of ​​the second region corresponding to the annotated geometric region based on the second grayscale value corresponding to each pixel point.

[0119] Step S408: determining a region segmentation loss between the predicted geometric region and the labeled geometric region based on the area of ​​the first region and the area of ​​the second region.

[0120] Specifically, the computer device may determine the area product of the first area and the second area, and the sum of the first area and the second area, and determine the region segmentation loss between the predicted geometric region and the labeled geometric region based on the area product and the area sum. Further, the computer device may use the ratio of the area product to the area sum as the region segmentation loss between the predicted geometric region and the labeled geometric region.

[0121] In one embodiment, the computer device may use the ratio of the area product of a preset multiple to the area sum as the region segmentation loss between the predicted geometric region and the annotated geometric region. For example, the region segmentation loss is obtained by dividing twice the area product by the area sum.

[0122] For example, the region segmentation loss between the predicted geometric region and the labeled geometric region is calculated by the following formula:

[0123]

[0124] Among them, GT i,j (x) is the gray value of the pixel at the i-th row and j-th column of the marked geometric area. i,j GT i,j (x) is the area of ​​the second region of the labeled geometric region. i,j I i,j (x) is the area of ​​the first region of the predicted geometric region.

[0125] Step S410, determining the corresponding regional feature loss according to the regional color loss and the regional segmentation loss.

[0126] Specifically, the computer device can obtain the weights corresponding to the regional color loss and the regional segmentation loss, respectively, perform weighted sum processing on the regional color loss and the regional segmentation loss, and obtain the corresponding regional feature loss.

[0127] In one embodiment, the computer device may sum the regional color loss and the regional segmentation loss to obtain the corresponding regional feature loss.

[0128] In this embodiment, the regional color loss is determined based on the color difference between the predicted geometric region and the annotated geometric region, and the color loss between the geometric region predicted by the segmentation network and the actual geometric region can be determined. Based on the area of ​​the predicted geometric region and the area of ​​the annotated geometric region, the segmentation difference between the geometric region predicted by the segmentation network and the actual geometric region can be determined, so that the color loss and the area segmentation loss are used as the conditions for training the segmentation network, so that the trained segmentation network has higher accuracy and segmentation precision.

[0129] In one embodiment, Figure 5 As shown, determining a first color value corresponding to the predicted geometric region and a second color value corresponding to the marked geometric region includes:

[0130] Step S502, obtaining the value of the color channel corresponding to each pixel point in the predicted geometric area, and obtaining the value of the color channel corresponding to each pixel point in the marked geometric area.

[0131] The color channels refer to the red channel, green channel and blue channel of the image. The red channel is the R (Red) channel, the green channel is the G (Green) channel, and the blue channel is the B (Blue) channel.

[0132] Specifically, the computer device may obtain each pixel point in the predicted geometric area, and for each pixel point, the computer device may obtain the value of the red channel, the value of the green channel, and the value of the blue channel corresponding to the pixel point.

[0133] The computer device can obtain each pixel point in the marked geometric area, and for each pixel point, the computer device can obtain the value of the red channel, the value of the green channel, and the value of the blue channel corresponding to the pixel point.

[0134] Step S504, determining a first color value corresponding to the predicted geometric area according to the value of the color channel corresponding to each pixel in the predicted geometric area, the first grayscale value corresponding to the corresponding pixel and the area of ​​the first area.

[0135] Specifically, the computer device obtains the first grayscale value corresponding to each pixel in the predicted geometric region and the first area corresponding to the predicted geometric region. For each pixel, the computer device calculates the product of the value of each color channel and the first grayscale value of the corresponding pixel to obtain the first product corresponding to each color channel.

[0136] The computer device calculates the sum of the first products of the same color channel, that is, the sum of the first products corresponding to each red channel, the sum of the first products corresponding to each green channel, and the sum of the first products corresponding to each blue channel. The computer device calculates a first ratio of the sum of the first products of the same color channel to the area of ​​the first region, and uses the first ratio as the color value of the color channel, thereby obtaining the color value corresponding to the red channel, the color value corresponding to the green channel, and the color value corresponding to the blue channel.

[0137] The computer device calculates the first color value corresponding to the predicted geometric area according to the color value corresponding to each color channel. Further, the computer device sums and averages the color values ​​corresponding to each color channel, and uses the average as the first color value corresponding to the predicted geometric area.

[0138] For example, the computer device may calculate the first color value corresponding to the predicted geometric area according to the following formula:

[0139]

[0140]

[0141]

[0142]

[0143] Wherein, C is the first color value corresponding to the predicted geometric area. i,j (x) is the value of the pixel in the i-th row and j-th column in the predicted geometric area in the red channel, G i,j (x) is the value of the pixel in the i-th row and j-th column in the predicted geometric area in the green channel, B i,j (x) is the value of the pixel in the i-th row and j-th column in the predicted geometric area in the blue channel. i,j (x) is the gray value corresponding to the pixel point in the i-th row and j-th column in the predicted geometric area. i,j I i,j (x) is the area of ​​the first region corresponding to the predicted geometric region. color_R1 is the value of the pixel point in the predicted geometric region in the red channel, color_G1 is the value of the pixel point in the predicted geometric region in the green channel, and color_B1 is the value of the pixel point in the predicted geometric region in the blue channel.

[0144] Step S506 , determining a second color value corresponding to the annotated geometric region according to the value of the color channel corresponding to each pixel in the annotated geometric region, the second grayscale value corresponding to the corresponding pixel and the second region area.

[0145] Specifically, the computer device obtains the second grayscale value corresponding to each pixel in the annotated geometric region and the second region area corresponding to the annotated geometric region. For each pixel, the computer device calculates the product of the value of each color channel and the second grayscale value of the corresponding pixel to obtain the second product corresponding to each color channel.

[0146] The computer device calculates the sum of the second products of the same color channel, that is, the sum of the second products corresponding to each red channel, the sum of the second products corresponding to each green channel, and the sum of the second products corresponding to each blue channel. The computer device calculates a second ratio of the sum of the second products of the same color channel to the area of ​​the second region, and uses the second ratio as the color value of the color channel, thereby obtaining the color value corresponding to the red channel, the color value corresponding to the green channel, and the color value corresponding to the blue channel.

[0147] The computer device calculates the second color value corresponding to the annotated geometric region according to the color value corresponding to each color channel. Further, the computer device sums and averages the color values ​​corresponding to each color channel, and uses the average as the second color value corresponding to the annotated geometric region.

[0148] For example, the computer device may calculate the second color value corresponding to the marked geometric area according to the following formula:

[0149]

[0150]

[0151]

[0152]

[0153] Where C is the second color value corresponding to the marked geometric area. i,j (y) is the value of the pixel in the red channel at the i-th row and j-th column in the labeled geometric area, G i,j (y) is the value of the pixel in the i-th row and j-th column in the labeled geometric area in the green channel, B i,j (y) is the value of the blue channel of the pixel at the i-th row and j-th column in the labeled geometric area. i,j (x) is the gray value corresponding to the pixel point in the i-th row and j-th column in the marked geometric area. i,j GT i,j(x) is the area of ​​the second region corresponding to the annotated geometric region. color_R2 is the value of the pixel in the annotated geometric region in the red channel, color_G2 is the value of the pixel in the annotated geometric region in the green channel, and color_B2 is the value of the pixel in the annotated geometric region in the blue channel.

[0154] In this embodiment, based on the values ​​of the color channels corresponding to each pixel in the predicted geometric area, the first grayscale value corresponding to the corresponding pixel and the first area, the average color value of the predicted geometric area can be accurately calculated. Based on the values ​​of the color channels corresponding to each pixel in the annotated geometric area, the second grayscale value corresponding to the corresponding pixel and the second area, the average color value of the annotated geometric area can be accurately calculated. Based on the difference between the average color value of the predicted geometric area and the average color value of the annotated geometric area, the color loss between the predicted geometric area predicted by the segmentation network and the actual geometric area can be accurately determined, so that the color loss is used as a training condition for the segmentation network, which can improve the accuracy of the segmentation network.

[0155] In one embodiment, determining the area of ​​the first region corresponding to the predicted geometric region and the area of ​​the second region corresponding to the marked geometric region includes:

[0156] Obtain the first grayscale value corresponding to each pixel in the predicted geometric area, and obtain the second grayscale value corresponding to each pixel in the annotated geometric area; use the sum of the first grayscale values ​​of each pixel in the predicted geometric area as the first area of ​​the predicted geometric area; use the sum of the second grayscale values ​​of each pixel in the annotated geometric area as the second area of ​​the annotated geometric area.

[0157] Specifically, the computer device can obtain the first grayscale value corresponding to each pixel point in the predicted geometric area, sum the first grayscale values ​​corresponding to each pixel point, and use the sum of the first grayscale values ​​of each pixel point as the first area of ​​the predicted geometric area.

[0158] The computer device can obtain the second grayscale value corresponding to each pixel point in the predicted geometric area, sum the second grayscale values ​​corresponding to each pixel point, and use the sum of the second grayscale values ​​of each pixel point as the second area of ​​the marked geometric area.

[0159] For example, the computer device may calculate the first area of ​​the predicted geometric area and the second area of ​​the marked geometric area according to the following formula:

[0160] S1=∑ i,j I i,j (x) (11)

[0161] Wherein, S1 is an area, for example, the area of ​​the first area or the area of ​​the second area.i,j (x) is the grayscale value of the pixel in the i-th row and j-th column, for example, the grayscale value of the pixel in the i-th row and j-th column in the predicted geometric area, and the grayscale value of the pixel in the i-th row and j-th column in the marked geometric area.

[0162] In this embodiment, the sum of the grayscale values ​​corresponding to each pixel point is taken as the area, so that the area composed of each pixel of the predicted geometric area can be accurately calculated, and the area composed of each pixel of the marked geometric area can also be accurately calculated.

[0163] In one embodiment, Figure 6 As shown, according to the predicted geometric area and the predicted polygon area determined by the predicted vertex information, the corresponding geometric feature loss is determined, including:

[0164] Step S602, determining a first region area of ​​the predicted geometric region, and calculating a third region area of ​​the predicted polygonal region determined by the predicted vertex information.

[0165] Specifically, the computer device obtains the first grayscale value corresponding to each pixel point in the predicted geometric area, and takes the sum of the first grayscale values ​​of each pixel point in the predicted geometric area as the first area of ​​the predicted geometric area.

[0166] The computer device may obtain the predicted vertex coordinates in the predicted vertex information, and determine the predicted polygon determined by the predicted vertex coordinates in the sample image. The computer device calculates the area of ​​the third region of the predicted polygon region based on the predicted vertex coordinates. For example, the computer device may calculate the area of ​​the third region of the predicted polygon region based on the shoelace formula:

[0167]

[0168] Among them, S2 is the area of ​​the third region, [P 11 ,P 12 ],[P 21 ,P 22 ],[P 31 ,P 32 ],[P 41 ,P 42 ] are the predicted vertex coordinates.

[0169] Step S604: determining a geometric area loss according to a difference between an area of ​​the first region and an area of ​​the third region.

[0170] The difference between the area of ​​the first region and the area of ​​the third region can be represented by an area comparison value between the area of ​​the first region and the area of ​​the third region, and the area comparison value can be at least one of a difference, an absolute value of the difference, a logarithm of the difference, a ratio, and a percentage.

[0171] Specifically, the computer device calculates the difference between the area of ​​the first region and the area of ​​the third region, and determines the difference between the area of ​​the first region and the area of ​​the third region as the regional color loss between the predicted geometric region and the predicted polygonal region. Further, the difference between the area of ​​the first region and the area of ​​the third region can be an area comparison value between the area of ​​the first region and the area of ​​the third region.

[0172] In one embodiment, the area comparison value refers to the difference between the area of ​​the first region and the area of ​​the third region. The computer device calculates the difference between the area of ​​the first region and the area of ​​the third region and uses the difference as the geometric area loss between the predicted geometric region and the predicted polygonal region.

[0173] In one embodiment, the area comparison value refers to the absolute value of the difference between the area of ​​the first region and the area of ​​the third region. The computer device calculates the difference between the area of ​​the first region and the area of ​​the third region, and uses the absolute value of the difference as the geometric area loss between the predicted geometric region and the predicted polygonal region. For example, the geometric area loss between the predicted geometric region and the predicted polygonal region is calculated using the following formula:

[0174] Loss1=|S1-S2| (13)

[0175] Among them, Loss1 is the geometric area loss between the predicted geometric area and the predicted polygonal area, S1 is the area of ​​the first area, and S2 is the area of ​​the third area.

[0176] In one embodiment, the area comparison value refers to the ratio between the area of ​​the first region and the area of ​​the third region. The computer device calculates the ratio between the area of ​​the first region and the area of ​​the third region and uses the ratio as the geometric area loss between the predicted geometric region and the predicted polygonal region.

[0177] Step S606, determining a first centroid position corresponding to the predicted geometric area and a second centroid position corresponding to the predicted polygonal area.

[0178] Specifically, the computer device obtains the first grayscale values ​​corresponding to each pixel point in the predicted geometric area, and determines the first centroid position of the predicted geometric area according to each first grayscale value. The computer device determines the second centroid position of the predicted polygonal area based on the predicted vertex information.

[0179] Step S608: determining the geometric center of gravity loss according to the distance between the first center of gravity position and the second center of gravity position.

[0180] Specifically, the computer device calculates the distance between the first barycenter position and the second barycenter coordinate position, and uses the distance between the first barycenter position and the second barycenter coordinate position as the geometric barycenter loss between the predicted geometric region and the predicted polygonal region.

[0181] In one embodiment, the computer device may respectively obtain weights corresponding to the first center of gravity position and the second center of gravity position, perform weighted sum processing on the first center of gravity position, the second center of gravity position and the corresponding weights to obtain a geometric center of gravity loss.

[0182] Step S610, determining the geometric feature loss based on the geometric area loss and the geometric center of gravity loss.

[0183] Specifically, the computer device can obtain the weights corresponding to the geometric area loss and the geometric center of gravity loss, respectively, perform weighted summation processing on the geometric area loss and the geometric center of gravity loss, and obtain the corresponding geometric feature loss.

[0184] In one embodiment, the computer device may sum the geometric area loss and the geometric center of gravity loss to obtain the corresponding geometric feature loss.

[0185] In this embodiment, the geometric area loss is determined based on the area difference between the predicted geometric area and the predicted polygonal area, and the area loss between the geometric area predicted by the segmentation network and the polygonal area can be determined. A large area loss indicates that the prediction and segmentation of the segmentation network are inaccurate. Based on the centroid position of the predicted geometric area and the centroid position of the predicted polygonal area, the centroid loss between the geometric area predicted by the segmentation network and the predicted polygonal area can be determined. A large centroid loss indicates that the prediction and segmentation of the segmentation network are inaccurate. Therefore, the area loss and centroid loss are used as conditions for training the segmentation network, so that the trained segmentation network has higher accuracy and segmentation precision.

[0186] In one embodiment, the first center of gravity position includes a first center of gravity coordinate, and the second center of gravity position includes a second center of gravity coordinate; and determining the geometric center of gravity loss according to the distance between the first center of gravity position and the second center of gravity position includes:

[0187] Determine the first barycentric coordinates of the predicted geometric area according to the first grayscale values ​​corresponding to each pixel point in the predicted geometric area; determine the second barycentric coordinates of the predicted polygonal area formed by the predicted vertex coordinates based on the predicted vertex coordinates in the predicted vertex information;

[0188] Determining a geometrical centroid loss according to a distance between the first centroid position and the second centroid position includes: determining a geometrical centroid loss between a predicted geometric region and a predicted polygonal region based on a distance between the first centroid coordinate and the second centroid coordinate.

[0189] Specifically, the computer device determines the horizontal and vertical coordinates of the first centroid coordinates according to the first grayscale values ​​corresponding to each pixel point in the predicted geometric area, thereby obtaining the first centroid coordinates of the predicted geometric area according to the horizontal and vertical coordinates.

[0190] The computer device obtains the coordinates of each predicted vertex in the predicted vertex information, takes the average of the sum of the horizontal coordinates of each predicted vertex coordinate, and uses the average of the sum of the horizontal coordinates as the horizontal coordinate of the second centroid coordinate of the predicted polygonal area. The computer device takes the average of the sum of the vertical coordinates of each predicted vertex coordinate, and uses the average of the sum of the vertical coordinates as the horizontal coordinate of the second centroid coordinate of the predicted polygonal area. The computer device obtains the second centroid coordinate of the measured polygonal area according to the horizontal coordinate and the vertical coordinate. For example, the computer device can calculate the second centroid coordinate according to the following formula:

[0191]

[0192] Among them, [P 11 ,P 12 ],[P 21 ,P 22 ],[P 31 ,P 32 ],[P 41 ,P 42 ] are the predicted vertex coordinates, and (x2,y2) are the second centroid coordinates.

[0193] The computer device calculates the distance between the abscissa in the first barycentric coordinate and the abscissa in the second barycentric coordinate, calculates the distance between the ordinate in the first barycentric coordinate and the ordinate in the second barycentric coordinate, and determines the geometric barycentric loss between the predicted geometric region and the predicted polygonal region based on the distance between the abscissas and the distance between the ordinates. Further, the computer device uses the sum of the squares of the distance between the abscissas and the squares of the distance between the ordinates as the geometric barycentric loss between the predicted geometric region and the predicted polygonal region. For example, the computer device may calculate the geometric barycentric loss according to the following formula:

[0194] Loss2=(x1-x2) 2 +(y1-y2) 2 (15)

[0195] Among them, Loss2 is the geometric center of gravity loss, and (x1, y1) is the first center of gravity coordinate.

[0196] In one embodiment, the computer device may obtain weights corresponding to the first barycentric coordinate and the second barycentric coordinate, respectively, multiply the first barycentric coordinate and the corresponding weight, multiply the second barycentric coordinate and the corresponding weight, and sum the product of the first barycentric coordinate and the weight with the product of the second barycentric coordinate and the weight as the geometric barycentric loss.

[0197] In this embodiment, based on the barycentric coordinates of the predicted geometric region and the barycentric coordinates of the predicted polygonal region, the barycentric loss between the geometric region predicted by the segmentation network and the predicted polygonal region can be determined, thereby determining the difference in barycentricity between the prediction results corresponding to the two methods when the same segmentation grid uses two methods to predict the target geometric figure, thereby using the barycentric loss as a condition for training the segmentation network, so that the trained segmentation network has higher accuracy and segmentation precision. In addition, the trained segmentation network can simultaneously have two prediction methods: segmenting the target geometric figure and predicting the vertex coordinates of the target geometric figure.

[0198] In one embodiment, determining the first centroid coordinates of the predicted geometric area according to the first grayscale values ​​corresponding to the pixels in the predicted geometric area includes:

[0199] Based on the first grayscale values ​​corresponding to each pixel point in the predicted geometric area, a grayscale value matrix is ​​constructed; the comparison value of the sum of the first grayscale values ​​of each row in the grayscale value matrix and the first area of ​​the predicted geometric area is used as the horizontal coordinate in the first centroid coordinate of the predicted geometric area; the comparison value of the sum of the first grayscale values ​​of each column in the grayscale value matrix and the first area of ​​the predicted geometric area is used as the vertical coordinate in the first centroid coordinate.

[0200] The comparison value includes ratio, difference, percentage, etc.

[0201] Specifically, the computer device obtains the first grayscale value corresponding to each pixel point in the predicted geometric area, and constructs a grayscale value matrix according to the first grayscale value. The computer device calculates the first area of ​​the predicted geometric area according to the first grayscale value corresponding to each pixel point. The computer device can sum the first grayscale values ​​of all rows in the grayscale value matrix, calculate the comparison value between the sum of the first grayscale values ​​of all rows and the first area of ​​the predicted geometry, and use the comparison value as the horizontal coordinate in the first centroid coordinate.

[0202] The computer device may sum the first grayscale values ​​of all columns in the grayscale value matrix, calculate the comparison value between the sum of the first grayscale values ​​of all columns and the area of ​​the first region of the predicted geometry, and use the comparison value as the ordinate in the first barycentric coordinate. The first barycentric coordinate of the predicted geometry region is obtained according to the abscissa and the ordinate.

[0203] In one embodiment, the contrast value refers to a ratio. The computer device calculates the ratio between the sum of the first grayscale values ​​of all rows in the grayscale value matrix and the first area of ​​the predicted geometry, and uses the ratio as the abscissa. The computer device calculates the ratio between the sum of the first grayscale values ​​of all columns in the grayscale value matrix and the first area of ​​the predicted geometry, and uses the ratio as the ordinate. For example, the computer device may calculate the first centroid coordinate according to the following formula:

[0204]

[0205] Where x1 is the horizontal coordinate of the first barycentric coordinate, y1 is the vertical coordinate of the first barycentric coordinate. i is the row in the gray value matrix, and j is the column in the gray value matrix. ∑ i,j I i,j (x) is the area of ​​the first region of the predicted geometric region. i,j (x) is the grayscale value of the pixel in the i-th row and j-th column, that is, the grayscale value of the i-th row and j-th column.

[0206] In one embodiment, the contrast value refers to a difference. The computer device calculates the ratio between the sum of the first gray values ​​of all rows in the gray value matrix and the area of ​​the first region of the predicted geometry, and uses the ratio as the abscissa. The computer device calculates the ratio between the sum of the first gray values ​​of all columns in the gray value matrix and the area of ​​the first region of the predicted geometry, and uses the ratio as the ordinate.

[0207] In this embodiment, the comparison value of the sum of the first grayscale values ​​of all rows in the grayscale value matrix and the area of ​​the first region is used as the horizontal coordinate in the centroid coordinate, and the comparison value of the sum of the first grayscale values ​​of all columns and the area of ​​the first region is used as the vertical coordinate, so that the centroid coordinates of the predicted geometric area can be calculated based on the grayscale value of the pixel, thereby realizing the calculation of the centroid coordinates at the pixel level.

[0208] like Figure 7 FIG. 1 is a flow chart of testing a segmentation network in an embodiment. The computer device can collect sample videos including target geometric figures in different environments, and obtain sample images including target geometric figures in each frame from the sample videos. The computer inputs each sample image obtained into the trained segmentation network to predict the predicted geometric region and predicted vertex information corresponding to the target geometric figure in each sample image frame, and tests the segmentation network through the predicted geometric region and predicted vertex information.

[0209] like Figure 8 , which is a diagram of a training architecture for a segmentation network in one embodiment.

[0210] The computer device performs downsampling processing on the sample image to obtain a corresponding sample sampling image. The sample image and the sample sampling image are input into a trained segmentation network, and the segmentation network to be trained may include a segmentation branch and a vertex prediction branch. The segmentation network to be trained performs convolution processing on the sample image through multiple convolution layers of the segmentation branch, such as 4 convolution layers, to extract features and obtain a first feature map output by each convolution layer.

[0211] The segmentation network to be trained performs convolution processing on the sample sampling image through multiple convolution layers of the vertex prediction branch, for example, 4 convolution layers, to extract features and obtain a second feature map output by each convolution layer.

[0212] The first feature map output by the first convolutional layer of the segmentation branch is subjected to 1*1 convolution processing, and the feature map after convolution processing is upsampled.

[0213] Starting from the second convolutional layer of the segmentation branch, the first feature map of the second convolutional layer and the second feature map of the first convolutional layer of the vertex prediction branch are concatenated to obtain a sample fusion feature map, until the sample fusion feature map output by the last convolutional layer of the segmentation branch is obtained. Each sample fusion feature map is subjected to 1*1 convolution processing, and the feature maps obtained after each 1*1 convolution processing are upsampled, and each feature map after upsampling processing is fused with the feature map after upsampling processing corresponding to the first convolutional layer to obtain the predicted geometric region in the sample image.

[0214] The second feature map output by the last convolution layer of the vertex prediction branch is subjected to 1*1 convolution processing, and the feature map obtained by 1*1 convolution processing is output to the fully connected layer. The feature map is fully connected through the fully connected layer to obtain the predicted vertex information corresponding to the target geometric figure in the sample sampling image.

[0215] According to the predicted geometric region and the marked geometric region, the corresponding regional color loss and regional segmentation loss are determined. According to the predicted geometric region and the predicted polygon region determined by the predicted vertex information, the corresponding geometric area loss and geometric centroid loss are determined.

[0216] Based on the regional color loss, regional segmentation loss, geometric area loss and geometric center of gravity loss, a target loss function is constructed. The segmentation network to be trained is trained by the target loss function until the training stop condition is reached, and a trained target segmentation network is obtained.

[0217] For example, the target loss function is: Loss = Loss0 + Loss1 + Loss2 + Loss3 (17)

[0218] Among them, Loss3 is the regional color loss, Loss0 is the regional segmentation loss, Loss1 is the geometric area loss, and Loss2 is the geometric center of gravity loss.

[0219] In one embodiment, the method also includes: acquiring an image to be processed, performing sampling processing on the image to be processed, and obtaining a corresponding sampled image to be processed; performing feature extraction on the image to be processed and the sampled image to be processed respectively through a trained target segmentation network, and obtaining a third feature map corresponding to the image to be processed and a fourth feature map corresponding to the sampled image to be processed; fusing the third feature map and the fourth feature map, and determining the target geometry in the image to be processed based on the target fusion feature map after the fusion processing.

[0220] Specifically, the computer device performs down-sampling processing on the image to be processed to obtain a corresponding down-sampled image to be processed. Alternatively, the computer device performs up-sampling processing on the image to be processed to obtain a corresponding up-sampled image to be processed.

[0221] In one embodiment, the computer device can perform sampling processing on the image to be processed through the trained segmentation network to obtain the corresponding sampled image to be processed. Further, the image to be processed can be upsampled or downsampled through the segmentation network to obtain the corresponding upsampled image to be processed or downsampled image to be processed.

[0222] Specifically, the segmentation network performs multi-layer feature extraction on the image to be processed to obtain a third feature map corresponding to the image to be processed. Further, the segmentation network to be trained performs feature extraction on the image to be processed through multiple convolutional layers, and uses the third feature map output by the previous convolutional layer as the input of the next convolutional layer to obtain the third feature map output by each convolutional layer.

[0223] The segmentation network performs multi-layer feature extraction on the sampled image to be processed to obtain a fourth feature map corresponding to the sampled image to be processed. Further, the segmentation network performs feature extraction on the sampled image to be processed through multiple convolutional layers, and uses the fourth feature map output by the previous convolutional layer as the input of the next convolutional layer to obtain the fourth feature map output by each convolutional layer.

[0224] In one embodiment, the segmentation network includes two encoders, each of which includes multiple convolutional layers. The segmentation network inputs the image to be processed and the sampled image to be processed into the two encoders respectively, performs feature extraction on the image to be processed and the sampled image to be processed respectively, and obtains the corresponding third feature map and fourth feature map.

[0225] Specifically, the segmentation network fuses the third feature map and the fourth feature map to obtain a target fused feature map. The segmentation network performs 1*1 convolution on the target fused feature map, and performs sampling on the feature map after the 1*1 convolution to obtain the target geometric figure in the image to be processed.

[0226] In this embodiment, fusing the third feature map with the fourth feature map may be concatenating or superimposing the third feature map with the fourth feature map.

[0227] In this embodiment, the image to be processed is sampled to obtain images of different sizes. The images of different sizes are subjected to feature extraction through a trained segmentation network to obtain feature maps of different resolutions. The feature maps of different resolutions are fused, which can more accurately identify the target geometric figures in the image to be processed, thereby improving the accuracy of target geometric figure recognition and segmentation.

[0228] In one embodiment, the method also includes: determining the intersection-and-union ratio between the area of ​​the target geometric figure and the area of ​​a preset region; when the intersection-and-union ratio is greater than or equal to a threshold, segmenting the target geometric figure from the image to be processed; and performing corresponding business processing based on the content included in the target geometric figure.

[0229] Specifically, the computer device may obtain the grayscale values ​​corresponding to each pixel point in the target geometric figure, and determine the area of ​​the target geometric figure according to each grayscale value. The computer device may obtain the area of ​​the preset region, calculate the intersection between the area of ​​the target geometric figure and the area of ​​the preset region, and the union between the area of ​​the target geometric figure and the area of ​​the preset region, thereby calculating the ratio of the intersection and the union, and obtaining the intersection-to-union ratio of the area.

[0230] When the intersection-and-union ratio of the area is greater than a threshold, the computer device can segment the target geometric figure from the image to be processed. The computer device can obtain the content in the target geometric figure and perform corresponding business processing based on the content in the target geometric figure. Business processing can be operations such as business data query, business data modification, business data update, business data deletion, etc., but is not limited thereto.

[0231] In this embodiment, when the intersection ratio between the area of ​​the target geometric figure and the area of ​​the preset region is greater than or equal to a threshold, it indicates that the verification of the target geometric figure is successful. Therefore, after the verification is successful, business processing is performed based on the information in the target geometric figure, which can improve the security of business processing.

[0232] In one embodiment, the method further includes: obtaining an image to be processed, performing feature extraction on the image to be processed through a trained target segmentation network; performing convolution and full connection processing on the extracted image features to output target vertex information corresponding to the target geometric figures in the image to be processed.

[0233] Specifically, the computer device obtains the image to be processed and inputs the image to be processed into the trained segmentation network. The segmentation network extracts features of the image to be processed through multiple convolutional layers, and uses the feature map output by the previous convolutional layer as the input of the next convolutional layer until the feature map output by the last convolutional layer is obtained. The segmentation network performs 1*1 convolution processing on the feature map output by the last convolutional layer, and outputs the feature map obtained by the 1*1 convolution processing to the fully connected layer. The feature map is fully connected through the fully connected layer to obtain the predicted vertex information corresponding to the target geometric figure in the image to be processed.

[0234] In this embodiment, feature extraction is performed on the image to be processed based on the target segmentation network, and convolution and full connection processing are performed on the extracted image features, so that the target vertex information corresponding to the target geometric figures in the image to be processed can be accurately identified, so that the target geometric figures can be segmented from the image to be processed based on the target vertex information, thereby improving the precision and accuracy of recognition and segmentation.

[0235] In one embodiment, the target vertex information includes target vertex coordinates; the method further includes:

[0236] Determine a target polygonal area formed by the target vertex coordinates; determine an intersection-and-union ratio between the area of ​​the target polygonal area and the area of ​​a preset area; when the intersection-and-union ratio is greater than or equal to a threshold, segment the target polygonal area formed by the target vertex coordinates from the image to be processed; and perform corresponding business processing based on the target polygonal area.

[0237] Specifically, the computer device may calculate the area of ​​the target polygonal region according to the target vertex coordinates. The computer device may obtain the area of ​​the preset region, calculate the intersection between the area of ​​the target polygonal region and the area of ​​the preset region, and the union between the area of ​​the target polygonal region and the area of ​​the preset region, thereby calculating the ratio of the intersection and the union, and obtaining the intersection-union ratio of the areas.

[0238] When the intersection-and-union ratio of the area is greater than a threshold, the computer device can segment a target polygonal area formed by the target vertex coordinates from the image to be processed, obtain the content in the target polygonal area, and perform corresponding business processing based on the content in the target polygonal area.

[0239] In this embodiment, when the intersection ratio between the area of ​​the target polygonal region and the area of ​​the preset region is greater than or equal to a threshold, it indicates that the verification of the target polygonal region is successful. Therefore, after the verification is successful, business processing is performed based on the information in the target geometric figure, which can improve the security of business processing.

[0240] In one embodiment, the sample image is an image containing a target certificate, the target geometric figure is a quadrilateral figure formed based on the boundary of the target certificate, the predicted fixed point information corresponding to the target geometric figure includes the vertex coordinates corresponding to each of the four vertices of the target certificate, and the segmentation network is a certificate segmentation network.

[0241] The target certificate is a quadrilateral certificate used to represent user information, including but not limited to a personal ID card, residence permit, driver's license, and passport.

[0242] Specifically, a computer device acquires a document image including a target document, and determines a marked document area corresponding to the target document based on the document image. The document image is subjected to target segmentation processing by the document segmentation network to be trained to obtain a predicted document area corresponding to the target document, and the predicted vertex coordinates corresponding to the target document are determined based on the image features in the target segmentation processing. The corresponding regional feature loss is determined based on the predicted document area and the marked document area. The corresponding geometric feature loss is determined based on the predicted document area and the predicted polygon area determined by the predicted vertex coordinates. The computer device constructs a target loss function based on the regional feature loss and the geometric feature loss. The document segmentation network to be trained is trained by the target loss function until the training stop condition is reached, and a trained document segmentation network is obtained; the document segmentation network is used to segment the target document from the document image.

[0243] In this embodiment, the document image including the target document is subjected to target segmentation processing by the document segmentation network to be trained, and the predicted document area corresponding to the target document predicted by the document segmentation network can be obtained. Based on the image features in the target segmentation processing, the predicted vertex coordinates of the target document predicted by the document segmentation network in the document image can be obtained. According to the regional feature loss between the predicted document area and the annotated document area, and the geometric feature loss between the predicted document area and the predicted polygon area determined by the predicted vertex coordinates, a target loss function is constructed, so that the target loss function includes multiple loss features. The document segmentation network to be trained is trained based on multiple losses, and the influence of various losses on the recognition and segmentation of the document segmentation network can be fully considered, so that the recognition and segmentation precision and accuracy of the document segmentation network can be improved through training. The trained target document segmentation network can accurately identify and segment the target document from the image. And the vertex coordinates of the target document in the image can be accurately output, so as to accurately locate the target document in the image.

[0244] like Fig. 9 FIG. 1 is an application scenario of a target segmentation network in an embodiment.

[0245] The front end collects the ID video through SDK (Software Development Kit) and sends the ID video to the back end. The back end uses the target segmentation network to segment the target geometry from the ID video and output the target vertex coordinates of the target geometry in the ID video. The back end returns the target geometry and target vertex coordinates to the front end. The front end calculates the intersection and union ratio between the area of ​​the target geometry and the area of ​​the preset area. When the intersection and union ratio is greater than or equal to the threshold, it is determined that the target ID verification is successful, and the user is allowed to perform the corresponding business processing.

[0246] Alternatively, the front end determines the target polygonal area formed by the target vertex coordinates, calculates the intersection-and-union ratio between the area of ​​the target polygonal area and the area of ​​the preset area, and when the intersection-and-union ratio is greater than or equal to a threshold, the target polygonal area verification is determined to be successful, allowing the user to perform corresponding business processing.

[0247] In one embodiment, a training method for a segmentation network is provided, comprising:

[0248] Step (S1), obtaining a sample image including a target geometric figure, and determining a marked geometric area corresponding to the target geometric figure based on the sample image.

[0249] Step (S2), performing sampling processing on the sample image to obtain a corresponding sample sampling image.

[0250] Step (S3), extracting features from the sample image and the sample sampling image respectively through the segmentation network to be trained, to obtain a first feature map corresponding to the sample image and a second feature map corresponding to the sample sampling image.

[0251] Step (S4), fusing the first feature map and the second feature map, and obtaining a predicted geometric area corresponding to the target geometric figure based on the sample fusion feature map after the fusion process.

[0252] Step (S5), performing convolution and full connection processing on the second feature map to obtain predicted vertex information corresponding to the target geometric figure.

[0253] Step (S6), obtaining the value of the color channel corresponding to each pixel point in the predicted geometric area, and obtaining the value of the color channel corresponding to each pixel point in the marked geometric area.

[0254] Step (S7), determining a first color value corresponding to the predicted geometric area according to the value of the color channel corresponding to each pixel in the predicted geometric area, the first grayscale value corresponding to the corresponding pixel and the area of ​​the first area.

[0255] Step (S8), determining the second color value corresponding to the annotated geometric area according to the value of the color channel corresponding to each pixel point in the annotated geometric area, the second gray value corresponding to the corresponding pixel point and the second area.

[0256] Step (S9), determining a regional color loss between the predicted geometric region and the annotated geometric region based on a difference between the first color value and the second color value.

[0257] Step (S10), obtaining the first grayscale value corresponding to each pixel point in the predicted geometric area, and taking the sum of the first grayscale values ​​of each pixel point in the predicted geometric area as the first area of ​​the predicted geometric area.

[0258] Step (S11), obtaining the second grayscale value corresponding to each pixel point in the annotated geometric region, and taking the sum of the second grayscale values ​​of each pixel point in the annotated geometric region as the second region area of ​​the annotated geometric region.

[0259] Step (S12), based on the area of ​​the first area and the area of ​​the second area, determine the area segmentation loss between the predicted geometric area and the marked geometric area; determine the first area of ​​the predicted geometric area, and calculate the third area of ​​the predicted polygonal area determined by the predicted vertex information; determine the geometric area loss based on the difference between the first area and the third area.

[0260] Step (S13), constructing a gray value matrix based on the first gray value corresponding to each pixel point in the predicted geometric area.

[0261] Step (S14), using the comparison value between the sum of the first grayscale values ​​of each row in the grayscale value matrix and the first area of ​​the predicted geometric region as the horizontal coordinate in the first centroid coordinate of the predicted geometric region.

[0262] Step (S15), using the comparison value between the sum of the first grayscale values ​​of each column in the grayscale value matrix and the first area of ​​the predicted geometric region as the ordinate in the first centroid coordinate.

[0263] Step (S16), based on the predicted vertex coordinates in the predicted vertex information, determine the second centroid coordinates of the predicted polygonal area formed by the predicted vertex coordinates; based on the distance between the first centroid coordinates and the second centroid coordinates, determine the geometric centroid loss between the predicted geometric area and the predicted polygonal area.

[0264] Step (S17), constructing a target loss function based on regional color loss, regional segmentation loss, geometric area loss, and geometric center of gravity loss.

[0265] Step (S18), training the segmentation network to be trained by the target loss function until the training stop condition is reached, thereby obtaining a trained target segmentation network.

[0266] Step (S19), obtaining the image to be processed, performing sampling processing on the image to be processed, and obtaining a corresponding sampled image to be processed.

[0267] Step (S20), performing feature extraction on the image to be processed and the sampled image to be processed respectively through the trained target segmentation network, and obtaining a third feature map corresponding to the image to be processed and a fourth feature map corresponding to the sampled image to be processed.

[0268] Step (S21), fusing the third feature map and the fourth feature map, and determining the target geometric figure in the image to be processed based on the target fused feature map after the fusion process.

[0269] Step (S22), performing convolution and full connection processing on the fourth feature map to output target vertex information corresponding to the target geometric figure in the image to be processed.

[0270] Step (S23), determine the intersection-and-union ratio between the area of ​​the target geometric figure and the area of ​​the preset region; when the intersection-and-union ratio is greater than or equal to a threshold, segment the target geometric figure from the image to be processed, and perform corresponding business processing based on the content included in the target geometric figure.

[0271] In this embodiment, the target segmentation processing is performed on the sample image including the target geometric figure by the segmentation network to be trained, and the predicted geometric region corresponding to the target geometric figure predicted by the segmentation network can be obtained. The regional color loss is determined based on the color difference between the predicted geometric region and the annotated geometric region, and the color loss between the geometric region predicted by the segmentation network and the real geometric region can be determined. Based on the area of ​​the predicted geometric region and the area of ​​the annotated geometric region, the segmentation difference between the geometric region predicted by the segmentation network and the real geometric region can be determined.

[0272] Based on the area difference between the predicted geometric area and the predicted polygonal area, the geometric area loss between the geometric area predicted by the segmentation network and the polygonal area can be determined. A large area loss indicates that the prediction and segmentation of the segmentation network are inaccurate. Based on the centroid position of the predicted geometric area and the centroid position of the predicted polygonal area, the centroid loss between the geometric area predicted by the segmentation network and the predicted polygonal area can be determined. A large centroid loss indicates that the prediction and segmentation of the segmentation network are inaccurate.

[0273] The color loss, loss, segmentation loss, area loss and centroid loss are used as the training conditions of the segmentation network. The segmentation network to be trained is trained based on multiple losses, which can fully consider the impact of various losses on the recognition and segmentation of the segmentation network, so that the recognition and segmentation precision and accuracy of the segmentation network can be improved through training. The trained target segmentation network can accurately identify and segment the target geometric figures from the image. And it can accurately output the vertex information of the target geometric figures in the image, so as to accurately locate the target geometric figures in the image to be processed.

[0274] The present application also provides an application scenario, which applies the above-mentioned document segmentation network training method. Specifically, the application of the document segmentation network training method in the application scenario is as follows:

[0275] The computer device obtains a sample ID image including a target ID, and determines a labeled ID region corresponding to the target ID based on the sample ID image. The computer device performs sampling processing on the sample ID image to obtain a corresponding sample sampling image. The computer device performs feature extraction on the sample ID image and the sample sampling image respectively through the ID segmentation network to be trained to obtain a first feature map corresponding to the sample ID image and a second feature map corresponding to the sample sampling image.

[0276] The computer device fuses the first feature map and the second feature map, and obtains a predicted document area corresponding to the target document based on the sample fusion feature map after the fusion process.

[0277] The computer device performs convolution and full connection processing on the second feature map to obtain the predicted vertex coordinates corresponding to the target document [P 11 ,P 12 ],[P 21 ,P 22 ],[P 31 ,P 32 ],[P 41 ,P 42 ].

[0278] The computer device obtains the value of the color channel corresponding to each pixel in the predicted document area, and obtains the value of the color channel corresponding to each pixel in the marked document area. Substitute the value of the color channel corresponding to each pixel in the predicted document area, the first gray value corresponding to the corresponding pixel, and the area of ​​the first area into the following formula (3) to calculate the first color value C corresponding to the predicted document area:

[0279]

[0280]

[0281]

[0282]

[0283] Similarly, the second color value C0 corresponding to the marked document area is determined according to the value of the color channel corresponding to each pixel in the marked document area, the second gray value corresponding to the corresponding pixel and the second area.

[0284] Substituting the first color value C and the second color value C0 into formula (1), we can obtain the regional color loss Loss3 between the predicted document area and the marked document area:

[0285] Loss3=|C0-C| (1)

[0286] The first grayscale values ​​corresponding to each pixel in the predicted document area are obtained, and the sum of the first grayscale values ​​of each pixel in the predicted document area is used as the first area of ​​the predicted document area, that is:

[0287] S1=∑ i,j I i,j (x) (11)

[0288] Obtain the second grayscale value corresponding to each pixel in the marked document area, and take the sum of the second grayscale values ​​of each pixel in the marked document area as the second area area ∑ i,j GT i,j (x).

[0289] Based on the area of ​​the first region ∑ i,j I i,j (x) and the area of ​​the second region ∑ i,j GT i,j (x), calculate the regional segmentation loss Loss0 between the predicted document area and the annotated document area, that is:

[0290]

[0291] Determine the first area of ​​the predicted document area, and calculate the third area S2 of the predicted polygonal area determined by the predicted vertex information, that is:

[0292]

[0293] According to the area of ​​the first area S1 and the area of ​​the third area S2, calculate the document area loss Loss1:

[0294] Loss1=|S1-S2| (13)

[0295] Based on the first grayscale values ​​corresponding to each pixel point in the predicted document area, a grayscale value matrix is ​​constructed. The comparison value of the sum of the first grayscale values ​​of each row in the grayscale value matrix and the first area of ​​the predicted document area is used as the horizontal coordinate x1 in the first centroid coordinate (x1, y1) of the predicted document area. The comparison value of the sum of the first grayscale values ​​of each column in the grayscale value matrix and the first area of ​​the predicted document area is used as the vertical coordinate y1 in the first centroid coordinate, as follows:

[0296]

[0297] Based on the predicted vertex coordinates in the predicted vertex information, the second centroid coordinates (x2, y2) of the predicted polygonal area formed by the predicted vertex coordinates are determined:

[0298]

[0299] Based on the distance between the first barycentric coordinate (x1, y1) and the second barycentric coordinate (x2, y2), the document barycentric loss Loss2 between the predicted document area and the predicted polygon area is determined:

[0300] Loss2=(x1-x2) 2 +(y1-y2) 2 (15)

[0301] Based on regional color loss Loss3, regional segmentation loss Loss0, document area loss Loss1, and document center of gravity loss Loss2, the target loss function Loss is constructed:

[0302] Loss=Loss0+Loss1+Loss2+Loss3 (17)

[0303] The document segmentation network to be trained is trained through the target loss function until the loss value of the document segmentation network is less than or equal to the loss threshold, thereby obtaining a trained target document segmentation network.

[0304] When a user needs to handle bank-related business, the front end of the computer device takes an image of the user's ID card and transmits the collected ID card image to the back end.

[0305] The backend performs target segmentation processing through the trained target ID segmentation network to obtain the ID card area in the ID card image, and can also output the coordinates of the four vertices of the ID card in the ID card image. The backend returns the ID card area and vertex coordinates to the frontend.

[0306] The front end calculates the intersection-and-union ratio between the area of ​​the target certificate and the area of ​​the preset area. When the intersection-and-union ratio is greater than or equal to the threshold, the user is allowed to conduct personal banking services, such as opening a bank card, querying and modifying bank reserved information, etc.

[0307] Alternatively, the front end calculates the intersection-and-union ratio between the area of ​​the quadrilateral formed by the coordinates of the four vertices and the area of ​​the preset area. When the intersection-and-union ratio is greater than or equal to a threshold, the user is allowed to conduct personal banking services, such as opening a bank card, querying and modifying bank reserved information, etc.

[0308] It should be understood that although Figure 2-Figure 9 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-Figure 9 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0309] In one embodiment, Fig.10 As shown, a training device for a segmentation network is provided. The device can adopt a software module or a hardware module, or a combination of the two to become a part of a computer device. The training device 1000 for the segmentation network specifically includes: an acquisition module 1002, a prediction module 1004, a regional feature loss determination module 1006, a geometric feature loss determination module 1008, a construction module 1010 and a training module 1012, wherein:

[0310] The acquisition module 1002 is used to acquire a sample image including a target geometric figure, and determine a marked geometric area corresponding to the target geometric figure based on the sample image.

[0311] The prediction module 1004 is used to perform target segmentation processing on the sample image through the segmentation network to be trained, obtain the predicted geometric area corresponding to the target geometric figure, and determine the predicted vertex information corresponding to the target geometric figure based on the image features in the target segmentation processing.

[0312] The regional feature loss determination module 1006 is used to determine the corresponding regional feature loss according to the predicted geometric region and the marked geometric region.

[0313] The geometric feature loss determination module 1008 is used to determine the corresponding geometric feature loss according to the predicted geometric area and the predicted polygon area determined by the predicted vertex information.

[0314] The construction module 1010 is used to construct a target loss function based on the regional feature loss and the geometric feature loss.

[0315] The training module 1012 is used to train the segmentation network to be trained by using the target loss function until the training stop condition is reached, thereby obtaining a trained target segmentation network; the target segmentation network is used to segment the target geometric figures from the image to be processed.

[0316] In this embodiment, a target segmentation process is performed on a sample image including a target geometric figure by a segmentation network to be trained, and a predicted geometric region corresponding to the target geometric figure predicted by the segmentation network can be obtained. Based on the image features in the target segmentation process, the predicted vertex information of the predicted target geometric figure predicted by the segmentation network in the sample image can be obtained. According to the regional feature loss between the predicted geometric region and the annotated geometric region, and the geometric feature loss between the predicted geometric region and the predicted polygonal region determined by the predicted vertex information, a target loss function is constructed, so that the target loss function includes multiple loss features. Based on multiple losses, the segmentation network to be trained is trained, and the influence of various losses on the recognition and segmentation of the segmentation network can be fully considered, so that the recognition and segmentation precision and accuracy of the segmentation network can be improved through training. The trained target segmentation network can accurately identify and segment the target geometric figure from the image. And the vertex information of the target geometric figure in the image can be accurately output, so as to accurately locate the target geometric figure in the image to be processed.

[0317] In one embodiment, the prediction module 1004 is also used to: perform sampling processing on the sample image to obtain a corresponding sample sampling image; perform feature extraction on the sample image and the sample sampling image respectively through the segmentation network to be trained to obtain a first feature map corresponding to the sample image and a second feature map corresponding to the sample sampling image; perform fusion processing on the first feature map and the second feature map, and obtain a predicted geometric area corresponding to the target geometric figure based on the sample fusion feature map after the fusion processing; perform convolution and full connection processing on the second feature map to obtain predicted vertex information corresponding to the target geometric figure.

[0318] In this embodiment, the sample image is sampled to obtain a sample sampling image, and the sample image and the sample sampling image are respectively subjected to feature extraction by the segmentation network to be trained, so that the features of images with different resolutions can be obtained. Based on the extracted first feature map and the second feature map, a fusion process is performed, and the predicted geometric region where the target geometric figure in the sample image is located can be more accurately predicted based on the image features of different resolutions. Based on the full connection process of the second feature map, the predicted vertex information corresponding to the target geometric figure is output, so that the segmentation network is trained based on the predicted geometric region and predicted vertex information obtained by different processes.

[0319] In one embodiment, the regional feature loss determination module 1006 is also used to: determine a first color value corresponding to the predicted geometric region, and a second color value corresponding to the annotated geometric region; determine a regional color loss between the predicted geometric region and the annotated geometric region based on the difference between the first color value and the second color value; determine a first region area corresponding to the predicted geometric region, and a second region area corresponding to the annotated geometric region; determine a regional segmentation loss between the predicted geometric region and the annotated geometric region based on the first region area and the second region area; and determine a corresponding regional feature loss based on the regional color loss and the regional segmentation loss.

[0320] In this embodiment, the regional color loss is determined based on the color difference between the predicted geometric region and the annotated geometric region, and the color loss between the geometric region predicted by the segmentation network and the actual geometric region can be determined. Based on the area of ​​the predicted geometric region and the area of ​​the annotated geometric region, the segmentation difference between the geometric region predicted by the segmentation network and the actual geometric region can be determined, so that the color loss and the area segmentation loss are used as the conditions for training the segmentation network, so that the trained segmentation network has higher accuracy and segmentation precision.

[0321] In one embodiment, the regional feature loss determination module 1006 is also used to: obtain the value of the color channel corresponding to each pixel in the predicted geometric area, and obtain the value of the color channel corresponding to each pixel in the annotated geometric area; determine the first color value corresponding to the predicted geometric area according to the value of the color channel corresponding to each pixel in the predicted geometric area, the first grayscale value corresponding to the corresponding pixel, and the first area; determine the second color value corresponding to the annotated geometric area according to the value of the color channel corresponding to each pixel in the annotated geometric area, the second grayscale value corresponding to the corresponding pixel, and the second area.

[0322] In this embodiment, based on the values ​​of the color channels corresponding to each pixel in the predicted geometric area, the first grayscale value corresponding to the corresponding pixel and the first area, the average color value of the predicted geometric area can be accurately calculated. Based on the values ​​of the color channels corresponding to each pixel in the annotated geometric area, the second grayscale value corresponding to the corresponding pixel and the second area, the average color value of the annotated geometric area can be accurately calculated. Based on the difference between the average color value of the predicted geometric area and the average color value of the annotated geometric area, the color loss between the predicted geometric area predicted by the segmentation network and the actual geometric area can be accurately determined, so that the color loss is used as a training condition for the segmentation network, which can improve the accuracy of the segmentation network.

[0323] In one embodiment, the regional feature loss determination module 1006 is also used to: obtain the first grayscale value corresponding to each pixel point in the predicted geometric area, and obtain the second grayscale value corresponding to each pixel point in the labeled geometric area; use the sum of the first grayscale values ​​of each pixel point in the predicted geometric area as the first area area of ​​the predicted geometric area; use the sum of the second grayscale values ​​of each pixel point in the labeled geometric area as the second area area of ​​the labeled geometric area.

[0324] In this embodiment, the sum of the grayscale values ​​corresponding to each pixel point is taken as the area, so that the area composed of each pixel of the predicted geometric area can be accurately calculated, and the area composed of each pixel of the marked geometric area can also be accurately calculated.

[0325] In one embodiment, the geometric feature loss determination module 1008 is also used to: determine the first area of ​​the predicted geometric area, and calculate the third area of ​​the predicted polygonal area determined by the predicted vertex information; determine the geometric area loss based on the difference between the first area and the third area; determine the first center of gravity position corresponding to the predicted geometric area, and the second center of gravity position corresponding to the predicted polygonal area; determine the geometric center of gravity loss based on the distance between the first center of gravity position and the second center of gravity position; determine the geometric feature loss based on the geometric area loss and the geometric center of gravity loss.

[0326] In this embodiment, the geometric area loss is determined based on the area difference between the predicted geometric area and the predicted polygonal area, and the area loss between the geometric area predicted by the segmentation network and the polygonal area can be determined. A large area loss indicates that the prediction and segmentation of the segmentation network are inaccurate. Based on the centroid position of the predicted geometric area and the centroid position of the predicted polygonal area, the centroid loss between the geometric area predicted by the segmentation network and the predicted polygonal area can be determined. A large centroid loss indicates that the prediction and segmentation of the segmentation network are inaccurate. Therefore, the area loss and centroid loss are used as conditions for training the segmentation network, so that the trained segmentation network has higher accuracy and segmentation precision.

[0327] In one embodiment, the first centroid position includes first centroid coordinates, and the second centroid position includes second centroid coordinates; the geometric feature loss determination module 1008: determines the first centroid coordinates of the predicted geometric area according to the first grayscale values ​​corresponding to each pixel point in the predicted geometric area; determines the second centroid coordinates of the predicted polygonal area formed by the predicted vertex coordinates based on the predicted vertex coordinates in the predicted vertex information; determines the geometric centroid loss between the predicted geometric area and the predicted polygonal area based on the distance between the first centroid coordinates and the second centroid coordinates.

[0328] In this embodiment, based on the barycentric coordinates of the predicted geometric region and the barycentric coordinates of the predicted polygonal region, the barycentric loss between the geometric region predicted by the segmentation network and the predicted polygonal region can be determined, thereby determining the difference in barycentricity between the prediction results corresponding to the two methods when the same segmentation grid uses two methods to predict the target geometric figure, thereby using the barycentric loss as a condition for training the segmentation network, so that the trained segmentation network has higher accuracy and segmentation precision. In addition, the trained segmentation network can simultaneously have two prediction methods: segmenting the target geometric figure and predicting the vertex coordinates of the target geometric figure.

[0329] In one embodiment, the geometric feature loss determination module 1008 is also used to: construct a grayscale value matrix based on the first grayscale values ​​corresponding to each pixel point in the predicted geometric area; use the comparison value of the sum of the first grayscale values ​​of each row in the grayscale value matrix and the first area of ​​the predicted geometric area as the horizontal coordinate in the first centroid coordinate of the predicted geometric area; use the comparison value of the sum of the first grayscale values ​​of each column in the grayscale value matrix and the first area of ​​the predicted geometric area as the vertical coordinate in the first centroid coordinate.

[0330] In this embodiment, the comparison value of the sum of the first grayscale values ​​of all rows in the grayscale value matrix and the area of ​​the first region is used as the horizontal coordinate in the centroid coordinate, and the comparison value of the sum of the first grayscale values ​​of all columns and the area of ​​the first region is used as the vertical coordinate, so that the centroid coordinates of the predicted geometric area can be calculated based on the grayscale value of the pixel, thereby realizing the calculation of the centroid coordinates at the pixel level.

[0331] In one embodiment, the device further includes: a segmentation module. The segmentation module is also used to obtain an image to be processed, perform sampling processing on the image to be processed, and obtain a corresponding sampled image to be processed; perform feature extraction on the image to be processed and the sampled image to be processed respectively through a trained target segmentation network to obtain a third feature map corresponding to the image to be processed and a fourth feature map corresponding to the sampled image to be processed; perform fusion processing on the third feature map and the fourth feature map, and determine the target geometric figure in the image to be processed based on the target fusion feature map after fusion processing.

[0332] In this embodiment, the image to be processed is sampled to obtain images of different sizes. The images of different sizes are subjected to feature extraction through a trained segmentation network to obtain feature maps of different resolutions. The feature maps of different resolutions are fused, which can more accurately identify the target geometric figures in the image to be processed, thereby improving the accuracy of target geometric figure recognition and segmentation.

[0333] In one embodiment, the device further includes: a service processing module. The service processing module is also used to:

[0334] Determine the intersection-and-union ratio between the area of ​​the target geometric figure and the area of ​​the preset region; when the intersection-and-union ratio is greater than or equal to a threshold, segment the target geometric figure from the image to be processed; and perform corresponding business processing based on the content included in the target geometric figure.

[0335] In this embodiment, when the intersection ratio between the area of ​​the target geometric figure and the area of ​​the preset region is greater than or equal to a threshold, it indicates that the verification of the target geometric figure is successful. Therefore, after the verification is successful, business processing is performed based on the information in the target geometric figure, which can improve the security of business processing.

[0336] In one embodiment, the device further includes: a vertex prediction module. The vertex prediction module is also used to: obtain an image to be processed, extract features of the image to be processed through a trained target segmentation network; perform convolution and full connection processing on the extracted image features to output target vertex information corresponding to the target geometric figure in the image to be processed.

[0337] In this embodiment, feature extraction is performed on the image to be processed based on the target segmentation network, and convolution and full connection processing are performed on the extracted image features, so that the target vertex information corresponding to the target geometric figures in the image to be processed can be accurately identified, so that the target geometric figures can be segmented from the image to be processed based on the target vertex information, thereby improving the precision and accuracy of recognition and segmentation.

[0338] In one embodiment, the target vertex information includes target vertex coordinates; the device further includes: a business processing module. The business processing module is also used to: determine a target polygonal area formed by the target vertex coordinates; determine an intersection-and-union ratio between an area of ​​the target polygonal area and an area of ​​a preset area; when the intersection-and-union ratio is greater than or equal to a second threshold, segment the target polygonal area formed by the target vertex coordinates from the image to be processed; and perform corresponding business processing based on the target polygonal area.

[0339] In this embodiment, when the intersection ratio between the area of ​​the target polygonal region and the area of ​​the preset region is greater than or equal to a threshold, it indicates that the verification of the target polygonal region is successful. Therefore, after the verification is successful, business processing is performed based on the information in the target geometric figure, which can improve the security of business processing.

[0340] In one embodiment, the sample image is an image containing a target certificate, the target geometric figure is a quadrilateral figure formed based on the boundary of the target certificate, the predicted fixed point information corresponding to the target geometric figure includes the vertex coordinates corresponding to each of the four vertices of the target certificate, and the target segmentation network is a certificate segmentation network.

[0341] In this embodiment, the document image including the target document is subjected to target segmentation processing by the document segmentation network to be trained, and the predicted document area corresponding to the target document predicted by the document segmentation network can be obtained. Based on the image features in the target segmentation processing, the predicted vertex coordinates of the target document predicted by the document segmentation network in the document image can be obtained. According to the regional feature loss between the predicted document area and the annotated document area, and the geometric feature loss between the predicted document area and the predicted polygon area determined by the predicted vertex coordinates, a target loss function is constructed, so that the target loss function includes multiple loss features. The document segmentation network to be trained is trained based on multiple losses, and the influence of various losses on the recognition and segmentation of the document segmentation network can be fully considered, so that the recognition and segmentation precision and accuracy of the document segmentation network can be improved through training. The trained target document segmentation network can accurately identify and segment the target document from the image. And the vertex coordinates of the target document in the image can be accurately output, so as to accurately locate the target document in the image.

[0342] For the specific definition of the training device for the segmentation network, please refer to the definition of the training method for the segmentation network above, which will not be repeated here. Each module in the above-mentioned training device for the segmentation network can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0343] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.11As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store training data of the segmentation network. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a training method for a segmentation network is implemented.

[0344] Those skilled in the art will understand that Fig.11 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0345] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0346] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0347] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the above-mentioned method embodiments.

[0348] Those of ordinary skill 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 in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0349] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0350] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A training method for a segmentation network, characterized in that: The method comprises: Acquire a sample image including a target geometric figure, and determine a marked geometric area corresponding to the target geometric figure based on the sample image; Performing sampling processing on the sample image to obtain a corresponding sample sampling image; Extracting features from the sample image and the sample sampling image respectively through the segmentation network to be trained to obtain a first feature map corresponding to the sample image and a second feature map corresponding to the sample sampling image; The first feature map and the second feature map are fused, and a predicted geometric region corresponding to the target geometric figure is obtained based on the fused sample fusion feature map; Performing convolution and full connection processing on the second feature map to obtain predicted vertex information corresponding to the target geometric figure; Determining a corresponding regional feature loss according to the predicted geometric region and the annotated geometric region; Determining a corresponding geometric feature loss according to the predicted geometric area and the predicted polygon area determined by the predicted vertex information; Based on the regional feature loss and the geometric feature loss, construct a target loss function; The segmentation network to be trained is trained by the target loss function until the training stop condition is reached, thereby obtaining a trained target segmentation network; the target segmentation network is used to segment target geometric figures from the image to be processed.

2. The method according to claim 1, characterized in that The determining, according to the predicted geometric region and the annotated geometric region, a corresponding regional feature loss includes: Determining a first color value corresponding to the predicted geometric area and a second color value corresponding to the annotated geometric area; Determining a regional color loss between the predicted geometric region and the annotated geometric region based on a difference between the first color value and the second color value; Determining an area of ​​a first region corresponding to the predicted geometric region and an area of ​​a second region corresponding to the annotated geometric region; Determining a region segmentation loss between the predicted geometric region and the labeled geometric region based on the area of ​​the first region and the area of ​​the second region; According to the regional color loss and the regional segmentation loss, a corresponding regional feature loss is determined.

3. The method according to claim 2, characterized in that The determining of the first color value corresponding to the predicted geometric area and the second color value corresponding to the marked geometric area includes: Obtain the value of the color channel corresponding to each pixel point in the predicted geometric area, and obtain the value of the color channel corresponding to each pixel point in the marked geometric area; Determine a first color value corresponding to the predicted geometric area according to the value of the color channel corresponding to each pixel in the predicted geometric area, the first grayscale value corresponding to the corresponding pixel, and the area of ​​the first area; The second color value corresponding to the annotated geometric area is determined according to the value of the color channel corresponding to each pixel in the annotated geometric area, the second grayscale value corresponding to the corresponding pixel and the area of ​​the second area.

4. The method according to claim 2, characterized in that: The determining the first region area corresponding to the predicted geometric region and the second region area corresponding to the marked geometric region includes: Obtain a first grayscale value corresponding to each pixel point in the predicted geometric area, and obtain a second grayscale value corresponding to each pixel point in the marked geometric area; Taking the sum of the first grayscale values ​​of the pixels in the predicted geometric area as the first area of ​​the predicted geometric area; The sum of the second grayscale values ​​of the pixels in the marked geometric region is used as the second region area of ​​the marked geometric region.

5. The method according to claim 1, characterized in that The determining of the corresponding geometric feature loss according to the predicted geometric area and the predicted polygon area determined by the predicted vertex information includes: Determine a first region area of ​​the predicted geometric region, and calculate a third region area of ​​the predicted polygonal region determined by the predicted vertex information; determining a geometric area loss according to a difference between an area of ​​the first region and an area of ​​the third region; Determining a first centroid position corresponding to the predicted geometric area and a second centroid position corresponding to the predicted polygonal area; determining a geometric center of gravity loss based on a distance between the first center of gravity position and the second center of gravity position; A geometric feature loss is determined based on the geometric area loss and the geometric center of gravity loss.

6. The method according to claim 5, characterized in that The first center of gravity position includes a first center of gravity coordinate, and the second center of gravity position includes a second center of gravity coordinate; and determining the geometric center of gravity loss according to the distance between the first center of gravity position and the second center of gravity position includes: Determine the first centroid coordinates of the predicted geometric area according to the first grayscale values ​​respectively corresponding to the pixels in the predicted geometric area; Based on the predicted vertex coordinates in the predicted vertex information, determining the second centroid coordinates of the predicted polygonal area formed by the predicted vertex coordinates; The determining of the geometric center of gravity loss according to the distance between the first center of gravity position and the second center of gravity position comprises: Based on the distance between the first barycentric coordinates and the second barycentric coordinates, a geometric barycentric loss between the predicted geometric region and the predicted polygonal region is determined.

7. The method according to claim 6, characterized in that The determining, according to the first grayscale values ​​respectively corresponding to the pixels in the predicted geometric area, the first centroid coordinates of the predicted geometric area comprises: Constructing a gray value matrix based on the first gray values ​​corresponding to each pixel point in the predicted geometric area; Using the comparison value of the sum of the first grayscale values ​​of each row in the grayscale value matrix and the first area of ​​the predicted geometric region as the abscissa in the first centroid coordinates of the predicted geometric region; The comparison value between the sum of the first grayscale values ​​of each column in the grayscale value matrix and the first region area of ​​the predicted geometric region is used as the ordinate in the first barycentric coordinate.

8. The method according to claim 1, characterized in that The method further comprises: Acquire an image to be processed, perform sampling processing on the image to be processed, and obtain a corresponding sampled image to be processed; Performing feature extraction on the image to be processed and the sampled image to be processed respectively through the trained target segmentation network to obtain a third feature map corresponding to the image to be processed and a fourth feature map corresponding to the sampled image to be processed; The third feature map and the fourth feature map are fused, and a target geometric figure in the image to be processed is determined based on the fused target fusion feature map.

9. The method according to claim 8, characterized in that The method further comprises: Determining the intersection-over-combination ratio between the area of ​​the target geometric figure and the area of ​​the preset region; When the intersection-over-union ratio is greater than or equal to a threshold, segmenting the target geometric figure from the image to be processed; Perform corresponding business processing based on the content included in the target geometry.

10. The method according to claim 1, characterized in that The method further comprises: Acquire an image to be processed, and perform feature extraction on the image to be processed through the trained target segmentation network; The extracted image features are subjected to convolution and full connection processing to output target vertex information corresponding to the target geometric figures in the image to be processed.

11. The method according to any one of claims 1 to 10, characterized in that: The sample image is an image containing a target certificate, the target geometric figure is a quadrilateral figure formed based on the boundary of the target certificate, the predicted fixed point information corresponding to the target geometric figure includes the vertex coordinates corresponding to each of the four vertices of the target certificate, and the target segmentation network is a certificate segmentation network.

12. A training device for a segmentation network, characterized in that: The device comprises: An acquisition module, used for acquiring a sample image including a target geometric figure, and determining a marked geometric area corresponding to the target geometric figure based on the sample image; A prediction module is used to perform sampling processing on the sample image to obtain a corresponding sample sampling image; perform feature extraction on the sample image and the sample sampling image respectively through a segmentation network to be trained to obtain a first feature map corresponding to the sample image and a second feature map corresponding to the sample sampling image; perform fusion processing on the first feature map and the second feature map, and obtain a predicted geometric region corresponding to the target geometric figure based on the sample fusion feature map after the fusion processing; perform convolution and full connection processing on the second feature map to obtain predicted vertex information corresponding to the target geometric figure; A regional feature loss determination module, used to determine the corresponding regional feature loss according to the predicted geometric region and the marked geometric region; A geometric feature loss determination module, configured to determine a corresponding geometric feature loss according to the predicted geometric region and the predicted polygon region determined by the predicted vertex information; A construction module, used to construct a target loss function based on the regional feature loss and the geometric feature loss; The training module is used to train the segmentation network to be trained by the target loss function until the training stop condition is reached, thereby obtaining a trained target segmentation network; the target segmentation network is used to segment the target geometric figure from the image to be processed.

13. The device according to claim 12, characterized in that The regional feature loss determination module is further used to determine a first color value corresponding to the predicted geometric region and a second color value corresponding to the annotated geometric region; based on the difference between the first color value and the second color value, determine the regional color loss between the predicted geometric region and the annotated geometric region; Determine the area of ​​a first region corresponding to the predicted geometric region, and the area of ​​a second region corresponding to the annotated geometric region; determine the regional segmentation loss between the predicted geometric region and the annotated geometric region based on the area of ​​the first region and the area of ​​the second region; determine the corresponding regional feature loss based on the regional color loss and the regional segmentation loss.

14. The device according to claim 13, characterized in that The regional feature loss determination module is also used to obtain the value of the color channel corresponding to each pixel point in the predicted geometric area, and obtain the value of the color channel corresponding to each pixel point in the annotated geometric area; determine the first color value corresponding to the predicted geometric area according to the value of the color channel corresponding to each pixel point in the predicted geometric area, the first grayscale value corresponding to the corresponding pixel point and the area of ​​the first area; determine the second color value corresponding to the annotated geometric area according to the value of the color channel corresponding to each pixel point in the annotated geometric area, the second grayscale value corresponding to the corresponding pixel point and the area of ​​the second area.

15. The device according to claim 13, characterized in that The regional feature loss determination module is also used to obtain the first grayscale value corresponding to each pixel point in the predicted geometric area, and obtain the second grayscale value corresponding to each pixel point in the labeled geometric area; the sum of the first grayscale values ​​of each pixel point in the predicted geometric area is used as the first area area of ​​the predicted geometric area; the sum of the second grayscale values ​​of each pixel point in the labeled geometric area is used as the second area area of ​​the labeled geometric area.

16. The device according to claim 12, characterized in that The geometric feature loss determination module is further used to determine a first area of ​​the predicted geometric area, and calculate a third area of ​​the predicted polygonal area determined by the predicted vertex information; determine a geometric area loss according to a difference between the first area and the third area; determine a first centroid position corresponding to the predicted geometric area, and a second centroid position corresponding to the predicted polygonal area; determine a geometric centroid loss according to a distance between the first centroid position and the second centroid position; A geometric feature loss is determined based on the geometric area loss and the geometric center of gravity loss.

17. The device according to claim 16, characterized in that The first centroid position includes first centroid coordinates, and the second centroid position includes second centroid coordinates; the geometric feature loss determination module is also used to determine the first centroid coordinates of the predicted geometric area according to the first grayscale values ​​corresponding to each pixel point in the predicted geometric area; based on the predicted vertex coordinates in the predicted vertex information, determine the second centroid coordinates of the predicted polygonal area formed by the predicted vertex coordinates; based on the distance between the first centroid coordinates and the second centroid coordinates, determine the geometric centroid loss between the predicted geometric area and the predicted polygonal area.

18. The device according to claim 17, characterized in that The geometric feature loss determination module is also used to construct a grayscale value matrix based on the first grayscale values ​​corresponding to each pixel point in the predicted geometric area; use the comparison value of the sum of the first grayscale values ​​of each row in the grayscale value matrix and the first area area of ​​the predicted geometric area as the horizontal coordinate in the first centroid coordinate of the predicted geometric area; use the comparison value of the sum of the first grayscale values ​​of each column in the grayscale value matrix and the first area area of ​​the predicted geometric area as the vertical coordinate in the first centroid coordinate.

19. The device according to claim 12, characterized in that The device also includes a segmentation module; the segmentation module is used to obtain an image to be processed, perform sampling processing on the image to be processed, and obtain a corresponding sampled image to be processed; perform feature extraction on the image to be processed and the sampled image to be processed respectively through the trained target segmentation network to obtain a third feature map corresponding to the image to be processed and a fourth feature map corresponding to the sampled image to be processed; fuse the third feature map and the fourth feature map, and determine the target geometric figure in the image to be processed based on the target fusion feature map after the fusion processing.

20. The device according to claim 12, characterized in that The device further includes a business processing module; the business processing module is used to determine the intersection-and-union ratio between the area of ​​the target geometric figure and the area of ​​the preset region; when the intersection-and-union ratio is greater than or equal to a threshold, segmenting the target geometric figure from the image to be processed; Perform corresponding business processing based on the content included in the target geometry.

21. The device according to claim 12, characterized in that The device further comprises a vertex prediction module; the vertex prediction module is used to obtain an image to be processed and perform feature extraction on the image to be processed through the trained target segmentation network; The extracted image features are subjected to convolution and full connection processing to output target vertex information corresponding to the target geometric figures in the image to be processed.

22. The device according to any one of claims 12 to 21, characterized in that The sample image is an image containing a target certificate, the target geometric figure is a quadrilateral figure formed based on the boundary of the target certificate, the predicted fixed point information corresponding to the target geometric figure includes the vertex coordinates corresponding to each of the four vertices of the target certificate, and the target segmentation network is a certificate segmentation network.

23. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 11 are implemented.

24. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.

25. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.