An image edge detection method and system
By introducing a depthwise separable convolutional network and an improved eight-way difference operator using an adaptive thresholding method, combined with a multi-scale feature fusion network, an edge detection model is constructed. This solves the problems of low detection accuracy and efficiency in UAV obstacle detection, achieving more efficient and accurate obstacle detection.
Patent Information
- Application Number
- CN202211388079.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-08
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2042-11-08
AI Technical Summary
Existing image edge detection algorithms suffer from low detection accuracy and low efficiency in drone obstacle detection. In particular, methods based on convolutional neural networks are prone to gradient explosion or vanishing phenomena, which leads to a decrease in detection accuracy.
An edge detection model is constructed by using a depthwise separable convolutional network and an eight-way difference operator improved by adaptive thresholding, combined with a multi-scale feature fusion network. The accuracy and efficiency of edge detection are improved through a first feature extraction module, a second feature extraction module, a filtering module, and a feature fusion module.
It improves the accuracy and efficiency of obstacle detection during drone flight, reduces computational complexity, enhances robustness to noise, and improves the overall performance of edge detection.
Smart Images

Figure CN115908467B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of edge detection technology, and in particular to an image edge detection method and system. Background Technology
[0002] With the opening up of the field of Unmanned Aerial Vehicles (UAVs), UAV obstacle avoidance research has received increasing attention. Applying edge detection to the obstacle detection stage during UAV flight can effectively promote the development and application of UAV autonomous collision avoidance technology.
[0003] Image edges typically refer to the collection of pixels where image texture and color undergo abrupt changes, representing a concentrated manifestation of image feature information. Traditional edge detection algorithms are mainly based on morphology and differential operators. However, morphology-based algorithms have simple structural elements, are prone to contour shifting and merging, and have high computational complexity; differential operator-based algorithms are greatly affected by noise, and low grayscale edge points are easily lost.
[0004] In recent years, convolutional neural networks have made significant breakthroughs in edge detection. For example, multiple sub-neural networks are used to learn edge knowledge of the same image at different scales; and VGG16 networks are used to extract image edge features using edge difference maps and attention mechanisms. However, these methods still suffer from low detection accuracy. Furthermore, as the number of network layers increases, gradient explosion or vanishing phenomena occur, leading to a decrease in edge detection accuracy. ResNet networks introduce residual structures to ensure network performance, but still suffer from low detection efficiency. Therefore, obstacle detection accuracy and efficiency are low for drones during flight. Summary of the Invention
[0005] The purpose of this invention is to provide an image edge detection method and system that improves the efficiency and accuracy of edge detection, thereby improving the accuracy and efficiency of obstacle detection for UAVs during flight.
[0006] To achieve the above objectives, the present invention provides the following solution:
[0007] An image edge detection method, the method comprising:
[0008] Acquire the original image; the original image is an image of the environment in which the UAV is located;
[0009] The original image is input into an edge detection model to obtain an edge map of the original image; the edge map is used by the UAV for obstacle detection.
[0010] The edge detection model includes a first feature extraction module, a second feature extraction module, a filtering module, and a feature fusion module; the second feature extraction module is constructed from a depthwise separable convolutional network; the filtering module is constructed from an eight-way difference operator based on an adaptive thresholding method.
[0011] The first feature extraction module is used to perform edge detection on the original image to obtain an initial feature map;
[0012] The second feature extraction module is used to perform edge detection on the initial feature map to obtain multiple secondary extracted feature maps;
[0013] The filtering module is used to filter each of the secondary extracted feature maps by pixels to obtain multiple filtered feature maps.
[0014] The feature fusion module is used to superimpose and fuse each of the filtered feature maps to obtain the edge map.
[0015] Optionally, the second feature extraction module includes A depthwise separable convolutional networks, the filtering module includes A+1 eight-way difference operators, and the feature fusion module includes A multi-scale feature fusion networks; where A is a positive integer.
[0016] The first output of the first feature extraction module is connected to the input of the first depthwise separable convolutional network, and the second output of the first feature extraction module is connected to the input of the first eight-way difference operator.
[0017] The first output of the m-th depthwise separable convolutional network is connected to the input of the (m+1)-th depthwise separable convolutional network, and the second output of the m-th depthwise separable convolutional network is connected to the input of the (m+1)-th eight-way difference operator; the output of the m-th eight-way difference operator is connected to the first input of the (m+1)-th multi-scale feature fusion network, and the output of the (m+1)-th multi-scale feature fusion network is connected to the second input of the m-th multi-scale feature fusion network; 1 ≤ m < A.
[0018] Optionally, the eight-way difference operator is represented as:
[0019]
[0020] Wherein, g1(x,y) is the eight-way difference value of the pixel (x,y) of the image input to the eight-way difference operator;
[0021] g1(x,y)=(|Δ l |+|Δ r |+|Δ u |+|Δ d|+|Δ lu |+|Δ ld |+|Δ ru |+|Δ rd |)÷8;
[0022] Δ l = g(x,y-1)-g(x,y), Δ r = g(x,y+1)-g(x,y), Δ u = g(x-1,y)-g(x,y), Δ d = g(x+1,y)-g(x,y), Δ lu =g(x-1,y-1)-g(x,y), Δ ld =g(x+1,y-1)-g(x,y), Δ ru =g(x-1,y+1)-g(x,y), Δ rd = g(x+1,y+1)-g(x,y);
[0023] g(x,y) is the pixel value of pixel (x,y), Δ l Let g(x,y-1) be the first pixel difference, and g(x,y-1) be the pixel value of pixel (x,y-1). Δ r The second pixel difference is g(x,y+1), where g(x,y+1) is the pixel value at pixel (x,y+1), and Δ u The difference is the third pixel value, g(x-1,y) is the pixel value of pixel (x-1,y), and Δ d The difference is the fourth pixel value, g(x+1,y) is the pixel value of pixel (x+1,y), and Δ lu The difference is the fifth pixel value, where g(x-1,y-1) is the pixel value at (x-1,y-1), and Δ ld The difference is the sixth pixel value, where g(x+1,y-1) is the pixel value at (x+1,y-1), and Δ ru The difference is the seventh pixel value, where g(x-1,y+1) is the pixel value at (x-1,y+1), and Δ rd The difference is the eighth pixel value, and g(x+1,y+1) is the pixel value of pixel (x+1,y+1).
[0024] T = max(M×K + N×g) max (x,y),g ave (x,y));
[0025] T is the adaptive threshold for a pixel unit of the image input to the eight-way difference operator, where each pixel unit consists of 3 rows × 3 columns of pixels; M and N are both constants; K is the optimal threshold obtained by pixel binarization classification of the image input to the eight-way difference operator based on the maximum inter-class variance method; g max(x, y) represents the maximum pixel value of the pixel unit, g ave (x,y) represents the average pixel value of a pixel unit.
[0026] Optionally, the first feature extraction module includes: a 7*7 convolutional layer, a max pooling layer, and two 3*3 convolutional layers connected in sequence.
[0027] Optionally, the edge detection model further includes: an average pooling layer; the output of the first multi-scale feature fusion network is connected to the input of the average pooling layer.
[0028] An image edge detection system, the system comprising:
[0029] The original image acquisition module is used to acquire the original image; the original image is an image of the environment in which the UAV is located;
[0030] An edge detection module is used to input the original image into an edge detection model to obtain an edge map of the original image; the edge map is used by the UAV for obstacle detection.
[0031] The edge detection model includes a first feature extraction module, a second feature extraction module, a filtering module, and a feature fusion module; the second feature extraction module is constructed from a depthwise separable convolutional network; the filtering module is constructed from an eight-way difference operator based on an adaptive thresholding method.
[0032] The first feature extraction module is used to perform edge detection on the original image to obtain an initial feature map;
[0033] The second feature extraction module is used to perform edge detection on the initial feature map to obtain multiple secondary extracted feature maps;
[0034] The filtering module is used to filter each of the secondary extracted feature maps by pixels to obtain multiple filtered feature maps.
[0035] The feature fusion module is used to superimpose and fuse each of the filtered feature maps to obtain the edge map.
[0036] An electronic device, comprising:
[0037] One or more processors;
[0038] A storage device on which one or more programs are stored;
[0039] When the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to perform the method described above.
[0040] A storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method described above.
[0041] According to specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0042] This invention discloses an image edge detection method and system. The method includes: acquiring an original image; the original image is an image of the environment in which the UAV is located; inputting the original image into an edge detection model to obtain an edge map of the original image; the edge map is used by the UAV for obstacle detection; the edge detection model includes a first feature extraction module, a second feature extraction module, a filtering module, and a feature fusion module; the second feature extraction module is constructed from a depthwise separable convolutional network; the filtering module is constructed from an eight-way difference operator based on an adaptive thresholding method. This invention introduces a depthwise separable convolutional network, which improves the efficiency of edge detection; based on the improvement of the eight-way difference operator using an adaptive thresholding method and the introduction of a multi-scale feature fusion network, the accuracy of edge detection is improved, thereby improving the accuracy and efficiency of obstacle detection for UAVs during flight. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0044] Figure 1 This is a schematic diagram of the image edge detection method provided in Embodiment 1 of the present invention;
[0045] Figure 2 This is a schematic diagram of the edge detection model provided by the present invention;
[0046] Figure 3 This is a schematic diagram of a regular convolution.
[0047] Figure 4 A schematic diagram of depthwise convolution in depthwise separable convolution provided by the present invention;
[0048] Figure 5 A schematic diagram of pointwise convolution in depth-separable convolution provided by the present invention;
[0049] Figure 6 This is a schematic diagram of the image edge detection system provided in Embodiment 2 of the present invention. Detailed Implementation
[0050] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0051] The purpose of this invention is to provide an image edge detection method and system, which aims to improve the efficiency and accuracy of edge detection, thereby improving the accuracy and efficiency of obstacle detection during the flight of UAVs, and can be applied to the field of edge detection technology.
[0052] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0053] Example 1
[0054] Figure 1 This is a schematic diagram of the image edge detection method provided in Embodiment 1 of the present invention. Figure 2 A schematic diagram of the edge detection model provided by this invention is shown below. Figures 1-2 As shown, the image edge detection method in this embodiment includes:
[0055] Step 101: Obtain the original image; the original image is an image of the environment in which the drone is located.
[0056] Step 102: Input the original image into the edge detection model to obtain the edge map of the original image; the edge map is used by the UAV for obstacle detection.
[0057] The edge detection model includes a first feature extraction module, a second feature extraction module, a filtering module, and a feature fusion module; the second feature extraction module is constructed from a depthwise separable convolutional network; the filtering module is constructed from an eight-way difference operator based on an adaptive thresholding method.
[0058] The first feature extraction module is used to perform edge detection on the original image to obtain an initial feature map.
[0059] The second feature extraction module is used to perform edge detection on the initial feature map to obtain multiple secondary extracted feature maps.
[0060] The filtering module is used to filter pixels in each secondary extracted feature map to obtain multiple filtered feature maps.
[0061] The feature fusion module is used to overlay and fuse each filtered feature map to obtain an edge map.
[0062] Specifically, the feature fusion module is constructed based on multiple multi-scale feature fusion networks. Through the feature fusion module, rich detailed information contained in the low-level feature map is superimposed on the high-level feature map with more condensed semantic information, further refining the edge information of small targets.
[0063] The multi-scale feature fusion module consists of three paths: left, middle, and right. The left path, from bottom to top, extracts semantic features from the image layer by layer using three convolutional modules: low, middle, and high. The right path, from top to bottom, upsamples and amplifies high-level features, outputting a feature map at the same scale as adjacent convolutional stages. The middle path connects 1×1 convolutional kernels horizontally to obtain the same number of channels as the feature maps of adjacent stages, achieving cross-channel feature integration. Based on unifying the scale and number of channels of adjacent feature maps, pixel-level superposition and fusion of feature information is performed to output a feature map that fuses multi-scale information. Finally, edge pixels are calculated using an eight-way difference operator and the final edge information is output through a cascaded approach.
[0064] As an optional implementation, the second feature extraction module includes A depthwise separable convolutional networks, the filtering module includes A+1 eight-way difference operators, and the feature fusion module includes A multi-scale feature fusion networks; where A is a positive integer.
[0065] The first output of the first feature extraction module is connected to the input of the first depthwise separable convolutional network, and the second output of the first feature extraction module is connected to the input of the first eight-way difference operator.
[0066] The first output of the m-th depthwise separable convolutional network is connected to the input of the (m+1)-th depthwise separable convolutional network, and the second output of the m-th depthwise separable convolutional network is connected to the input of the (m+1)-th octagonal difference operator; the output of the m-th octagonal difference operator is connected to the first input of the (m+1)-th multi-scale feature fusion network, and the output of the (m+1)-th multi-scale feature fusion network is connected to the second input of the m-th multi-scale feature fusion network; 1 ≤ m < A.
[0067] Specifically, depthwise separable convolutional networks include depthwise convolution and pointwise convolution. Depthwise convolution convolves the input RGB feature map into three channels to obtain three-channel feature maps. Then, pointwise convolution combines the three-channel feature maps into a single feature map. In this process, the feature information of the feature map is more obvious, and the number of module parameters is reduced compared with traditional convolution.
[0068] In edge detection, the convolution kernel acts like a filter, and changes in the convolution method directly affect the feature extraction effect. However, as the network depth increases, the parameters of conventional convolution operations increase exponentially, gradually reducing the network training efficiency. Introducing depthwise separable convolution can effectively alleviate this problem. The essence of conventional convolution operations is to couple the image in spatial and channel (depth) dimensions, while depthwise separable convolution, through decoupling, enables the network to effectively reduce the dimensionality of parameters while maintaining edge detection accuracy.
[0069] In such Figure 3 In the conventional convolution shown, assuming the input image resolution is h×h and there are P k×k filters in the convolutional layer, then the size of the output feature map and the number of parameters N are... STD They are respectively:
[0070]
[0071] N STD = size × size × 3 × P.
[0072] In this context, padding is the padding size, and stride is the stride size.
[0073] Depthwise separable convolution decouples regular convolution into depthwise convolution for the channel dimension and pointwise convolution for the spatial dimension, thereby achieving dimensionality reduction of parameters.
[0074] In depthwise separable convolution, assuming the input image resolution is h×h, the convolutional layer contains P k×k filters, such as... Figure 4 The depthwise convolution shown involves performing a channel-by-channel depthwise convolution operation on the input image, with N parameters. depth for:
[0075] N depth = size × size × 3.
[0076] Depthwise convolution does not consider the spatial location information of feature maps, therefore it needs to be processed by methods such as... Figure 5 The pointwise convolution shown superimposes feature information from different channels at corresponding positions. The number of parameters N in the pointwise convolution is... point for:
[0077] N point = 1 × 1 × P.
[0078] Therefore, the ratio of the number of parameters between depthwise separable convolution and regular convolution is:
[0079]
[0080] As shown in the above equation, introducing depthwise separable convolution can effectively reduce computational complexity, and the number of parameters in the residual structure is reduced from the original 4.23 × 10⁻⁶. 6 Reduced to 0.32×10 6 The total number of network parameters increased from 14.69 × 10 6 Reduced to 9.68×10 6 This improves the speed of edge detection.
[0081] As an optional implementation, the eight-way difference operator is represented as:
[0082]
[0083] Where g1(x,y) is the eight-way difference value of the pixel (x,y) of the image input to the eight-way difference operator;
[0084] g1(x,y)=(|Δ l |+|Δ r |+|Δ u |+|Δ d |+|Δ lu |+|Δ ld |+|Δ ru |+|Δ rd |)÷8.
[0085] Δ l = g(x,y-1)-g(x,y), Δ r = g(x,y+1)-g(x,y), Δ u = g(x-1,y)-g(x,y), Δ d = g(x+1,y)-g(x,y), Δ lu =g(x-1,y-1)-g(x,y), Δ ld =g(x+1,y-1)-g(x,y), Δ ru =g(x-1,y+1)-g(x,y), Δ rd = g(x+1,y+1)-g(x,y).
[0086] g(x,y) is the pixel value of pixel (x,y), Δ l Let g(x,y-1) be the first pixel difference, and g(x,y-1) be the pixel value of pixel (x,y-1). Δ r The second pixel difference is g(x,y+1), where g(x,y+1) is the pixel value at pixel (x,y+1), and Δ u The difference is the third pixel value, g(x-1,y) is the pixel value of pixel (x-1,y), and Δ d The difference is the fourth pixel value, g(x+1,y) is the pixel value of pixel (x+1,y), and Δ luThe difference is the fifth pixel value, where g(x-1,y-1) is the pixel value at (x-1,y-1), and Δ ld The difference is the sixth pixel value, where g(x+1,y-1) is the pixel value at (x+1,y-1), and Δ ru The difference is the seventh pixel value, where g(x-1,y+1) is the pixel value at (x-1,y+1), and Δ rd The difference is the eighth pixel value, and g(x+1,y+1) is the pixel value of pixel (x+1,y+1).
[0087] T = max(M×K + N×g) max (x,y),g ave (x,y)).
[0088] T is the adaptive threshold for pixel units in the image input to the eight-way difference operator, where a pixel unit consists of 3 rows × 3 columns of pixels; M and N are both constants; K is the optimal threshold obtained by pixel binarization classification of the image input to the eight-way difference operator based on the maximum inter-class variance method; g max (x,y) represents the maximum pixel value of a pixel unit, g ave (x,y) represents the average pixel value of a pixel unit.
[0089] Specifically, after the input image undergoes depthwise separable convolution to obtain a feature map, the edge pixels of the target object in the feature map are calculated using an eight-way difference operator. Since the grayscale threshold setting greatly affects the detection effect when the eight-way difference operator is used for edge detection, an adaptive thresholding method is adopted to improve the eight-way difference operator.
[0090] Except for the boundaries, within a 3×3 neighborhood, any pixel in the image has eight neighboring pixels in eight directions: left, right, top, bottom, top-left, bottom-left, top-right, and bottom-right. Let the pixel value of pixel (x, y) in the image be g(x, y). Then, the eight-way difference of any pixel (x, y) in the image is the difference between it and its eight neighboring pixels:
[0091] Δ l = g(x,y-1)-g(x,y), Δ r = g(x,y+1)-g(x,y), Δ u = g(x-1,y)-g(x,y), Δ d = g(x+1,y)-g(x,y), Δ lu =g(x-1,y-1)-g(x,y), Δ ld =g(x+1,y-1)-g(x,y), Δ ru =g(x-1,y+1)-g(x,y), Δ rd = g(x+1,y+1)-g(x,y).
[0092] g(x,y) is the pixel value of pixel (x,y), Δ l Let g(x,y-1) be the first pixel difference, and g(x,y-1) be the pixel value of pixel (x,y-1). Δ r The second pixel difference is g(x,y+1), where g(x,y+1) is the pixel value at pixel (x,y+1), and Δ u The difference is the third pixel value, g(x-1,y) is the pixel value of pixel (x-1,y), and Δ d The difference is the fourth pixel value, g(x+1,y) is the pixel value of pixel (x+1,y), and Δ lu The difference is the fifth pixel value, where g(x-1,y-1) is the pixel value at (x-1,y-1), and Δ ld The difference is the sixth pixel value, where g(x+1,y-1) is the pixel value at (x+1,y-1), and Δ ru The difference is the seventh pixel value, where g(x-1,y+1) is the pixel value at (x-1,y+1), and Δ rd The difference is the eighth pixel value, and g(x+1,y+1) is the pixel value of pixel (x+1,y+1).
[0093] By averaging the absolute values of the differences between the eight neighboring pixels, we can obtain the eight-way difference value of that pixel:
[0094] g1(x,y)=(|Δ l |+|Δ r |+|Δ u |+|Δ d |+|Δ lu |+|Δ ld |+|Δ ru |+|Δ rd |)÷8.
[0095] Traditional eight-way difference algorithms mostly set the average value of pixels in the image as the threshold, or design a fixed threshold based on experience. The threshold setting is relatively coarse and has poor robustness. Therefore, this invention proposes an adaptive thresholding method that comprehensively considers the fixed threshold and the average value of local edge points to improve the eight-way difference operator and suppress noise interference.
[0096] The edge points are determined as shown in the following formula, by comparing the eight-way difference value of the pixel with a set threshold to binarize the edge points:
[0097]
[0098] In the formula, g(x,y) is the eight-way difference value of pixel (x,y); the adaptive threshold T is:
[0099] T = max(M×K + N×g) max (x,y),gave (x,y)).
[0100] Where T is the adaptive threshold of the pixel unit of the image input to the eight-way difference operator, and the pixel unit consists of 3 rows × 3 columns of pixels; M and N are constants determined experimentally, and can be taken as M = 0.5, N = 0.2, g max (x,y) represents the maximum pixel value of a pixel unit, g ave (x, y) represents the pixel mean of a pixel unit, and K is the optimal threshold obtained by pixel binarization classification of the image input eight-way difference operator based on the maximum inter-class variance method. The specific calculation method is as follows:
[0101] The Otsu's method (Maximum Inter-Class Variance) performs thresholding on the feature map based on pixel gray levels, effectively suppressing noise and significantly improving target-background segmentation. Otsu's method divides the image into two parts, target region E0 and background region E1, based on a gray-level threshold K. E0 represents the set of pixels with gray levels in the range [0, 1, ..., K-1], and E1 represents the set of pixels with gray levels in the range [K, K+1, ..., L]. The probabilities of any pixel falling into these two regions are as follows:
[0102]
[0103]
[0104] Where ω0 is the probability that a pixel falls within region E0, ω1 is the probability that a pixel falls within region E1, and q(·) is the probability function. i Let i represent the probability of any pixel with gray level i appearing in the image, where i∈[0,1,…,L].
[0105] Therefore, the average gray levels of the target area and the background area are respectively:
[0106]
[0107]
[0108] The overall average gray level of the image is:
[0109]
[0110] The inter-class variance between regions is:
[0111]
[0112] When the variance When the threshold is maximized, the segmentation of the two regions is optimal, and the corresponding grayscale value K is the best threshold.
[0113] As an optional implementation, the first feature extraction module includes: a 7*7 convolutional layer, a max pooling layer, and two 3*3 convolutional layers connected in sequence.
[0114] Specifically, in the first feature extraction module, the resolution of the original image continuously decreases from the 7*7 convolutional layer to the 3*3 convolutional layer, resulting in more detailed feature information.
[0115] As an optional implementation, the edge detection model further includes: an average pooling layer; the output of the first multi-scale feature fusion network is connected to the input of the average pooling layer.
[0116] Example 2
[0117] Figure 6 This is a schematic diagram of the image edge detection method provided in Embodiment 2 of the present invention. Figure 6 As shown, an image edge detection system in this embodiment includes:
[0118] The original image acquisition module 201 is used to acquire the original image; the original image is an image of the environment in which the UAV is located.
[0119] The edge detection module 202 is used to input the original image into the edge detection model to obtain the edge map of the original image; the edge map is used by the UAV for obstacle detection.
[0120] The edge detection model 202 includes a first feature extraction module, a second feature extraction module, a filtering module, and a feature fusion module; the second feature extraction module is constructed from a depthwise separable convolutional network; the filtering module is constructed from an eight-way difference operator based on an adaptive threshold method.
[0121] The first feature extraction module is used to perform edge detection on the original image to obtain an initial feature map.
[0122] The second feature extraction module is used to perform edge detection on the initial feature map to obtain multiple secondary extracted feature maps.
[0123] The filtering module is used to filter pixels in each secondary extracted feature map to obtain multiple filtered feature maps.
[0124] The feature fusion module is used to overlay and fuse each filtered feature map to obtain an edge map.
[0125] Example 3
[0126] The present invention also provides an electronic device, comprising:
[0127] One or more processors.
[0128] A storage device on which one or more programs are stored.
[0129] When one or more programs are executed by one or more processors, the one or more processors implement the method provided in Example 1.
[0130] Example 4
[0131] The present invention also provides a storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method provided in Embodiment 1.
[0132] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to the method section.
[0133] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. An image edge detection method, characterized in that, The method includes: Acquire the original image; the original image is an image of the environment in which the UAV is located; The original image is input into an edge detection model to obtain an edge map of the original image; the edge map is used by the UAV for obstacle detection. The edge detection model includes a first feature extraction module, a second feature extraction module, a filtering module, and a feature fusion module; the second feature extraction module is constructed from a depthwise separable convolutional network; the filtering module is constructed from an eight-way difference operator based on an adaptive thresholding method. The eight-way difference operator is represented as: Wherein, g1(x,y) is the eight-way difference value of the pixel (x,y) of the image input to the eight-way difference operator; g1(x,y)=(|Δ l |+|D r |+|D u |+|D d |+|D lu |+|D ld |+|D ru |+|D rd |)÷8; Δ l =g(x,y-1)-g(x,y),Δ r =g(x,y+1)-g(x,y),Δ u =g(x-1,y)-g(x,y),Δ d =g(x+1,y)-g(x,y),Δ lu =g(x-1,y-1)-g(x,y),Δ ld =g(x+1,y-1)-g(x,y),Δ ru =g(x-1,y+1)-g(x,y),Δ rd =g(x+1,y+1)-g(x,y); g(x,y) is the pixel value of pixel (x,y), Δ l Let g(x,y-1) be the first pixel difference, and g(x,y-1) be the pixel value of pixel (x,y-1). Δ r The second pixel difference is g(x,y+1), where g(x,y+1) is the pixel value at pixel (x,y+1), and Δ u The difference is the third pixel value, g(x-1,y) is the pixel value of pixel (x-1,y), and Δ d The difference is the fourth pixel value, g(x+1,y) is the pixel value of pixel (x+1,y), and Δ lu The difference is the fifth pixel value, where g(x-1,y-1) is the pixel value at (x-1,y-1), and Δ ld The difference is the sixth pixel value, where g(x+1,y-1) is the pixel value at (x+1,y-1), and Δ ru The difference is the seventh pixel value, where g(x-1,y+1) is the pixel value at (x-1,y+1), and Δ rd The difference is the eighth pixel value, and g(x+1,y+1) is the pixel value of pixel (x+1,y+1). T=max(M×K+N×g max (x,y),g ave (x,y)); T is the adaptive threshold for pixel units in the image input to the eight-way difference operator, where a pixel unit consists of 3 rows × 3 columns of pixels; M and N are both constants; K is the optimal threshold obtained by pixel binarization classification of the image input to the eight-way difference operator based on the maximum inter-class variance method; g max (x,y) represents the maximum pixel value of a pixel unit, g ave (x,y) represents the average pixel value of a pixel unit; The first feature extraction module is used to perform edge detection on the original image to obtain an initial feature map; The second feature extraction module is used to perform edge detection on the initial feature map to obtain multiple secondary extracted feature maps; The filtering module is used to filter each of the secondary extracted feature maps by pixels to obtain multiple filtered feature maps. The feature fusion module is used to superimpose and fuse each of the filtered feature maps to obtain the edge map.
2. The image edge detection method according to claim 1, characterized in that, The second feature extraction module includes A depthwise separable convolutional networks; the filtering module includes A+1 eight-way difference operators; the feature fusion module includes A multi-scale feature fusion networks; where A is a positive integer. The first output of the first feature extraction module is connected to the input of the first depthwise separable convolutional network, and the second output of the first feature extraction module is connected to the input of the first eight-way difference operator. The first output of the m-th depthwise separable convolutional network is connected to the input of the (m+1)-th depthwise separable convolutional network, and the second output of the m-th depthwise separable convolutional network is connected to the input of the (m+1)-th eight-way difference operator; the output of the m-th eight-way difference operator is connected to the first input of the (m+1)-th multi-scale feature fusion network, and the output of the (m+1)-th multi-scale feature fusion network is connected to the second input of the m-th multi-scale feature fusion network; 1 ≤ m < A.
3. The image edge detection method according to claim 1, characterized in that, The first feature extraction module includes: a 7*7 convolutional layer, a max pooling layer, and two 3*3 convolutional layers connected in sequence.
4. The image edge detection method according to claim 2, characterized in that, The edge detection model further includes: an average pooling layer; the output of the first multi-scale feature fusion network is connected to the input of the average pooling layer.
5. An image edge detection system, characterized in that, The system includes: The original image acquisition module is used to acquire the original image; the original image is an image of the environment in which the UAV is located; An edge detection module is used to input the original image into an edge detection model to obtain an edge map of the original image; the edge map is used by the UAV for obstacle detection. The edge detection model includes a first feature extraction module, a second feature extraction module, a filtering module, and a feature fusion module; the second feature extraction module is constructed from a depthwise separable convolutional network; the filtering module is constructed from an eight-way difference operator based on an adaptive thresholding method. The first feature extraction module is used to perform edge detection on the original image to obtain an initial feature map; The second feature extraction module is used to perform edge detection on the initial feature map to obtain multiple secondary extracted feature maps; The filtering module is used to filter each of the secondary extracted feature maps by pixels to obtain multiple filtered feature maps. The feature fusion module is used to superimpose and fuse each of the filtered feature maps to obtain the edge map; The eight-way difference operator is represented as: Wherein, g1(x,y) is the eight-way difference value of the pixel (x,y) of the image input to the eight-way difference operator; g1(x,y)=(|Δ l |+|D r |+|D u |+|D d |+|D lu |+|D ld |+|D ru |+|D rd |)÷8; Δ l =g(x,y-1)-g(x,y),Δ r =g(x,y+1)-g(x,y),Δ u =g(x-1,y)-g(x,y),Δ d =g(x+1,y)-g(x,y),Δ lu =g(x-1,y-1)-g(x,y),Δ ld =g(x+1,y-1)-g(x,y),Δ ru =g(x-1,y+1)-g(x,y),Δ rd =g(x+1,y+1)-g(x,y); g(x,y) is the pixel value of pixel (x,y), Δ l Let g(x,y-1) be the first pixel difference, and g(x,y-1) be the pixel value of pixel (x,y-1). Δ r The second pixel difference is g(x,y+1), where g(x,y+1) is the pixel value at pixel (x,y+1), and Δ u The difference is the third pixel value, g(x-1,y) is the pixel value of pixel (x-1,y), and Δ d The difference is the fourth pixel value, g(x+1,y) is the pixel value of pixel (x+1,y), and Δ lu The difference is the fifth pixel value, where g(x-1,y-1) is the pixel value at (x-1,y-1), and Δ ld The difference is the sixth pixel value, where g(x+1,y-1) is the pixel value at (x+1,y-1), and Δ ru The difference is the seventh pixel value, where g(x-1,y+1) is the pixel value at (x-1,y+1), and Δ rd The difference is the eighth pixel value, and g(x+1,y+1) is the pixel value of pixel (x+1,y+1). T=max(M×K+N×g max (x,y),g ave (x,y)); T is the adaptive threshold for pixel units in the image input to the eight-way difference operator, where a pixel unit consists of 3 rows × 3 columns of pixels; M and N are both constants; K is the optimal threshold obtained by pixel binarization classification of the image input to the eight-way difference operator based on the maximum inter-class variance method; g max (x,y) represents the maximum pixel value of a pixel unit, g ave (x,y) represents the average pixel value of a pixel unit.
6. An electronic device, characterized in that, include: One or more processors; A storage device on which one or more programs are stored; When the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the method as described in any one of claims 1 to 4.
7. A storage medium, characterized in that, It stores a computer program thereon, wherein the computer program, when executed by a processor, implements the method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Multi-scale feature fusion target detection method and system
CN113313162A
Deep learning-based scotopic vision and low-illumination image edge detection method
CN114693712A