Automatic channel system identification method and system based on artificial intelligence
By introducing the self-attention mechanism in channel recognition and calculating the long-distance dependencies between image blocks, the problems of missed recognition and limited field of view in channel recognition are solved, and the accuracy of channel recognition is improved.
Patent Information
- Application Number
- CN202511153848.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-18
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2045-08-18
AI Technical Summary
The existing technology for channel recognition suffers from problems of missed recognition and limited field of view, especially when the channel is long. Traditional convolutional neural networks cannot accurately recognize segmented connections due to the limited size of the convolution kernel.
The self-attention mechanism is introduced. By setting multiple independent attention heads, the long-distance dependencies between image blocks are calculated, the query matrix Q, key matrix K, and value matrix V are generated, the original similarity score is calculated, and the features of the aggregated image blocks are weighted according to the directional weights, fusing local and global features to identify channels.
It improves the accuracy of channel identification, solves the problem of missed identification at the connection points of channel segments, and enhances the ability to capture long-distance dependencies.
Smart Images

Figure CN120673263A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to an artificial intelligence-based automatic channel identification method and system, as well as an electronic device and a non-transitory computer-readable storage medium. Background Art
[0002] With the continuous advancement of aerospace and drone technology, drone remote sensing technology has become an effective means of obtaining high-resolution and high-precision surface information. In precision agriculture, canal system identification using remote sensing imagery can provide a detailed understanding of the distribution of farmland irrigation canals. In newly constructed farmland water conservancy projects, such as canal lining projects, remote sensing image recognition and comparison techniques can be used to monitor construction progress in real time. Canal system identification also aids in the protection and supervision of existing water conservancy facilities. In watershed water resource management, canal systems are a key component of water resource allocation. By identifying canals at all levels within a watershed using remote sensing imagery, detailed water network models can be constructed. Therefore, canal system identification is crucial in both agriculture and water conservancy.
[0003] Currently, satellite remote sensing images and drone remote sensing images are mainly used for channel identification.
[0004] Canal identification using satellite-acquired remote sensing imagery offers advantages such as wide coverage and rapid data acquisition. By interpreting satellite remote sensing imagery, information about field canal distribution can be extracted. Current identification methods utilize spectral characteristics, such as water's strong absorption of near-infrared wavelengths, for water-filled canals. For waterless or low-water culverts, supervised classification, self-organizing classification, support vector machines, and object-oriented methods are employed, combining geometric and spatial characteristics.
[0005] Drone remote sensing systems offer advantages such as ease of transport, high flexibility, short operating cycles, and high-resolution image data. They can acquire higher-resolution remote sensing imagery, making them more conducive to canal identification and extraction. Currently, methods for extracting canal systems from drone orthophotos of irrigation areas, based on fully convolutional neural networks, use the FCN model to extract canal outlines to quickly obtain canal distribution information. Alternatively, methods can combine high-precision orthophotos, elevation, and slope data collected by drones, employing methods such as the improved Hough transform to achieve comprehensive extraction of irrigation canal networks. Both of these approaches suffer from the problem of missing segments at the junctions of different segments during segmented identification due to the length of the canal systems. Furthermore, traditional convolutional neural networks (CNNs) have limited field of view due to the limited size of the convolution kernel. Summary of the Invention
[0006] The present invention provides an artificial intelligence-based automatic channel identification method and system, as well as an electronic device and a non-transitory computer-readable storage medium, to solve the technical problems in the prior art of missed recognition at the connections between different segments and the limited field of view of traditional convolutional neural networks due to the limited size of the convolution kernel.
[0007] The artificial intelligence-based automatic channel identification method includes: Set H independent attention heads, each head generates query matrix Q, key matrix K, and value matrix V by linear transformation of the local feature vector of the image block; Based on the query matrix Q and the key matrix K, calculating the original correlation of an adjacent image block to the target image block, which is recorded as the original similarity score; Multiplying the original similarity score by the directional weight matrix element by element, and determining the attention weight of each adjacent image block to the target image block based on the multiplication result, wherein the directional weight is determined based on the correlation between the adjacent image block and the channel direction; Reweighting and aggregating the value features of each image block in the value matrix V according to the attention weight to generate a global feature vector of the enhanced target image block; The global feature vector of the target image block is fused with the local feature vector to identify the channel according to the fused features.
[0008] Optionally, before generating a query matrix Q, a key matrix K, and a value matrix V by linearly transforming the local feature vectors of the image block, the method includes: Constructing a position encoding matrix corresponding to the spatial size of the image data, wherein each position in the position encoding matrix stores a trainable position vector, and the position vector represents the absolute position information of the image block in the overall structure of the channel; Map the coordinates of each image block of the input image into the position encoding matrix and extract the corresponding position vector P; The position vector P is added to the local feature vector F of the image block element by element to obtain a fused local feature vector F′=F+P.
[0009] Optionally, before each head generates a query matrix Q, a key matrix K, and a value matrix V by linearly transforming the local feature vectors of the image block, the method further includes: Download image data of the area to be identified; The image data is divided into rectangles of a predetermined size, each rectangle corresponding to an image block.
[0010] Optionally, the attention weight is determined by the following formula:
[0011] Among them QK T is the original similarity score, Represents element-by-element multiplication, W is the directional weight matrix, Indicates the dimensions of K and Q.
[0012] Optionally, re-weighting and aggregating the value features of each image block in the value matrix V according to the attention weight to generate a global feature vector of the enhanced target image block includes: The value features of each image block are reweighted and aggregated to generate the global perceptual features of the target image block, that is, the enhanced attention features of the i-th block , , where V j is the value vector of the j-th block, j is the j-th row in the value matrix V, and the value matrix V has a total of N rows of data.
[0013] Optionally, the original local features F are fused with the enhanced attention feature matrix to retain local details while introducing global information. The attention feature matrix is composed of all The matrix composed of .
[0014] Optionally, the algorithm for fusing the original local feature F with the enhanced attention feature matrix is as follows: , where LayerNorm is the normalization layer, and A is the global feature after attention enhancement, that is, all The matrix composed of is a learnable adjustment factor used to adjust the contribution to the global feature.
[0015] The present invention also provides an artificial intelligence-based canal automatic identification system, the system comprising: The linear transformation module is used to set H independent attention heads. Each head transforms the local feature vector of the image block through linear transformation to generate the query matrix Q, key matrix K, and value matrix V; an original correlation calculation module, configured to calculate an original correlation of an adjacent image block to a target image block based on the query matrix Q and the key matrix K, which is recorded as an original similarity score; an attention weight determination module, configured to multiply the original similarity score by a directional weight matrix element by element, and determine an attention weight of each adjacent image block with respect to the target image block based on the multiplication result, wherein the directional weight is determined based on a correlation between the adjacent image block and the channel direction; An attention weighted aggregation module is used to re-weight and aggregate the value features of each image block in the value matrix V according to the attention weight to generate a global feature vector of the enhanced target image block; A hierarchical feature fusion module is used to fuse the global feature vector of the target image block with the local feature vector to identify the channel based on the fused features.
[0016] As a preferred embodiment, the system also includes a position coding matrix construction module, which is used to construct a position coding matrix corresponding to the spatial size of the image data, wherein each position in the position coding matrix stores a trainable position vector, and the position vector represents the absolute position information of the image block in the overall structure of the channel; an image block coordinate mapping module, which is used to map the coordinates of each image block of the input image to the position coding matrix and extract the corresponding position vector P; and a local feature vector fusion module, which is used to add the position vector P to the local feature vector F of the image block element by element to obtain a fused local feature vector F′=F+P.
[0017] As a preferred embodiment, the system further includes a vector data download module for downloading image data of the area to be identified; and an image block segmentation module for segmenting the water system vector data into rectangles of a predetermined size, each rectangle corresponding to an image block.
[0018] As a preferred embodiment, the attention weighted aggregation module re-weights and aggregates the value features of each image block according to the attention weight to generate the global perceptual features of the target image block, that is, the enhanced attention features of the i-th block , , where V j is the value vector of the j-th block, j is the j-th row in the value matrix V, and the value matrix V has a total of N rows of data.
[0019] The attention weighted aggregation module fuses the original local features F with the enhanced attention feature matrix to retain local details while introducing global information. The attention feature matrix is composed of all The matrix composed of .
[0020] The present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the aforementioned artificial intelligence-based automatic channel identification method is implemented.
[0021] The present invention provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the computer program implements the aforementioned artificial intelligence-based automatic channel identification method.
[0022] The automatic channel recognition method provided by the present invention captures the long-distance dependencies between image blocks by introducing a self-attention mechanism, thereby solving the problem of missed recognition at the connections between different segments during segmented recognition due to the long channel. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the present invention or the prior art, a brief introduction is given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0024] Figure 1a It is a schematic diagram of the process of constructing a canal training database in the present invention.
[0025] Figure 1b This is an example of a vector diagram of canal image data collected during the process of building a canal training database in the present invention.
[0026] Figure 1c This is an example of a segmented canal system satellite image during the process of constructing a canal system training database in the present invention.
[0027] Figure 1d This is an example of a segmented canal satellite image after software labeling in the process of constructing a canal training database in the present invention.
[0028] Figure 2 This is a common architecture diagram for selecting a model when using a convolutional neural network for target detection used in this invention.
[0029] Figure 3 It is a flow chart of the method for automatic channel identification based on artificial intelligence provided by the present invention.
[0030] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0031] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.
[0032] In order to train the canal identification model and select the optimal canal identification model, it is necessary to build a canal training database. Figure 1a As shown in Figure 2, the process of building a canal training database includes: Step 101: Collect canal image data from satellite remote sensing images or drone remote sensing images; the vector diagram of the canal image data in this step is as follows: Figure 1b As shown; Step 102: Segment the canal image data into equal segments to obtain each segment of the canal image. An example of the segmented canal satellite image in this step is shown in FIG. Figure 1c As shown; Step 103: Create label data corresponding to each image. In this step, it is preferred to use a predetermined software tag. An example of an image tagged by the software is as follows: Figure 1d As shown; Step 104: construct a channel training database based on the images and their corresponding label data, and in the training database, divide the images and their corresponding label data into a training set and a validation set.
[0033] Based on the construction of the above training database, a convolutional neural network model as a channel identification model can be trained and its performance can be evaluated.
[0034] like Figure 2 As shown in the figure, this figure shows a common architecture for selecting a model when using convolutional neural networks for target detection. Among them, the backbone network (Backbone) is the initial convolutional neural network used to extract feature maps from the input image, including C3, C4 and C5 layers, representing different stages of the backbone. The spatial resolution of the input image is 800 1024. The feature map sizes output by C3, C4, and C5 are 100 128, 50 64 and 25 32. The backbone network gradually reduces the resolution of the input image to extract features of different scales. A feature pyramid (FPN) is constructed from the feature map of the backbone network, which helps detect objects of different scales. Figure 3 In the example in , P3, P4, P5, P6, and P7 feature maps are constructed. Bottom-up: the backbone (C3, C4, C5) generates feature maps; top-down: the network starts upsampling from the coarsest feature map (C5). Then, lateral connections are established from the finer feature maps of the backbone (C4, C3). These connections involve merging the upsampled feature maps with the corresponding feature maps of the backbone. This enables the network to combine high-level semantic information (from coarser layers) with fine-grained spatial information (from finer layers). The feature map sizes output by P3, P4, P5, P6, and P7 are 100, respectively. 128, 50 64, 25 32, 13 16 and 7 8.
[0035] The FPN generates feature maps at multiple scales. Each level of the pyramid (P3, P4, P5, P6, P7) is fed into a "head." The head is responsible for making predictions. Crucially, "shared head" means that each feature level uses the same head architecture, which reduces the number of parameters and helps the model generalize across different scales.
[0036] Each head has three branches, namely classification, regression, and center-ness. The classification is used to predict the category of the object, and the output is H × W × C, where H and W are the height and width of the feature map, and C is the number of categories. The regression is used to predict the bounding box coordinates of the object, and the output is H × W × 4, where H and W are the height and width of the feature map, and 4 represents the bounding box parameters (for example, x, y, width, height, or offset relative to the anchor box). The center-ness is used to predict the distance score between the center of the object and the center of the predicted bounding box, and the output is H × W × 1. This is often used to suppress predictions far away from the center of the object, which can improve recognition accuracy. Appendix Figure 3 As shown in Figure 2, each branch (classification, regression, and centrality) is implemented by several convolutional layers (marked with small rectangles as “×4”), each with 256 channels (H × W × 256).
[0037] Because we don't know which model is optimal before identifying channel data, we can build different convolutional neural network models (this involves trying different backbone architectures, different FPN configurations, different number of head layers, etc.) and train them using the training set of the training database built earlier. After training, we use the validation set to evaluate the performance of each model by evaluating indicators such as precision and recall, and select the optimal model as the channel recognition model for target detection.
[0038] After selecting a canal recognition model, the model is used to identify irrigation canals in each image and obtain the latitude and longitude of the center of the irrigation canal recognition frame. Generally, each image input to the canal recognition model is an image block of a predetermined size. The image block pre-generation process includes downloading image data of the area to be identified and segmenting the image data into rectangles of a predetermined size, with each rectangle corresponding to an image block.
[0039] The present invention aims to enhance the processing of image blocks after the canal identification model generates them, before identifying the irrigation canals in each image. Specifically, it introduces a self-attention mechanism to capture long-range dependencies between image blocks. This self-attention mechanism calculates the correlation between different images, assigning higher weights to adjacent canal image blocks. This weighting is then combined with the model's recognition results, and the weights of each image are summed to ultimately determine the canal identification result.
[0040] Figure 3 This is a flow chart of the method for automatic channel identification based on artificial intelligence provided by the present invention, such as Figure 3 As shown, the method includes the following: Step 301: Set H independent attention heads, each head generates a query matrix Q, a key matrix K, and a value matrix V by linearly transforming the local feature vector of the image block; Step 302: Based on the query matrix Q and the key matrix K, calculate the original correlation of an adjacent image block to the target image block, which is recorded as the original similarity score; Step 303: multiply the original similarity score by the directional weight matrix element by element, and determine the attention weight of each adjacent image block to the target image block based on the multiplication result, wherein the directional weight is determined based on the correlation between the adjacent image block and the channel direction; Step 304: re-weight and aggregate the value features of each image block in the value matrix V according to the attention weight to generate a global feature vector of the enhanced target image block; Step 305: Fuse the global feature vector of the target image block with the local feature vector to identify the channel based on the fused features.
[0041] Through the above method, before the canal recognition model performs canal recognition, an image preprocessing stage is added, and a self-attention mechanism is introduced to calculate the correlation between images of different image blocks. Adjacent canal images obtain higher attention weights. Therefore, on the basis of retaining the local features of the image blocks, global features are introduced to capture the long-distance dependency between image blocks, so as to solve the problem of missed recognition at the connection between different segments due to the long canal, thereby ultimately improving the accuracy of the canal recognition results.
[0042] As a specific implementation method, it can be divided into four steps: position code injection, multi-head attention calculation, cross-block feature association, and hierarchical feature fusion. Each step is described in detail below.
[0043] 1. Positional encoding injection Construct a position encoding matrix corresponding to the spatial size of the image data. It can be understood that each position in the matrix corresponds to the coordinates (x, y) of the original image block. Each position in the position encoding matrix stores a trainable position vector, which represents the absolute position information of the image block in the overall structure of the channel.
[0044] Map the coordinates of each image block of the input image (which can be the center point coordinates) to the position encoding matrix and extract the corresponding position vector P; add the position vector P to the local feature vector F of the image block element by element to obtain the fused local feature vector F′=F+P. The local feature vector F∈R D, recording the texture, edges, and heights (topography) of each small area.
[0045] 2. Multi-head attention calculation 1) Core input As the core input, the image patch embedding sequence (X) is represented as follows: Assume that the image is divided into N patches. Each patch is mapped into a D-dimensional feature vector through a linear embedding layer (or convolutional layer). Therefore, the entire input can be represented as a matrix X ∈ ^(N×D), where N is the number of blocks and D is the embedding dimension (feature vector length).
[0046] 2) Parameter settings Number of attention heads (K): Specifies the number of independent attention heads to use.
[0047] The dimensions of each head (d_k, d_v): d_k = d_v = D / K is usually set to ensure that the concatenated output dimensions of all heads are consistent with the input D. This means that D must be divisible by K.
[0048] 3) The specific operation process of each attention head h (h = 1, 2, ..., K) includes the following steps: ① Define a head-specific learnable weight matrix Each head h has its own independent three linear transformation weight matrices: W_q^h ∈ ^(D × d_k) : The weight matrix used to generate the query.
[0049] W_k^h ∈ ^(D × d_k) : Weight matrix used to generate the key.
[0050] W_v^h ∈ ^(D × d_v) : Weight matrix used to generate the value (Value).
[0051] These matrices W_q^h, W_k^h, W_v^h are parameters unique to this head h. Unlike the parameters of other heads, they are what the model needs to learn during training.
[0052] ② Apply linear transformation to the input sequence to generate Q^h, K^h, V^h: Multiply the entire input sequence matrix X by the three weight matrices of the head h respectively: Query matrix (Q^h): Q^h = X W_q^h ∈ ^(N × d_k) Each row corresponds to a query vector after the transformation of an image block, indicating the role of the block in finding relevant information.
[0053] Key matrix (K^h): K^h = X W_k^h ∈ ^(N × d_k) Each row corresponds to a key vector after the conversion of an image block, indicating the information identifier that can be queried for the block.
[0054] Value matrix (V^h): V^h = X W_v^h ∈ ^(N × d_v) Each row corresponds to a "value" vector after the conversion of an image block, which contains the information content that actually needs to be aggregated for the block.
[0055] There are a few key points to note when applying linear transformations. The same input sequence X is fed into all heads. Each head h projects X using its own independent W_q^h, W_k^h, and W_v^h. The dimensions of the transformed Q^h, K^h, and V^h are d_k (or d_v), which is smaller than the original input dimension D (because d_k = d_v = D / K).
[0056] ③(Inside the head) Calculate self-attention, that is, the attention calculation is completed inside each head.
[0057] Use Q^h, K^h, V^h generated by this head to calculate the head's own attention output Z^h.
[0058] First, we calculate the (scaled dot product) similarity score between all image patch pairs: Attention score: AttentionScore^h = softmax((Q^h (K^h)^T) / sqrt(d_k) ) ∈ ^(N × N). By (Q^h (K^h)^T) produces an N x N matrix, where element (i, j) represents the query-key match score for the i-th block with respect to the j-th block. Dividing by sqrt(d_k) prevents the dot product from being too large and causing vanishing gradients. A softmax is computed along each row (key / value dimension) such that the sum of the attention weights for a given block i over all blocks j is 1.
[0059] Then, perform weighted aggregation: Z^h = AttentionScore^h V^h ∈ ^(N × d_v). Apply the attention weight matrix AttentionScore^h obtained in the previous step to the value matrix V^h. The i-th row of the result Z^h represents: for the i-th image patch, the new feature vector (dimension d_v) obtained by the attention head h by focusing on all other patches (including itself).
[0060] 4) Splicing the outputs of all heads, that is, splicing the outputs of the overall multi-head mechanism: Concatenate the outputs Z^h (h=1..K) of all K attention heads along the feature dimension: Z = Concat(Z^1, Z^2, ..., Z^K) ∈ ^(N × (K d_v)) = ^(N × D) Since d_v = D / K, the Z dimension after stitching is restored to N x D.
[0061] 5) Final linear projection: The concatenated Z (dimension N x D) is usually passed through a learnable linear projection matrix W_o ∈ ^(D × D), then Output = Z W_o ∈ ^(N × D).
[0062] The role of this projection W_o is to fuse and transform the spliced multi-head information to generate the final multi-head self-attention output sequence, whose dimension (N x D) is consistent with the input sequence X and can be input into subsequent layers (such as feedforward neural network layer).
[0063] The following is an example of applying a multi-head attention mechanism to a specific image block (with dimension examples): Assume the following parameters: N = number of image blocks (e.g. 196) D = input feature dimension / embedding dimension (e.g. 768) K = number of attention heads (e.g. 12) d_k = d_v = D / K (e.g. 768 / 12 = 64) The specific steps include: Input image patch: X ∈ ^(196×768) For each head h (h=1..12), use the Q^h, K^h, V^h generated by this head to calculate the head's own attention output Z^h: Q^h = X W_q^h (W_q^h ∈ ^(768×64)) → Q^h ∈ ^(196×64) K^h = X W_k^h (W_k^h ∈ ^(768×64)) → K^h ∈ ^(196×64) V^h = X W_v^h (W_v^h ∈ ^(768×64)) → V^h ∈ ^(196×64) AttnScore^h = softmax( (Q^h (K^h)^T) / sqrt(64) ) ∈ ^(196×196) Z^h = AttnScore^h V^h ∈ ^(196×64) Concatenate all Z^h: Z = Concat(Z^1, Z^2, ..., Z^12) ∈ ^(196×768) (because 12 64 = 768) Output projection: Output = Z W_o (W_o ∈ ^(768×768)) → Output ∈ ^(196×768) In the multi-head attention mechanism applied to the image patches above, each attention head is independent, and its weight matrices W_q^h, W_k^h, and W_v^h are independent and distinct. This is the core of the multi-head design. Different heads learn to focus on different aspects of the input (such as contour, texture, color, spatial relationships, etc.) in different representation subspaces (defined by these projections). Each head performs a dimensionality reduction projection, first projecting the D-dimensional input features into a lower-dimensional d_k / d_v-dimensional subspace for computation (reducing complexity and allowing attention to different features). Information aggregation is then performed within each head's own space. Within its own subspace, each head calculates the associations between patches (attention scores, representing the weights of the associations between patches) using Q^h, K^h, and V^h. This weighted aggregation is then applied to the information from V^h to obtain a new representation Z^h from that head's perspective. Finally, the results from all heads are concatenated and (optionally) projected, fusing the different information learned by all heads to form a richer and more robust feature representation output.
[0064] The above process simultaneously learns the relationship between image patches in multiple different subspaces or "viewpoints", greatly enhancing the model's ability to capture complex patterns and long-range dependencies.
[0065] As a second specific implementation, the process of determining the attention between image blocks includes: 1) Set up H independent attention heads, using a multi-head parallel mechanism. Each head transforms the fused local feature vector F′ through linear transformation to generate a query matrix Q, a key matrix K, and a value matrix V. V is another linear mapping of the input features, preserving the semantic information of the original features for subsequent feature aggregation.
[0066] 2) Calculate the attention weight (attention score) to reflect the similarity between image patches.
[0067] The attention weight is determined by the following formula:
[0068] where w ij represents the attention weight of the i-th block to the j-th block, QK T is the original similarity score, which is used to reflect the original correlation between the original image blocks. Represents element-by-element multiplication, W is the directional weight matrix, Denotes the dimensions of K and Q. By scaling QK T Operation (i.e., division by ) can stabilize the training process. W is determined as follows: ①Convert to plane coordinates to calculate offset Δxi =R·(x i -x c )·cos(y c π / 180)π / 180 Δy i =R·(y i -y c )·π / 180 where x i and y i is the latitude and longitude of the center of the i-th block image, and the latitude and longitude of the center position of the entire image (including all blocks) is x c and y c , R=6371000m (radius of the earth).
[0069] ②Calculate the relative distance between blocks Δx ij =|Δx i -Δx j ∣ Δy ij =|Δy i -Δy j ∣ ③ Calculate W by combining distance and direction parameters
[0070] Where Dr is the parameter representing the direction, if Δy ij ≤1 and Δx ij >0, then Dr=0.7, if Δx ij ≤1 and Δy ij >0, then Dr=0.7, if |Δx ij -Δy ij ∣≤1, then Dr=0.5.
[0071] 3. Cross-block feature association (generating new features) The value features of each image block in the value matrix V are re-weighted and aggregated according to the attention weight to generate a global feature vector of the enhanced target image block, including: The value features of each image block are reweighted and aggregated to generate the global perceptual features of the target image block, that is, the enhanced attention features of the i-th block , , where V j is the value vector of the j-th block, j is the j-th row in the value matrix V, and the value matrix V has a total of N rows of data.
[0072] 4. Hierarchical feature fusion (original features and global perception features) The original local features F (recording the texture, edge and height (topography) of each small area) are fused with the enhanced attention feature matrix A to retain local details while introducing global information. The attention feature matrix A is composed of all The matrix is composed of directional weights (W) that focus on areas along the channel direction (such as horizontal / vertical channels) and ignore irrelevant areas.
[0073] The algorithm for fusing the original local feature F with the enhanced attention feature matrix is as follows: , where LayerNorm is the normalization layer, and A is the global feature after attention enhancement, that is, all The matrix is composed of α, which is a learnable adjustment factor used to adjust the contribution to the global feature. The original local feature F can be the channel edge details extracted by CNN, and A is the global feature after attention enhancement (i.e., all The learnable adjustment factor α is used to dynamically control the contribution of global features. For example, α is an adaptive adjustment factor responsible for feature fusion weights. In areas with a clear channel, increasing α makes the model more confident in the attention feature matrix A, which reflects global information, and maintains channel coherence. For normal terrain or noise, decreasing α allows the model to rely more on local features F, which represent local details, to avoid being biased in the wrong direction. LayerNorm is a normalization layer used to stabilize the training process.
[0074] The present invention also provides an artificial intelligence-based canal automatic identification system, the system comprising: The linear transformation module is used to set H independent attention heads. Each head transforms the local feature vector of the image block through linear transformation to generate the query matrix Q, key matrix K, and value matrix V; an original correlation calculation module, configured to calculate an original correlation of an adjacent image block to a target image block based on the query matrix Q and the key matrix K, which is recorded as an original similarity score; an attention weight determination module, configured to multiply the original similarity score by a directional weight matrix element by element, and determine an attention weight of each adjacent image block with respect to the target image block based on the multiplication result, wherein the directional weight is determined based on a correlation between the adjacent image block and the channel direction; An attention weighted aggregation module is used to re-weight and aggregate the value features of each image block in the value matrix V according to the attention weight to generate a global feature vector of the enhanced target image block; A hierarchical feature fusion module is used to fuse the global feature vector of the target image block with the local feature vector to identify the channel based on the fused features.
[0075] As a preferred embodiment, the system also includes a position coding matrix construction module, which is used to construct a position coding matrix corresponding to the spatial size of the image data, wherein each position in the position coding matrix stores a trainable position vector, and the position vector represents the absolute position information of the image block in the overall structure of the channel; an image block coordinate mapping module, which is used to map the coordinates of each image block of the input image to the position coding matrix and extract the corresponding position vector P; and a local feature vector fusion module, which is used to add the position vector P to the local feature vector F of the image block element by element to obtain a fused local feature vector F′=F+P.
[0076] As a preferred embodiment, the system further includes a vector data download module for downloading image data of the area to be identified; and an image block segmentation module for segmenting the water system vector data into rectangles of a predetermined size, each rectangle corresponding to an image block.
[0077] As a preferred embodiment, the attention weighted aggregation module re-weights and aggregates the value features of each image block according to the attention weight to generate the global perceptual features of the target image block, that is, the enhanced attention features of the i-th block , , where V j is the value vector of the j-th block, j is the j-th row in the value matrix V, and the value matrix V has a total of N rows of data.
[0078] The attention weighted aggregation module fuses the original local features F with the enhanced attention feature matrix to retain local details while introducing global information. The attention feature matrix is composed of all The matrix composed of .
[0079] The present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the aforementioned artificial intelligence-based automatic channel identification method is implemented.
[0080] The present invention provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the computer program implements the aforementioned artificial intelligence-based automatic channel identification method.
[0081] The automatic channel recognition method and system provided by the present invention capture the long-distance dependencies between image blocks by introducing a self-attention mechanism, thereby solving the problem of missed recognition at the connections between different segments during segmented recognition due to the long channel.
[0082] Figure 4 An example of a physical structure diagram of an electronic device is shown below. Figure 4As shown, the electronic device may include: a processor (processor) 410 , a communication interface (Communications Interface) 420 , a memory (memory) 430 and a communication bus 440 , wherein the processor 410 , the communication interface 420 , and the memory 430 communicate with each other via the communication bus 440 . The processor 410 can call the logic instructions in the memory 430 to execute an artificial intelligence-based channel automatic identification method, which includes: setting H independent attention heads, each head generates a query matrix Q, a key matrix K, and a value matrix V by linearly transforming the local feature vector of the image block; based on the query matrix Q and the key matrix K, calculating the original correlation of an adjacent image block to the target image block, recorded as the original similarity score; multiplying the original similarity score by the directional weight matrix element by element, and determining the attention weight of each adjacent image block to the target image block based on the multiplication result, wherein the directional weight is determined based on the correlation between the adjacent image block and the channel direction; re-weighting and aggregating the value features of each image block in the value matrix V according to the attention weight to generate a global feature vector of the enhanced target image block; fusing the global feature vector of the target image block with the local feature vector to identify the channel based on the fused features.
[0083] Furthermore, the logic instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product, stored in a storage medium, includes instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0084] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the artificial intelligence-based automatic channel identification method provided by the above methods.
[0085] In remote sensing images, canal identification has many important application scenarios.
[0086] In precision agriculture, canal system identification using remote sensing imagery can provide a detailed understanding of the distribution of irrigation canals. For example, in large irrigation areas, accurate canal system identification can help agricultural managers determine irrigation water delivery routes. This allows them to formulate appropriate irrigation plans based on crop water requirements and canal supply capacity. For example, in the winter wheat growing areas of the North China Plain, remote sensing technology can identify irrigation canals, allowing precise irrigation according to the water requirements of wheat at different growth stages, improving irrigation efficiency and reducing water waste. Furthermore, canal system identification is crucial for assessing canal utilization efficiency. By combining information such as canal flow and velocity with data such as canal geometry from remote sensing imagery, it is possible to identify canals with problems such as poor water flow and leakage, enabling timely maintenance and renovation. In new agricultural water conservancy projects, such as canal lining projects, remote sensing image recognition and comparison technologies can be used to monitor construction progress in real time. For example, when constructing anti-seepage canals, regular remote sensing imagery can be used to compare changes in canal morphology before and after construction, verifying that the canal lining has been completed according to design requirements and ensuring project quality meets standards. Canal identification also facilitates the protection and supervision of existing water conservancy facilities. Any illegal occupation or damage to canals, such as the illegal construction of farms near them, can be promptly detected and stopped, ensuring the normal operation of farmland water conservancy facilities.
[0087] Canal systems play a crucial role in farmland ecosystems. Identifying canals through remote sensing imagery allows for the study of interactions between them and surrounding farmland ecological elements, such as soil and vegetation. For example, canal water can carry nutrients to farmland, influencing crop growth. Furthermore, the growth of vegetation surrounding canals can affect canal stability. Long-term remote sensing monitoring allows for analysis of the dynamics of these interactions, providing data support for maintaining farmland ecological balance.
[0088] In river basin water resource management, canal systems are a critical component of water resource allocation. Identifying canals at all levels within a river basin using remote sensing imagery allows for the construction of detailed water system network models. For example, in the Yellow River Basin, accurate canal system identification helps rationally distribute limited water resources through canals to different irrigation areas and water users, achieving optimal water resource allocation. In the event of drought or a sudden increase in water demand, a clear understanding of the canal system allows for rapid adjustments to water resource allocation plans. For example, during the peak agricultural irrigation season in summer, water can be prioritized to areas in urgent need of irrigation by controlling canal gates, thereby improving emergency water resource allocation capabilities. Water quality in canals has a significant impact on both agricultural production and the ecological environment. Although remote sensing technology cannot directly measure chemical indicators of water quality, it can identify changes in canal water status, such as turbidity and color, to provide a preliminary assessment of water quality anomalies. For example, if a section of canal water suddenly turns black or contains a large amount of suspended solids, on-site testing can be promptly arranged to quickly locate the source of the contamination and implement appropriate remediation measures.
[0089] In comprehensive regional water resource assessments, the distribution and scale of canals, as water transmission and distribution infrastructure, are crucial indicators. By identifying and analyzing canal systems in remote sensing imagery, combined with factors such as regional precipitation and evaporation, we can assess the role and deficiencies of existing canal systems in water resource utilization. This provides a basis for long-term water resource planning, such as determining the need for new canals or expansion of existing ones to meet the water resource needs of regional economic and social development.
[0090] In areas surrounding wetlands, numerous channels connect to the wetland's drainage system. Identifying these channels through remote sensing imagery allows for the study of their impact on wetland hydrological processes. For example, some channels may drain water from wetlands, causing them to shrink; whereas others may replenish water, maintaining the health of wetland ecosystems. Accurate channel identification facilitates the implementation of appropriate measures, such as adjusting channel flow and installing ecological flow control devices, to protect wetland ecosystems. Channels can serve as part of ecological corridors, connecting diverse ecosystems. In ecological corridor planning, identified channel systems can help determine the direction and layout of ecological corridors. Furthermore, regular monitoring of changes in the channels and their surrounding ecosystems using remote sensing imagery can assess the connectivity of ecological corridors and the performance of their ecological functions, such as whether they facilitate species migration and dispersal.
[0091] In summary, channel system identification has a very wide range of application scenarios and is used to solve specific technical problems in the scenarios. Therefore, the research and development and innovation of channel system identification have very important practical significance.
[0092] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units. That is, they may be located in one location or distributed across multiple network units. Some or all of these modules may be selected based on actual needs to achieve the objectives of the present invention. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0093] Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented using software plus a necessary general-purpose hardware platform, or of course, hardware. Based on this understanding, the essence of the above technical solution, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, or an optical disk, and includes a number of instructions for causing a computer device (such as a personal computer, server, or network device) to execute the methods described in each embodiment or certain portions of the embodiments.
[0094] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A method for automatic channel identification based on artificial intelligence, characterized in that: include: Set H independent attention heads, and use each of the attention heads to linearly transform the local feature vectors of the image block to generate a query matrix Q, a key matrix K, and a value matrix V; Based on the query matrix Q and the key matrix K, calculating the original correlation of an adjacent image block to the target image block, which is recorded as the original similarity score; Multiplying the original similarity score by the directional weight matrix element by element, and determining the attention weight of each adjacent image block to the target image block based on the multiplication result, wherein the directional weight is determined based on the correlation between the adjacent image block and the channel direction; Reweighting and aggregating the value features of each image block in the value matrix V according to the attention weight to generate a global feature vector of the target image block after weighted aggregation; The global feature vector of the target image block is fused with the local feature vector to identify the channel according to the fused features.
2. The method for automatic canal identification based on artificial intelligence according to claim 1, characterized in that: Before the local feature vectors of the image block are linearly transformed to generate the query matrix Q, the key matrix K and the value matrix V, the method includes: Constructing a position encoding matrix corresponding to the spatial size of the image data, wherein each position in the position encoding matrix stores a trainable position vector, wherein the position vector represents the absolute position information of the image block in the overall structure of the channel; Mapping the coordinates of each image block of the input image into the position encoding matrix and extracting the corresponding position vector P; The position vector P is added to the local feature vector F of the image block element by element to obtain a fused local feature vector F′=F+P.
3. The method for automatic channel identification based on artificial intelligence according to claim 1, characterized in that: Before each head generates a query matrix Q, a key matrix K and a value matrix V by linearly transforming the local feature vectors of the image block, the method further includes: Download image data of the area to be identified; The image data is divided into rectangles of a predetermined size, each rectangle corresponding to an image block.
4. The method for automatic channel identification based on artificial intelligence according to claim 1, characterized in that: The attention weight is determined by the following formula: ; Among them QK T is the original similarity score, ⊙ represents element-by-element multiplication, W is the directional weight matrix, Indicates the dimensions of K and Q.
5. The method for automatic channel identification based on artificial intelligence according to claim 4, characterized in that: Re-weighting and aggregating the value features of each image block in the value matrix V according to the attention weight to generate a global feature vector of the target image block after weighted aggregation, including: The value features of each image block are reweighted and aggregated to generate the global perceptual features of the target image block, that is, the enhanced attention features of the i-th target image block , , where V j is the value vector of the j-th target image block, j is the j-th row in the value matrix V, and the value matrix V has a total of N rows of data.
6. The method for automatic channel identification based on artificial intelligence according to claim 5, characterized in that: The fusing of the global feature vector of the target image block with the local feature vector includes: fusing the original local feature F with the enhanced attention feature matrix to retain local details while introducing global information, and the attention feature matrix is a matrix composed of all.
7. The method for automatic channel identification based on artificial intelligence according to claim 6, characterized in that: The algorithm for fusing the original local feature F with the enhanced attention feature matrix is as follows: , where LayerNorm is the normalization layer, and A is the global feature after attention enhancement, that is, all , α is a learnable adjustment factor used to adjust the contribution to the global feature, and Z is the fusion feature.
8. An artificial intelligence-based canal automatic identification system, characterized in that: The system includes: The linear transformation module is used to set H independent attention heads. Each head transforms the local feature vector of the image block through linear transformation to generate the query matrix Q, key matrix K, and value matrix V; an original correlation calculation module, configured to calculate an original correlation of an adjacent image block to a target image block based on the query matrix Q and the key matrix K, which is recorded as an original similarity score; an attention weight determination module, configured to multiply the original similarity score by a directional weight matrix element by element, and determine an attention weight of each adjacent image block with respect to the target image block based on the multiplication result, wherein the directional weight is determined based on a correlation between the adjacent image block and the channel direction; An attention weighted aggregation module is used to re-weight and aggregate the value features of each image block in the value matrix V according to the attention weight to generate a global feature vector of the enhanced target image block; A hierarchical feature fusion module is used to fuse the global feature vector of the target image block with the local feature vector to identify the channel based on the fused features.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the program, the artificial intelligence-based automatic channel identification method according to any one of claims 1 to 7 is implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for automatic channel identification based on artificial intelligence as claimed in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
MROCNet model construction and multi-source remote sensing image change detection method and system
CN116363526A
Global-to-local key point positioning method and device based on fusion attention
CN119399491A
Method and system for registering electric wires among aerial images of unmanned aerial vehicle based on deep learning
CN119672078A
Image label generation method and device based on feature fusion, equipment and medium
CN119992272A
Remote sensing image classification method based on improved self-attention
CN120259729A