Edge extraction method, device, electronic device and storage medium

The edge extraction model trained by deep learning technology solves the problem of rough image edge extraction results, and achieves more accurate edge information extraction.

CN114419086BActive Publication Date: 2025-06-17BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210067538.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-20
Publication Date
2025-06-17
Estimated Expiration
2042-01-20

AI Technical Summary

Technical Problem

The prior art results are rough and not fine enough when detecting and extracting images edges.

Method used

By obtaining the target image to be extracted and inputting it into the trained target edge extraction model, the corresponding target edge mask image is obtained. The model is based on deep learning technology, and performs image enhancement processing on the initial image of the sample and edge mask images, expands the sample and improves the image quality, and then performs model training.

Benefits of technology

This achieves more precise extraction of edge information in the image, solving the problem of rough image edge extraction results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114419086B_ABST
    Figure CN114419086B_ABST
Patent Text Reader

Abstract

An embodiment of the present disclosure discloses an edge extraction method, apparatus, electronic device, and storage medium. The method includes: obtaining a target image to be extracted; inputting the target image to be extracted into a target edge extraction model to obtain a target edge mask image corresponding to the target image to be extracted; the target edge extraction model is trained based on the following method: obtaining a sample initial image to be extracted and a sample initial edge mask image; performing image enhancement processing on the sample initial image to be extracted, and performing image enhancement processing on the sample initial edge mask image; training an initial deep learning model according to the sample initial image to be extracted and the sample initial edge mask image after image enhancement processing to obtain a target edge extraction model. The technical solution of the embodiment of the present disclosure can obtain a target edge extraction model by training with the sample initial image to be extracted and the sample initial edge mask image after image enhancement processing, and can more accurately extract edge information in the image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the field of image processing technologies, and in particular, to an edge extraction method, apparatus, electronic device, and storage medium. Background Art

[0002] As a basic feature of an image, the image edge concentrates a large amount of image information. Image edge detection is a basic problem in image processing and computer vision. Image edges usually exist between objects, backgrounds, and regions. Therefore, it is difficult to detect and extract image edges.

[0003] Currently, when detecting and extracting image edges based on existing image edge detection and extraction technologies, there are problems such as rough and not fine enough image edge extraction results. Summary of the Invention

[0004] Embodiments of the present disclosure provide an edge extraction method, apparatus, electronic device, and storage medium to achieve the effect of more accurately extracting edge information in an image.

[0005] In a first aspect, embodiments of the present disclosure provide an edge extraction method, which includes:

[0006] Obtain a target image to be extracted;

[0007] Input the target image to be extracted into a target edge extraction model to obtain a target edge mask image corresponding to the target image to be extracted;

[0008] Wherein, the target edge extraction model is trained based on the following method:

[0009] Obtain a sample initial image to be extracted and a sample initial edge mask image corresponding to the sample initial image to be extracted;

[0010] Perform image enhancement processing on the sample initial image to be extracted to obtain a sample target image to be extracted with a target size, and perform image enhancement processing on the sample initial edge mask image to obtain the sample target edge mask image with the target size;

[0011] Train an initial deep learning model according to the sample target image to be extracted and the sample target edge mask image corresponding to the sample target image to be extracted to obtain a target edge extraction model.

[0012] In a second aspect, embodiments of the present disclosure further provide an edge extraction apparatus, which includes:

[0013] An image acquisition module, configured to obtain a target image to be extracted;

[0014] An edge extraction module, configured to input the target image to be extracted into a target edge extraction model to obtain a target edge mask image corresponding to the target image to be extracted;

[0015] Wherein, the target edge extraction model is obtained based on a model training device, and the model training device includes:

[0016] A sample acquisition module, configured to acquire a sample initial image to be extracted and a sample initial edge mask image corresponding to the sample initial image to be extracted;

[0017] A sample enhancement module, configured to perform image enhancement processing on the sample initial image to be extracted to obtain a sample target image to be extracted with a target size, and perform image enhancement processing on the sample initial edge mask image to obtain the sample target edge mask image with the target size;

[0018] A model training module, configured to train an initial deep learning model according to the sample target image to be extracted and the sample target edge mask image corresponding to the sample target image to be extracted to obtain a target edge extraction model.

[0019] In a third aspect, an embodiment of the present disclosure further provides an electronic device, which includes:

[0020] One or more processors;

[0021] A storage device, configured to store one or more programs,

[0022] When the one or more programs are executed by the one or more processors, the one or more processors implement the edge extraction method provided in any embodiment of the present disclosure.

[0023] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the edge extraction method provided in any embodiment of the present disclosure is implemented.

[0024] The technical solution of the embodiment of the present disclosure obtains a target image to be extracted, inputs the target image to be extracted into a target edge extraction model, and obtains a target edge mask image corresponding to the target image to be extracted for edge extraction of the image. Moreover, by obtaining a sample initial image to be extracted and a sample initial edge mask image corresponding to the sample initial image to be extracted, performing image enhancement processing on the sample initial image to be extracted to obtain a sample target image to be extracted with a target size, and performing image enhancement processing on the sample initial edge mask image to obtain a sample target edge mask image with a target size for sample expansion and image quality improvement, training an initial deep learning model according to the sample target image to be extracted and the sample target edge mask image corresponding to the sample target image to be extracted to obtain a target edge extraction model, which solves the problem that the image edge extraction result is rough and not fine enough, and realizes the effect of more accurately extracting edge information in the image. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present disclosure, the following briefly introduces the drawings required for describing the embodiments. Obviously, the introduced drawings are only the drawings of a part of the embodiments to be described in the present invention, rather than all the drawings. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0026] Figure 1 It is a flowchart of an edge extraction method provided in Embodiment 1 of the present disclosure;

[0027] Figure 2 It is a flowchart of a method for training a target edge extraction model provided in Embodiment 2 of the present disclosure;

[0028] Figure 3 It is a flowchart of a method for training a target edge extraction model provided in Embodiment 3 of the present disclosure;

[0029] Figure 4 It is a flowchart of a method for training a target edge extraction model provided in Embodiment 4 of the present disclosure;

[0030] Figure 5 It is a schematic diagram of a sample initial image to be extracted provided in Embodiment 5 of the present disclosure;

[0031] Figure 6 It is a schematic diagram of a sample target image to be extracted provided in Embodiment 5 of the present disclosure;

[0032] Figure 7 It is a schematic diagram of a target edge mask image output by the target edge extraction model provided in Embodiment 5 of the present disclosure;

[0033] Figure 8 Schematic diagram of the target edge mask image after image brightness adjustment provided in the fifth embodiment of the present disclosure;

[0034] Figure 9 Schematic structural diagram of an edge extraction device and a model training device provided in the sixth embodiment of the present disclosure;

[0035] Figure 10 Schematic structural diagram of an electronic device provided in the seventh embodiment of the present disclosure. Detailed implementation manners

[0036] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although some embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Instead, these embodiments are provided to more thoroughly and completely understand the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not used to limit the protection scope of the present disclosure.

[0037] It should be understood that the various steps recited in the method embodiments of the present disclosure can be executed in a different order and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this regard.

[0038] As used herein, the term "including" and its variants are open-ended, that is, "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0039] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order of the functions executed by these devices, modules or units or their interdependent relationships. It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0040] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only for illustrative purposes and are not used to limit the scope of these messages or information.

[0041] Embodiment 1

[0042] Figure 1The flowchart of an edge extraction method provided in Embodiment 1 of the present disclosure. This embodiment is applicable to the situation of extracting the edges of an image. This method can be executed by an edge extraction device, which can be implemented by software and / or hardware, and can be configured in a terminal and / or a server to implement the edge extraction method in the embodiments of the present disclosure.

[0043] As Figure 1 shown, the method of this embodiment specifically may include:

[0044] S110. Obtain a target image to be extracted.

[0045] Wherein, the target image to be extracted may be the original image to be subjected to edge extraction.

[0046] Specifically, the target image to be extracted can be obtained by means such as downloading, photographing, drawing, uploading, etc.

[0047] S120. Input the target image to be extracted into a target edge extraction model to obtain a target edge mask image corresponding to the target image to be extracted.

[0048] Wherein, the target edge mask image may be an image with edge information corresponding to the target image to be extracted. The target edge extraction model can be a trained model that can be used for edge extraction of an image.

[0049] Specifically, input the target image to be extracted into the target edge extraction model, process the target image to be extracted, and use the output result as the target edge mask image corresponding to the target image to be extracted.

[0050] Wherein, the target edge extraction model is trained based on the following method, which specifically includes the following steps:

[0051] Step 1. Obtain a sample initial image to be extracted and a sample initial edge mask image corresponding to the sample initial image to be extracted.

