WO2023138540A1 - 边缘提取方法、装置、电子设备及存储介质 - Google Patents

边缘提取方法、装置、电子设备及存储介质 Download PDF

Info

Publication number
WO2023138540A1
WO2023138540A1 PCT/CN2023/072410 CN2023072410W WO2023138540A1 WO 2023138540 A1 WO2023138540 A1 WO 2023138540A1 CN 2023072410 W CN2023072410 W CN 2023072410W WO 2023138540 A1 WO2023138540 A1 WO 2023138540A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
sample
target
initial
extracted
Prior art date
Application number
PCT/CN2023/072410
Other languages
English (en)
French (fr)
Inventor
朱渊略
Original Assignee
北京字跳网络技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京字跳网络技术有限公司 filed Critical 北京字跳网络技术有限公司
Publication of WO2023138540A1 publication Critical patent/WO2023138540A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20092Interactive image processing based on input by user
    • G06T2207/20104Interactive definition of region of interest [ROI]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20172Image enhancement details
    • G06T2207/20192Edge enhancement; Edge preservation

Definitions

  • the present disclosure relates to the technical field of image processing, for example, to an edge extraction method, device, electronic equipment, and storage medium.
  • Image edge detection is a fundamental problem in image processing and computer vision. Image edges usually exist between objects, backgrounds and regions, so it is very difficult to detect and extract image edges.
  • the present disclosure provides an edge extraction method, device, electronic equipment and storage medium, so as to realize the effect of more accurately extracting edge information in an image.
  • the present disclosure provides an edge extraction method, the method comprising:
  • the target edge extraction model is trained based on the following method:
  • 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 obtain the target edge extraction model.
  • an edge extraction device which includes:
  • the image acquisition module is configured to acquire the target image to be extracted
  • the edge extraction module is configured 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;
  • the target edge extraction model is obtained based on a model training device, and the model training device includes:
  • the sample acquisition module is configured to acquire an initial image to be extracted of the sample and an initial edge mask image of the sample corresponding to the initial image to be extracted of the sample;
  • the sample enhancement module is configured to perform image enhancement processing on the initial image to be extracted of the sample to obtain an image to be extracted of the sample target of the target size, and perform image enhancement processing on the initial edge mask image of the sample to obtain an edge mask image of the sample target of the target size;
  • the model training module is configured to 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 obtain the target edge extraction model.
  • the present disclosure also provides an electronic device, which includes:
  • processors one or more processors
  • a storage device configured to store one or more programs
  • the one or more processors are made to implement the edge extraction method provided in the present disclosure.
  • the present disclosure also 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 the present disclosure is implemented.
  • the present disclosure further provides a computer program product, including a computer program carried on a non-transitory computer readable medium, the computer program including program codes for implementing the edge extraction method provided in the present disclosure.
  • FIG. 1 is a schematic flowchart of an edge extraction method provided in Embodiment 1 of the present disclosure
  • FIG. 2 is a schematic flowchart of a method for training a target edge extraction model provided in Embodiment 2 of the present disclosure
  • FIG. 3 is a schematic flowchart of a method for training a target edge extraction model provided by Embodiment 3 of the present disclosure
  • FIG. 4 is a flow chart of a target edge extraction model training method provided by Embodiment 4 of the present disclosure. intention;
  • FIG. 5 is a schematic diagram of an initial image to be extracted of a sample provided in Embodiment 5 of the present disclosure
  • FIG. 6 is a schematic diagram of an image to be extracted of a sample target provided by Embodiment 5 of the present disclosure.
  • FIG. 7 is a schematic diagram of an object edge mask image output by an object edge extraction model provided in Embodiment 5 of the present disclosure.
  • FIG. 8 is a schematic diagram of a target edge mask image after image brightness adjustment provided by Embodiment 5 of the present disclosure.
  • FIG. 9 is a schematic structural diagram of an edge extraction device and a model training device provided in Embodiment 6 of the present disclosure.
  • FIG. 10 is a schematic structural diagram of an electronic device provided by Embodiment 7 of the present disclosure.
  • the term “comprise” and its variations are open-ended, ie “including but not limited to”.
  • the term “based on” is “based at least in part on”.
  • the term “one embodiment” means “at least one embodiment”; the term “another embodiment” means “at least one further embodiment”; the term “some embodiments” means “at least some embodiments.” Relevant definitions of other terms will be given in the description below.
  • FIG 1 is a schematic flow chart of an edge extraction method provided by Embodiment 1 of the present disclosure. This embodiment is applicable to the situation of extracting image edges.
  • the 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 server to implement the disclosure. Open the edge extraction method in the embodiment.
  • the method of this embodiment may specifically include:
  • the target image to be extracted may be the original image to be edge extracted.
  • the target image to be extracted can be obtained by downloading, shooting, drawing, uploading, etc.
  • 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 model that has been trained and can be used to extract edges from images.
  • the target image to be extracted is input into the target edge extraction model, the target image to be extracted is processed, and the output result is used as the target edge mask image corresponding to the target image to be extracted.
  • the target edge extraction model is trained based on the following method, including the following steps:
  • Step 1 Obtain an initial image to be extracted of the sample and an initial edge mask image of the sample corresponding to the initial image to be extracted of the sample.
  • the sample initial image to be extracted may be an original sample image to be subjected to edge extraction.
  • the sample initial edge mask image may be an image corresponding to the sample initial image to be extracted and used to represent edge information.
  • the sample initial image to be extracted and the sample initial edge mask image corresponding to the sample initial image to be extracted may be obtained from the database. It is also possible to acquire the initial image to be extracted of the sample first, and then mark the edge information of the initial image to be extracted of the sample to obtain an initial edge mask image of the sample corresponding to the initial image to be extracted of the sample.
  • Step 2 Perform image enhancement processing on the initial image to be extracted of the sample to obtain an image to be extracted of the sample object of the target size, and perform image enhancement processing on the initial edge mask image of the sample to obtain an edge mask image of the sample object of the target size.
  • Image enhancement processing can be an image processing method that improves the visual effect of an image. Image enhancement processing can purposely emphasize the overall or local characteristics of an image, highlight interesting features, and suppress uninteresting features.
  • the target size may be a preset output image size, for example: 512 ⁇ 512, 1024 ⁇ 1024, etc.
  • the image of the sample target to be extracted may be an image of the sample initial image to be extracted after image enhancement processing, and the sample target edge mask image may be an image of the sample initial edge mask image subjected to image enhancement processing.
  • the purpose of performing image enhancement processing on the initial image to be extracted of the sample to obtain a sample target image to be extracted of the target size is to realize the purpose of expanding the sample.
  • the purpose of performing image enhancement processing on the initial edge mask image of the sample to obtain the target edge mask image of the sample is to highlight the edge information in the initial edge mask image of the sample, so as to improve the quality of the sample.
  • Step 3 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.
  • the initial deep learning model includes a convolutional neural network model
  • 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.
  • the current deep learning model obtained from the last training can be used as the target edge extraction model.
  • the target edge mask image can be processed to weaken irrelevant information and refine the edge information. After obtaining the target edge mask image corresponding to the target image to be extracted, it also includes:
  • Image brightness adjustment is performed on the target edge mask image based on a preset color lookup table.
  • a color look-up table (Look-Up-Table, LUT) is used to adjust the color value of a pixel, which may be: after the color information of each pixel is readjusted by the LUT, a new color information of the pixel is obtained.
  • Processing the target edge mask image according to the preset color lookup table may be to adjust the color of the pixel points related to the edge in the target edge mask image, so as to adjust the image brightness of the target edge mask image.
  • contour recognition processing can be performed on multiple edge pixels in the target edge mask image to obtain the hierarchical relationship of multiple edge pixels, which is convenient for subsequent root Processing such as display or special effects is performed according to the hierarchical relationship.
  • the target edge mask image corresponding to the target image to be extracted it also includes:
  • the edge pixels in the target edge mask image are identified based on a preset contour recognition algorithm, and the recognized edge pixels are stored in the form of point vectors.
  • the target edge mask image may include edge pixels and non-edge pixels.
  • the target edge mask image may be a binary image, for example, edge pixels are white, and non-edge pixels are black.
  • the contour recognition algorithm may be an algorithm for determining the hierarchical relationship of multiple edge pixel points in the contour, for example: the FindContours function in OpenCV, etc., and the hierarchical relationship may be used to represent the order of multiple edge pixel points.
  • the point vector may include the position of the edge pixel and the direction of the next edge pixel of the edge pixel.
  • the point vector of each edge pixel can be obtained, and multiple point vectors can be stored for subsequent processing based on multiple point vectors. Display or add special effects, etc., and then realize the process of gradual change.
  • the target image to be extracted is input into the target edge extraction model, and the target edge mask image corresponding to the target image to be extracted is obtained to perform image edge extraction.
  • image enhancement processing is performed on the sample initial image to be extracted to obtain a sample target image of the target size to be extracted, and image enhancement processing is performed on the sample initial edge mask image to obtain a sample target edge mask image of the target size, so as to perform sample expansion and improve image quality.
  • Embodiment 2 is a schematic flowchart of a target edge extraction model training method provided by Embodiment 2 of the present disclosure. This embodiment is described on the basis of any technical solution in the embodiments of the present disclosure. For the method of performing image enhancement processing on the initial sample image to be extracted, refer to the technical solution of this embodiment. Wherein, explanations of terms that are the same as or corresponding to those in the foregoing embodiments will not be repeated here.
  • the method of this embodiment may include:
  • S220 Perform scaling processing on the sample initial image to be extracted to obtain the sample initial image of the first size. Extract the image.
  • the scaling process may be zoom-in or zoom-out processing, for example, it may be a scale function.
  • the first size may be the size after scaling the initial image to be extracted of the sample.
  • Scaling the length and/or width of the initial image to be extracted of the sample according to a preset ratio can obtain the initial image to be extracted of the sample in the first size.
  • the preset ratio can be any preset ratio
  • 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 sample initial image to be extracted
  • the width preset ratio can be the ratio of the width in the first size to the width of the sample initial image to be extracted.
  • the preset ratio of the length and the preset ratio of the width can be the same or different, for example, the value of the preset ratio can be 0.5, 0.7, 1.2, 1.5 and so on.
  • the length and width of the initial image to be extracted of the sample can be respectively scaled, for example, the length and width of the initial image to be extracted of the sample can be respectively scaled according to the preset size transformation range.
  • the preset size conversion range may be the range of the preset ratio for zooming the initial image to be extracted of the sample.
  • the advantage of setting the preset size conversion range is to avoid the loss of image quality caused by excessive size changes.
  • the length and width of the initial sample image to be extracted can be scaled according to any value within the preset size conversion range. For example, if the preset size conversion range is [0.5, 2], then the length preset ratio can be any value in the interval [0.5, 2], and the width preset ratio can also be any value in the interval [0.5, 2].
  • the length and width of the initial sample image to be extracted may be scaled using the same ratio, or may be scaled using different ratios.
  • the nearest neighbor interpolation method may be a method of assigning the gray value of the nearest neighbor pixel of the original pixel in the transformed image to the original pixel.
  • the target size can be a preset desired image size, for example: 512 ⁇ 512 and so on.
  • the nearest neighbor interpolation method is used to perform interpolation processing on the sample initial image to be extracted of the first size to adjust the size of the sample initial image to be extracted to adjust the first size to the target size to obtain the sample target image of the target size to be extracted.
  • the initial sample image to be extracted of the first size can be cropped first, so that the aspect ratio of the cropped sample initial image to be extracted conforms to the preset aspect ratio.
  • the initial image to be extracted of the sample of the first size is interpolated according to the nearest neighbor interpolation method, including:
  • the initial image to be extracted of the sample of the first size is cropped according to the preset aspect ratio, and the initial image to be extracted of the sample after cropping is interpolated according to the nearest neighbor interpolation method.
  • the preset aspect ratio may be a preset ratio between image length and width, for example: 1:1, 4:3, 16:9, etc.
  • the initial sample image to be extracted of the first size may be cropped according to the preset aspect ratio, to obtain at least one cropped initial sample image to be extracted. Furthermore, an interpolation process is performed on at least one cropped sample initial image to be extracted by using a nearest neighbor interpolation method.
  • the sample initial image to be extracted of the first size is randomly cropped according to the preset aspect ratio to obtain a plurality of different images, and each image can be regarded as a sample initial image to be extracted after cropping.
  • pre-processing can be performed on the initial image to be extracted of the sample to make the image quality of the initial image to be extracted of the sample higher.
  • the technical solution of the embodiment of the present disclosure by acquiring the initial sample image to be extracted and the sample initial edge mask image corresponding to the sample initial image to be extracted, performing scaling processing on the sample initial image to be extracted to obtain an initial sample image to be extracted of a first size, performing interpolation processing on the first size sample image to be extracted according to the nearest neighbor interpolation method to obtain a sample target image to be extracted of a target size, and performing image expansion on the sample initial image to be extracted, and adjusting its size.
  • the image enhancement processing is performed on the initial sample edge mask image to obtain the sample target edge mask image of the target size, and 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, and the target edge extraction model is obtained.
  • Embodiment 3 is a schematic flowchart of a target edge extraction model training method provided by Embodiment 3 of the present disclosure. This embodiment is described on the basis of any technical solution in the embodiments of the present disclosure. For the method of performing image enhancement processing on the initial sample image to be extracted, refer to the technical solution of this embodiment. Wherein, explanations of terms that are the same as or corresponding to those in the foregoing embodiments will not be repeated here.
  • the method of this embodiment may include:
  • the second size may be a scaled size of the original edge mask image of the sample.
  • Scaling the length and/or width of the sample initial edge mask image according to a preset ratio can obtain a sample initial edge mask image of a second size.
  • the preset ratio can be any preset ratio
  • 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
  • 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 preset ratio of the length and the preset ratio of the width can be the same or different, for example, the value of the preset ratio can be 0.5, 0.7, 1.2, 1.5 and so on.
  • the length and width of the initial edge mask image of the sample can be scaled separately, for example, the length and width of the initial edge mask image of the sample can be scaled according to a preset size transformation range.
  • the preset size transformation range may be the range of the preset ratio for scaling the initial edge mask image of the sample.
  • the advantage of setting the preset size transformation range is to avoid the loss of image quality caused by excessive size changes.
  • the length and width of the initial edge mask image of the sample can be scaled according to any value within the preset size transformation range.
  • the preset size transformation range is [0.5, 2]
  • the length preset ratio can be any value in the interval [0.5, 2]
  • the width preset ratio can also be any value in the interval [0.5, 2].
  • the sample initial edge mask image of the second size can be cropped first, so that the aspect ratio of the sample initial edge mask image after cropping conforms to the preset
  • the aspect ratio for example, interpolates the sample initial edge mask image of the second size according to the nearest neighbor interpolation method, including:
  • the preset aspect ratio may be a preset ratio between image length and width, for example: 1:1, 4:3, 16:9, etc.
  • the sample initial edge mask image of the second size may be cropped according to the preset aspect ratio to obtain at least one sample initial edge mask image after cropping. Furthermore, interpolation processing is performed on at least one sample initial edge mask image after cropping processing by a nearest neighbor interpolation method.
  • a plurality of different images can be obtained by randomly cropping the sample initial edge mask image of the second size according to the preset aspect ratio, and each image can be regarded as a cropped sample initial edge mask image.
  • the initial edge mask image of the sample is scaled and nearest neighbor interpolated, there will be a certain loss for the edge pixels, so the image loss can be reduced by first expanding and then thinning.
  • it before performing scaling processing on the sample initial edge mask image, it also 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, before obtaining the sample target edge mask image of the target size, further includes: performing thinning processing on the sample initial edge mask image.
  • Dilation processing can be a processing method that adds pixel values at the edge of the image to expand the overall pixel value, thereby achieving the image expansion effect, for example: the cv2.dilate function in OpenCV, etc.
  • Thinning processing can be a processing method of reducing the edge of the image to achieve the thinning effect of the image, for example: the cv2.thinning function in OpenCV, etc.
  • performing expansion processing on the sample initial edge mask image can realize the expansion of edge pixels in the sample initial edge mask image, for example: dilate 1 pixel to 3 pixels, etc. Moreover, since the expansion process is performed first, then, after the scaling process and the nearest neighbor interpolation process, the processed sample initial edge mask image is thinned to refine the edge pixels, for example, 3 pixels are thinned to 1 pixel, etc., and then the sample initial edge mask image after the thinning process is determined as the sample target edge mask image of the target size.
  • image augmentation is performed on the initial image to be extracted of the sample. Strong processing to obtain the sample target image of the target size to be extracted.
  • the initial edge mask image of the sample is scaled to obtain the initial edge mask image of the sample of the second size, and the initial edge mask image of the sample of the second size is interpolated according to the nearest neighbor interpolation method to obtain the sample target edge mask image of the target size, and the edge information of the initial edge mask image of the sample is enhanced to make the edge effect more obvious and accurate.
  • 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, and the target edge extraction model is obtained, which solves the problem of poor model training effect due to the insufficient edge information of the sample initial edge mask image, and realizes the enhanced processing of the edge information of the sample initial edge mask image to improve the effect of model training quality.
  • FIG. 4 is a schematic flowchart of a method for training a target edge extraction model provided in Embodiment 4 of the present disclosure. This embodiment is described on the basis of any technical solution in the embodiments of the present disclosure. For training the initial deep learning model and obtaining a target edge extraction model, refer to the technical solution of this embodiment. Wherein, explanations of terms that are the same as or corresponding to those in the foregoing embodiments will not be repeated here.
  • the method of this embodiment may include:
  • the initial deep learning model includes at least two edge extraction layers, input the image of the sample target to be extracted into the initial deep learning model, and obtain a layer output edge mask image corresponding to the image of the sample target to be extracted output by each edge extraction layer in the initial deep learning model.
  • the edge extraction layer can be a network layer in the initial deep learning model.
  • the layer output edge mask image may be an edge mask image corresponding to the output result of the edge extraction layer.
  • the sample target image to be extracted is input into the initial deep learning model, and each edge extraction layer in the initial deep learning model is sequentially processed to obtain the output result of each edge extraction layer.
  • the output result of the edge extraction layer can be converted to between 0 and 1 through activation processing and binarization processing, and then converted to 0 or 1 processing, and the processing result is determined to be the layer output edge mask image corresponding to the sample target image to be extracted.
  • the edge extraction layer includes a convolution module and an upsampling module, and the output and The layer output edge mask image corresponding to the sample target image to be extracted:
  • the layer input image of the edge extraction layer is convoluted through the convolution module of the edge extraction layer, and the layer input image after convolution processing is upsampled through the upsampling module to obtain the layer output edge mask image corresponding to the sample target image to be extracted.
  • the upsampling module also includes activation functions and binarization.
  • an activation function such as: Sigmoid function, etc.
  • the value of each pixel in the upsampled image can be converted to a value between 0 and 1, which is recorded as a probability image.
  • the probability image is often an image that characterizes whether each pixel in the image to be extracted of the sample target is an edge pixel.
  • the probability image can be converted into a layer output edge mask image through binarization, for example: the value of each pixel in the probability image is converted to 0 or 1 by setting a threshold.
  • the layer output edge mask image is the same size as the sample target edge mask image.
  • the convolution module is used for convolution processing
  • the upsampling module is used for upsampling processing, and can also be used for activation and binarization processing.
  • the layer input image can be an 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, then the layer input image of the current edge extraction layer is the sample target image to be extracted; if the current edge extraction layer is the second edge extraction layer in the initial deep learning model or the edge extraction layer after the second edge extraction layer, then 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.
  • the layer input image of the edge extraction layer is convoluted through the convolution module of the edge extraction layer.
  • the size of the convolution-processed layer input image is different from the size of the original layer input image. Therefore, the up-sampling process is performed on the convolution-processed layer input image through the up-sampling module, so that the size of the convolution-processed layer input image is restored to the size of the sample target edge mask image. Furthermore, the layer input image after the upsampling process is subjected to activation function and binarization processing to obtain a layer output edge mask image corresponding to the sample target image to be extracted.
  • the loss function of the initial deep learning model may be a preset function for determining loss.
  • the loss function may be mean square error loss (Mean Square Error Loss, MSE Loss), mean absolute error loss (Mean Absolute Error Loss, MAE Loss), etc.
  • the target loss of the initial deep learning model may be a value obtained by comprehensively measuring the difference between the output edge mask image of multiple layers representing the initial deep learning model and the sample target image to be extracted.
  • the loss function of the initial deep learning model is calculated to determine the corresponding loss of each edge extraction layer, and then the target loss of the entire initial deep learning model can be obtained according to the determined loss.
  • the target loss function of the initial deep learning model can be determined according to the following steps:
  • 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.
  • the layer output loss may be 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.
  • the layer output edge mask image and the sample target edge mask image corresponding to the sample target image to be extracted are calculated through the loss function of the initial deep learning model to obtain the layer output loss corresponding to the edge extraction layer.
  • Step 2 Determine the initial loss of the initial deep learning model according to the layer output losses corresponding to the multiple edge extraction layers, and determine the target loss according to the initial loss function.
  • the initial loss may be a loss comprehensively determined according to output losses of multiple layers.
  • an integrated analysis can be performed based on the output losses of multiple layers to determine the initial loss of the initial deep learning model.
  • the initial loss can be determined as the target loss, and the initial loss can also be scaled and/or processed by adding other items, and the processed initial loss can be used as the target loss.
  • the target loss can be determined according to the initial loss through the following steps:
  • Step 1 Use edge pixels in the sample target edge mask image as positive sample pixels, and use pixels in the sample target edge mask image other than edge pixels as negative sample pixels.
  • the edge pixels may be pixels describing the edge of the image, and the positive sample pixels are the edge pixels in the sample target edge mask image.
  • Negative sample pixels are multiple pixels in the sample target edge mask image other than edge pixels, that is, non-edge pixels in the sample target edge mask image, and can also be considered as other pixels in the sample target edge mask image except positive sample pixels.
  • Step 2 Determine the number of positive sample pixels of the positive sample pixels in the sample target edge mask image, determine the number of negative sample pixels of the negative sample pixels in the sample target edge mask image, and determine the total number of pixels in the sample target edge mask image.
  • the number of positive sample pixels may be the total number of positive sample pixels in the sample object edge mask image.
  • the number of negative sample pixels may be the total number of negative sample pixels in the sample object edge mask image.
  • the total number of pixels is the total number of pixels in the sample object edge mask image, that is, the sum of the number of positive sample pixels and the number of negative sample pixels.
  • 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. It is also possible to count all the pixels in the sample target edge mask image 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, another value can be determined through calculation after any two values are determined.
  • 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.
  • the pixel point loss weight may be the weight used when calculating the loss value of the pixel point, which is related to whether the pixel point is a positive sample pixel point or a negative sample pixel point.
  • 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 negative sample pixel number to the total pixel number can be used as the pixel loss weight corresponding to each negative sample pixel in the sample target image to be extracted.
  • Step 4 Weight the initial loss according to the pixel loss weight corresponding to each pixel to obtain the target loss corresponding to each pixel.
  • the loss weight of each pixel point is multiplied by the initial loss to obtain the target loss corresponding to each pixel point.
  • the reason why the initial loss is weighted according to the pixel loss weight corresponding to each pixel in the above method is that in the sample target edge mask image, the number of positive sample pixels is much smaller than the number of negative sample pixels, and there will be a problem of unbalanced sample numbers, which will lead to inaccurate loss calculation and affect the subsequent training of the initial deep learning model. Setting the pixel loss weight can effectively adjust the influence caused by the unbalanced number of samples.
  • the current initial deep learning model is a network model corresponding to the target loss, which can be a model after adjusting model parameters.
  • the initial deep learning model includes at least two edge extraction layers, and the sample target image to be extracted is input into the initial deep learning model, and 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 is obtained.
  • 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 to determine the target loss of the initial deep learning model, so that the target loss covers multiple edge extraction layers, improving the reliability of target loss calculation.
  • the target loss is determined according to the overall model output results, the problem of inaccurate determination of the target loss and the inaccurate adjustment of model parameters due to inaccurate target loss achieve a more accurate determination of the target loss and make the training effect of the target edge extraction model better, so as to more accurately extract the edge information in the image.
  • Embodiment 5 of the present disclosure provides an edge extraction and model training method, including:
  • PASCAL and labeled data are obtained from the Berkeley Segmentation Dataset and Benchmark (The Berkeley Segmentation Dataset and Benchmark, BSDS) database.
  • BSDS Berkeley Segmentation Dataset and Benchmark
  • sample initial image to be extracted ->sharp (sharp processing)->scale(0.5,2.0) (length and width are randomly scaled from 0.5 to 2 times the range)->nearset resize (nearest adjacent interpolation).
  • FIG. 5 a schematic diagram of the sample initial image to be extracted
  • FIG. 6 a schematic diagram of the sample target image to be extracted
  • sample initial edge mask image in the sample initial edge mask image set B For each sample initial edge mask image in the sample initial edge mask image set B, carry out expansion processing and then perform scaling processing to obtain a sample initial edge mask image set B'[B'1, B'2,...,B'n] of the second size, and perform cropping processing, nearest neighbor interpolation processing and thinning processing on each sample initial edge mask image set in the sample initial edge mask image set B', and obtain a sample target edge mask image set B"[B"1, B"2,..., B'n].
  • sample initial edge mask image ->cv2.dilate (expansion processing)->scale(0.5,2.0) (length and width are randomly scaled from 0.5 to 2 times the range)->nearset resize (nearest neighbor interpolation)->cv2.thinning (thinning processing).
  • the size of the sample initial edge mask image is 1024 ⁇ 768, the second size is 512 ⁇ 1536, and the target size is 512 ⁇ 512.
  • the initial deep learning model has five edge extraction layers
  • the sample target image A"m to be extracted is processed by the initial deep learning model
  • the layer output loss Loss1 can be determined according to the layer output edge mask image Am1 and the sample target edge mask image "Bm" of the first edge extraction layer
  • the layer output losses Loss2, Loss3, Loss4 and Loss5 can be determined in a similar manner.
  • the target loss corresponding to each pixel determine the target loss of each sample target image to be extracted, and then 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.
  • the target edge extraction model is obtained by training a low-resolution (for example: 512 ⁇ 512 resolution) sample initial image set to be extracted and a sample initial edge mask image set, then the target edge extraction model can also be used for edge extraction of a target image to be extracted with a higher resolution (for example: 1024 ⁇ 1024 resolution).
  • a low-resolution for example: 512 ⁇ 512 resolution
  • a sample initial edge mask image set for example: 1024 ⁇ 1024 resolution
  • FIG. 8 Exemplarily, a schematic diagram of a target edge mask image after image brightness adjustment is shown in FIG. 8 .
  • image enhancement processing is performed on multiple sample initial images to be extracted by acquiring a sample initial image set to be extracted and a sample initial edge mask image set corresponding to the sample initial image to be extracted to obtain multiple sample target image images to be extracted, and image enhancement processing is performed on multiple sample initial edge mask images to obtain multiple sample target edge mask images of the target size, so as to perform sample expansion and improve image quality.
  • the target edge extraction model is obtained, which solves the problem that the image edge extraction results are rough and not fine enough, and achieves the effect of more accurately extracting the edge information in the image.
  • FIG. 9 is a schematic structural diagram of an edge extraction device and a model training device provided in Embodiment 6 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 server to implement the edge extraction method in the embodiment of the present disclosure.
  • the edge extraction device 51 may include: an image acquisition module 510 and an edge extraction module 520 .
  • the image acquisition module 510 is configured to acquire a target image to be extracted; the edge extraction module 520 is 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.
  • the model training device 52 may include: a sample acquisition module 530 , a sample enhancement module 540 and a model training module 550 .
  • the sample acquisition module 530 is configured to acquire an initial image to be extracted of the sample and an initial edge mask image of the sample corresponding to the initial image to be extracted of the sample;
  • the sample enhancement module 540 is configured to perform image enhancement processing on the initial image to be extracted of the sample to obtain an image of the sample object to be extracted with a target size, and perform image enhancement processing on the initial edge mask image of the sample to obtain a sample object of the target size Mark the edge mask image;
  • the model training module 550 is configured to 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.
  • the sample enhancement module 540 is further configured to perform scaling processing on the initial image to be extracted of the sample to obtain an initial image to be extracted of the sample of a first size; perform interpolation processing on the initial image to be extracted of the sample of the first size according to the nearest neighbor interpolation method to obtain an image to be extracted of the sample target of the target size.
  • the sample enhancement module 540 is further configured to perform scaling processing on the length and width of the initial image to be extracted of the sample according to a preset size transformation range.
  • the model training device 52 further includes: an image sharpening module configured to sharpen the initial image to be extracted of the sample.
  • the sample enhancement module 540 is further configured to 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 target size sample target edge mask image.
  • the model training device 52 further includes: an image expansion module, configured to perform expansion processing on the initial edge mask image of the sample; the model training device 52 also includes: an image thinning module, configured to perform thinning processing on the initial edge mask image of the sample.
  • the initial deep learning model includes at least two edge extraction layers; the model training module 550 is configured to input the sample target image to be extracted into the initial deep learning model, and obtain 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; 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 Determining the target loss of the initial deep learning model; adjusting model parameters of the initial deep learning model based on the target loss to obtain a target edge extraction model.
  • the model training module 550 is further configured to 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 for the layer output edge mask image output by each edge extraction layer; determine the initial loss of the initial deep learning model according to the layer output losses corresponding to multiple edge extraction layers, and determine the target loss according to the initial loss.
  • the model training module 550 is further configured to use edge pixels in the sample target edge mask image as positive sample pixels, and use pixels in the sample target edge mask image other than edge pixels as negative sample pixels; determine the number of positive sample pixels of the positive sample pixels in the sample target edge mask image, determine the number of negative sample pixels of the sample target edge mask image in the sample target edge mask image, and determine the total pixels of the sample target edge mask image Number of points; calculate the pixel point loss weight corresponding to each pixel point in the sample target image to be extracted according to the positive sample pixel point number, the negative sample pixel point number and the total pixel point number; weight the initial loss according to the pixel point loss weight corresponding to each pixel point respectively, and obtain the target loss corresponding to each pixel point.
  • the edge extraction layer includes a convolution module and an upsampling module;
  • the model training module 550 is also configured to perform convolution processing on the layer input image of the edge extraction layer through the convolution module of the edge extraction layer for each edge extraction layer in the initial deep learning model, 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, wherein the layer output edge mask image is consistent with the sample target
  • the edge mask images are the same size.
  • the edge extraction device 51 further includes: a brightness adjustment module configured to perform image brightness adjustment on the target edge mask image based on a preset color lookup table.
  • the edge extraction device 51 further includes: a contour recognition module configured to recognize edge pixels in the target edge mask image based on a preset contour recognition algorithm, and store the recognized edge pixels in the form of point vectors.
  • the initial deep learning model includes a convolutional neural network model
  • 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.
  • the above-mentioned device can execute the method provided by any embodiment of the present disclosure, and has corresponding functional modules and effects for executing the method.
  • the target image to be extracted is input into the target edge extraction model, and the target edge mask image corresponding to the target image to be extracted is obtained to perform image edge extraction.
  • the target image to be extracted is input into the target edge extraction model, and the target edge mask image corresponding to the target image to be extracted is obtained to perform image edge extraction.
  • the multiple units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be realized; in addition, the names of the multiple functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present disclosure.
  • FIG. 10 is a schematic structural diagram of an electronic device provided by Embodiment 7 of the present disclosure.
  • the terminal device in the embodiments of the present disclosure may include, but not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, personal digital assistants (Personal Digital Assistant, PDA), tablet computers (Portable Android Device, PAD), portable multimedia players (Portable Media Player, PMP), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital televisions (Television, TV), desktop computers, etc.
  • the electronic device 600 shown in FIG. 10 is only an example, and should not limit the functions and scope of use of the embodiments of the present disclosure.
  • an 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 a program stored in a read-only memory (Read-Only Memory, ROM) 602 or a program loaded from a storage device 608 into a random access memory (Random Access Memory, RAM) 603.
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • various programs and data necessary for the operation of the electronic device 600 are also stored.
  • the processing device 601, ROM 602, and RAM 603 are connected to each other through a bus 605.
  • An edit/output (Input/Output, I/O) interface 604 is also connected to the bus 605 .
  • the following devices can 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 (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 means 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data.
  • FIG. 10 shows electronic device 600 having various means, it is not required to implement or possess all of the means shown. More or fewer means may alternatively be implemented or provided.
  • embodiments of the present disclosure include a computer program product including a computer program carried on a non-transitory computer-readable medium, the computer program including a method for executing the The program code for the method.
  • the computer program may be downloaded and installed from a network via communication means 609 , or from storage means 608 , or from ROM 602 .
  • the processing device 601 When the computer program is executed by the processing device 601, the above-mentioned functions defined in the methods of the embodiments of the present disclosure are performed.
  • the electronic device provided by the embodiment of the present disclosure belongs to the same idea as the edge extraction method provided by the above embodiment.
  • An 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 foregoing embodiments is implemented.
  • the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two.
  • a computer readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination thereof.
  • Examples of computer-readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer disks, hard disks, RAM, ROM, Erasable Programmable Read-Only Memory (EPROM or flash memory), fiber optics, portable Compact Disc Read-Only Memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave carrying computer-readable program code therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • a computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in connection 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: electric wire, optical cable, radio frequency (Radio Frequency, RF), etc., or any suitable combination of the above.
  • the client and the server can utilize any currently known or future developed network such as HyperText Transfer Protocol (HyperText Transfer Protocol, HTTP) protocol and may be interconnected by any form or medium of digital data communication (eg, a communication network).
  • Examples of communication networks include local area networks (Local Area Network, LAN), wide area networks (Wide Area Network, WAN), internetworks (for example, the Internet) and peer-to-peer networks (for example, ad hoc peer-to-peer networks), and any currently known or future developed networks.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device, or may exist independently without being incorporated into the electronic device.
  • the above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the electronic device, the electronic device:
  • the sample target image to be extracted and the sample target edge mask image corresponding to the sample target image to be extracted are used to train the initial deep learning model to obtain a target edge extraction model.
  • Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, or combinations thereof, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and conventional procedural programming languages—such as the “C” language or similar programming languages.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server.
  • the remote computer can be connected to the user computer through any kind of network, including a LAN or WAN, or it can be connected to an external computer (eg via the Internet using an Internet Service Provider).
  • each block in the flowchart or block diagram may represent a module, program segment, or portion of code that includes one or more executable instructions for implementing specified logical functions.
  • the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block in the block diagrams and/or flowcharts, and combinations of blocks in the block diagrams and/or flowcharts can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a dedicated A combination of hardware and computer instructions.
  • the units involved in the embodiments described in the present disclosure may be implemented by software or by hardware. Wherein, the name of the unit does not constitute a limitation of the unit itself in one case.
  • exemplary types of hardware logic components include: Field Programmable Gate Array (Field Programmable Gate Array, FPGA), Application Specific Integrated Circuit (ASIC), Application Specific Standard Parts (ASSP), System on Chip (System on Chip, SOC), Complex Programmable Logic Device (Complex Programming log ic device, CPLD) and so on.
  • a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction 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. Examples of a machine-readable storage medium would include one or more wire-based electrical connections, a portable computer disk, a hard disk, RAM, ROM, EPROM or flash memory, optical fiber, CD-ROM, optical storage, magnetic storage, or any suitable combination of the foregoing.
  • Example 1 provides an edge extraction method, the method includes:
  • the target edge extraction model is trained based on the following method:
  • 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 obtain the target edge extraction model.
  • Example 2 provides an edge extraction method, The method also includes:
  • Example 3 provides an edge extraction method, the method further includes:
  • Perform scaling processing on the initial image to be extracted of the sample including:
  • the length and width of the initial image to be extracted of the sample are respectively scaled according to the preset size transformation range.
  • Example 4 provides an edge extraction method, the method further includes:
  • Example 5 provides an edge extraction method, the method further includes:
  • Perform image enhancement processing on the sample initial edge mask image to obtain the sample target edge mask image of the target size including:
  • the sample initial edge mask image of the second size is interpolated according to the nearest neighbor interpolation method to obtain the sample target edge mask image of the target size.
  • Example 6 provides an edge extraction method, the method further includes:
  • the method After performing interpolation processing on the sample initial edge mask image of the second size according to the nearest neighbor interpolation method, before obtaining the sample target edge mask image of the target size, the method further includes:
  • Thinning processing is performed on the initial edge mask image of the sample.
  • Example 7 provides an edge extraction method, the method further includes:
  • the initial deep learning model includes at least two edge extraction layers
  • 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 obtain the target edge extraction model, including:
  • the sample target image to be extracted is input into the initial deep learning model, and the layer output edge mask image corresponding to the sample target image to be extracted that is output by each edge extraction layer in the initial deep learning model is obtained;
  • Example 8 provides an edge extraction method, the method further includes:
  • the target loss of the initial deep learning model is determined 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, including:
  • 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;
  • the initial loss of the initial deep learning model is determined according to the layer output losses corresponding to the multiple edge extraction layers, and the target loss is determined according to the initial loss.
  • Example 9 provides an edge extraction method, the method further includes:
  • Determine the target loss based on the initial loss including:
  • edge pixels in the sample target edge mask image as positive sample pixels, and using pixels in the sample target edge mask image other than edge pixels as negative sample pixels;
  • the initial loss is weighted according to the pixel point loss weight corresponding to each pixel point to obtain the target loss corresponding to each pixel point.
  • Example 10 provides an edge extraction method, the method further includes:
  • the edge extraction layer includes a convolution module and an upsampling module
  • the obtaining of the layer output edge mask image corresponding to the image to be extracted of the sample target output by each edge extraction layer in the initial deep learning model includes:
  • the layer input image of the edge extraction layer is convoluted by the convolution module of the edge extraction layer, and the layer input image after convolution is processed by the upsampling module.
  • the layer output edge mask image corresponding to the sample target image to be extracted is obtained, wherein the layer output edge mask image is the same size as the sample target edge mask image.
  • Example Eleven provides an edge extraction method, the method further includes:
  • the target edge mask image corresponding to the target image to be extracted After obtaining the target edge mask image corresponding to the target image to be extracted, it also includes:
  • Image brightness adjustment is performed on the target edge mask image based on a preset color lookup table.
  • Example 12 provides an edge extraction method, the method further includes:
  • the target edge mask image corresponding to the target image to be extracted After obtaining the target edge mask image corresponding to the target image to be extracted, it also includes:
  • the edge pixels in the target edge mask image are identified based on a preset contour recognition algorithm, and the recognized edge pixels are stored in the form of point vectors.
  • Example 13 provides an edge extraction method, the method further includes:
  • the initial deep learning model includes a convolutional neural network model
  • 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.
  • Example Fourteen provides an edge extraction device, which includes:
  • the image acquisition module is configured to acquire the target image to be extracted
  • the edge extraction module is configured 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;
  • the target edge extraction model is obtained based on a model training device, and the model training device includes:
  • the sample acquisition module is configured to acquire an initial image to be extracted of the sample and an initial edge mask image of the sample corresponding to the initial image to be extracted of the sample;
  • the sample enhancement module is configured to perform image enhancement processing on the initial image to be extracted of the sample to obtain an image to be extracted of the sample target of the target size, and perform image enhancement processing on the initial edge mask image of the sample to obtain an edge mask image of the sample target of the target size;
  • the model training module is configured to 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 obtain the target edge extraction model.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • Molecular Biology (AREA)
  • Biomedical Technology (AREA)
  • Health & Medical Sciences (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Health & Medical Sciences (AREA)
  • Biophysics (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Evolutionary Biology (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

本公开提供了一种边缘提取方法、装置、电子设备及存储介质。该边缘提取方法包括:获取目标待提取图像;将目标待提取图像输入至目标边缘提取模型中,得到与目标待提取图像对应的目标边缘掩膜图像;目标边缘提取模型基于下述方法训练得到:获取样本初始待提取图像以及样本初始边缘掩膜图像;对样本初始待提取图像进行图像增强处理,并对样本初始边缘掩膜图像进行图像增强处理;根据图像增强处理后的样本初始待提取图像和样本初始边缘掩膜图像对初始深度学习模型进行训练,得到目标边缘提取模型。

Description

边缘提取方法、装置、电子设备及存储介质
本申请要求在2022年01月20日提交中国专利局、申请号为202210067538.9的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。
技术领域
本公开涉及图像处理技术领域,例如涉及一种边缘提取方法、装置、电子设备及存储介质。
背景技术
图像边缘作为图像基本的特征,集中了大量的图像信息。图像边缘检测是图像处理和计算机视觉中的基本问题。图像边缘通常存在于目标、背景和区域之间,因此,对于图像边缘的检测和提取具有较大的难度。
基于图像边缘检测和提取技术对图像边缘进行检测和提取时,存在着图像边缘提取结果粗糙,不够精细的问题。
发明内容
本公开提供了一种边缘提取方法、装置、电子设备及存储介质,以实现更为精准地提取图像中的边缘信息的效果。
第一方面,本公开提供了一种边缘提取方法,该方法包括:
获取目标待提取图像;
将所述目标待提取图像输入至目标边缘提取模型中,得到与所述目标待提取图像对应的目标边缘掩膜图像;
其中,所述目标边缘提取模型基于下述方法训练得到:
获取样本初始待提取图像以及与所述样本初始待提取图像对应的样本初始边缘掩膜图像;
对所述样本初始待提取图像进行图像增强处理,得到目标尺寸的样本目标待提取图像,并对所述样本初始边缘掩膜图像进行图像增强处理,得到所述目标尺寸的样本目标边缘掩膜图像;
根据所述样本目标待提取图像以及与所述样本目标待提取图像对应的样本目标边缘掩膜图像对初始深度学习模型进行训练,得到目标边缘提取模型。
第二方面,本公开还提供了一种边缘提取装置,该装置包括:
图像获取模块,设置为获取目标待提取图像;
边缘提取模块,设置为将所述目标待提取图像输入至目标边缘提取模型中,得到与所述目标待提取图像对应的目标边缘掩膜图像;
其中,所述目标边缘提取模型基于模型训练装置得到,所述模型训练装置包括:
样本获取模块,设置为获取样本初始待提取图像以及与所述样本初始待提取图像对应的样本初始边缘掩膜图像;
样本增强模块,设置为对所述样本初始待提取图像进行图像增强处理,得到目标尺寸的样本目标待提取图像,并对所述样本初始边缘掩膜图像进行图像增强处理,得到所述目标尺寸的样本目标边缘掩膜图像;
模型训练模块,设置为根据所述样本目标待提取图像以及与所述样本目标待提取图像对应的样本目标边缘掩膜图像对初始深度学习模型进行训练,得到目标边缘提取模型。
第三方面,本公开还提供了一种电子设备,该电子设备包括:
一个或多个处理器;
存储装置,设置为存储一个或多个程序;
当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现本公开提供的边缘提取方法。
第四方面,本公开还提供了一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现本公开所提供的边缘提取方法。
第五方面,本公开还提供了一种计算机程序产品,包括承载在非暂态计算机可读介质上的计算机程序,所述计算机程序包含用于实现本公开所提供的边缘提取方法的程序代码。
附图说明
图1为本公开实施例一所提供的一种边缘提取方法的流程示意图;
图2为本公开实施例二所提供的一种目标边缘提取模型训练方法的流程示意图;
图3为本公开实施例三所提供的一种目标边缘提取模型训练方法的流程示意图;
图4为本公开实施例四所提供的一种目标边缘提取模型训练方法的流程示 意图;
图5为本公开实施例五所提供的一种样本初始待提取图像的示意图;
图6为本公开实施例五所提供的一种样本目标待提取图像的示意图;
图7为本公开实施例五所提供的一种目标边缘提取模型输出的目标边缘掩膜图像的示意图;
图8为本公开实施例五所提供的一种图像亮度调整后的目标边缘掩膜图像的示意图;
图9为本公开实施例六所提供的一种边缘提取装置和模型训练装置的结构示意图;
图10为本公开实施例七所提供的一种电子设备的结构示意图。
具体实施方式
下面将参照附图描述本公开的实施例。虽然附图中显示了本公开的一些实施例,然而本公开可以通过多种形式来实现,提供这些实施例是为了理解本公开。本公开的附图及实施例仅用于示例性作用。
本公开的方法实施方式中记载的多个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。
本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有指出,否则应该理解为“一个或多个”。
本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。
实施例一
图1为本公开实施例一所提供的一种边缘提取方法的流程示意图,本实施例可适用于对图像边缘进行提取的情况,该方法可以由边缘提取装置来执行,该装置可以通过软件和/或硬件来实现,可配置于终端和/或服务器中来实现本公 开实施例中的边缘提取方法。
如图1所示,本实施例的方法具体可包括:
S110、获取目标待提取图像。
目标待提取图像可以是待进行边缘提取的原始图像。
可以通过下载、拍摄、绘制、上传等方式获取目标待提取图像。
S120、将目标待提取图像输入至目标边缘提取模型中,得到与目标待提取图像对应的目标边缘掩膜图像。
目标边缘掩膜图像可以是与目标待提取图像对应的具有边缘信息的图像。目标边缘提取模型可以是训练完成的,可以用于对图像进行边缘提取的模型。
将目标待提取图像输入至目标边缘提取模型中,对目标待提取图像进行处理,将输出结果作为与目标待提取图像对应的目标边缘掩膜图像。
目标边缘提取模型基于下述方法训练得到,包括如下步骤:
步骤一、获取样本初始待提取图像以及与样本初始待提取图像对应的样本初始边缘掩膜图像。
样本初始待提取图像可以是待进行边缘提取的原始样本图像。样本初始边缘掩膜图像可以是与样本初始待提取图像相对应的用于表征边缘信息的图像。
可以从数据库中获取样本初始待提取图像以及与样本初始待提取图像对应的样本初始边缘掩膜图像。也可以先获取样本初始待提取图像,进而,对样本初始待提取图像进行边缘信息标注,得到与样本初始待提取图像相对应的样本初始边缘掩膜图像。
步骤二、对样本初始待提取图像进行图像增强处理,得到目标尺寸的样本目标待提取图像,并对样本初始边缘掩膜图像进行图像增强处理,得到目标尺寸的样本目标边缘掩膜图像。
图像增强处理可以是改善图像的视觉效果的图像处理方式,图像增强处理能够有目的地强调图像的整体或局部特性,突出感兴趣的特征,抑制不感兴趣的特征。目标尺寸可以是预先设定的输出图像的尺寸,例如:512×512、1024×1024等。样本目标待提取图像可以是样本初始待提取图像进行图像增强处理后的图像,样本目标边缘掩膜图像可以是样本初始边缘掩膜图像进行图像增强处理后的图像。
对样本初始待提取图像进行图像增强处理,以对样本初始待提取图像附加一些信息或变换数据,突出样本初始待提取图像中感兴趣的特征,并将图像增强处理后的样本初始待提取图像进行尺寸变换,得到目标尺寸的样本目标待提 取图像。对样本初始边缘掩膜图像进行图像增强处理,以对样本初始边缘掩膜图像附加一些信息或变换数据,突出样本初始待提取图像中感兴趣的特征,并将图像增强处理后的样本初始边缘掩膜图像进行尺寸变换,得到目标尺寸的样本目标边缘掩膜图像。
对样本初始待提取图像进行图像增强处理,得到目标尺寸的样本目标待提取图像的目的在于,能够实现扩充样本的目的。对样本初始边缘掩膜图像进行图像增强处理,得到目标尺寸的样本目标边缘掩膜图像的目的在于,能够突显样本初始边缘掩膜图像中的边缘信息,以提高样本的质量。
步骤三、根据样本目标待提取图像以及与样本目标待提取图像对应的样本目标边缘掩膜图像对初始深度学习模型进行训练,得到目标边缘提取模型。
初始深度学习模型包括卷积神经网络模型,卷积神经网络模型包括u2net模型、unet模型、deeplab模型、transformer模型以及pidinet模型中的至少一种。
将初始深度学习模型作为当前深度学习模型。将样本目标待提取图像输入至当前深度学习模型中,得到输出图像,将输出图像和与样本目标待提取图像对应的样本目标边缘掩膜图像进行比较得到当前损失函数。若损失函数不符合需求,则根据当前损失函数对当前深度学习模型中的多个参数进行调节,将调节后的深度学习模型作为当前深度学习模型,并返回执行将样本目标待提取图像输入至当前深度学习模型中,得到输出图像的操作;若损失函数符合需求,则将当前深度学习模型作为目标边缘提取模型。
若训练次数达到预设次数时,当前损失函数仍不符合需求,则可以将最后一次训练得到的当前深度学习模型作为目标边缘提取模型。
在本公开实施例技术方案的基础上,可以对目标边缘掩膜图像进行处理,以弱化无关信息,并将边缘信息进行细化处理。在得到与目标待提取图像对应的目标边缘掩膜图像之后,还包括:
基于预设的颜色查找表对目标边缘掩膜图像进行图像亮度调整。
颜色查找表(Look-Up-Table,LUT)用于对像素点的颜色值进行调整,可以是:每个像素点的色彩信息经过LUT重新调整之后,得到该像素点的一个新的色彩信息。
根据预设的颜色查找表对目标边缘掩膜图像进行处理,可以是对目标边缘掩膜图像中与边缘相关的像素点进行颜色调节,以对目标边缘掩膜图像进行图像亮度调整。
在本公开实施例技术方案的基础上,可以对目标边缘掩膜图像中的多个边缘像素点进行轮廓识别处理,以得到多个边缘像素点的层次关系,便于后续根 据该层次关系进行显示或特效等处理。在得到与目标待提取图像对应的目标边缘掩膜图像之后,还包括:
基于预设的轮廓识别算法对目标边缘掩膜图像中的边缘像素点进行识别,并将识别到的边缘像素点以点向量的形式进行存储。
目标边缘掩膜图像中可以包括边缘像素点和非边缘像素点,示例性的,目标边缘掩膜图像可以是二值图像,例如,边缘像素点为白色,非边缘像素点为黑色。轮廓识别算法可以是用于确定轮廓中多个边缘像素点的层次关系的算法,例如:OpenCV中的FindContours函数等,层次关系可以用于表示多个边缘像素点的先后顺序等。点向量可以包括边缘像素点的位置以及边缘像素点的下一边缘像素点的方向。
基于预设的轮廓识别算法对目标边缘掩膜图像中的边缘像素点进行识别,可以得到每个边缘像素点的点向量,并将多个点向量进行存储,以便于后续根据多个点向量进行显示或添加特效等处理,进而实现渐变的过程。
本公开实施例的技术方案,通过获取目标待提取图像,将目标待提取图像输入至目标边缘提取模型中,得到与目标待提取图像对应的目标边缘掩膜图像,以进行图像的边缘提取。并且,通过获取样本初始待提取图像以及与样本初始待提取图像对应的样本初始边缘掩膜图像,对样本初始待提取图像进行图像增强处理,得到目标尺寸的样本目标待提取图像,并对样本初始边缘掩膜图像进行图像增强处理,得到目标尺寸的样本目标边缘掩膜图像,以进行样本扩充并提高图像质量,根据样本目标待提取图像以及与样本目标待提取图像对应的样本目标边缘掩膜图像对初始深度学习模型进行训练,得到目标边缘提取模型,解决了图像边缘提取结果粗糙,不够精细的问题,实现了更为精准地提取图像中的边缘信息的效果。
实施例二
图2为本公开实施例二所提供的一种目标边缘提取模型训练方法的流程示意图,本实施例在本公开实施例中任一技术方案的基础上进行说明,针对样本初始待提取图像进行图像增强处理的方式可参见本实施例的技术方案。其中,与上述实施例相同或相应的术语的解释在此不再赘述。
如图2所示,本实施例的方法可包括:
S210、获取样本初始待提取图像以及与样本初始待提取图像对应的样本初始边缘掩膜图像。
S220、对样本初始待提取图像进行缩放处理,得到第一尺寸的样本初始待 提取图像。
缩放处理可以是放大或缩小处理,示例性的,可以是scale函数。第一尺寸可以是对样本初始待提取图像进行缩放后的尺寸。
对样本初始待提取图像按照预设比例进行长度和/或宽度的缩放,可以得到第一尺寸的样本初始待提取图像。其中,预设比例可以是预先设定的任一比例,预设比例可以包括长度预设比例和宽度预设比例,长度预设比例可以是第一尺寸中的长度与样本初始待提取图像的长度的比值,宽度预设比例可以是第一尺寸中的宽度与样本初始待提取图像的宽度的比值。长度预设比例和宽度预设比例可以相同,也可以不同,例如:预设比例的数值可以是0.5、0.7、1.2、1.5等。
在本公开实施例技术方案的基础上,可以对样本初始待提取图像的长度和宽度分别进行缩放处理,例如,根据预设尺寸变换范围对样本初始待提取图像的长度和宽度分别进行缩放处理。
预设尺寸变换范围可以是对样本初始待提取图像进行放缩的预设比例所属的范围,设置预设尺寸变换范围的好处在于避免尺寸变化过大导致图像质量损失的情况。
可以根据预设尺寸变换范围内的任一数值对样本初始待提取图像的长度和宽度分别进行缩放处理,例如:若预设尺寸变换范围为[0.5,2],那么,长度预设比例可以是[0.5,2]区间内的任一数值,宽度预设比例也可以是[0.5,2]区间内的任一数值。
针对样本初始待提取图像的长度和宽度可以使用相同的比例进行缩放处理,也可以使用不同的比例进行缩放处理。
S230、根据最近邻插值方法对第一尺寸的样本初始待提取图像进行插值处理,得到目标尺寸的样本目标待提取图像。
最近邻插值方法可以是将变换后的图像中的原像素点最邻近像素的灰度值赋给原像素点的方法。目标尺寸可以是预先设定的想要得到的图像尺寸,例如:512×512等。
使用最近邻插值方法对第一尺寸的样本初始待提取图像进行插值处理,以对第一尺寸的样本初始待提取图像的尺寸进行调节,以将第一尺寸调节为目标尺寸,得到目标尺寸的样本目标待提取图像。
在本公开实施例技术方案的基础上,可以先对第一尺寸的样本初始待提取图像进行裁剪处理,使得裁剪后的样本初始待提取图像的长宽比符合预设长宽比,例如,根据最近邻插值方法对第一尺寸的样本初始待提取图像进行插值处理,包括:
根据预设长宽比对第一尺寸的样本初始待提取图像进行裁剪处理,根据最近邻插值方法对裁剪处理后的样本初始待提取图像进行插值处理。
预设长宽比可以是预先设定的图像长度和宽度的比值,例如:1:1、4:3、16:9等。
根据预设长宽比可以对第一尺寸的样本初始待提取图像进行裁剪处理,得到至少一个裁剪处理后的样本初始待提取图像。进而,对至少一个裁剪处理后的样本初始待提取图像,通过最近邻插值方法进行插值处理。
将第一尺寸的样本初始待提取图像根据预设长宽比进行随机的裁剪处理可以得到多个不同的图像,每一个图像都可以认为是一个裁剪处理后的样本初始待提取图像。
在本公开实施例技术方案的基础上,可以对样本初始待提取图像进行前处理,以使样本初始待提取图像的图像质量更高,例如,在对样本初始待提取图像进行缩放处理之前,还包括:对样本初始待提取图像进行锐化处理。
S240、对样本初始边缘掩膜图像进行图像增强处理,得到目标尺寸的样本目标边缘掩膜图像。
S250、根据样本目标待提取图像以及与样本目标待提取图像对应的样本目标边缘掩膜图像对初始深度学习模型进行训练,得到目标边缘提取模型。
本公开实施例的技术方案,通过获取样本初始待提取图像以及与样本初始待提取图像对应的样本初始边缘掩膜图像,对样本初始待提取图像进行缩放处理,得到第一尺寸的样本初始待提取图像,根据最近邻插值方法对第一尺寸的样本初始待提取图像进行插值处理,得到目标尺寸的样本目标待提取图像,来对样本初始待提取图像进行图像扩充,并调节其尺寸。对样本初始边缘掩膜图像进行图像增强处理,得到目标尺寸的样本目标边缘掩膜图像,根据样本目标待提取图像以及与样本目标待提取图像对应的样本目标边缘掩膜图像对初始深度学习模型进行训练,得到目标边缘提取模型,解决了由于样本初始待提取图像较少导致的模型训练效果不佳的问题,实现了对样本初始待提取图像进行样本扩充,以提高模型训练质量的效果。
实施例三
图3为本公开实施例三所提供的一种目标边缘提取模型训练方法的流程示意图,本实施例在本公开实施例中任一技术方案的基础上进行说明,针对样本初始待提取图像进行图像增强处理的方式可参见本实施例的技术方案。其中,与上述实施例相同或相应的术语的解释在此不再赘述。
如图3所示,本实施例的方法可包括:
S310、获取样本初始待提取图像以及与样本初始待提取图像对应的样本初始边缘掩膜图像。
S320、对样本初始待提取图像进行图像增强处理,得到目标尺寸的样本目标待提取图像。
S330、对样本初始边缘掩膜图像进行缩放处理,得到第二尺寸的样本初始边缘掩膜图像。
第二尺寸可以是对样本初始边缘掩膜图像进行缩放后的尺寸。
对样本初始边缘掩膜图像按照预设比例进行长度和/或宽度的缩放,可以得到第二尺寸的样本初始边缘掩膜图像。其中,预设比例可以是预先设定的任一比例,预设比例可以包括长度预设比例和宽度预设比例,长度预设比例可以是第二尺寸中的长度与样本初始边缘掩膜图像的长度的比值,宽度预设比例可以是第二尺寸中的宽度与样本初始边缘掩膜图像的宽度的比值。长度预设比例和宽度预设比例可以相同,也可以不同,例如:预设比例的数值可以是0.5、0.7、1.2、1.5等。
在本公开实施例技术方案的基础上,可以对样本初始边缘掩膜图像的长度和宽度分别进行缩放处理,例如,根据预设尺寸变换范围对样本初始边缘掩膜图像的长度和宽度分别进行缩放处理。
预设尺寸变换范围可以是对样本初始边缘掩膜图像进行放缩的预设比例所属的范围,设置预设尺寸变换范围的好处在于避免尺寸变化过大导致图像质量损失的情况。
可以根据预设尺寸变换范围内的任一数值对样本初始边缘掩膜图像的长度和宽度分别进行缩放处理,例如:若预设尺寸变换范围为[0.5,2],那么,长度预设比例可以是[0.5,2]区间内的任一数值,宽度预设比例也可以是[0.5,2]区间内的任一数值。
S340、根据最近邻插值方法对第二尺寸的样本初始边缘掩膜图像进行插值处理,得到目标尺寸的样本目标边缘掩膜图像。
使用最近邻插值方法对第二尺寸的样本初始边缘掩膜图像进行插值处理,以对第二尺寸的样本初始边缘掩膜图像的尺寸进行调节,以将第二尺寸调节为目标尺寸,得到目标尺寸的样本目标边缘掩膜图像。
在本公开实施例技术方案的基础上,可以先对第二尺寸的样本初始边缘掩膜图像进行裁剪处理,使得裁剪后的样本初始边缘掩膜图像的长宽比符合预设 长宽比,例如,根据最近邻插值方法对第二尺寸的样本初始边缘掩膜图像进行插值处理,包括:
根据预设长宽比对第二尺寸的样本初始边缘掩膜图像进行裁剪处理,根据最近邻插值方法对裁剪处理后的样本初始边缘掩膜图像进行插值处理。
预设长宽比可以是预先设定的图像长度和宽度的比值,例如:1:1、4:3、16:9等。
根据预设长宽比可以对第二尺寸的样本初始边缘掩膜图像进行裁剪处理,得到至少一个裁剪处理后的样本初始边缘掩膜图像。进而,对至少一个裁剪处理后的样本初始边缘掩膜图像,通过最近邻插值方法进行插值处理。
将第二尺寸的样本初始边缘掩膜图像根据预设长宽比进行随机的裁剪处理可以得到多个不同的图像,每一个图像都可以认为是一个裁剪处理后的样本初始边缘掩膜图像。
在本公开实施例技术方案的基础上,由于对样本初始边缘掩膜图像进行缩放处理和最近邻插值处理,对于边缘像素点会存在一定的损失,因此可以通过先膨胀再细化的操作来降低图像损失。例如,在对样本初始边缘掩膜图像进行缩放处理之前,还包括:对样本初始边缘掩膜图像进行膨胀处理;在根据最近邻插值方法对第二尺寸的样本初始边缘掩膜图像进行插值处理之后,得到目标尺寸的样本目标边缘掩膜图像之前,还包括:对样本初始边缘掩膜图像进行细化处理。
膨胀处理可以是在图像的边缘添加像素值,使得整体的像素值扩张,进而达到图像的膨胀效果的处理方式,例如:OpenCV中的cv2.dilate函数等。细化处理可以是对图像的边缘进行缩小,达到图像的细化效果的处理方式,例如:OpenCV中的cv2.thinning函数等。
在对样本初始边缘掩膜图像进行缩放处理之前,对样本初始边缘掩膜图像进行膨胀处理,可以实现对样本初始边缘掩膜图像中的边缘像素点的膨胀,例如:将1像素膨胀为3像素等。并且,由于先进行了膨胀处理,那么,在进行缩放处理和最近邻插值处理之后,对处理后的样本初始边缘掩膜图像进行细化处理,以使边缘像素点细化,例如:将3像素细化为1像素等,进而,将细化处理后的样本初始边缘掩膜图像确定为目标尺寸的样本目标边缘掩膜图像。
S350、根据样本目标待提取图像以及与样本目标待提取图像对应的样本目标边缘掩膜图像对初始深度学习模型进行训练,得到目标边缘提取模型。
本公开实施例的技术方案,通过获取样本初始待提取图像以及与样本初始待提取图像对应的样本初始边缘掩膜图像,对样本初始待提取图像进行图像增 强处理,得到目标尺寸的样本目标待提取图像。对样本初始边缘掩膜图像进行缩放处理,得到第二尺寸的样本初始边缘掩膜图像,根据最近邻插值方法对第二尺寸的样本初始边缘掩膜图像进行插值处理,得到目标尺寸的样本目标边缘掩膜图像,来对样本初始边缘掩膜图像的边缘信息进行增强,使边缘效果更加明显和准确。根据样本目标待提取图像以及与样本目标待提取图像对应的样本目标边缘掩膜图像对初始深度学习模型进行训练,得到目标边缘提取模型,解决了由于样本初始边缘掩膜图像的边缘信息不够明显导致的模型训练效果不佳的问题,实现了对样本初始边缘掩膜图像的边缘信息进行增强处理,以提高模型训练质量的效果。
实施例四
图4为本公开实施例四所提供的一种目标边缘提取模型训练方法的流程示意图,本实施例在本公开实施例中任一技术方案的基础上进行说明,针对对初始深度学习模型进行训练,得到目标边缘提取模型的方式可参见本实施例的技术方案。其中,与上述实施例相同或相应的术语的解释在此不再赘述。
如图4所示,本实施例的方法可包括:
S410、获取样本初始待提取图像以及与样本初始待提取图像对应的样本初始边缘掩膜图像。
S420、对样本初始待提取图像进行图像增强处理,得到目标尺寸的样本目标待提取图像,并对样本初始边缘掩膜图像进行图像增强处理,得到目标尺寸的样本目标边缘掩膜图像。
S430、初始深度学习模型包括至少两个边缘提取层,将样本目标待提取图像输入至初始深度学习模型中,得到初始深度学习模型中每一个边缘提取层所输出的与样本目标待提取图像对应的层输出边缘掩膜图像。
边缘提取层可以是初始深度学习模型中的一个网络层。层输出边缘掩膜图像可以是边缘提取层的输出结果对应的边缘掩膜图像。
将样本目标待提取图像输入至初始深度学习模型中,经由初始深度学习模型中每一个边缘提取层依次进行处理,可以得到每一个边缘提取层的输出结果。针对每一个边缘提取层,可以将该边缘提取层的输出结果通过激活处理和二值化处理,将输出结果转化至0到1之间,进而,转换为0或1的处理,将处理结果确定为与样本目标待提取图像对应的层输出边缘掩膜图像。
在本公开实施例技术方案的基础上,边缘提取层包括卷积模块和上采样模块,可以通过下述方式得到初始深度学习模型中每一个边缘提取层所输出的与 样本目标待提取图像对应的层输出边缘掩膜图像:
针对初始深度学习模型中每一个边缘提取层,通过边缘提取层的卷积模块将边缘提取层的层输入图像进行卷积处理,并通过上采样模块对卷积处理后的层输入图像进行上采样处理,得到与样本目标待提取图像对应的层输出边缘掩膜图像。
上采样模块还包括激活函数和二值化处理。经由每个边缘提取层的上采样处理后的图像经由激活函数(如:Sigmoid函数等)处理,可以将上采样处理后的图像中每个像素点的值转化至0到1之间,记为概率图像。概率图像往往为表征样本目标待提取图像中的每个像素点是否为边缘像素点的图像。由于需要得到与样本目标待提取图像对应的层输出边缘掩膜图像,即,得到像素概率值表示为0或1的图像,因此,可以通过二值化处理将概率图像转化为层输出边缘掩膜图像,例如:通过设定阈值的方式将概率图像中每个像素点的值转换为0或者1。
层输出边缘掩膜图像与样本目标边缘掩膜图像的尺寸相同。卷积模块用于进行卷积处理,上采样模块用于进行上采样处理,还可以用于进行激活和二值化处理。层输入图像可以是输入至边缘提取层的图像,示例性的,若当前边缘提取层为初始深度学习模型中的第一个边缘提取层,则当前边缘提取层的层输入图像为样本目标待提取图像;若当前边缘提取层为初始深度学习模型中的第二个边缘提取层或第二个边缘提取层之后的边缘提取层,则当前边缘提取层的层输入图像为当前边缘提取层的上一边缘提取层的层输出边缘掩膜图像。
针对初始深度学习模型中每一个边缘提取层,通过边缘提取层的卷积模块将边缘提取层的层输入图像进行卷积处理,卷积处理后的层输入图像的尺寸与原始的层输入图像的尺寸不同,因此,通过上采样模块对卷积处理后的层输入图像进行上采样处理,以使卷积处理后的层输入图像的尺寸恢复至样本目标边缘掩膜图像的尺寸。进而,将上采样处理后的层输入图像通过激活函数和二值化处理得到与样本目标待提取图像对应的层输出边缘掩膜图像。
S440、根据每一个边缘提取层所输出的层输出边缘掩膜图像、与样本目标待提取图像对应的样本目标边缘掩膜图像以及初始深度学习模型的损失函数确定初始深度学习模型的目标损失。
初始深度学习模型的损失函数可以是预先设定的用于确定损失的函数。损失函数可以是均方差损失(Mean Square Error Loss,MSE Loss)、平均绝对误差损失(Mean Absolute Error Loss,MAE Loss)等。初始深度学习模型的目标损失可以是用于表示初始深度学习模型的多个层输出边缘掩膜图像与样本目标待提取图像之间差异进行综合衡量得到的数值。
针对每一个边缘提取层所输出的层输出边缘掩膜图像,根据该层输出边缘掩膜图像和与样本目标待提取图像对应的样本目标边缘掩膜图像,通过初始深度学学习模型的损失函数进行计算,能够确定每个边缘提取层对应的损失,进而,根据确定出的损失可以得到整个初始深度学习模型的目标损失。
在本公开实施例技术方案的基础上,可以根据下述步骤确定初始深度学习模型的目标损失函数:
步骤一、针对每一个边缘提取层所输出的层输出边缘掩膜图像,根据初始深度学习模型的损失函数计算层输出边缘掩膜图像和与样本目标待提取图像对应的样本目标边缘掩膜图像之间的层输出损失。
层输出损失可以是层输出边缘掩膜图像和与样本目标待提取图像对应的样本目标边缘掩膜图像之间的差异信息。
针对每一个边缘提取层所输出的层输出边缘掩膜图像,将层输出边缘掩膜图像和与样本目标待提取图像对应的样本目标边缘掩膜图像通过初始深度学习模型的损失函数进行计算,得到该边缘提取层所对应的层输出损失。
步骤二、根据多个边缘提取层对应的层输出损失确定初始深度学习模型的初始损失,根据初始损失函数确定目标损失。
初始损失可以是根据多个层输出损失综合确定的损失。
在获取多个边缘提取层对应的层输出损失后,可以根据多个层输出损失进行整合分析,确定初始深度学习模型的初始损失。进而,可以将初始损失确定为目标损失,还可以对初始损失进行放缩处理和/或添加其余项的处理,将处理后的初始损失作为目标损失。
在本公开实施例技术方案的基础上,可以通过下述步骤根据初始损失确定目标损失:
步骤一、将样本目标边缘掩膜图像中的边缘像素点作为正样本像素点,将样本目标边缘掩膜图像中除边缘像素点之外的像素点作为负样本像素点。
边缘像素点可以是描述图像边缘的像素点,正样本像素点即为样本目标边缘掩膜图像中的边缘像素点。负样本像素点是样本目标边缘掩膜图像中除边缘像素点之外的多个像素点,即样本目标边缘掩膜图像中的非边缘像素点,还可以认为是样本目标边缘掩膜图像中除正样本像素点之外的其他像素点。
步骤二、确定正样本像素点在样本目标边缘掩膜图像中的正样本像素点数量,确定负样本像素点在样本目标边缘掩膜图像中的负样本像素点数量,并确定样本目标边缘掩膜图像的总像素点数量。
正样本像素点数量可以是样本目标边缘掩膜图像中的正样本像素点的总数量。负样本像素点数量可以是样本目标边缘掩膜图像中的负样本像素点的总数量。总像素点数量是样本目标边缘掩膜图像中像素点的总数量,即正样本像素点数量和负样本像素点数量之和。
可以对样本目标边缘掩膜图像中的正样本像素点计数,得到正样本像素点数量。也可以对样本目标边缘掩膜图像中的负样本像素点计数,得到负样本像素点数量。还可以对样本目标边缘掩膜图像中的全部像素点计数,得到总像素点数量。由于,正样本像素点数量和负样本像素点数量之和为总像素点数量,因此,在确定其中任意两个数值后可以通过计算确定另一个数值。
步骤三、根据正样本像素点数量、负样本像素点数量和总像素点数量计算样本目标待提取图像中的每个像素点对应的像素点损失权重。
像素点损失权重可以是计算像素点的损失值时使用的权重,与该像素点是正样本像素点还是负样本像素点相关。
可以将正样本像素点数量与总像素点数量的比值作为样本目标待提取图像中的每个正样本像素点对应的像素点损失权重,将负样本像素点数量与总像素点数量的比值作为样本目标待提取图像中的每个负样本像素点对应的像素点损失权重。
还可以根据正样本像素点数量、负样本像素点数量和总像素点数量进行其他的数学计算处理,得到每个像素点对应的像素点损失权重,在本实施例中不做限定。
步骤四、根据每个像素点对应的像素点损失权重对初始损失进行加权,得到每个像素点对应的目标损失。
在确定每个像素点的像素点损失权重之后,将每个像素点的损失权重与初始损失分别相乘,得到每个像素点对应的目标损失。
若想要根据多个像素点对应的目标损失得到初始深度学习模型的目标损失,则可以对多个像素点对应的目标损失进行数学计算,例如:求和或求平均等,在本实施例中不做限定。
通过上述方式根据每个像素点对应的像素点损失权重对初始损失进行加权的原因在于:在样本目标边缘掩膜图像中,正样本像素点数量远小于负样本像素点数量,会存在样本数量不均衡的问题,会导致损失计算不准确的问题,影响后续的初始深度学习模型的训练。设置像素点损失权重,能够有效地调节由于样本数量不均衡造成的影响。
S450、基于目标损失对初始深度学习模型进行模型参数调整,以得到目标 边缘提取模型。
若目标损失不符合预设需求,则对初始深度学习模型的模型参数进行调整,以提高模型效果;若目标损失符合预设需求,则将当前的初始深度学习模型作为目标边缘提取模型,当前的初始深度学习模型为与目标损失相对应的网络模型,可以是进行模型参数调整后的模型。
本公开实施例的技术方案,通过获取样本初始待提取图像以及与样本初始待提取图像对应的样本初始边缘掩膜图像,对样本初始待提取图像进行图像增强处理,得到目标尺寸的样本目标待提取图像,并对样本初始边缘掩膜图像进行图像增强处理,得到目标尺寸的样本目标边缘掩膜图像,以进行样本扩充并提高图像质量。初始深度学习模型包括至少两个边缘提取层,将样本目标待提取图像输入至初始深度学习模型中,得到初始深度学习模型中每一个边缘提取层所输出的与样本目标待提取图像对应的层输出边缘掩膜图像,进而,根据每一个边缘提取层所输出的层输出边缘掩膜图像、与样本目标待提取图像对应的样本目标边缘掩膜图像以及初始深度学习模型的损失函数确定初始深度学习模型的目标损失,以使目标损失覆盖多个边缘提取层,提高目标损失计算的可靠性,解决了根据总的模型输出结果确定目标损失时,目标损失确定不准确的问题,以及由于目标损失不准确导致的模型参数调整不准确的问题,实现了更为精准地确定目标损失,使目标边缘提取模型的训练效果更好,以更精确地提取图像中的边缘信息。
实施例五
本公开实施例五提供了一种边缘提取和模型训练方法,包括:
1、从网络数据库中获取样本初始待提取图像集合A[A1,A2,…,An]以及与样本初始待提取图像对应的样本初始边缘掩膜图像集合B[B1,B2,…,Bn]。
示例性的,从Berkeley分割数据集和基准(The Berkeley Segmentation Dataset and Benchmark,BSDS)数据库获取PASCAL and labelled data。
2、针对样本初始待提取图像集合A中的每一个样本初始待提取图像,进行锐化处理后再进行缩放处理,得到第一尺寸的样本初始待提取图像集合A’[A’1,A’2,…,A’n],并对样本初始待提取图像集合A’中的每一个样本初始待提取图像进行裁剪处理和最近邻插值处理,得到目标尺寸的样本目标待提取图像集合A”[A”1,A”2,…,A”n]。
示例性的,image(样本初始待提取图像)->sharp(锐化处理)->scale(0.5,2.0)(长度和宽度做0.5到2倍范围的随机缩放)->nearset resize(最近 邻插值)。其中,样本初始待提取图像的示意图如图5所示,样本目标待提取图像的示意图如图6所示。
3、针对样本初始边缘掩膜图像集合B中的每一个样本初始边缘掩膜图像,进行膨胀处理后再进行缩放处理,得到第二尺寸的样本初始边缘掩膜图像集合B’[B’1,B’2,…,B’n],并对样本初始边缘掩膜图像集合B’中的每一个样本初始边缘掩膜图像集合进行裁剪处理和最近邻插值处理并做细化处理,得到目标尺寸的样本目标边缘掩膜图像集合B”[B”1,B”2,…,B”n]。
示例性的,mask(样本初始边缘掩膜图像)->cv2.dilate(膨胀处理)->scale(0.5,2.0)(长度和宽度做0.5到2倍范围的随机缩放)->nearset resize(最近邻插值)->cv2.thinning(细化处理)。例如:样本初始边缘掩膜图像的尺寸为1024×768,第二尺寸为512×1536,目标尺寸为512×512。
4、将样本目标待提取图像集合A”中的多个样本目标待提取图像输入至初始深度学习模型中,针对每一个样本目标待提取图像可以得到多个边缘提取层所输出的层输出边缘掩膜图像,将多个层输出边缘掩膜图像分别和与该样本目标待提取图像相对应的目标边缘掩膜图像进行损失计算,得到初始损失。
示例性的,初始深度学习模型具有5个边缘提取层,样本目标待提取图像A”m经由初始深度学习模型处理,根据第一个边缘提取层的层输出边缘掩膜图像Am1和样本目标边缘掩膜图像”Bm,可以确定层输出损失Loss1,基于类似方式,可以确定层输出损失Loss2、Loss3、Loss4和Loss5。
5、针对每一个样本目标待提取图像中的正样本像素点数量、负样本像素点数量和总像素点数量计算样本目标待提取图像中的每个像素点对应的像素点损失权重,并根据每个像素点对应的像素点损失权重对初始损失进行加权,得到每个像素点对应的目标损失。
6、根据每个像素点对应的目标损失,确定每个样本目标待提取图像的目标损失,进而,确定初始深度学习模型的目标损失,以对初始深度学习模型进行模型参数调整,得到目标边缘提取模型。
7、将目标待提取图像C输入至目标边缘提取模型中,得到目标边缘掩膜图像D。
若目标边缘提取模型是经由低分辨率(例如:512×512分辨率)的样本初始待提取图像集合和样本初始边缘掩膜图像集合训练得到的,则该目标边缘提取模型也可以用于更高分辨率(例如:1024x1024分辨率)的目标待提取图像的边缘提取。
示例性的,目标边缘提取模型输出的目标边缘掩膜图像的示意图如图7所 示。
8、基于预设的颜色查找表对目标边缘掩膜图像D进行图像亮度调整。
示例性的,图像亮度调整后的目标边缘掩膜图像的示意图如图8所示。
9、基于预设的轮廓识别算法对目标边缘掩膜图像中的边缘像素点进行识别,并将识别到的边缘像素点以点向量的形式进行存储。
示例性的,通过find contour(轮廓识别算法)+cv2.thinning(细化处理),得到精细的轮廓,并得到每个边缘像素点的点向量形式,以便于后续进行动态的边缘线条处理。
本公开实施例的技术方案,通过获取样本初始待提取图像集合以及与样本初始待提取图像对应的样本初始边缘掩膜图像集合,对多个样本初始待提取图像进行图像增强处理,得到目标尺寸的多个样本目标待提取图像,并对多个样本初始边缘掩膜图像进行图像增强处理,得到目标尺寸的多个样本目标边缘掩膜图像,以进行样本扩充并提高图像质量,根据多个样本目标待提取图像以及与多个样本目标待提取图像对应的多个样本目标边缘掩膜图像对初始深度学习模型进行训练,得到目标边缘提取模型,解决了图像边缘提取结果粗糙,不够精细的问题,实现了更为精准地提取图像中的边缘信息的效果。
实施例六
图9为本公开实施例六所提供的一种边缘提取装置和模型训练装置的结构示意图,本实施例所提供的边缘提取装置51和模型训练装置52可以通过软件和/或硬件来实现,可配置于终端和/或服务器中来实现本公开实施例中的边缘提取方法。
边缘提取装置51可包括:图像获取模块510以及边缘提取模块520。
图像获取模块510,设置为获取目标待提取图像;边缘提取模块520,设置为将所述目标待提取图像输入至目标边缘提取模型中,得到与所述目标待提取图像对应的目标边缘掩膜图像。
模型训练装置52可包括:样本获取模块530、样本增强模块540以及模型训练模块550。
样本获取模块530,设置为获取样本初始待提取图像以及与所述样本初始待提取图像对应的样本初始边缘掩膜图像;样本增强模块540,设置为对所述样本初始待提取图像进行图像增强处理,得到目标尺寸的样本目标待提取图像,并对所述样本初始边缘掩膜图像进行图像增强处理,得到所述目标尺寸的样本目 标边缘掩膜图像;模型训练模块550,设置为根据所述样本目标待提取图像以及与所述样本目标待提取图像对应的样本目标边缘掩膜图像对初始深度学习模型进行训练,得到目标边缘提取模型。
在本公开实施例中任一技术方案的基础上,所述样本增强模块540,还设置为对所述样本初始待提取图像进行缩放处理,得到第一尺寸的样本初始待提取图像;根据最近邻插值方法对所述第一尺寸的样本初始待提取图像进行插值处理,得到目标尺寸的样本目标待提取图像。
在本公开实施例中任一技术方案的基础上,所述样本增强模块540,还设置为根据预设尺寸变换范围对所述样本初始待提取图像的长度和宽度分别进行缩放处理。
在本公开实施例中任一技术方案的基础上,模型训练装置52还包括:图像锐化模块,设置为所述样本初始待提取图像进行锐化处理。
在本公开实施例中任一技术方案的基础上,所述样本增强模块540,还设置为对所述样本初始边缘掩膜图像进行缩放处理,得到第二尺寸的样本初始边缘掩膜图像;根据最近邻插值方法对所述第二尺寸的样本初始边缘掩膜图像进行插值处理,得到目标尺寸的样本目标边缘掩膜图像。
在本公开实施例中任一技术方案的基础上,模型训练装置52还包括:图像膨胀模块,设置为对所述样本初始边缘掩膜图像进行膨胀处理;模型训练装置52还包括:图像细化模块,设置为对所述样本初始边缘掩膜图像进行细化处理。
在本公开实施例中任一技术方案的基础上,所述初始深度学习模型包括至少两个边缘提取层;所述模型训练模块550,设置为将所述样本目标待提取图像输入至初始深度学习模型中,得到所述初始深度学习模型中每一个边缘提取层所输出的与所述样本目标待提取图像对应的层输出边缘掩膜图像;根据每一个边缘提取层所输出的所述层输出边缘掩膜图像、与所述样本目标待提取图像对应的样本目标边缘掩膜图像以及所述初始深度学习模型的损失函数确定所述初始深度学习模型的目标损失;基于所述目标损失对所述初始深度学习模型进行模型参数调整,以得到目标边缘提取模型。
在本公开实施例中任一技术方案的基础上,所述模型训练模块550,还设置为针对每一个边缘提取层所输出的所述层输出边缘掩膜图像,根据所述初始深度学习模型的损失函数计算所述层输出边缘掩膜图像和与所述样本目标待提取图像对应的样本目标边缘掩膜图像之间的层输出损失;根据多个边缘提取层对应的层输出损失确定所述初始深度学习模型的初始损失,根据所述初始损失确定目标损失。
在本公开实施例中任一技术方案的基础上,所述模型训练模块550,还设置为将所述样本目标边缘掩膜图像中的边缘像素点作为正样本像素点,将所述样本目标边缘掩膜图像中除边缘像素点之外的像素点作为负样本像素点;确定所述正样本像素点在所述样本目标边缘掩膜图像中的正样本像素点数量,确定所述负样本像素点在所述样本目标边缘掩膜图像中的负样本像素点数量,并确定所述样本目标边缘掩膜图像的总像素点数量;根据所述正样本像素点数量、所述负样本像素点数量和所述总像素点数量计算所述样本目标待提取图像中的每个像素点对应的像素点损失权重;分别根据每个像素点对应的像素点损失权重对所述初始损失进行加权,得到每个像素点对应的目标损失。
在本公开实施例中任一技术方案的基础上,所述边缘提取层包括卷积模块和上采样模块;所述模型训练模块550,还设置为针对所述初始深度学习模型中每一个边缘提取层,通过所述边缘提取层的卷积模块将所述边缘提取层的层输入图像进行卷积处理,并通过上采样模块对卷积处理后的层输入图像进行上采样处理,得到与所述样本目标待提取图像对应的层输出边缘掩膜图像,其中,所述层输出边缘掩膜图像与所述样本目标边缘掩膜图像的尺寸相同。
在本公开实施例中任一技术方案的基础上,边缘提取装置51还包括:亮度调整模块,设置为基于预设的颜色查找表对所述目标边缘掩膜图像进行图像亮度调整。
在本公开实施例中任一技术方案的基础上,边缘提取装置51还包括:轮廓识别模块,设置为基于预设的轮廓识别算法对所述目标边缘掩膜图像中的边缘像素点进行识别,并将识别到的边缘像素点以点向量的形式进行存储。
在本公开实施例中任一技术方案的基础上,所述初始深度学习模型包括卷积神经网络模型,所述卷积神经网络模型包括u2net模型、unet模型、deeplab模型、transformer模型以及pidinet模型中的至少一种。
上述装置可执行本公开任意实施例所提供的方法,具备执行方法相应的功能模块和效果。
本公开实施例的技术方案,通过获取目标待提取图像,将目标待提取图像输入至目标边缘提取模型中,得到与目标待提取图像对应的目标边缘掩膜图像,以进行图像的边缘提取。并且,通过获取样本初始待提取图像以及与样本初始待提取图像对应的样本初始边缘掩膜图像,对样本初始待提取图像进行图像增强处理,得到目标尺寸的样本目标待提取图像,并对样本初始边缘掩膜图像进行图像增强处理,得到目标尺寸的样本目标边缘掩膜图像,以进行样本扩充并提高图像质量,根据样本目标待提取图像以及与样本目标待提取图像对应的样本目标边缘掩膜图像对初始深度学习模型进行训练,得到目标边缘提取模型, 解决了图像边缘提取结果粗糙,不够精细的问题,实现了更为精准地提取图像中的边缘信息的效果。
上述装置所包括的多个单元和模块只是按照功能逻辑进行划分的,但并不局限于上述的划分,只要能够实现相应的功能即可;另外,多个功能单元的名称也只是为了便于相互区分,并不用于限制本公开实施例的保护范围。
实施例七
图10为本公开实施例七所提供的一种电子设备的结构示意图。下面参考图10,其示出了适于用来实现本公开实施例的电子设备(例如图10中的终端设备或服务器)600的结构示意图。本公开实施例中的终端设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、个人数字助理(Personal Digital Assistant,PDA)、平板电脑(Portable Android Device,PAD)、便携式多媒体播放器(Portable Media Player,PMP)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字电视(Television,TV)、台式计算机等等的固定终端。图10示出的电子设备600仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图10所示,电子设备600可以包括处理装置(例如中央处理器、图形处理器等)601,其可以根据存储在只读存储器(Read-Only Memory,ROM)602中的程序或者从存储装置608加载到随机访问存储器(Random Access Memory,RAM)603中的程序而执行多种适当的动作和处理。在RAM 603中,还存储有电子设备600操作所需的多种程序和数据。处理装置601、ROM 602以及RAM 603通过总线605彼此相连。编辑/输出(Input/Output,I/O)接口604也连接至总线605。
通常,以下装置可以连接至I/O接口604:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置606;包括例如液晶显示器(Liquid Crystal Display,LCD)、扬声器、振动器等的输出装置607;包括例如磁带、硬盘等的存储装置608;以及通信装置609。通信装置609可以允许电子设备600与其他设备进行无线或有线通信以交换数据。虽然图10示出了具有多种装置的电子设备600,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的 方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置609从网络上被下载和安装,或者从存储装置608被安装,或者从ROM 602被安装。在该计算机程序被处理装置601执行时,执行本公开实施例的方法中限定的上述功能。
本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。
本公开实施例提供的电子设备与上述实施例提供的边缘提取方法属于同一构思,未在本实施例中详尽描述的技术细节可参见上述实施例,并且本实施例与上述实施例具有相同的效果。
实施例八
本公开实施例提供了一种计算机存储介质,其上存储有计算机程序,该程序被处理器执行时实现上述实施例所提供的边缘提取方法。
本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、RAM、ROM、可擦式可编程只读存储器(Erasable Programmable Read-Only Memory,EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(Compact Disc Read-Only Memory,CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、射频(Radio Frequency,RF)等等,或者上述的任意合适的组合。
在一些实施方式中,客户端、服务器可以利用诸如超文本传输协议(HyperText Transfer Protocol,HTTP)之类的任何当前已知或未来研发的网络 协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(Local Area Network,LAN),广域网(Wide Area Network,WAN),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:
获取目标待提取图像;将所述目标待提取图像输入至目标边缘提取模型中,得到与所述目标待提取图像对应的目标边缘掩膜图像;其中,所述目标边缘提取模型基于下述方法训练得到:获取样本初始待提取图像以及与所述样本初始待提取图像对应的样本初始边缘掩膜图像;对所述样本初始待提取图像进行图像增强处理,得到目标尺寸的样本目标待提取图像,并对所述样本初始边缘掩膜图像进行图像增强处理,得到所述目标尺寸的样本目标边缘掩膜图像;根据所述样本目标待提取图像以及与所述样本目标待提取图像对应的样本目标边缘掩膜图像对初始深度学习模型进行训练,得到目标边缘提取模型。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括LAN或WAN—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开多种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用 硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元的名称在一种情况下并不构成对该单元本身的限定。
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(Field Programmable Gate Array,FPGA)、专用集成电路(Application Specific Integrated Circuit,ASIC)、专用标准产品(Application Specific Standard Parts,ASSP)、片上系统(System on Chip,SOC)、复杂可编程逻辑设备(Complex Programming logic device,CPLD)等等。
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、RAM、ROM、可EPROM或快闪存储器、光纤、CD-ROM、光学储存设备、磁储存设备、或上述内容的任何合适组合。
根据本公开的一个或多个实施例,【示例一】提供了一种边缘提取方法,该方法包括:
获取目标待提取图像;
将所述目标待提取图像输入至目标边缘提取模型中,得到与所述目标待提取图像对应的目标边缘掩膜图像;
其中,所述目标边缘提取模型基于下述方法训练得到:
获取样本初始待提取图像以及与所述样本初始待提取图像对应的样本初始边缘掩膜图像;
对所述样本初始待提取图像进行图像增强处理,得到目标尺寸的样本目标待提取图像,并对所述样本初始边缘掩膜图像进行图像增强处理,得到所述目标尺寸的样本目标边缘掩膜图像;
根据所述样本目标待提取图像以及与所述样本目标待提取图像对应的样本目标边缘掩膜图像对初始深度学习模型进行训练,得到目标边缘提取模型。
根据本公开的一个或多个实施例,【示例二】提供了一种边缘提取方法, 该方法还包括:
对所述样本初始待提取图像进行图像增强处理,得到目标尺寸的样本目标待提取图像,包括:
对所述样本初始待提取图像进行缩放处理,得到第一尺寸的样本初始待提取图像;
根据最近邻插值方法对所述第一尺寸的样本初始待提取图像进行插值处理,得到目标尺寸的样本目标待提取图像。
根据本公开的一个或多个实施例,【示例三】提供了一种边缘提取方法,该方法还包括:
对所述样本初始待提取图像进行缩放处理,包括:
根据预设尺寸变换范围对所述样本初始待提取图像的长度和宽度分别进行缩放处理。
根据本公开的一个或多个实施例,【示例四】提供了一种边缘提取方法,该方法还包括:
在所述对所述样本初始待提取图像进行缩放处理之前,还包括:
对所述样本初始待提取图像进行锐化处理。
根据本公开的一个或多个实施例,【示例五】提供了一种边缘提取方法,该方法还包括:
对所述样本初始边缘掩膜图像进行图像增强处理,得到所述目标尺寸的样本目标边缘掩膜图像,包括:
对所述样本初始边缘掩膜图像进行缩放处理,得到第二尺寸的样本初始边缘掩膜图像;
根据最近邻插值方法对所述第二尺寸的样本初始边缘掩膜图像进行插值处理,得到目标尺寸的样本目标边缘掩膜图像。
根据本公开的一个或多个实施例,【示例六】提供了一种边缘提取方法,该方法还包括:
在所述对所述样本初始边缘掩膜图像进行缩放处理之前,还包括:
对所述样本初始边缘掩膜图像进行膨胀处理;
在所述根据最近邻插值方法对所述第二尺寸的样本初始边缘掩膜图像进行插值处理之后,所述得到目标尺寸的样本目标边缘掩膜图像之前,还包括:
对所述样本初始边缘掩膜图像进行细化处理。
根据本公开的一个或多个实施例,【示例七】提供了一种边缘提取方法,该方法还包括:
所述初始深度学习模型包括至少两个边缘提取层;
所述根据所述样本目标待提取图像以及与所述样本目标待提取图像对应的样本目标边缘掩膜图像对初始深度学习模型进行训练,得到目标边缘提取模型,包括:
将所述样本目标待提取图像输入至初始深度学习模型中,得到所述初始深度学习模型中每一个边缘提取层所输出的与所述样本目标待提取图像对应的层输出边缘掩膜图像;
根据每一个边缘提取层所输出的所述层输出边缘掩膜图像、与所述样本目标待提取图像对应的样本目标边缘掩膜图像以及所述初始深度学习模型的损失函数确定所述初始深度学习模型的目标损失;
基于所述目标损失对所述初始深度学习模型进行模型参数调整,以得到目标边缘提取模型。
根据本公开的一个或多个实施例,【示例八】提供了一种边缘提取方法,该方法还包括:
根据每一个边缘提取层所输出的所述层输出边缘掩膜图像、与所述样本目标待提取图像对应的样本目标边缘掩膜图像以及所述初始深度学习模型的损失函数确定所述初始深度学习模型的目标损失,包括:
针对每一个边缘提取层所输出的所述层输出边缘掩膜图像,根据所述初始深度学习模型的损失函数计算所述层输出边缘掩膜图像和与所述样本目标待提取图像对应的样本目标边缘掩膜图像之间的层输出损失;
根据多个边缘提取层对应的层输出损失确定所述初始深度学习模型的初始损失,根据所述初始损失确定目标损失。
根据本公开的一个或多个实施例,【示例九】提供了一种边缘提取方法,该方法还包括:
根据所述初始损失确定目标损失,包括:
将所述样本目标边缘掩膜图像中的边缘像素点作为正样本像素点,将所述样本目标边缘掩膜图像中除边缘像素点之外的像素点作为负样本像素点;
确定所述正样本像素点在所述样本目标边缘掩膜图像中的正样本像素点数量,确定所述负样本像素点在所述样本目标边缘掩膜图像中的负样本像素点数 量,并确定所述样本目标边缘掩膜图像的总像素点数量;
根据所述正样本像素点数量、所述负样本像素点数量和所述总像素点数量计算所述样本目标待提取图像中的每个像素点对应的像素点损失权重;
分别根据每个像素点对应的像素点损失权重对所述初始损失进行加权,得到每个像素点对应的目标损失。
根据本公开的一个或多个实施例,【示例十】提供了一种边缘提取方法,该方法还包括:
所述边缘提取层包括卷积模块和上采样模块;
所述得到所述初始深度学习模型中每一个边缘提取层所输出的与所述样本目标待提取图像对应的层输出边缘掩膜图像,包括:
针对所述初始深度学习模型中每一个边缘提取层,通过所述边缘提取层的卷积模块将所述边缘提取层的层输入图像进行卷积处理,并通过上采样模块对卷积处理后的层输入图像进行上采样处理,得到与所述样本目标待提取图像对应的层输出边缘掩膜图像,其中,所述层输出边缘掩膜图像与所述样本目标边缘掩膜图像的尺寸相同。
根据本公开的一个或多个实施例,【示例十一】提供了一种边缘提取方法,该方法还包括:
在所述得到与所述目标待提取图像对应的目标边缘掩膜图像之后,还包括:
基于预设的颜色查找表对所述目标边缘掩膜图像进行图像亮度调整。
根据本公开的一个或多个实施例,【示例十二】提供了一种边缘提取方法,该方法还包括:
在所述得到与所述目标待提取图像对应的目标边缘掩膜图像之后,还包括:
基于预设的轮廓识别算法对所述目标边缘掩膜图像中的边缘像素点进行识别,并将识别到的边缘像素点以点向量的形式进行存储。
根据本公开的一个或多个实施例,【示例十三】提供了一种边缘提取方法,该方法还包括:
所述初始深度学习模型包括卷积神经网络模型,所述卷积神经网络模型包括u2net模型、unet模型、deeplab模型、transformer模型以及pidinet模型中的至少一种。
根据本公开的一个或多个实施例,【示例十四】提供了一种边缘提取装置,该装置包括:
图像获取模块,设置为获取目标待提取图像;
边缘提取模块,设置为将所述目标待提取图像输入至目标边缘提取模型中,得到与所述目标待提取图像对应的目标边缘掩膜图像;
其中,所述目标边缘提取模型基于模型训练装置得到,所述模型训练装置包括:
样本获取模块,设置为获取样本初始待提取图像以及与所述样本初始待提取图像对应的样本初始边缘掩膜图像;
样本增强模块,设置为对所述样本初始待提取图像进行图像增强处理,得到目标尺寸的样本目标待提取图像,并对所述样本初始边缘掩膜图像进行图像增强处理,得到所述目标尺寸的样本目标边缘掩膜图像;
模型训练模块,设置为根据所述样本目标待提取图像以及与所述样本目标待提取图像对应的样本目标边缘掩膜图像对初始深度学习模型进行训练,得到目标边缘提取模型。
此外,虽然采用特定次序描绘了多个操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了多个实现细节,但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的一些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的多种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。

Claims (17)

  1. 一种边缘提取方法,包括:
    获取目标待提取图像;
    将所述目标待提取图像输入至目标边缘提取模型中,得到与所述目标待提取图像对应的目标边缘掩膜图像;
    其中,所述目标边缘提取模型基于下述方法训练得到:
    获取样本初始待提取图像以及与所述样本初始待提取图像对应的样本初始边缘掩膜图像;
    对所述样本初始待提取图像进行图像增强处理,得到目标尺寸的样本目标待提取图像,并对所述样本初始边缘掩膜图像进行图像增强处理,得到所述目标尺寸的样本目标边缘掩膜图像;
    根据所述样本目标待提取图像以及与所述样本目标待提取图像对应的样本目标边缘掩膜图像对初始深度学习模型进行训练,得到所述目标边缘提取模型。
  2. 根据权利要求1所述的方法,其中,所述对所述样本初始待提取图像进行图像增强处理,得到目标尺寸的样本目标待提取图像,包括:
    对所述样本初始待提取图像进行缩放处理,得到第一尺寸的样本初始待提取图像;
    根据最近邻插值方法对所述第一尺寸的样本初始待提取图像进行插值处理,得到所述目标尺寸的样本目标待提取图像。
  3. 根据权利要求2所述的方法,其中,所述对所述样本初始待提取图像进行缩放处理,包括:
    根据预设尺寸变换范围对所述样本初始待提取图像的长度和宽度分别进行缩放处理。
  4. 根据权利要求2所述的方法,其中,在所述对所述样本初始待提取图像进行缩放处理之前,还包括:
    对所述样本初始待提取图像进行锐化处理。
  5. 根据权利要求1所述的方法,其中,所述对所述样本初始边缘掩膜图像进行图像增强处理,得到所述目标尺寸的样本目标边缘掩膜图像,包括:
    对所述样本初始边缘掩膜图像进行缩放处理,得到第二尺寸的样本初始边缘掩膜图像;
    根据最近邻插值方法对所述第二尺寸的样本初始边缘掩膜图像进行插值处 理,得到所述目标尺寸的样本目标边缘掩膜图像。
  6. 根据权利要求5所述的方法,其中,在所述对所述样本初始边缘掩膜图像进行缩放处理之前,还包括:
    对所述样本初始边缘掩膜图像进行膨胀处理;
    在所述根据最近邻插值方法对所述第二尺寸的样本初始边缘掩膜图像进行插值处理之后,所述得到所述目标尺寸的样本目标边缘掩膜图像之前,还包括:
    对所述样本初始边缘掩膜图像进行细化处理。
  7. 根据权利要求1所述的方法,其中,所述初始深度学习模型包括至少两个边缘提取层;
    所述根据所述样本目标待提取图像以及与所述样本目标待提取图像对应的样本目标边缘掩膜图像对初始深度学习模型进行训练,得到所述目标边缘提取模型,包括:
    将所述样本目标待提取图像输入至所述初始深度学习模型中,得到所述初始深度学习模型中每一个边缘提取层所输出的与所述样本目标待提取图像对应的层输出边缘掩膜图像;
    根据每一个边缘提取层所输出的层输出边缘掩膜图像、与所述样本目标待提取图像对应的样本目标边缘掩膜图像以及所述初始深度学习模型的损失函数确定所述初始深度学习模型的目标损失;
    基于所述目标损失对所述初始深度学习模型进行模型参数调整,以得到所述目标边缘提取模型。
  8. 根据权利要求7所述的方法,其中,所述根据每一个边缘提取层所输出的层输出边缘掩膜图像、与所述样本目标待提取图像对应的样本目标边缘掩膜图像以及所述初始深度学习模型的损失函数确定所述初始深度学习模型的目标损失,包括:
    针对每一个边缘提取层所输出的层输出边缘掩膜图像,根据所述初始深度学习模型的损失函数计算所述层输出边缘掩膜图像和与所述样本目标待提取图像对应的样本目标边缘掩膜图像之间的层输出损失;
    根据多个边缘提取层对应的层输出损失确定所述初始深度学习模型的初始损失,根据所述初始损失确定所述目标损失。
  9. 根据权利要求8所述的方法,其中,所述根据所述初始损失确定所述目标损失,包括:
    将所述样本目标边缘掩膜图像中的边缘像素点作为正样本像素点,将所述样本目标边缘掩膜图像中除边缘像素点之外的像素点作为负样本像素点;
    确定所述正样本像素点在所述样本目标边缘掩膜图像中的正样本像素点数量,确定所述负样本像素点在所述样本目标边缘掩膜图像中的负样本像素点数量,并确定所述样本目标边缘掩膜图像的总像素点数量;
    根据所述正样本像素点数量、所述负样本像素点数量和所述总像素点数量计算所述样本目标待提取图像中的每个像素点对应的像素点损失权重;
    根据每个像素点对应的像素点损失权重对所述初始损失进行加权,得到每个像素点对应的目标损失。
  10. 根据权利要求7所述的方法,其中,所述边缘提取层包括卷积模块和上采样模块;
    所述得到所述初始深度学习模型中每一个边缘提取层所输出的与所述样本目标待提取图像对应的层输出边缘掩膜图像,包括:
    针对所述初始深度学习模型中每一个边缘提取层,通过所述边缘提取层的卷积模块将所述边缘提取层的层输入图像进行卷积处理,并通过所述边缘提取层的上采样模块对卷积处理后的层输入图像进行上采样处理,得到与所述样本目标待提取图像对应的层输出边缘掩膜图像,其中,所述层输出边缘掩膜图像与所述样本目标边缘掩膜图像的尺寸相同。
  11. 根据权利要求1所述的方法,在所述得到与所述目标待提取图像对应的目标边缘掩膜图像之后,还包括:
    基于预设的颜色查找表对所述目标边缘掩膜图像进行图像亮度调整。
  12. 根据权利要求1所述的方法,在所述得到与所述目标待提取图像对应的目标边缘掩膜图像之后,还包括:
    基于预设的轮廓识别算法对所述目标边缘掩膜图像中的边缘像素点进行识别,并将识别到的边缘像素点以点向量的形式进行存储。
  13. 根据权利要求1所述的方法,其中,所述初始深度学习模型包括卷积神经网络模型,所述卷积神经网络模型包括u2net模型、unet模型、deeplab模型、transformer模型以及pidinet模型中的至少一种。
  14. 一种边缘提取装置,包括:
    图像获取模块,设置为获取目标待提取图像;
    边缘提取模块,设置为将所述目标待提取图像输入至目标边缘提取模型中, 得到与所述目标待提取图像对应的目标边缘掩膜图像;
    其中,所述目标边缘提取模型基于模型训练装置得到,所述模型训练装置包括:
    样本获取模块,设置为获取样本初始待提取图像以及与所述样本初始待提取图像对应的样本初始边缘掩膜图像;
    样本增强模块,设置为对所述样本初始待提取图像进行图像增强处理,得到目标尺寸的样本目标待提取图像,并对所述样本初始边缘掩膜图像进行图像增强处理,得到所述目标尺寸的样本目标边缘掩膜图像;
    模型训练模块,设置为根据所述样本目标待提取图像以及与所述样本目标待提取图像对应的样本目标边缘掩膜图像对初始深度学习模型进行训练,得到所述目标边缘提取模型。
  15. 一种电子设备,包括:
    至少一个处理器;
    存储装置,设置为存储至少一个程序,
    当所述至少一个程序被所述至少一个处理器执行,使得所述至少一个处理器实现如权利要求1-13中任一所述的边缘提取方法。
  16. 一种计算机可读存储介质,存储有计算机程序,所述程序被处理器执行时实现如权利要求1-13中任一所述的边缘提取方法。
  17. 一种计算机程序产品,包括承载在非暂态计算机可读介质上的计算机程序,所述计算机程序包含用于执行如权利要求1-13中任一所述的边缘提取方法的程序代码。
PCT/CN2023/072410 2022-01-20 2023-01-16 边缘提取方法、装置、电子设备及存储介质 WO2023138540A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210067538.9A CN114419086A (zh) 2022-01-20 2022-01-20 边缘提取方法、装置、电子设备及存储介质
CN202210067538.9 2022-01-20

Publications (1)

Publication Number Publication Date
WO2023138540A1 true WO2023138540A1 (zh) 2023-07-27

Family

ID=81275242

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/072410 WO2023138540A1 (zh) 2022-01-20 2023-01-16 边缘提取方法、装置、电子设备及存储介质

Country Status (2)

Country Link
CN (1) CN114419086A (zh)
WO (1) WO2023138540A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114419086A (zh) * 2022-01-20 2022-04-29 北京字跳网络技术有限公司 边缘提取方法、装置、电子设备及存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110660066A (zh) * 2019-09-29 2020-01-07 Oppo广东移动通信有限公司 网络的训练方法、图像处理方法、网络、终端设备及介质
WO2021258955A1 (zh) * 2020-06-24 2021-12-30 中兴通讯股份有限公司 目标图像中的对象轮廓的标注方法及装置、存储介质和电子装置
CN114419086A (zh) * 2022-01-20 2022-04-29 北京字跳网络技术有限公司 边缘提取方法、装置、电子设备及存储介质

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110660066A (zh) * 2019-09-29 2020-01-07 Oppo广东移动通信有限公司 网络的训练方法、图像处理方法、网络、终端设备及介质
WO2021258955A1 (zh) * 2020-06-24 2021-12-30 中兴通讯股份有限公司 目标图像中的对象轮廓的标注方法及装置、存储介质和电子装置
CN114419086A (zh) * 2022-01-20 2022-04-29 北京字跳网络技术有限公司 边缘提取方法、装置、电子设备及存储介质

Also Published As

Publication number Publication date
CN114419086A (zh) 2022-04-29

Similar Documents

Publication Publication Date Title
CN111275721B (zh) 一种图像分割方法、装置、电子设备及存储介质
CN110413812B (zh) 神经网络模型的训练方法、装置、电子设备及存储介质
CN112990219B (zh) 用于图像语义分割的方法和装置
CN110826567B (zh) 光学字符识别方法、装置、设备及存储介质
WO2023143178A1 (zh) 对象分割方法、装置、设备及存储介质
CN112084920B (zh) 提取热词的方法、装置、电子设备及介质
CN110211195B (zh) 生成图像集合的方法、装置、电子设备和计算机可读存储介质
WO2020062494A1 (zh) 图像处理方法和装置
WO2023138540A1 (zh) 边缘提取方法、装置、电子设备及存储介质
WO2023138549A1 (zh) 图像处理方法、装置、电子设备及存储介质
WO2023103887A1 (zh) 图像分割标签的生成方法、装置、电子设备及存储介质
WO2023083152A1 (zh) 图像分割方法、装置、设备及存储介质
CN112488095A (zh) 印章图像识别方法、装置和电子设备
WO2022028253A1 (zh) 定位模型优化方法、定位方法和定位设备以及存储介质
CN110738625B (zh) 图像重采样方法、装置、终端及计算机可读存储介质
WO2023093481A1 (zh) 基于傅里叶域的超分图像处理方法、装置、设备及介质
CN116912556A (zh) 图片分类方法、装置、电子设备及存储介质
CN110765304A (zh) 图像处理方法、装置、电子设备及计算机可读介质
WO2022105622A1 (zh) 图像分割方法、装置、可读介质及电子设备
CN114495080A (zh) 字体识别方法、装置、可读介质及电子设备
CN114399696A (zh) 一种目标检测方法、装置、存储介质及电子设备
CN112241744A (zh) 图像颜色迁移方法、装置、设备和计算机可读介质
CN112308809A (zh) 一种图像合成方法、装置、计算机设备及存储介质
WO2022194157A1 (zh) 一种目标跟踪方法、装置、设备及介质
WO2023093683A1 (zh) 图像剪裁方法、模型训练方法、装置、电子设备及介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23742855

Country of ref document: EP

Kind code of ref document: A1