[0052] Wherein, the sample initial image to be extracted may be the original sample image to be subjected to edge extraction. The sample initial edge mask image may be an image used to represent edge information corresponding to the sample initial image to be extracted.

[0053] Specifically, the sample initial image to be extracted and the sample initial edge mask image corresponding to the sample initial image to be extracted can be obtained from an existing database. It is also possible to first obtain the sample initial image to be extracted, and then perform edge information annotation on the sample initial image to be extracted to obtain the sample initial edge mask image corresponding to the sample initial image to be extracted.

[0054] Step 2: Perform image enhancement processing on the initial sample image to be extracted to obtain a sample target image to be extracted with the target size, and perform image enhancement processing on the initial sample edge mask image to obtain a sample target edge mask image with the target size.

[0055] Among them, image enhancement processing can be an image processing method to improve the visual effect of the image. Image enhancement processing can purposefully emphasize the overall or local characteristics of the image, highlight the features of interest, and suppress the features of disinterest. The target size can be the size of the output image set in advance, such as: 512×512, 1024×1024, etc. The sample target image to be extracted can be the image after the initial sample image to be extracted undergoes image enhancement processing, and the sample target edge mask image can be the image after the initial sample edge mask image undergoes image enhancement processing.

[0056] Specifically, perform image enhancement processing on the initial sample image to be extracted to attach some information or transform the data to the initial sample image to be extracted, highlight the features of interest in the initial sample image to be extracted, and perform size transformation on the initial sample image to be extracted after image enhancement processing to obtain a sample target image to be extracted with the target size. Perform image enhancement processing on the initial sample edge mask image to attach some information or transform the data to the initial sample edge mask image, highlight the features of interest in the initial sample image to be extracted, and perform size transformation on the initial sample edge mask image after image enhancement processing to obtain a sample target edge mask image with the target size.

[0057] It should be noted that the purpose of performing image enhancement processing on the initial sample image to be extracted to obtain a sample target image to be extracted with the target size is to achieve the purpose of expanding the sample. The purpose of performing image enhancement processing on the initial sample edge mask image to obtain a sample target edge mask image with the target size is to highlight the edge information in the initial sample edge mask image to improve the quality of the sample.

[0058] Step 3: Train the initial deep learning model according to the sample target image to be extracted and the corresponding sample target edge mask image to obtain a target edge extraction model.

[0059] Among them, the initial deep learning model includes a convolutional neural network model, and the convolutional neural network model includes at least one of the u2net model, unet model, deeplab model, transformer model, and pidinet model.

[0060] Specifically, the initial deep learning model is used as the current deep learning model. The sample target image to be extracted is input into the current deep learning model to obtain an output image. The output image is compared with the sample target edge mask image corresponding to the sample target image to be extracted to obtain the current loss function. If the loss function does not meet the requirements, the parameters in the current deep learning model are adjusted according to the current loss function. The adjusted deep learning model is used as the current deep learning model, and the operation of inputting the sample target image to be extracted into the current deep learning model to obtain an output image is returned; if the loss function meets the requirements, the current deep learning model is used as the target edge extraction model.

[0061] Optionally, if the current loss function still does not meet the requirements when the number of training times reaches the preset number of times, the current deep learning model obtained from the last training can be used as the target edge extraction model.

[0062] Based on the technical solution of the embodiment of the present disclosure, the target edge mask image can be processed to weaken irrelevant information and refine the edge information. Optionally, after obtaining the target edge mask image corresponding to the target image to be extracted, it further includes:

[0063] Adjust the image brightness of the target edge mask image based on a preset color look-up table.

[0064] Among them, the color look-up table (Look-Up-Table, LUT) is used to adjust the color value of pixel points. It can be that after the color information of each pixel point is readjusted by the LUT, a new color information of the pixel point is obtained.

[0065] Specifically, processing the target edge mask image according to the preset color look-up table can be to adjust the colors of the pixel points related to the edge in the target edge mask image to adjust the image brightness of the target edge mask image.

[0066] Based on the technical solution of the embodiment of the present disclosure, contour recognition processing can be performed on each edge pixel point in the target edge mask image to obtain the hierarchical relationship of each edge pixel point, which is convenient for subsequent display or special effect processing according to the hierarchical relationship. Optionally, after obtaining the target edge mask image corresponding to the target image to be extracted, it further includes:

[0067] Identify the edge pixel points in the target edge mask image based on a preset contour recognition algorithm and store the identified edge pixel points in the form of point vectors.

[0068] Among them, the target edge mask image may include edge pixel points and non-edge pixel points. Exemplarily, the target edge mask image may be a binary image. For example, the edge pixel points are white and the non-edge pixel points are black. The contour recognition algorithm may be an algorithm for determining the hierarchical relationship of each edge pixel point in the contour. For example, the FindContours function in OpenCV, etc. The hierarchical relationship can be used to represent the order of each edge pixel point, etc. The point vector may include the position of the edge pixel point and the direction of the next edge pixel point of the edge pixel point.

[0069] Specifically, based on a preset contour recognition algorithm, the edge pixel points in the target edge mask image are recognized to obtain the point vector of each edge pixel point, and each point vector is stored for subsequent processing such as display or adding special effects according to each point vector, thereby realizing the gradient process.

[0070] The technical solution of the embodiment of the present disclosure obtains a target image to be extracted, inputs the target image to be extracted into a target edge extraction model, and obtains a target edge mask image corresponding to the target image to be extracted for edge extraction of the image. Moreover, by obtaining a sample initial image to be extracted and a sample initial edge mask image corresponding to the sample initial image to be extracted, performing image enhancement processing on the sample initial image to be extracted to obtain a sample target image to be extracted with a target size, and performing image enhancement processing on the sample initial edge mask image to obtain a sample target edge mask image with a target size for sample expansion and image quality improvement, training an initial deep learning model according to the sample target image to be extracted and the sample target edge mask image corresponding to the sample target image to be extracted to obtain a target edge extraction model, which solves the problem that the image edge extraction result is rough and not fine enough, and realizes the effect of more accurately extracting the edge information in the image.

[0071] Embodiment 2

[0072] Figure 2 As shown in the flowchart of a method for training a target edge extraction model provided in Embodiment 2 of the present disclosure. Based on any optional technical solution in the embodiments of the present disclosure, optionally, the manner of performing image enhancement processing on the sample initial image to be extracted can refer to the technical solution of this embodiment. Among them, the explanations of the same or corresponding terms as those in the above embodiments are not repeated here.

[0073] As Figure 2 shown, the method of this embodiment may specifically include:

[0074] S210. Obtain a sample initial image to be extracted and a sample initial edge mask image corresponding to the sample initial image to be extracted.

[0075] S220. Scale the initial sample image to be extracted to obtain the initial sample image to be extracted with the first size.

[0076] Among them, the scaling process can be an enlargement or reduction process. Exemplarily, it can be the scale function. The first size can be the size after scaling the initial sample image to be extracted.

[0077] Specifically, by scaling the length and / or width of the initial sample image to be extracted according to a preset ratio, the initial sample image to be extracted with the first size can be obtained. Among them, the preset ratio can be any ratio set in advance. The preset ratio can include a length preset ratio and a width preset ratio. The length preset ratio can be the ratio of the length in the first size to the length of the initial sample image to be extracted, and the width preset ratio can be the ratio of the width in the first size to the width of the initial sample image to be extracted. The length preset ratio and the width preset ratio can be the same or different. For example, the value of the preset ratio can be 0.5, 0.7, 1.2, 1.5, etc.

[0078] Based on the technical solution of the embodiment of the present disclosure, the length and width of the initial sample image to be extracted can be scaled respectively. Optionally, the length and width of the initial sample image to be extracted are scaled respectively according to the preset size transformation range.

[0079] Among them, the preset size transformation range can be the range to which the preset ratio for scaling the initial sample image to be extracted belongs. The advantage of setting the preset size transformation range is to avoid the situation of image quality loss caused by excessive size change.

[0080] Specifically, the length and width of the initial sample image to be extracted can be scaled respectively according to any value within the preset size transformation range. For example, if the preset size transformation range is [0.5, 2], then the length preset ratio can be any value within the interval [0.5, 2], and the width preset ratio can also be any value within the interval [0.5, 2].

[0081] It should be noted that the length and width of the initial sample image to be extracted can be scaled using the same ratio or different ratios.

[0082] S230. Perform interpolation processing on the initial sample image to be extracted with the first size according to the nearest neighbor interpolation method to obtain the target sample image to be extracted with the target size.

[0083] Among them, the nearest neighbor interpolation method can be a method of assigning the gray value of the nearest pixel to the original pixel point in the transformed image. The target size can be a preset image size to be obtained, such as 512×512, etc.

[0084] Specifically, the nearest neighbor interpolation method is used to interpolate the sample initial image to be extracted with the first size, so as to adjust the size of the sample initial image to be extracted with the first size, and adjust the first size to the target size, thereby obtaining the sample target image to be extracted with the target size.

[0085] Based on the technical solution of the embodiment of the present disclosure, the sample initial image to be extracted with the first size can be first cropped so that the aspect ratio of the cropped sample initial image to be extracted meets the preset aspect ratio. Optionally, interpolating the sample initial image to be extracted with the first size according to the nearest neighbor interpolation method includes:

[0086] Cropping the sample initial image to be extracted with the first size according to the preset aspect ratio, and interpolating the cropped sample initial image to be extracted according to the nearest neighbor interpolation method.

[0087] Among them, the preset aspect ratio can be the ratio of the preset image length to the width, such as: 1:1, 4:3, 16:9, etc.

[0088] Specifically, the sample initial image to be extracted with the first size can be cropped according to the preset aspect ratio to obtain at least one cropped sample initial image to be extracted. Furthermore, for each cropped sample initial image to be extracted, interpolation processing is performed by the nearest neighbor interpolation method.

[0089] It should be noted that randomly cropping the sample initial image to be extracted with the first size according to the preset aspect ratio can obtain multiple different images, and each image can be regarded as a cropped sample initial image to be extracted.

[0090] Based on the technical solution of the embodiment of the present disclosure, preprocessing can be performed on the sample initial image to be extracted to make the image quality of the sample initial image to be extracted higher. Optionally, before performing the scaling processing on the sample initial image to be extracted, it further includes: performing sharpening processing on the sample initial image to be extracted.

[0091] S240. Perform image enhancement processing on the sample initial edge mask image to obtain a sample target edge mask image with the target size.

[0092] S250. Train the initial deep learning model according to the sample target image to be extracted and the corresponding sample target edge mask image to obtain a target edge extraction model.

[0093] In the technical solution of the embodiment of the present disclosure, by obtaining a sample initial image to be extracted and a sample initial edge mask image corresponding to the sample initial image to be extracted, performing a scaling process on the sample initial image to be extracted to obtain a sample initial image to be extracted with a first size, and performing an interpolation process on the sample initial image to be extracted with the first size according to the nearest neighbor interpolation method to obtain a sample target image to be extracted with a target size, the sample initial image to be extracted is expanded and its size is adjusted. Image enhancement processing is performed on the sample initial edge mask image to obtain a sample target edge mask image with a target size. The initial deep learning model is trained according to the sample target image to be extracted and the sample target edge mask image corresponding to the sample target image to be extracted to obtain a target edge extraction model, which solves the problem of poor model training effect due to the small number of sample initial images to be extracted, and realizes the effect of expanding the sample initial images to be extracted to improve the model training quality.

[0094] Embodiment III

[0095] Figure 3 FIG. is a schematic flowchart of a method for training a target edge extraction model provided in Embodiment III of the present disclosure. On the basis of any optional technical solution in the embodiment of the present disclosure, optionally, the manner of performing image enhancement processing on the sample initial image to be extracted can refer to the technical solution of this embodiment. Among them, the explanations of the same or corresponding terms as those in the above embodiments will not be repeated here.

[0096] As Figure 3 shown, the method of this embodiment may specifically include:

[0097] S310. Obtain a sample initial image to be extracted and a sample initial edge mask image corresponding to the sample initial image to be extracted.

[0098] S320. Perform image enhancement processing on the sample initial image to be extracted to obtain a sample target image to be extracted with a target size.

[0099] S330. Perform a scaling process on the sample initial edge mask image to obtain a sample initial edge mask image with a second size.

[0100] Wherein, the second size may be the size after scaling the sample initial edge mask image.

[0101] Specifically, the length and / or width of the sample initial edge mask image can be scaled according to a preset ratio to obtain a sample initial edge mask image of a second size. Herein, the preset ratio can be any ratio set in advance, and the preset ratio can include a length preset ratio and a width preset ratio. The length preset ratio can be the ratio of the length in the second size to the length of the sample initial edge mask image, and the width preset ratio can be the ratio of the width in the second size to the width of the sample initial edge mask image. The length preset ratio and the width preset ratio can be the same or different. For example, the value of the preset ratio can be 0.5, 0.7, 1.2, 1.5, etc.

[0102] Based on the technical solution of the embodiment of the present disclosure, the length and width of the sample initial edge mask image can be scaled respectively. Optionally, the length and width of the sample initial edge mask image can be scaled according to a preset size transformation range respectively.

[0103] Herein, the preset size transformation range can be the range to which the preset ratio for scaling the sample initial edge mask image belongs. The advantage of setting the preset size transformation range is to avoid the situation of image quality loss caused by excessive size change.

[0104] Specifically, the length and width of the sample initial edge mask image can be scaled respectively according to any value within the preset size transformation range. For example, if the preset size transformation range is [0.5, 2], then the length preset ratio can be any value within the interval [0.5, 2], and the width preset ratio can also be any value within the interval [0.5, 2].

[0105] S340. Interpolate the sample initial edge mask image of the second size according to the nearest neighbor interpolation method to obtain a sample target edge mask image of the target size.

[0106] Specifically, use the nearest neighbor interpolation method to interpolate the sample initial edge mask image of the second size to adjust the size of the sample initial edge mask image of the second size to adjust the second size to the target size, and obtain a sample target edge mask image of the target size.

[0107] Based on the technical solution of the embodiment of the present disclosure, the sample initial edge mask image of the second size can be cropped first so that the aspect ratio of the cropped sample initial edge mask image conforms to the preset aspect ratio. Optionally, interpolating the sample initial edge mask image of the second size according to the nearest neighbor interpolation method includes:

[0108] Crop the sample initial edge mask image of the second size according to a preset aspect ratio, and perform interpolation processing on the cropped sample initial edge mask image according to the nearest neighbor interpolation method.

[0109] Among them, the preset aspect ratio can be the ratio of the preset image length to the width, for example: 1:1, 4:3, 16:9, etc.

[0110] Specifically, the sample initial edge mask image of the second size can be cropped according to the preset aspect ratio to obtain at least one cropped sample initial edge mask image. Furthermore, for each cropped sample initial edge mask image, interpolation processing is performed by the nearest neighbor interpolation method.

[0111] It should be noted that randomly cropping the sample initial edge mask image of the second size according to the preset aspect ratio can obtain multiple different images, and each image can be regarded as a cropped sample initial edge mask image.

[0112] Based on the technical solution of the embodiment of the present disclosure, since there will be a certain loss of edge pixel points during the scaling processing and nearest neighbor interpolation processing of the sample initial edge mask image, the image loss can be reduced by the operations of dilation first and then thinning. Optionally, before scaling the sample initial edge mask image, it further includes: performing dilation processing on the sample initial edge mask image; after performing interpolation processing on the sample initial edge mask image of the second size according to the nearest neighbor interpolation method and before obtaining the sample target edge mask image of the target size, it further includes: performing thinning processing on the sample initial edge mask image.

[0113] Among them, the dilation processing can be a processing method of adding pixel values to the edge of the image to expand the overall pixel values and thus achieve the dilation effect of the image, for example: the cv2.dilate function in OpenCV, etc. The thinning processing can be a processing method of shrinking the edge of the image to achieve the thinning effect of the image, for example: the cv2.thinning function in OpenCV, etc.

[0114] Specifically, before scaling the sample initial edge mask image, performing dilation processing on the sample initial edge mask image can achieve the dilation of the edge pixel points in the sample initial edge mask image, for example: dilating 1 pixel to 3 pixels, etc. And since the dilation processing is performed first, then, after the scaling processing and nearest neighbor interpolation processing, performing thinning processing on the processed sample initial edge mask image to thin the edge pixel points, for example: thinning 3 pixels to 1 pixel, etc. Furthermore, the thinned sample initial edge mask image is determined as the sample target edge mask image of the target size.

[0115] S350. Train an initial deep learning model based on the sample target image to be extracted and the sample target edge mask image corresponding to the sample target image to be extracted to obtain a target edge extraction model.

[0116] In the technical solution of this embodiment of the present disclosure, by obtaining the sample initial image to be extracted and the sample initial edge mask image corresponding to the sample initial image to be extracted, performing image enhancement processing on the sample initial image to be extracted to obtain a sample target image to be extracted with a target size. Performing scaling processing on the sample initial edge mask image to obtain a sample initial edge mask image with a second size, and performing interpolation processing on the sample initial edge mask image with the second size according to the nearest neighbor interpolation method to obtain a sample target edge mask image with a target size, so as to enhance the edge information of the sample initial edge mask image and make the edge effect more obvious and accurate. Training an initial deep learning model based on the sample target image to be extracted and the sample target edge mask image corresponding to the sample target image to be extracted to obtain a target edge extraction model solves the problem of poor model training effect caused by insufficiently obvious edge information of the sample initial edge mask image, and realizes the effect of enhancing the edge information of the sample initial edge mask image to improve the model training quality.

[0117] Embodiment 4

[0118] Figure 4 FIG. is a schematic flowchart of a method for training a target edge extraction model provided in Embodiment 4 of the present disclosure. Based on any optional technical solution in this embodiment of the present disclosure, optionally, for the manner of training an initial deep learning model to obtain a target edge extraction model, refer to the technical solution of this embodiment. Among them, the explanations of the same or corresponding terms as those in the above embodiments will not be repeated here.

[0119] As Figure 4 shown, the method of this embodiment may specifically include:

[0120] S410. Obtain a sample initial image to be extracted and a sample initial edge mask image corresponding to the sample initial image to be extracted.

[0121] S420. Perform image enhancement processing on the sample initial image to be extracted to obtain a sample target image to be extracted with a target size, and perform image enhancement processing on the sample initial edge mask image to obtain a sample target edge mask image with a target size.

[0122] S430. The initial deep learning model includes at least two edge extraction layers. The image of the sample target to be extracted is input into the initial deep learning model, and the layer output edge mask images corresponding to the image of the sample target to be extracted output by each edge extraction layer in the initial deep learning model are obtained respectively.

[0123] Among them, the edge extraction layer can be a network layer in the initial deep learning model. The layer output edge mask image can be the edge mask image corresponding to the output result of each edge extraction layer.

[0124] Specifically, the image of the sample target to be extracted is input into the initial deep learning model, and is sequentially processed by each edge extraction layer in the initial deep learning model, and the output result of each edge extraction layer can be obtained. For each edge extraction layer, the output result of the edge extraction layer can be processed through activation processing and binarization processing, and the output result is converted to between 0 and 1, and then, through the processing of converting to 0 or 1, the processing result is determined as the layer output edge mask image corresponding to the image of the sample target to be extracted.

[0125] Based on the technical solution of the embodiment of the present disclosure, the edge extraction layer includes a convolution module and an upsampling module. The layer output edge mask images corresponding to the image of the sample target to be extracted output by each edge extraction layer in the initial deep learning model can be obtained respectively in the following manner:

[0126] For each edge extraction layer in the initial deep learning model, the layer input image of the edge extraction layer is subjected to convolution processing through the convolution module of the edge extraction layer, and the layer input image after convolution processing is subjected to upsampling processing through the upsampling module, so as to obtain the layer output edge mask image corresponding to the image of the sample target to be extracted.

[0127] It should be noted that the upsampling module further includes an activation function and binarization processing. The image after upsampling processing by each edge extraction layer is processed through an activation function (such as: Sigmoid function, etc.), and the values of each pixel point in the image after upsampling processing can be converted to between 0 and 1, which is recorded as a probability image. The probability image is often an image representing whether each pixel point in the image of the sample target to be extracted is an edge pixel point. Since it is necessary to obtain the layer output edge mask image corresponding to the image of the sample target to be extracted, that is, to obtain an image with pixel probability values represented as 0 or 1, therefore, the probability image can be converted into a layer output edge mask image through binarization processing, for example: by setting a threshold, the values of each pixel point in the probability image are converted to 0 or 1.

[0128] Among them, the size of the layer output edge mask image is the same as that of the sample target edge mask image. The convolution module is used for convolution processing, and the upsampling module is used for upsampling processing, and can also be used for activation and binarization processing. The layer input image can be the image input to the edge extraction layer. Exemplarily, if the current edge extraction layer is the first edge extraction layer in the initial deep learning model, the layer input image of the current edge extraction layer is the image to be extracted from the sample target; if the current edge extraction layer is the second edge extraction layer or an edge extraction layer after the second edge extraction layer in the initial deep learning model, the layer input image of the current edge extraction layer is the layer output edge mask image of the previous edge extraction layer of the current edge extraction layer.

[0129] Specifically, for each edge extraction layer in the initial deep learning model, the layer input image of the edge extraction layer is convolved through the convolution module of the edge extraction layer. The size of the layer input image after convolution processing is different from the size of the original layer input image. Therefore, the upsampling module is used to perform upsampling processing on the layer input image after convolution processing so that the size of the layer input image after convolution processing is restored to the size of the sample target edge mask image. Furthermore, the layer input image after upsampling processing is passed through an activation function and binarization processing to obtain a layer output edge mask image corresponding to the image to be extracted from the sample target.

[0130] S440. Determine the target loss of the initial deep learning model according to the layer output edge mask image output by each edge extraction layer, the sample target edge mask image corresponding to the image to be extracted from the sample target, and the loss function of the initial deep learning model.

[0131] Among them, the loss function of the initial deep learning model can be a pre-set function for determining loss. The loss function can be mean squared error loss (MSE Loss), mean absolute error loss (MAE Loss), etc. The target loss of the initial deep learning model can be a value obtained by comprehensively measuring the difference between the layer output edge mask images of each layer of the initial deep learning model and the image to be extracted from the sample target.

[0132] Specifically, for the layer output edge mask image output by each edge extraction layer, according to the layer output edge mask image and the sample target edge mask image corresponding to the image to be extracted from the sample target, calculation is performed through the loss function of the initial deep learning model, and the loss corresponding to each edge extraction layer can be determined. Furthermore, the target loss of the entire initial deep learning model can be obtained according to the determined loss.

[0133] Based on the technical solution of the embodiment of the present disclosure, optionally, the target loss function of the initial deep learning model can be determined according to the following steps:

[0134] Step 1: For the layer output edge mask image output by each edge extraction layer, calculate the layer output loss between the layer output edge mask image and the sample target edge mask image corresponding to the sample target image to be extracted according to the loss function of the initial deep learning model.

[0135] Among them, the layer output loss can be the difference information between the layer output edge mask image and the sample target edge mask image corresponding to the sample target image to be extracted.

[0136] Specifically, for the layer output edge mask image output by each edge extraction layer, calculate the layer output edge mask image and the sample target edge mask image corresponding to the sample target image to be extracted through the loss function of the initial deep learning model to obtain the layer output loss corresponding to the edge extraction layer.

[0137] Step 2: Determine the initial loss of the initial deep learning model according to the layer output losses corresponding to each edge extraction layer, and determine the target loss according to the initial loss function.

[0138] Among them, the initial loss can be the loss comprehensively determined according to the layer output losses.

[0139] Specifically, after obtaining the layer output losses corresponding to each edge extraction layer, the initial loss of the initial deep learning model can be determined through integrated analysis of the layer output losses. Furthermore, the initial loss can be determined as the target loss, or the initial loss can be scaled and / or other terms can be added, and the processed initial loss can be used as the target loss.

[0140] Based on the technical solution of the embodiment of the present disclosure, optionally, the target loss can be determined according to the initial loss through the following steps:

[0141] Step 1: Take the edge pixel points in the sample target edge mask image as positive sample pixel points, and take the pixel points other than the edge pixel points in the sample target edge mask image as negative sample pixel points.

[0142] Among them, the edge pixel points can be the pixel points describing the image edge, and the positive sample pixel points are the edge pixel points in the sample target edge mask image. The negative sample pixel points are the pixel points other than the edge pixel points in the sample target edge mask image, that is, the non-edge pixel points in the sample target edge mask image, and can also be considered as the other pixel points in the sample target edge mask image except the positive sample pixel points.

[0143] Step 2: Determine the number of positive sample pixel points of the positive sample pixel points in the sample target edge mask image, determine the number of negative sample pixel points of the negative sample pixel points in the sample target edge mask image, and determine the total number of pixel points in the sample target edge mask image.

[0144] Among them, the number of positive sample pixels can be the total number of positive sample pixels in the sample target edge mask image. The number of negative sample pixels can be the total number of negative sample pixels in the sample target edge mask image. The total number of pixels is the total number of pixels in the sample target edge mask image, that is, the sum of the number of positive sample pixels and the number of negative sample pixels.

[0145] Specifically, the number of positive sample pixels in the sample target edge mask image can be counted to obtain the number of positive sample pixels. The number of negative sample pixels in the sample target edge mask image can also be counted to obtain the number of negative sample pixels. The total number of all pixels in the sample target edge mask image can also be counted to obtain the total number of pixels. Since the sum of the number of positive sample pixels and the number of negative sample pixels is the total number of pixels, therefore, after determining any two of these values, the other value can be determined by calculation.

[0146] Step 3: Calculate the pixel loss weight corresponding to each pixel in the sample target image to be extracted according to the number of positive sample pixels, the number of negative sample pixels, and the total number of pixels.

[0147] Among them, the pixel loss weight can be the weight used when calculating the loss value of the pixel, and is related to whether the pixel is a positive sample pixel or a negative sample pixel.

[0148] Specifically, the ratio of the number of positive sample pixels to the total number of pixels can be used as the pixel loss weight corresponding to each positive sample pixel in the sample target image to be extracted, and the ratio of the number of negative sample pixels to the total number of pixels can be used as the pixel loss weight corresponding to each negative sample pixel in the sample target image to be extracted.

[0149] It should be noted that other mathematical calculation processes can also be performed according to the number of positive sample pixels, the number of negative sample pixels, and the total number of pixels to obtain the pixel loss weight corresponding to each pixel, which is not specifically limited in this embodiment.

[0150] Step 4: Weight the initial loss according to the pixel loss weight corresponding to each pixel respectively to obtain the target loss corresponding to each pixel.

[0151] Specifically, after determining the pixel loss weights of each pixel, multiply the loss weights of each pixel by the initial loss respectively to obtain the target loss corresponding to each pixel.

[0152] It should be noted that if you want to obtain the target loss of the initial deep learning model according to the target loss corresponding to each pixel, mathematical calculations can be performed on the target loss corresponding to each pixel, such as: summing or averaging, etc., which is not specifically limited in this embodiment.

[0153] It should also be noted that the reason for weighting the initial loss according to the pixel loss weight corresponding to each pixel point in the above manner is as follows: in the sample target edge mask image, the number of positive sample pixel points is much smaller than the number of negative sample pixel points, resulting in an imbalance in the number of samples, which will lead to inaccurate loss calculation and affect the training of the subsequent initial deep learning model. Setting the pixel loss weight can effectively adjust the impact caused by the imbalance in the number of samples.

[0154] S450. Adjust the model parameters of the initial deep learning model based on the target loss to obtain the target edge extraction model.

[0155] Specifically, if the target loss does not meet the preset requirements, adjust the model parameters of the initial deep learning model to further improve the model effect; if the target loss meets the preset requirements, use the current initial deep learning model as the target edge extraction model. It should be noted that the current initial deep learning model is the network model corresponding to the target loss and can be the model after model parameter adjustment.

[0156] The technical solution of the embodiment of the present disclosure obtains the sample initial image to be extracted and the sample initial edge mask image corresponding to the sample initial image to be extracted, performs image enhancement processing on the sample initial image to be extracted to obtain the sample target image to be extracted with the target size, and performs image enhancement processing on the sample initial edge mask image to obtain the sample target edge mask image with the target size for sample expansion and image quality improvement. The initial deep learning model includes at least two edge extraction layers. Input the sample target image to be extracted into the initial deep learning model, and respectively obtain the layer output edge mask images corresponding to the sample target image to be extracted output by each edge extraction layer in the initial deep learning model. Furthermore, determine the target loss of the initial deep learning model according to the layer output edge mask images output by each edge extraction layer, the sample target edge mask image corresponding to the sample target image to be extracted, and the loss function of the initial deep learning model, so that the target loss covers each edge extraction layer, improving the reliability of target loss calculation, solving the problem of inaccurate determination of the target loss when determining the target loss based on the overall model output result, and the problem of inaccurate model parameter adjustment caused by inaccurate target loss, realizing more accurate determination of the target loss, making the training effect of the target edge extraction model better, and more accurately extracting the edge information in the image.

[0157] Embodiment Five

[0158] As an optional embodiment of the above embodiments, Embodiment Five of the present disclosure provides an edge extraction and model training method, specifically as follows:

[0159] 1. Obtain a set of initial sample images to be extracted A[A1, A2, …, An] and a set of initial edge mask images B[B1, B2, …, Bn] corresponding to the initial sample images to be extracted from a network database.

[0160] Exemplarily, obtain PASCAL and labelled data from the BSDS database.

[0161] 2. For each initial sample image to be extracted in the set A of initial sample images to be extracted, perform sharpening processing and then scaling processing to obtain a set A'[A'1, A'2, …, A'n] of initial sample images to be extracted with the first size, and perform cropping processing and nearest neighbor interpolation processing on each initial sample image to be extracted in the set A' of initial sample images to be extracted to obtain a set A''[A''1, A''2, …, A''n] of target sample images to be extracted with the target size.

[0162] Exemplarily, image(initial sample image to be extracted)->sharp(sharpening processing) ->scale(0.5,2.0)(random scaling of length and width in the range of 0.5 to 2 times)->nearset resize(nearest neighbor interpolation). Among them, the schematic diagram of the initial sample image to be extracted is as Figure 5 shown, and the schematic diagram of the target sample image to be extracted is as Figure 6 shown.

[0163] 3. For each initial edge mask image in the set B of initial edge mask images, perform dilation processing and then scaling processing to obtain a set B'[B'1, B'2, …, B'n] of initial edge mask images with the second size, and perform cropping processing, nearest neighbor interpolation processing and thinning processing on each initial edge mask image in the set B' of initial edge mask images to obtain a set B''[B''1, B''2, …, B''n] of target edge mask images with the target size.

[0164] Exemplarily, mask(initial edge mask image)->cv2.dilate(dilation processing)->scale(0.5,2.0)(random scaling of length and width in the range of 0.5 to 2 times)->nearset resize(nearest neighbor interpolation)->cv2.thinning(thinning processing). For example: the size of the initial edge mask image is 1024×768, the second size is 512×1536, and the target size is 512×512.

[0165] 4. Input each sample target image to be extracted in the set A" of sample target images to be extracted into the initial deep learning model. For each sample target image to be extracted, layer output edge mask images output by each edge extraction layer can be obtained. Calculate the loss respectively for each layer output edge mask image and the target edge mask image corresponding to the sample target image to be extracted to obtain the initial loss.

[0166] Exemplarily, the initial deep learning model has 5 edge extraction layers. The sample target image Am to be extracted is processed by the initial deep learning model. According to the layer output edge mask image Am1 of the first edge extraction layer and the target edge mask image Bm, the layer output loss Loss1 can be determined. Based on a similar method, the layer output losses Loss2, Loss3, Loss4, and Loss5 can be determined.

[0167] 5. Calculate the pixel loss weight corresponding to each pixel in the sample target image to be extracted for the number of positive sample pixels, negative sample pixels, and total pixels in each sample target image to be extracted, and weight the initial loss according to the pixel loss weight corresponding to each pixel to obtain the target loss corresponding to each pixel.

[0168] 6. Determine the target loss of each sample target image to be extracted according to the target loss corresponding to each pixel. Furthermore, determine the target loss of the initial deep learning model to adjust the model parameters of the initial deep learning model to obtain the target edge extraction model.

[0169] 7. Input the target image C to be extracted into the target edge extraction model to obtain the target edge mask image D.

[0170] It should be noted that if the target edge extraction model is trained by a set of sample initial images to be extracted and a set of sample initial edge mask images with a low resolution (for example: 512×512 resolution), then this target edge extraction model can also be used for edge extraction of target images to be extracted with a higher resolution (for example: 1024x1024 resolution).

[0171] Exemplarily, a schematic diagram of the target edge mask image output by the target edge extraction model is as Figure 7 shown.

[0172] 8. Adjust the image brightness of the target edge mask image D based on a preset color lookup table.

[0173] Exemplarily, a schematic diagram of the target edge mask image after image brightness adjustment is as Figure 8 shown.

[0174] 9. Identify the edge pixel points in the target edge mask image based on a preset contour recognition algorithm, and store the identified edge pixel points in the form of point vectors.

[0175] Exemplarily, through find contour (contour recognition algorithm) + cv2.thinning (thinning process), a fine contour is obtained, and the point vector form of each edge pixel point is obtained, so as to facilitate subsequent dynamic edge line processing.

[0176] The technical solution of the embodiment of the present disclosure, by obtaining a set of sample initial images to be extracted and a set of sample initial edge mask images corresponding to the sample initial images to be extracted, performing image enhancement processing on each sample initial image to be extracted to obtain each sample target image to be extracted with the target size, and performing image enhancement processing on each sample initial edge mask image to obtain each sample target edge mask image with the target size, so as to perform sample expansion and improve the image quality. Training the initial deep learning model according to each sample target image to be extracted and each sample target edge mask image corresponding to each sample target image to be extracted to obtain a target edge extraction model, solves the problem that the image edge extraction result is rough and not fine enough, and realizes the effect of more accurately extracting the edge information in the image.

[0177] Embodiment Six

[0178] Figure 9 FIG. 13 is a schematic structural diagram of an edge extraction device and a model training device provided in Embodiment Six of the present disclosure. The edge extraction device 51 and the model training device 52 provided in this embodiment can be implemented by software and / or hardware, and can be configured in a terminal and / or a server to implement the edge extraction method in the embodiment of the present disclosure.

[0179] The edge extraction device 51 may specifically include: an image acquisition module 510 and an edge extraction module 520.

[0180] Among them, the image acquisition module 510 is used to acquire a target image to be extracted; the edge extraction module 520 is used to input the target image to be extracted into the target edge extraction model to obtain a target edge mask image corresponding to the target image to be extracted.

[0181] The model training device 52 may specifically include: a sample acquisition module 530, a sample enhancement module 540, and a model training module 550.

[0182] Among them, a sample acquisition module 530 is configured to acquire an initial sample image to be extracted and an initial sample edge mask image corresponding to the initial sample image to be extracted; a sample enhancement module 540 is configured to perform image enhancement processing on the initial sample image to be extracted to obtain a sample target image to be extracted with a target size, and perform image enhancement processing on the initial sample edge mask image to obtain a sample target edge mask image with the target size; a model training module 550 is configured to train an initial deep learning model according to the sample target image to be extracted and the sample target edge mask image corresponding to the sample target image to be extracted to obtain a target edge extraction model.

[0183] Based on any optional technical solution in the embodiments of the present disclosure, optionally, the sample enhancement module 540 is further configured to perform scaling processing on the initial sample image to be extracted to obtain an initial sample image to be extracted with a first size; perform interpolation processing on the initial sample image to be extracted with the first size according to the nearest neighbor interpolation method to obtain a sample target image to be extracted with a target size.

[0184] Based on any optional technical solution in the embodiments of the present disclosure, optionally, the sample enhancement module 540 is further configured to perform scaling processing on the length and width of the initial sample image to be extracted respectively according to a preset size transformation range.

[0185] Based on any optional technical solution in the embodiments of the present disclosure, optionally, the model training device 52 further includes: an image sharpening module, configured to perform sharpening processing on the initial sample image to be extracted.

[0186] Based on any optional technical solution in the embodiments of the present disclosure, optionally, the sample enhancement module 540 is further configured to perform scaling processing on the initial sample edge mask image to obtain an initial sample edge mask image with a second size; perform interpolation processing on the initial sample edge mask image with the second size according to the nearest neighbor interpolation method to obtain a sample target edge mask image with a target size.

[0187] Based on any optional technical solution in the embodiments of the present disclosure, optionally, the model training device 52 further includes: an image dilation module, configured to perform dilation processing on the initial sample edge mask image; the model training device 52 further includes: an image thinning module, configured to perform thinning processing on the initial sample edge mask image.

[0188] Based on any optional technical solution in the embodiments of the present disclosure, optionally, the initial deep learning model includes at least two edge extraction layers; the model training module 550 is specifically configured to input the sample target image to be extracted into the initial deep learning model, and respectively obtain the layer output edge mask images corresponding to the sample target image to be extracted output by each edge extraction layer in the initial deep learning model; determine the target loss of the initial deep learning model according to the layer output edge mask images output by each edge extraction layer, the sample target edge mask image corresponding to the sample target image to be extracted, and the loss function of the initial deep learning model; and adjust the model parameters of the initial deep learning model based on the target loss to obtain a target edge extraction model.

[0189] Based on any optional technical solution in the embodiments of the present disclosure, optionally, the model training module 550 is further configured to, for the layer output edge mask images output by each edge extraction layer, calculate the layer output loss between the layer output edge mask image and the sample target edge mask image corresponding to the sample target image to be extracted according to the loss function of the initial deep learning model; determine the initial loss of the initial deep learning model according to the layer output losses corresponding to each edge extraction layer, and determine the target loss according to the initial loss.

[0190] Based on any optional technical solution in the embodiments of the present disclosure, optionally, the model training module 550 is further configured to use the edge pixel points in the sample target edge mask image as positive sample pixel points, and use the pixel points other than the edge pixel points in the sample target edge mask image as negative sample pixel points; determine the number of positive sample pixel points of the positive sample pixel points in the sample target edge mask image, determine the number of negative sample pixel points of the negative sample pixel points in the sample target edge mask image, and determine the total number of pixel points in the sample target edge mask image; calculate the pixel point loss weight corresponding to each pixel point in the sample target image to be extracted according to the number of positive sample pixel points, the number of negative sample pixel points, and the total number of pixel points; and respectively weight the initial loss according to the pixel point loss weight corresponding to each pixel point to obtain the target loss corresponding to each pixel point.

[0191] Based on any optional technical solution in the embodiments of the present disclosure, optionally, the edge extraction layer includes a convolution module and an upsampling module; the model training module 550 is further configured to, for each edge extraction layer in the initial deep learning model, perform convolution processing on the layer input image of the edge extraction layer through the convolution module of the edge extraction layer, and perform upsampling processing on the layer input image after convolution processing through the upsampling module to obtain a layer output edge mask image corresponding to the sample target image to be extracted, where the size of the layer output edge mask image is the same as that of the sample target edge mask image.

[0192] Based on any optional technical solution in the embodiments of the present disclosure, optionally, the edge extraction device 51 further includes: a brightness adjustment module, configured to adjust the image brightness of the target edge mask image based on a preset color lookup table.

[0193] Based on any optional technical solution in the embodiments of the present disclosure, optionally, the edge extraction device 51 further includes: a contour recognition module, configured to recognize edge pixel points in the target edge mask image based on a preset contour recognition algorithm, and store the recognized edge pixel points in the form of point vectors.

[0194] Based on any optional technical solution in the embodiments of the present disclosure, optionally, the initial deep learning model includes a convolutional neural network model, and the convolutional neural network model includes at least one of a u2net model, a unet model, a deeplab model, a transformer model, and a pidinet model.

[0195] The above device can execute the method provided in any embodiment of the present disclosure, and has corresponding functional modules and beneficial effects for executing the method.

[0196] The technical solution of the embodiments of the present disclosure obtains a target image to be extracted, inputs the target image to be extracted into a target edge extraction model to obtain a target edge mask image corresponding to the target image to be extracted for edge extraction of the image. Moreover, by obtaining a sample initial image to be extracted and a sample initial edge mask image corresponding to the sample initial image to be extracted, performing image enhancement processing on the sample initial image to be extracted to obtain a sample target image to be extracted with a target size, and performing image enhancement processing on the sample initial edge mask image to obtain a sample target edge mask image with a target size for sample expansion and improvement of image quality, training an initial deep learning model according to the sample target image to be extracted and the sample target edge mask image corresponding to the sample target image to be extracted to obtain a target edge extraction model, which solves the problem that the image edge extraction result is rough and not fine enough, and realizes the effect of more accurately extracting edge information in the image.

[0197] It should be noted that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of the functional units are only for the convenience of mutual distinction and are not used to limit the protection scope of the embodiments of the present disclosure.

[0198] Embodiment Seven

[0199] Figure 10 FIG. 10 is a schematic structural diagram of an electronic device provided in Embodiment Seven of the present disclosure. Referring to FIG. 10 below, it shows a schematic structural diagram of an electronic device 600 suitable for implementing the embodiments of the present disclosure (such as Figure 10 the terminal device or server in). The terminal device in the embodiments of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Computers), PMPs (Portable Multimedia Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 10 The electronic device shown is only an example and should not impose any limitation on the functions and usage scope of the embodiments of the present disclosure.

[0200] As Figure 10 shown, the electronic device 600 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 601, which may perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the storage device 608 into the random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 605. The editing / output (I / O) interface 604 is also connected to the bus 605.

[0201] Generally, the following devices may be connected to the I / O interface 604: an input device 606 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 10 the electronic device 600 with various devices is shown, it should be understood that it is not required to implement or have all the shown devices. More or fewer devices may be alternatively implemented or had.

[0202] In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, an embodiment of the present disclosure includes a computer program product that includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes program code for performing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above functions defined in the method of the embodiment of the present disclosure are performed.

[0203] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are for illustrative purposes only and are not used to limit the scope of these messages or information.

[0204] The electronic device provided in the embodiment of the present disclosure and the edge extraction method provided in the above embodiment belong to the same inventive concept. Technical details not described in detail in this embodiment can be referred to in the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.

[0205] Embodiment VIII

[0206] The embodiment of the present disclosure provides a computer storage medium, on which a computer program is stored, and when the program is executed by a processor, the edge extraction method provided in the above embodiment is implemented.

[0207] It should be noted that the computer-readable medium described above can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program, and the program can be used by or in combination with an instruction execution system, apparatus, or device. In the present disclosure, the computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, and the computer-readable signal medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted by any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0208] In some embodiments, the client and the server can communicate using any currently known or future-developed network protocol such as HTTP (HyperText Transfer Protocol), and can be interconnected with digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include local area networks ("LANs"), wide area networks ("WANs"), the Internet (e.g., the Internet), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any currently known or future-developed networks.

[0209] The above computer-readable medium can be included in the above electronic device; or it can exist separately without being assembled into the electronic device.

[0210] The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by the electronic device, the electronic device is caused to:

[0211] Obtain a target image to be extracted;

[0212] Input the target image to be extracted into a target edge extraction model to obtain a target edge mask image corresponding to the target image to be extracted;

[0213] Among them, the target edge extraction model is trained based on the following method:

[0214] Obtain a sample initial image to be extracted and a sample initial edge mask image corresponding to the sample initial image to be extracted;

[0215] Perform image enhancement processing on the sample initial image to be extracted to obtain a sample target image to be extracted with a target size, and perform image enhancement processing on the sample initial edge mask image to obtain the sample target edge mask image with the target size;

[0216] Train an initial deep learning model according to the sample target image to be extracted and the sample target edge mask image corresponding to the sample target image to be extracted to obtain a target edge extraction model.

[0217] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or combinations thereof. The above programming languages include, but are not limited to, object-oriented programming languages - such as Java, Smalltalk, C++; and also include conventional procedural programming languages - such as the "C" language or similar programming languages. The program code may execute entirely on the user's computer, partially on the user's computer, execute as a stand-alone software package, execute partially on the user's computer and partially on a remote computer, or execute entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network - including a local area network (LAN) or a wide area network (WAN) - or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0218] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a part of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, as well as combinations of blocks in the block diagram and / or flowchart, may be implemented by a dedicated hardware-based system that performs the specified functions or operations, or may be implemented by a combination of dedicated hardware and computer instructions.

[0219] The units involved in the embodiments described in the present disclosure may be implemented in software or in hardware. In some cases, the name of the unit does not constitute a limitation on the unit itself.

[0220] The functions described above in this document may be performed, at least in part, by one or more hardware logic components. By way of example and not limitation, the types of hardware logic components that may be used include: field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CPLDs), and the like.

[0221] In the context of the present disclosure, a machine-readable medium may be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0222] According to one or more embodiments of the present disclosure, [Example 1] provides an edge extraction method, the method comprising:

[0223] Obtain the target image to be extracted;

[0224] Input the target image to be extracted into the target edge extraction model to obtain a target edge mask image corresponding to the target image to be extracted;

[0225] Wherein, the target edge extraction model is trained based on the following method:

[0226] Obtain the sample initial image to be extracted and the sample initial edge mask image corresponding to the sample initial image to be extracted;

[0227] Perform image enhancement processing on the sample initial image to be extracted to obtain a sample target image to be extracted of the target size, and perform image enhancement processing on the sample initial edge mask image to obtain the sample target edge mask image of the target size;

[0228] Train the initial deep learning model according to the sample target image to be extracted and the sample target edge mask image corresponding to the sample target image to be extracted to obtain the target edge extraction model.

[0229] According to one or more embodiments of the present disclosure, [Example 2] provides an edge extraction method, and the method further includes:

[0230] Optionally, performing image enhancement processing on the sample initial image to be extracted to obtain a sample target image to be extracted of the target size includes:

[0231] Perform scaling processing on the sample initial image to be extracted to obtain a sample initial image to be extracted of the first size;

[0232] Perform interpolation processing on the sample initial image to be extracted of the first size according to the nearest neighbor interpolation method to obtain a sample target image to be extracted of the target size.

[0233] According to one or more embodiments of the present disclosure, [Example 3] provides an edge extraction method, and the method further includes:

[0234] Optionally, performing scaling processing on the sample initial image to be extracted includes:

[0235] Perform scaling processing on the length and width of the sample initial image to be extracted respectively according to the preset size transformation range.

[0236] According to one or more embodiments of the present disclosure, [Example 4] provides an edge extraction method, and the method further includes:

[0237] Optionally, before performing scaling processing on the sample initial image to be extracted, it further includes:

[0238] Sharpen the initial image to be extracted from the sample.

[0239] According to one or more embodiments of the present disclosure, [Example Five] provides an edge extraction method, which further includes:

[0240] Optionally, performing image enhancement processing on the initial edge mask image of the sample to obtain the sample target edge mask image of the target size, including:

[0241] Performing scaling processing on the initial edge mask image of the sample to obtain the initial edge mask image of the second size;

[0242] Performing interpolation processing on the initial edge mask image of the second size according to the nearest neighbor interpolation method to obtain the sample target edge mask image of the target size.

[0243] According to one or more embodiments of the present disclosure, [Example Six] provides an edge extraction method, which further includes:

[0244] Optionally, before performing scaling processing on the initial edge mask image of the sample, it further includes:

[0245] Performing dilation processing on the initial edge mask image of the sample;

[0246] After performing interpolation processing on the initial edge mask image of the second size according to the nearest neighbor interpolation method and before obtaining the sample target edge mask image of the target size, it further includes:

[0247] Performing thinning processing on the initial edge mask image of the sample.

[0248] According to one or more embodiments of the present disclosure, [Example Seven] provides an edge extraction method, which further includes:

[0249] Optionally, the initial deep learning model includes at least two edge extraction layers;

[0250] Training the initial deep learning model according to the sample target image to be extracted and the corresponding sample target edge mask image of the sample target image to be extracted to obtain a target edge extraction model, including:

[0251] Inputting the sample target image to be extracted into the initial deep learning model, and respectively obtaining the layer output edge mask images corresponding to the sample target image to be extracted output by each edge extraction layer in the initial deep learning model;

[0252] Determine the target loss of the initial deep learning model based on the layer output edge mask image output by each edge extraction layer, the sample target edge mask image corresponding to the sample target image to be extracted, and the loss function of the initial deep learning model;

[0253] Adjust the model parameters of the initial deep learning model based on the target loss to obtain a target edge extraction model.

[0254] According to one or more embodiments of the present disclosure, [Example Eight] provides an edge extraction method, and the method further includes:

[0255] Optionally, determining the target loss of the initial deep learning model based on the layer output edge mask image output by each edge extraction layer, the sample target edge mask image corresponding to the sample target image to be extracted, and the loss function of the initial deep learning model includes:

[0256] For the layer output edge mask image output by each edge extraction layer, calculate the layer output loss between the layer output edge mask image and the sample target edge mask image corresponding to the sample target image to be extracted according to the loss function of the initial deep learning model;

[0257] Determine the initial loss of the initial deep learning model according to the layer output losses corresponding to each edge extraction layer, and determine the target loss according to the initial loss.

[0258] According to one or more embodiments of the present disclosure, [Example Nine] provides an edge extraction method, and the method further includes:

[0259] Optionally, determining the target loss according to the initial loss includes:

[0260] Take the edge pixel points in the sample target edge mask image as positive sample pixel points, and take the pixel points other than the edge pixel points in the sample target edge mask image as negative sample pixel points;

[0261] Determine the number of positive sample pixel points of the positive sample pixel points in the sample target edge mask image, determine the number of negative sample pixel points of the negative sample pixel points in the sample target edge mask image, and determine the total number of pixel points of the sample target edge mask image;

[0262] Calculate the pixel point loss weight corresponding to each pixel point in the sample target image to be extracted according to the number of positive sample pixel points, the number of negative sample pixel points, and the total number of pixel points;

[0263] Weight the initial loss according to the pixel loss weight corresponding to each pixel to obtain the target loss corresponding to each pixel.

[0264] According to one or more embodiments of the present disclosure, [Example Ten] provides an edge extraction method, and the method further includes:

[0265] Optionally, the edge extraction layer includes a convolution module and an upsampling module;

[0266] The step of respectively obtaining the layer output edge mask images corresponding to the sample target image to be extracted output by each edge extraction layer in the initial deep learning model includes:

[0267] For each edge extraction layer in the initial deep learning model, perform convolution processing on the layer input image of the edge extraction layer through the convolution module of the edge extraction layer, and perform upsampling processing on the layer input image after convolution processing through the upsampling module to obtain the layer output edge mask image corresponding to the sample target image to be extracted, wherein the size of the layer output edge mask image is the same as that of the sample target edge mask image.

[0268] According to one or more embodiments of the present disclosure, [Example Eleven] provides an edge extraction method, and the method further includes:

[0269] Optionally, after obtaining the target edge mask image corresponding to the target image to be extracted, the method further includes:

[0270] Adjust the image brightness of the target edge mask image based on a preset color lookup table.

[0271] According to one or more embodiments of the present disclosure, [Example Twelve] provides an edge extraction method, and the method further includes:

[0272] Optionally, after obtaining the target edge mask image corresponding to the target image to be extracted, the method further includes:

[0273] Identify the edge pixels in the target edge mask image based on a preset contour recognition algorithm, and store the identified edge pixels in the form of point vectors.

[0274] According to one or more embodiments of the present disclosure, [Example Thirteen] provides an edge extraction method, and the method further includes:

[0275] Optionally, the initial deep learning model includes a convolutional neural network model, and the convolutional neural network model includes at least one of a u2net model, a unet model, a deeplab model, a transformer model, and a pidinet model.

[0276] According to one or more embodiments of the present disclosure, [Example XIV] provides an edge extraction device, which includes:

[0277] An image acquisition module, configured to acquire a target image to be extracted;

[0278] An edge extraction module, configured to input the target image to be extracted into a target edge extraction model to obtain a target edge mask image corresponding to the target image to be extracted;

[0279] Wherein, the target edge extraction model is obtained based on a model training device, and the model training device includes:

[0280] A sample acquisition module, configured to acquire a sample initial image to be extracted and a sample initial edge mask image corresponding to the sample initial image to be extracted;

[0281] A sample enhancement module, configured to perform image enhancement processing on the sample initial image to be extracted to obtain a sample target image to be extracted with a target size, and perform image enhancement processing on the sample initial edge mask image to obtain the sample target edge mask image with the target size;

[0282] A model training module, configured to train an initial deep learning model according to the sample target image to be extracted and the sample target edge mask image corresponding to the sample target image to be extracted to obtain a target edge extraction model.

[0283] The above description is only a preferred embodiment of the present disclosure and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of the disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosure concept. For example, the technical solutions formed by mutually replacing the above features with the technical features (but not limited to) having similar functions disclosed in the present disclosure.

[0284] In addition, although the operations are depicted in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although a number of specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features described in the context of separate embodiments may also be implemented in combination in a single embodiment. Conversely, the various features described in the context of a single embodiment may also be implemented separately or in any suitable sub-combination in multiple embodiments.

[0285] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. On the contrary, the specific features and acts described above are merely example forms of implementing the claims.

Claims

1. An edge extraction method, characterized in that, Including: Obtain a target image to be extracted; Input the target image to be extracted into a target edge extraction model to obtain a target edge mask image corresponding to the target image to be extracted; Wherein, the target edge extraction model is trained based on the following method: Obtain a sample initial image to be extracted and a sample initial edge mask image corresponding to the sample initial image to be extracted; Perform image enhancement processing on the sample initial image to be extracted to obtain a sample target image to be extracted of a target size, and perform image enhancement processing on the sample initial edge mask image to obtain a sample target edge mask image of the target size; Train an initial deep learning model according to the sample target image to be extracted and the sample target edge mask image corresponding to the sample target image to be extracted to obtain a target edge extraction model; The initial deep learning model includes at least two edge extraction layers; The training of the initial deep learning model according to the sample target image to be extracted and the sample target edge mask image corresponding to the sample target image to be extracted to obtain a target edge extraction model includes: Input the sample target image to be extracted into the initial deep learning model to respectively obtain a layer output edge mask image corresponding to the sample target image to be extracted output by each edge extraction layer in the initial deep learning model; Determine the target loss of the initial deep learning model according to the layer output edge mask image output by each edge extraction layer, the sample target edge mask image corresponding to the sample target image to be extracted, and the loss function of the initial deep learning model; Adjust the model parameters of the initial deep learning model based on the target loss to obtain a target edge extraction model.

2. The method according to claim 1, characterized in that, The performing image enhancement processing on the sample initial image to be extracted to obtain a sample target image to be extracted of a target size includes: Perform scaling processing on the sample initial image to be extracted to obtain a sample initial image to be extracted of a first size; Perform interpolation processing on the sample initial image to be extracted of the first size according to the nearest neighbor interpolation method to obtain a sample target image to be extracted of a target size.

3. The method according to claim 2, characterized in that, The performing scaling processing on the sample initial image to be extracted includes: Perform scaling processing on the length and width of the sample initial image to be extracted respectively according to a preset size transformation range.

4. The method according to claim 2, characterized in that, Before performing the scaling processing on the sample initial image to be extracted, it further includes: Perform sharpening processing on the sample initial image to be extracted.

5. The method according to claim 1, characterized in that, The performing image enhancement processing on the sample initial edge mask image to obtain the sample target edge mask image of the target size includes: Perform scaling processing on the sample initial edge mask image to obtain a sample initial edge mask image of a second size; Perform interpolation processing on the sample initial edge mask image of the second size according to the nearest neighbor interpolation method to obtain a sample target edge mask image of a target size.

6. The method according to claim 5, characterized in that, Before performing the scaling processing on the sample initial edge mask image, it further includes: Perform dilation processing on the sample initial edge mask image; After interpolating the sample initial edge mask image of the second size according to the nearest neighbor interpolation method and before obtaining the sample target edge mask image of the target size, the following steps are further included: Refine the sample initial edge mask image.

7. The method according to claim 1, characterized in that, Determining the target loss of the initial deep learning model based on the layer output edge mask image output by each edge extraction layer, the sample target edge mask image corresponding to the sample target image to be extracted, and the loss function of the initial deep learning model includes: For the layer output edge mask image output by each edge extraction layer, calculate the layer output loss between the layer output edge mask image and the sample target edge mask image corresponding to the sample target image to be extracted according to the loss function of the initial deep learning model; Determine the initial loss of the initial deep learning model based on the layer output losses corresponding to each edge extraction layer, and determine the target loss based on the initial loss.

8. The method according to claim 7, characterized in that, Determining the target loss based on the initial loss includes: Regarding the edge pixel points in the sample target edge mask image as positive sample pixel points, and regarding the pixel points other than the edge pixel points in the sample target edge mask image as negative sample pixel points; Determine the number of positive sample pixel points of the positive sample pixel points in the sample target edge mask image, determine the number of negative sample pixel points of the negative sample pixel points in the sample target edge mask image, and determine the total number of pixel points in the sample target edge mask image; Calculate the pixel point loss weight corresponding to each pixel point in the sample target image to be extracted according to the number of positive sample pixel points, the number of negative sample pixel points, and the total number of pixel points; Weight the initial loss according to the pixel point loss weight corresponding to each pixel point respectively to obtain the target loss corresponding to each pixel point.

9. The method according to claim 1, wherein, The edge extraction layer includes a convolution module and an upsampling module; Respectively obtaining the layer output edge mask image corresponding to the sample target image to be extracted output by each edge extraction layer in the initial deep learning model includes: For each edge extraction layer in the initial deep learning model, perform convolution processing on the layer input image of the edge extraction layer through the convolution module of the edge extraction layer, and perform upsampling processing on the layer input image after convolution processing through the upsampling module to obtain the layer output edge mask image corresponding to the sample target image to be extracted, where the size of the layer output edge mask image is the same as that of the sample target edge mask image.

10. The method according to claim 1, wherein, After obtaining the target edge mask image corresponding to the target image to be extracted, the following steps are further included: Adjust the image brightness of the target edge mask image based on a preset color lookup table.

11. The method according to claim 1, wherein, After obtaining the target edge mask image corresponding to the target image to be extracted, the following steps are further included: Identify the edge pixel points in the target edge mask image based on a preset contour recognition algorithm, and store the identified edge pixel points in the form of point vectors.

12. The method according to claim 1, wherein, The initial deep learning model includes a convolutional neural network model, and the convolutional neural network model includes at least one of a u2net model, a unet model, a deeplab model, a transformer model, and a pidinet model.

13. An edge extraction device, wherein, Comprising: An image acquisition module, configured to acquire a target image to be extracted; An edge extraction module, configured to input the target image to be extracted into a target edge extraction model to obtain a target edge mask image corresponding to the target image to be extracted; Wherein, the target edge extraction model is obtained based on a model training device, and the model training device includes: A sample acquisition module, configured to acquire a sample initial image to be extracted and a sample initial edge mask image corresponding to the sample initial image to be extracted; A sample enhancement module, configured to perform image enhancement processing on the sample initial image to be extracted to obtain a sample target image to be extracted with a target size, and perform image enhancement processing on the sample initial edge mask image to obtain the sample target edge mask image with the target size; A model training module, configured to train an initial deep learning model according to the sample target image to be extracted and the sample target edge mask image corresponding to the sample target image to be extracted to obtain a target edge extraction model; The initial deep learning model includes at least two edge extraction layers; The model training module is specifically configured to: Input the sample target image to be extracted into the initial deep learning model, and respectively obtain a layer output edge mask image corresponding to the sample target image to be extracted output by each edge extraction layer in the initial deep learning model; Determine the target loss of the initial deep learning model according to the layer output edge mask image output by each edge extraction layer, the sample target edge mask image corresponding to the sample target image to be extracted, and the loss function of the initial deep learning model; Based on the target loss, adjust the model parameters of the initial deep learning model to obtain a target edge extraction model.

14. An electronic device, wherein, The electronic device includes: One or more processors; A storage device, configured to store one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the edge extraction method according to any one of claims 1-12.

15. A computer-readable storage medium, on which a computer program is stored, wherein, When the program is executed by the processor, it implements the edge extraction method according to any one of claims 1-12.

Citation Information

Patent Citations

  • Network training method, image processing method, network, terminal device and medium

    CN110660066A