A lunar linear feature classification and identification method and device based on a YOLOv8 model
By improving the C2f and C2f-MHSA layers of the YOLOv8 model, the ability to identify linear features on the moon was enhanced, solving the problems of time-consuming and labor-intensive traditional methods and poor detection results of existing models, and realizing high-precision automatic identification of linear features on the moon.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WUHAN UNIV
- Filing Date
- 2026-03-19
- Publication Date
- 2026-06-09
AI Technical Summary
Traditional methods are time-consuming and labor-intensive in linear ground feature identification on the moon, and are easily affected by lighting and subjective factors. Existing deep learning models do not perform well in detecting small targets in complex backgrounds, making it difficult to meet the requirements of high accuracy and high robustness.
All C2f layers in the backbone network of the YOLOv8 model were replaced with C2f-MLCA layers, and the C2f layers connected to the detection head network in the neck network were replaced with C2f-MHSA layers to enhance the model's ability to perceive weak linear textures and improve the accuracy of spatial context modeling.
It improves the model's recognition performance in low-contrast, weak-texture, and small-target recognition scenarios, and has excellent terrain detail representation and spatial structure perception capabilities, making it suitable for automatic detection of linear features in lunar remote sensing images.
Smart Images

Figure CN121861396B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method and apparatus for classifying and identifying linear land features on the moon based on the YOLOv8 model, belonging to the field of deep space exploration technology. Background Technology
[0002] The lunar surface exhibits two main structural types: toroidal and linear. Structural features are crucial for studying lunar geological evolution. Linear structures are linear extensions on the lunar surface, and their distribution is closely linked to the dynamic geological processes within the Moon. Compared to toroidal structures, linear structures can reflect the tectonic features and stress states of the entire Moon or specific regions, as well as geological information about the lunar interior. Lunar grabens and ridges, as the most common linear structures on the lunar surface, exhibit global distribution and certain regularities, and have always been a focus of lunar surface structural research both domestically and internationally.
[0003] Although lunar ridges, grabens, and foliate scarps vary in shape, they all originate from lunar crustal faulting activity and record the tectonic stress and deformation of the Moon at different stages. Lunar ridges are mainly distributed in basaltic lunar maria, appearing as low, meandering folds. Their typical cross-section consists of a wide, gently arched side and superimposed sharp ridge lines. The internal controlling structure is a shallowly buried, bent backthrust fault, reflecting the horizontal compression caused by lava cooling and contraction and loading. They can extend for hundreds of kilometers, but are only tens to hundreds of meters high, and often develop along concealed ring structures or basin margins. Lunar grabens, formed under tensile stress, are defined by two opposing, inwardly dipping normal faults. The subsidence of the central block creates linear depressions, ranging in width from tens of meters to tens of kilometers and in length from tens to hundreds of kilometers. They are commonly found at the boundaries between lunar maria and highlands at the edges of impact basins, reflecting the extensional structures resulting from early to middle lunar crustal stretching and mass-loaded nodules. Small-scale grabens, even those only a few kilometers long and a few hundred meters wide, represent more recent, small-scale extension. Lunar lobate scarps are the youngest expression of contractile faults, characterized by stepped, curved scarps with steep cliffs on one side and gentle slopes on the other. Their leading edge is arc-shaped, with typical elevations of tens to hundreds of meters and lengths generally within 10-20 km. Formed by shallow backthrust faults caused by cooling and contraction, they are distributed globally but concentrated in the boundaries between lunar highlands and maria. Lacking large, superimposed impact craters and exhibiting distinct morphologies, they indicate an age of less than 100 million years, still undergoing late-stage global contraction of the Moon. All three are surface manifestations of fault activity, and their distribution is often associated with basalt injection or mass nodule structures, recording lunar thermal evolution and tectonic succession. However, ridges and foliate scarps belong to the compressional orogenic style (thrust / backthrust faults), focusing on uplift and folding, while grabens are products of extensional faults, showing block subsidence and extension. This makes these three landforms present a sharp contrast in terms of stress type, fault geometry, and landform morphology.
[0004] Traditionally, the identification and classification of the aforementioned linear features have relied primarily on researchers' manual visual interpretation of high-resolution remote sensing imagery, combined with topographic profiles and spectral data for manual annotation. This method is not only time-consuming and labor-intensive, but also susceptible to the influence of lighting, observation angle, and researchers' subjective experience, making it difficult to guarantee consistency and high accuracy on large-scale datasets.
[0005] In recent years, deep learning technology has made significant progress in the field of object detection and classification in remote sensing images. Deep convolutional neural networks can significantly improve the automation and accuracy of ground feature extraction and are widely used in scenarios such as urban monitoring, agricultural identification and disaster assessment.
[0006] While the YOLOv8 model performs well in object detection in natural scenes, its direct application to lunar linear features—characterized by weak textures, low contrast, large scale spans, and complex backgrounds—still falls short of meeting the high-precision and robustness requirements for identifying ridges, grabens, and foliate scarps. The distribution of lunar features exhibits no fixed pattern, and linear features may vary at arbitrary angles or arcs. Lunar linear features (ridges, grabens, and foliate scarps) often appear as narrow, elongated structures only a few meters wide, frequently blending into the surrounding terrain texture in Lunar Reconnaissance Orbiter Camera (LROC) or Digital Elevation Model (DEM) images. The YOLOv8 model generally performs poorly in detecting small targets against complex backgrounds, exhibiting high false negative and false positive rates. Summary of the Invention
[0007] The purpose of this invention is to provide a method and apparatus for classifying and recognizing linear features on the moon based on the YOLOv8 model. By replacing all C2f layers in the backbone network of the original YOLOv8 model with C2f-MLCA layers (Mixed Local Channel Attention), efficient enhancement of weak linear textures is achieved. This invention also replaces the C2f layers connected to the detection head network in the neck network of the original YOLOv8 model with C2f-MHSA layers (Multi-head self-attention), enhancing the spatial context modeling accuracy of the model, thereby achieving efficient classification and recognition of linear features on the moon.
[0008] In a first aspect, the present invention provides a method for classifying and identifying linear land features on the moon based on the YOLOv8 model, comprising:
[0009] Obtain panoramic images of the moon;
[0010] The panoramic image is sliced to obtain a sliced image containing linear features;
[0011] The sliced images are input into a trained improved YOLOv8 model for land cover classification and recognition.
[0012] The improvements to the improved YOLOv8 model include:
[0013] Replace all C2f layers in the backbone network of the original YOLOv8 model with C2f-MLCA layers;
[0014] Replace the C2f layer in the neck network of the original YOLOv8 model that is connected to the detection head network with a C2f-MHSA layer.
[0015] Optionally, the C2f-MLCA layer and the C2f-MHSA layer each include a pre-convolutional layer, a splitting layer, a bottleneck layer, a first connection layer, and a post-convolutional layer. The feature map is first input into the pre-convolutional layer. The splitting layer separates the output of the pre-convolutional layer into a first feature map and a second feature map. The first feature map is input into the first connection layer after passing through the bottleneck layer, and the second feature map is directly input into the first connection layer. The first connection layer concatenates all the input feature maps to obtain a concatenated feature map, and the concatenated feature map is input into the post-convolutional layer to generate an output feature map.
[0016] The bottleneck layer of the C2f-MLCA layer includes a first convolutional layer, a second convolutional layer, and an MLCA layer connected in sequence;
[0017] The bottleneck layer of the C2f-MHSA layer includes a third convolutional layer, an MHSA layer, and a fourth convolutional layer connected in sequence.
[0018] Optionally, the MLCA layer includes a global branch, a local branch, and a second attention fusion layer. The global branch includes a global pooling layer, a one-dimensional convolutional layer, and a first attention fusion layer. The local branch includes a local pooling layer and a one-dimensional convolutional layer.
[0019] The feature maps of the input MLCA layer are input into the global branch and local branch in parallel.
[0020] In the global branch, the feature map of the input MLCA layer is input into the global pooling layer to generate a global pooling feature map. After feature reshaping, the global pooling feature map is input into the first one-dimensional convolutional layer. The output of the first one-dimensional convolutional layer is then input into the first attention fusion layer to generate a global attention weight vector.
[0021] In the local branch, the feature map of the input MLCA layer is input into the local pooling layer to generate a local pooling feature map. The local pooling feature map is then reshaped and input into the second one-dimensional convolutional layer.
[0022] The output of the second one-dimensional convolutional layer and the global attention weight vector of the global branch output are input into the second attention fusion layer to generate the final channel attention weights. After feature reshaping, the channel attention weights are weighted by channel on the feature map of the input MLCA layer to obtain the output of the MLCA layer.
[0023] Optionally, the MHSA layer includes a linear projection layer, multiple self-attention mechanism heads, a stitching layer, and a linear transformation layer;
[0024] The feature map input to the MHSA layer is flattened to obtain the input vector.
[0025] The input vector is fed into the linear projection layer to generate a query vector, a key vector, and a value vector;
[0026] The query vector, key vector, and value vector are input in parallel into multiple self-attention mechanism heads for computation.
[0027] The outputs of multiple self-attention mechanism heads are concatenated by a splicing layer and then input into a linear transformation layer for dimension restoration to generate the output of the MHSA layer.
[0028] Optionally, the output of the self-attention mechanism head is represented as:
[0029] ;
[0030] in, Output i Indicates the first i The output of a self-attention mechanism head; Q i Indicates the first i The query vector input to the self-attention mechanism head; K i Indicates the first i The key vector input to the self-attention mechanism head; V i Indicates the first i The value vector input to the self-attention mechanism head; d Indicates the dimensions of the query vector and key vector; Indicates the first i The transpose of the key vector input to the self-attention mechanism head; R h and R w The codes represent the height and width respectively;
[0031] Output of MHSA layer MHSA ( Q,K , V ) is represented as:
[0032] ;
[0033] in, L Represents a linear transformation. h This indicates the number of heads in the self-attention mechanism. Concat This indicates a splicing operation.
[0034] Optionally, the backbone network of the improved YOLOv8 model includes a fifth convolutional layer, a sixth convolutional layer, a first C2f-MLCA layer, a seventh convolutional layer, a second C2f-MLCA layer, a eighth convolutional layer, a third C2f-MLCA layer, and a downsampling layer connected in sequence.
[0035] The neck network of the improved YOLOv8 model includes upsampling layer 1, connection layer 2, first C2f layer, upsampling layer 2, connection layer 3, second C2f layer, convolutional layer 9, connection layer 4, third C2f layer, connection layer 5, and C2f-MHSA layer;
[0036] The improved YOLOv8 model's detection head network includes a first detection head, a second detection head, and a third detection head;
[0037] The sliced image is input into the backbone network of the improved YOLOv8 model after being standardized. After being processed by each layer of the backbone network, it is output by the downsampling layer of the backbone network.
[0038] The output of the downsampling layer is concatenated with the output of the first upsampling layer of the neck network and the output of the third C2f-MLCA layer in the second connection layer and then input into the first C2f layer for feature extraction. The output of the first C2f layer is concatenated with the output of the second C2f-MLCA layer in the second connection layer and then input into the second C2f layer for feature extraction. The output of the second C2f layer is concatenated with the ninth convolutional layer and the fourth connection layer and then input into the third C2f layer for feature extraction. The output of the third C2f layer and the output of the downsampling layer are concatenated with the fifth connection layer and then input into the C2f-MHSA layer to output a fused feature map.
[0039] The input to the first detection head is the output of the second C2f layer, the input to the second detection head is the output of the third C2f layer, and the input to the third detection head is the output of the C2f-MHSA layer.
[0040] Optionally, the training method for the improved YOLOv8 model includes:
[0041] Obtain historical panoramic images of the moon;
[0042] The historical panoramic image is sliced to obtain a historical slice image containing linear features;
[0043] A dataset is constructed based on the historical slice images and the linear feature labels annotated on the historical slice images;
[0044] The historical slice images in the dataset are input into the improved YOLOv8 model to obtain the corresponding output prediction boxes. Each output prediction box includes: the center coordinates of the prediction box output by the localization branch, the width of the prediction box, the height of the prediction box, the class probability distribution output by the classification branch, and the target confidence output by the confidence branch.
[0045] Based on the linear land cover labels on historical slice images in the dataset and the corresponding output prediction boxes of historical slice images, the bounding box regression loss of the localization branch, the classification loss of the classification branch, and the confidence loss of the confidence branch are calculated respectively.
[0046] The total loss function is obtained by weighted summing of the bounding box regression loss of the localization branch, the classification loss of the classification branch, and the confidence loss of the confidence branch.
[0047] The improved YOLOv8 model is iteratively optimized based on the total loss function to obtain a trained improved YOLOv8 model.
[0048] Optionally, the labeling method for the linear feature tags includes:
[0049] Use a bounding box to select linear feature regions on historical slice images;
[0050] Add corresponding linear feature labels to each bounding box; the linear feature labels include: linear feature category, bounding box center coordinates, bounding box width, and bounding box height.
[0051] Optionally, both the classification loss and the confidence loss employ the focus loss function.
[0052] Secondly, the present invention provides a lunar linear land cover classification and identification device based on the YOLOv8 model, comprising:
[0053] The acquisition module is used to acquire panoramic images of the moon;
[0054] The processing module is used to slice the panoramic image to obtain a slice image containing linear features;
[0055] The recognition module is used to input the sliced image into the trained improved YOLOv8 model for land cover classification and recognition; wherein, the improvement of the improved YOLOv8 model includes: replacing all C2f layers in the backbone network of the original YOLOv8 model with C2f-MLCA layers; and replacing the C2f layer connected to the detection head network in the neck network of the original YOLOv8 model with C2f-MHSA layers.
[0056] Compared with the prior art, the beneficial effects achieved by the present invention are as follows:
[0057] This invention first acquires a panoramic image of the moon; then slices the panoramic image to obtain sliced images containing linear features; finally, inputs the sliced images into a trained improved YOLOv8 model for feature classification and recognition. The improvements to the improved YOLOv8 model include: replacing all C2f layers in the backbone network of the original YOLOv8 model with C2f-MLCA layers to achieve efficient enhancement of weak linear textures; and replacing the C2f layers connected to the detection head network in the neck network of the original YOLOv8 model with C2f-MHSA layers to enhance the model's spatial context modeling accuracy and improve its ability to perceive low-contrast targets. The improved YOLOv8 model of this invention possesses excellent terrain detail representation and spatial structure perception capabilities, achieving superior recognition results in application scenarios involving low-contrast, weak-texture, and small-target recognition in lunar remote sensing imagery. Attached Figure Description
[0058] Figure 1 This is a model architecture diagram of an improved YOLOv8 model for a lunar linear land cover classification and identification method based on the YOLOv8 model, according to an embodiment of the present invention.
[0059] Figure 2 This is a flowchart of the MLCA layer of an improved YOLOv8 model for a lunar linear land cover classification and identification method based on the YOLOv8 model, according to an embodiment of the present invention.
[0060] Figure 3 This is a flowchart of the MHSA layer processing of an improved YOLOv8 model for a lunar linear land cover classification and identification method based on the YOLOv8 model, according to an embodiment of the present invention.
[0061] Figure 4 for Figure 3 Flowchart of the self-attention mechanism head in the MHSA layer;
[0062] Figure 5 The image shows a lunar ridge identified by a lunar linear land cover classification and recognition method based on the YOLOv8 model, according to an embodiment of the present invention.
[0063] Figure 6 The image shows a lunar leaf-shaped ridge identified by a lunar linear land cover classification and recognition method based on the YOLOv8 model, according to an embodiment of the present invention.
[0064] Figure 7 This is a physical image of a lunar graben identified by a lunar linear land feature classification and recognition method based on the YOLOv8 model, according to an embodiment of the present invention. Detailed Implementation
[0065] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the embodiments of the present invention and the specific features in the embodiments are detailed descriptions of the technical solution of the present invention, rather than limitations thereof. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments can be combined with each other.
[0066] The term "and / or" simply describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0067] Combination Figure 1 This embodiment provides a method for classifying and identifying linear land features on the moon based on the YOLOv8 model, which includes:
[0068] Step S1: Obtain a panoramic image of the moon, and slice the panoramic image to obtain a slice image containing linear features;
[0069] Specifically, in this embodiment, the panoramic image of the moon is first downloaded by the Wide Angle Camera (WAC) of the Lunar Reconnaissance Orbiter (LRO). In this embodiment, the panoramic image is cropped according to the linear ground feature size to generate a slice image adapted to the YOLOv8 model input.
[0070] Step S2: Input the sliced image into the trained improved YOLOv8 model for land cover classification and recognition;
[0071] The improvements to the YOLOv8 model include: replacing all C2f layers in the backbone network of the original YOLOv8 model with C2f-MLCA (Mixed Local Channel Attention) layers to achieve efficient enhancement of weak linear textures; and replacing the C2f layers connected to the detection head network in the neck network of the original YOLOv8 model with C2f-MHSA (Multi-head self-attention) layers to enhance the model's ability to perceive low-contrast targets while maintaining a lightweight structure and low parameter count.
[0072] Specifically, the backbone network of the improved YOLOv8 model includes a fifth convolutional layer, a sixth convolutional layer, a first C2f-MLCA layer, a seventh convolutional layer, a second C2f-MLCA layer, an eighth convolutional layer, a third C2f-MLCA layer, and a downsampling layer connected in sequence.
[0073] The sliced images, after standardization, are input into the backbone network of the improved YOLOv8 model. After being processed sequentially by each layer of the backbone network, the output is from the downsampling layer. In this embodiment, the backbone network of the improved YOLOv8 model employs multiple convolutional layers in conjunction with a C2f-MLCA layer for feature extraction, enabling the extraction of feature maps at different scales to enhance feature representation. Feature maps at different scales contain different levels of semantic information. While high-level feature maps have rich semantic content, their spatial resolution is reduced, while lower-level feature maps have higher spatial resolution but less semantic detail. Integrating feature maps at various scales can more effectively capture the diversity and complexity of targets, enhancing the model's ability to perceive small targets in remote sensing images. Furthermore, in object detection tasks, complex environments often severely interfere with target recognition. The C2f-MLCA layer introduces a contextual attention mechanism that enhances the model's focus on key regions by considering the background information of the feature maps. This mechanism helps suppress irrelevant background interference, thereby improving the quality of feature representation and detection performance.
[0074] The neck network of the improved YOLOv8 model includes upsampling layer 1, connection layer 2, first C2f layer, upsampling layer 2, connection layer 3, second C2f layer, convolutional layer 9, connection layer 4, third C2f layer, connection layer 5, and C2f-MHSA layer;
[0075] The output of the downsampling layer of the backbone network is concatenated with the output of the first upsampling layer and the third C2f-MLCA layer of the neck network at the second connection layer and then input into the first C2f layer for feature extraction. The output of the first C2f layer is concatenated with the output of the second C2f-MLCA layer at the third connection layer and then input into the second C2f layer for feature extraction. The output of the second C2f layer is concatenated with the ninth convolutional layer and the fourth connection layer and then input into the third C2f layer for feature extraction. The output of the third C2f layer and the output of the downsampling layer are concatenated at the fifth connection layer and then input into the C2f-MHSA layer to output a fused feature map. The improved YOLOv8 model in this embodiment embeds a C2f-MHSA layer between the neck network and the detection head network, which can further enhance spatial context understanding, establish global dependencies between different regions in the image, and make up for the shortcomings of the limited receptive field of traditional convolution, especially suitable for long-distance, irregularly shaped linear ground object recognition.
[0076] The improved YOLOv8 model's detection head network includes a first detection head, a second detection head, and a third detection head. The input to the first detection head is the output of the second C2f layer, the input to the second detection head is the output of the third C2f layer, and the input to the third detection head is the fused feature map output by the C2f-MHSA layer. In this embodiment, the first, second, and third detection heads use feature maps of different scales as input, which enhances the improved YOLOv8 model's ability to recognize small targets and elongated structures such as linear features on the lunar surface. This improved YOLOv8 model in this embodiment sets up multi-task outputs in the detection head network. Each detection head in the network simultaneously regresses the target category probability, bounding box center coordinates, bounding box width, and bounding box height to enhance the perception of small targets in remote sensing images, thereby simultaneously completing target localization, classification, and confidence prediction. In this embodiment, the number of classification output channels is set to 3, and the Softmax function is used to predict the probability distribution of each predicted box belonging to the category of ridges, grabens, or leaf-shaped scarps.
[0077] This embodiment improves the YOLOv8 model. The overall design follows the principles of lightweight, high precision, and multi-scale compatibility, and is suitable for the automatic detection of linear features (ridges, grabens, and leaf-shaped scarps) in lunar remote sensing images. Through the above structural design and module collaboration, the improved YOLOv8 model in this embodiment has excellent ability to express terrain details and perceive spatial structure, and can effectively cope with the technical challenges of identifying low contrast, weak texture, and small targets in lunar remote sensing images.
[0078] Specifically, the C2f-MLCA layer and the C2f-MHSA layer each include a pre-convolutional layer, a splitting layer, a bottleneck layer, a first connecting layer, and a post-convolutional layer. The feature map is first input into the pre-convolutional layer. The splitting layer separates the output of the pre-convolutional layer into a first feature map and a second feature map. The first feature map is input into the first connecting layer after passing through the bottleneck layer, and the second feature map is directly input into the first connecting layer. The first connecting layer concatenates all the input feature maps to obtain a concatenated feature map, which is input into the post-convolutional layer to generate an output feature map. The bottleneck layer of the C2f-MLCA layer includes a first convolutional layer, a second convolutional layer, and an MLCA layer connected in sequence. The bottleneck layer of the C2f-MHSA layer includes a third convolutional layer, an MHSA layer, and a fourth convolutional layer connected in sequence.
[0079] Combination Figure 2The MLCA layer includes a global branch, a local branch, and a second attention fusion layer. The global branch includes a global pooling layer, a one-dimensional convolutional layer, and a first attention fusion layer. The local branch includes a local pooling layer and a one-dimensional convolutional layer. The feature maps of the MLCA layer are input to the global and local branches in parallel. In the global branch, the feature maps of the MLCA layer are input to the global pooling layer (GAP) to generate a global pooling feature map. After feature reshaping, the global pooling feature map is input to the one-dimensional convolutional layer (Conv1d). The output of the one-dimensional convolutional layer is then input to the first attention fusion layer to generate a global attention weight vector. The first attention fusion layer can use the sigmoid activation function to apply the first attention weight vector to the output of the one-dimensional convolutional layer. The first branch processes the data to generate a global attention weight vector. In the local branch, the feature map of the input MLCA layer is input to a local pooling layer (LAP) to generate a local pooling feature map. This local pooling feature map, after feature reshaping, is input to a second one-dimensional convolutional layer. The output of the second one-dimensional convolutional layer and the global attention weight vector output from the global branch are input to a second attention fusion layer. The second attention fusion layer multiplies the output of the second one-dimensional convolutional layer element-wise with the global attention weight vector output from the global branch and normalizes it using a sigmoid activation function to generate the final channel attention weights. These channel attention weights, after feature reshaping, are matched to the dimension of the feature map input to the MLCA layer. The feature map input to the MLCA layer is then weighted by channel to obtain the output of the MLCA layer. In this embodiment, the MLCA layer, through parallel dual-path processing of global and local branches and two-stage fusion processing of the first and second attention fusion layers, effectively improves the model's sensitivity to key features and suppresses background interference, thereby improving the model's robustness and detection accuracy in complex environments.
[0080] Both the first and second one-dimensional convolutional layers in the MLCA layer use one-dimensional convolutional kernels, with a kernel size of... k With channel dimension C Proportional to each other, aiming to capture local features between each channel and its neighboring channels. Kernel size k The choice is determined by the following formula, which dynamically determines the appropriate kernel size. k This ensures that one-dimensional convolutions efficiently and effectively capture the interaction information between channels. Adjusting the scaling hyperparameter... and offset hyperparameters b The complexity of convolution operations can be controlled to meet the needs of different applications. The specific formula is as follows:
[0081] ;
[0082] in, C Indicates the channel dimension; k It refers to the kernel size; μThis represents the scaling hyperparameter, used to control how much the kernel size changes with the number of channels; the default value is 2. b This represents the offset hyperparameter, used as a baseline for adjusting the kernel size; the default value is 1. odd The operator that takes the nearest odd number; that is, if the calculated result is... k If the number is even, increment by 1.
[0083] The MLCA layer extracts fine-grained local information through local pooling and then combines it with global pooling to obtain channel attention weights that contain overall contextual information, thereby improving the sensitivity to targets. The MLCA layer can perform multi-level rescaling and fusion of the input feature map, enabling the model to better distinguish between targets and backgrounds, effectively handle occlusion, illumination changes, and background noise in the image, and thus improve the stability and reliability of target detection.
[0084] The C2f-MHSA layer is inserted before the detection head network of the YOLOv8 model. It aims to enhance the model's ability to perceive global context and long-distance spatial dependencies through multiple self-attention mechanism heads in parallel in the MHSA layer, thereby improving the detection performance of weak linear features such as lunar ridges, grabens and foliate scarps.
[0085] Combination Figure 3 The MHSA layer includes a linear projection layer, multiple parallel self-attention mechanism heads, a concatenation layer, and a linear transformation layer. The feature map input to the MHSA layer is flattened to obtain an input vector. The input vector is input to the linear projection layer to generate a query vector Q, a key vector K, and a value vector V. The query vector Q, key vector K, and value vector V are input in parallel to multiple self-attention mechanism heads for computation. The outputs of the multiple self-attention mechanism heads are concatenated by the concatenation layer and then input to the linear transformation layer for dimension restoration to generate the output of the MHSA layer.
[0086] Combination Figure 4 The self-attention mechanism head includes a Scaled Dot-Product Attention module. This module performs matrix multiplication on the query vector Q and the key vector K to obtain a relevance score. This relevance score is then scaled and masked before being converted into self-attention weights using a Softmax activation function, which are then used to perform a weighted summation on the value vector V. The output of the self-attention mechanism head is represented as follows:
[0087] ;
[0088] in, Output i Indicates the first i The output of a self-attention mechanism head; Qi Indicates the first i The query vector input to the self-attention mechanism head; K i Indicates the first i The key vector input to the self-attention mechanism head; V i Indicates the first i The value vector input to the self-attention mechanism head; d This represents the dimensions of the query vector and the key vector, and is used as a scaling factor to prevent the gradient explosion caused by an excessively large dot product result. Indicates the first i The transpose of the key vector input to the self-attention mechanism head; R h and R w The codes representing height and width are used to introduce spatial location information; Softmax The function represents the correlation between the query vector, key vector, height, and width in the form of probabilities to achieve normalization.
[0089] Softmax The execution process of the function is represented as follows:
[0090] ;
[0091] in, z i Indicates the first i One independent variable, N This indicates the total number of independent variables.
[0092] Compared to other attention mechanisms, the MHSA layer can reduce the computational complexity of the model by parallelizing the computation of multiple self-attention heads. Each self-attention head obtains its weight by calculating the correlation between each location and other locations, and then performs a weighted summation of all locations to obtain more comprehensive contextual information. Because self-attention heads can establish long-range dependencies, they also perform well in detecting distant targets.
[0093] The outputs of multiple self-attention mechanism heads are concatenated by a splicing layer and then input into a linear transformation layer for dimension reduction to generate the output of the MHSA layer. MHSA ( Q,K , V ) is represented as:
[0094] ;
[0095] in, L Represents a linear transformation. h This indicates the number of heads in the self-attention mechanism. ConcatThis indicates a splicing operation.
[0096] The MHSA layer linearly maps the query vector Q, key vector K, and value vector V through a linear projection layer to obtain processing results of different dimensions. Therefore, the MHSA layer allows the model to focus on information from different locations, which is beneficial for parallel computation. Considering the limited hardware memory and model computation requirements, this embodiment only replaces the C2f layer connected to the detection head network in the neck network with a C2f-MHSA layer, focusing on the target and reducing interference from irrelevant background on target detection.
[0097] The training process of the improved YOLOv8 model includes: acquiring historical panoramic images of the moon; slicing the historical panoramic images to obtain historical slice images containing linear features; constructing a dataset based on the historical slice images and the linear feature labels on the historical slice images; inputting the historical slice images in the preprocessed dataset into the improved YOLOv8 model to obtain corresponding output prediction boxes, each output prediction box including: the center coordinates of the prediction box output by the localization branch, the prediction box width, the prediction box height, the class probability distribution output by the classification branch, and the target confidence score output by the confidence branch; calculating the bounding box regression loss of the localization branch, the classification loss of the classification branch, and the confidence loss of the confidence branch based on the linear feature labels on the historical slice images in the dataset and the corresponding output prediction boxes of the historical slice images; obtaining a total loss function by weighted summing of the bounding box regression loss of the localization branch, the classification loss of the classification branch, and the confidence loss of the confidence branch; and iteratively optimizing the improved YOLOv8 model based on the total loss function to obtain a trained improved YOLOv8 model.
[0098] This embodiment uses the LabelImg tool to manually label three types of linear ground features on the dataset: wrinkle ridges, grabens, and lobate scarps. The labeling process involves enclosing the regions of each feature with bounding boxes and adding a linear feature label to each bounding box. Each linear feature label uses the YOLO format for multi-object labeling and includes the linear feature category, bounding box center coordinates, bounding box width, and bounding box height. The bounding box center coordinates, width, and height are all normalized to the width and height scale of the slice image (value range [0, 1]). The category IDs for the linear features are 0, 1, and 2, representing wrinkle ridges, grabens, and lobate scarps, respectively. The dataset preprocessing includes data augmentation and gamma correction. Data augmentation can employ multi-scale scaling, translation, and mosaic techniques to improve the model's generalization ability to targets and multi-class samples.
[0099] During the training phase of the improved YOLOv8 model, each predicted bounding box output by the model corresponds to a prediction in the same format as the linear feature label. The prediction results include the bounding box center coordinates, bounding box width, bounding box height, and class probability distribution. The loss function for model training consists of bounding box regression loss, classification loss, and confidence loss. The bounding box regression loss uses CIoU (Complete Intersection over Union Loss) to measure the overlap between the predicted box and the ground truth box. In this embodiment, to further improve the detection performance of the improved YOLOv8 model in lunar linear feature identification tasks, especially for small samples, imbalanced classes, and difficult-to-detect targets (narrow and long ridges, grabens, and leaf-shaped scarps), a Focal Loss function is introduced during training to replace the standard cross-entropy loss for the classification branch and confidence branch.
[0100] Specifically, Focal Loss is a loss function designed to address the problem of imbalanced samples. It increases the model's focus on difficult samples and reduces the loss contribution from easily classified samples. The improvement goals of Focal Loss include: first, suppressing the dominant role of a large number of easily classified negative samples in the loss; second, strengthening the model's training signal for difficult-to-classify (low-confidence) samples; and third, being suitable for detection scenarios with sparse targets, small targets, and weak textures. The expression is as follows:
[0101] ;
[0102] in: This indicates the confidence level of the prediction result relative to the true category. y= 1 indicates that the true label is positive (i.e., the sample belongs to the target category). y =0 indicates that the true label is negative (i.e., the sample does not belong to the target category). p=σ (logits) To predict probabilities; ( Alpha () is a balancing factor used to reduce the proportion of negative samples in the loss and increase the focus on positive samples; ( gamma () is a modulation factor used to suppress the loss contribution of easily classified samples and highlight the training signal of difficult-to-classify samples. It degenerates into the ordinary binary cross-entropy loss function (BCE). This function passes through a factor... By amplifying the loss on difficult samples and suppressing the loss on easily classified samples, dynamic attention can be achieved during training.
[0103] This embodiment, based on the improved YOLOv8 model, uses a dual-focus loss function structure, where both the classification loss and confidence loss utilize the focus loss function. It also supports the introduction of class weights (class_weights) to enhance the detection capability for a few classes (such as "leaf-shaped sill"). The three losses (localization, classification, and confidence) can be weighted separately and combined into a total loss function. The expression is:
[0104] ;
[0105] in, , , These are the weighting coefficients for the localization branch, classification branch, and confidence branch, respectively. This represents the bounding box regression loss. Represents classification loss, This represents the confidence loss.
[0106] The introduction of the focus loss function effectively addresses the problems of imbalanced training samples, weak target texture and low contrast, and complex background interference, providing a more stable and reliable loss function for the automatic identification of linear structures on the moon. This loss function maintains compatibility with the YOLOv8 model and is also suitable for application in other remote sensing image weak target detection tasks. By jointly training the above loss function, the model can simultaneously optimize the target localization accuracy and classification accuracy. In addition, data augmentation strategies (multi-scale scaling, translation, mosaic enhancement) can be used to improve the model's generalization ability to targets and multi-class samples.
[0107] To illustrate with a specific example, the YOLOv8 model training phase employs the YOLO universal label format. In this example, the category IDs for linear land cover categories are set to 0, 1, and 2, corresponding to wrinkle ridges, grabens, and lobate scarps, respectively. The physical images of wrinkle ridges, grabens, and lobate scarps are shown below. Figure 5 , Figure 6 and Figure 7As shown. The training configuration is set as follows: initial learning rate 0.01, batch size 16, training epochs 100; in the loss function, the bounding box regression loss uses the full intersection-over-union loss, and the classification loss and confidence loss both use the focus loss function; data augmentation uses random color dithering, mosaic enhancement, and image blending to improve model robustness. This embodiment uses the trained improved YOLOv8 model to perform land feature classification and recognition on slice images of the moon. The recognition results are verified through non-maximum suppression and visual interpretation. Finally, the recognition results that meet the requirements are converted into lunar latitude and longitude coordinates and labeled in the panoramic image of the moon. This embodiment sets a confidence threshold to filter predicted boxes and uses non-maximum suppression of the IoU (Intersection over Union) threshold to merge overlapping boxes.
[0108] In another specific embodiment, a lunar linear land cover classification and identification device based on the YOLOv8 model is provided, which includes:
[0109] The acquisition module is used to acquire panoramic images of the moon;
[0110] The processing module is used to slice the panoramic image to obtain a slice image containing linear features;
[0111] The slicing module is used to input the sliced images into the trained improved YOLOv8 model for land cover classification and recognition; wherein, the improvement of the improved YOLOv8 model includes: replacing all C2f layers in the backbone network of the original YOLOv8 model with C2f-MLCA layers; and replacing the C2f layers connected to the detection head network in the neck network of the original YOLOv8 model with C2f-MHSA layers.
[0112] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0113] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0114] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0115] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0116] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims. All of these forms are within the protection scope of the present invention.
Claims
1. A method for classifying and identifying linear land features on the moon based on the YOLOv8 model, characterized in that, include: Obtain panoramic images of the moon; The panoramic image is sliced to obtain a sliced image containing linear features; The sliced images are input into a trained improved YOLOv8 model for land cover classification and recognition. The improvements to the improved YOLOv8 model include: Replace all C2f layers in the backbone network of the original YOLOv8 model with C2f-MLCA layers; Replace the C2f layer in the neck network of the original YOLOv8 model that connects to the detection head network with a C2f-MHSA layer; The C2f-MLCA layer and the C2f-MHSA layer each include a pre-convolutional layer, a splitting layer, a bottleneck layer, a first connection layer, and a post-convolutional layer. Feature maps are first input into the pre-convolutional layer. The splitting layer separates the output of the pre-convolutional layer into a first feature map and a second feature map. The first feature map is input into the first connection layer after passing through the bottleneck layer, and the second feature map is directly input into the first connection layer. The first connection layer concatenates all the input feature maps to obtain a concatenated feature map, which is then input into the post-convolutional layer to generate the output feature map. The bottleneck layer of the C2f-MLCA layer includes a first convolutional layer, a second convolutional layer, and an MLCA layer connected in sequence; The bottleneck layer of the C2f-MHSA layer includes a third convolutional layer, an MHSA layer, and a fourth convolutional layer connected in sequence; The backbone network of the improved YOLOv8 model includes, in sequence, convolutional layer 5, convolutional layer 6, first C2f-MLCA layer, convolutional layer 7, second C2f-MLCA layer, convolutional layer 8, third C2f-MLCA layer, and downsampling layer; The neck network of the improved YOLOv8 model includes upsampling layer 1, connection layer 2, first C2f layer, upsampling layer 2, connection layer 3, second C2f layer, convolutional layer 9, connection layer 4, third C2f layer, connection layer 5, and C2f-MHSA layer; The improved YOLOv8 model's detection head network includes a first detection head, a second detection head, and a third detection head; The sliced image is input into the backbone network of the improved YOLOv8 model after being standardized. After being processed by each layer of the backbone network, it is output by the downsampling layer of the backbone network. The output of the downsampling layer is concatenated with the output of the first upsampling layer of the neck network and the output of the third C2f-MLCA layer in the second connection layer and then input into the first C2f layer for feature extraction. The output of the first C2f layer is concatenated with the output of the second C2f-MLCA layer in the second connection layer and then input into the second C2f layer for feature extraction. The output of the second C2f layer is concatenated with the ninth convolutional layer and the fourth connection layer and then input into the third C2f layer for feature extraction. The output of the third C2f layer and the output of the downsampling layer are concatenated with the fifth connection layer and then input into the C2f-MHSA layer to output a fused feature map. The input to the first detection head is the output of the second C2f layer, the input to the second detection head is the output of the third C2f layer, and the input to the third detection head is the output of the C2f-MHSA layer.
2. The lunar linear land cover classification and identification method based on the YOLOv8 model according to claim 1, characterized in that, The MLCA layer includes a global branch, a local branch, and a second attention fusion layer. The global branch includes a global pooling layer, a one-dimensional convolutional layer, and a first attention fusion layer. The local branch includes a local pooling layer and a one-dimensional convolutional layer. The feature maps of the input MLCA layer are input into the global branch and local branch in parallel. In the global branch, the feature map of the input MLCA layer is input into the global pooling layer to generate a global pooling feature map. After feature reshaping, the global pooling feature map is input into the first one-dimensional convolutional layer. The output of the first one-dimensional convolutional layer is then input into the first attention fusion layer to generate a global attention weight vector. In the local branch, the feature map of the input MLCA layer is input into the local pooling layer to generate a local pooling feature map. The local pooling feature map is then reshaped and input into the second one-dimensional convolutional layer. The output of the second one-dimensional convolutional layer and the global attention weight vector of the global branch output are input into the second attention fusion layer to generate the final channel attention weights. After feature reshaping, the channel attention weights are weighted by channel on the feature map of the input MLCA layer to obtain the output of the MLCA layer.
3. The lunar linear land cover classification and identification method based on the YOLOv8 model according to claim 1, characterized in that, The MHSA layer includes a linear projection layer, multiple self-attention mechanism heads, a splicing layer, and a linear transformation layer; The feature map input to the MHSA layer is flattened to obtain the input vector. The input vector is fed into the linear projection layer to generate a query vector, a key vector, and a value vector; The query vector, key vector, and value vector are input in parallel into multiple self-attention mechanism heads for computation. The outputs of multiple self-attention mechanism heads are concatenated by a splicing layer and then input into a linear transformation layer for dimension restoration to generate the output of the MHSA layer.
4. The lunar linear land cover classification and identification method based on the YOLOv8 model according to claim 3, characterized in that, The output of the self-attention mechanism head is represented as follows: ; in, Output i Indicates the first i The output of a self-attention mechanism head; Q i Indicates the first i The query vector input to the self-attention mechanism head; K i Indicates the first i The key vector input to the self-attention mechanism head; V i Indicates the first i The value vector input to the self-attention mechanism head; d Indicates the dimensions of the query vector and key vector; Indicates the first i The transpose of the key vector input to the self-attention mechanism head; R h and R w The codes represent the height and width respectively; Output of MHSA layer MHSA ( Q,K , V ) is represented as: ; in, L Represents a linear transformation. h This indicates the number of heads in the self-attention mechanism. Concat This indicates a splicing operation.
5. The lunar linear land cover classification and identification method based on the YOLOv8 model according to claim 1, characterized in that, The training method for the improved YOLOv8 model includes: Obtain historical panoramic images of the moon; The historical panoramic image is sliced to obtain a historical slice image containing linear features; A dataset is constructed based on the historical slice images and the linear feature labels annotated on the historical slice images; The historical slice images in the dataset are input into the improved YOLOv8 model to obtain the corresponding output prediction boxes. Each output prediction box includes: the center coordinates of the prediction box output by the localization branch, the width of the prediction box, the height of the prediction box, the class probability distribution output by the classification branch, and the target confidence output by the confidence branch. Based on the linear land cover labels on historical slice images in the dataset and the corresponding output prediction boxes of historical slice images, the bounding box regression loss of the localization branch, the classification loss of the classification branch, and the confidence loss of the confidence branch are calculated respectively. The total loss function is obtained by weighted summing of the bounding box regression loss of the localization branch, the classification loss of the classification branch, and the confidence loss of the confidence branch. The improved YOLOv8 model is iteratively optimized based on the total loss function to obtain a trained improved YOLOv8 model.
6. The lunar linear land cover classification and identification method based on the YOLOv8 model according to claim 5, characterized in that, The labeling method for the linear feature tags includes: Use a bounding box to select linear feature regions on historical slice images; Add corresponding linear feature labels to each bounding box; the linear feature labels include: linear feature category, bounding box center coordinates, bounding box width, and bounding box height.
7. The lunar linear land cover classification and identification method based on the YOLOv8 model according to claim 5, characterized in that, Both the classification loss and the confidence loss adopt the focus loss function.
8. A lunar linear land feature classification and identification device based on the YOLOv8 model, characterized in that, The apparatus for performing the lunar linear land cover classification and identification method based on the YOLOv8 model as described in any one of claims 1-7, the apparatus comprising: The acquisition module is used to acquire panoramic images of the moon; The processing module is used to slice the panoramic image to obtain a slice image containing linear features; The recognition module is used to input the sliced image into the trained improved YOLOv8 model for land cover classification and recognition; wherein, the improvement of the improved YOLOv8 model includes: replacing all C2f layers in the backbone network of the original YOLOv8 model with C2f-MLCA layers; and replacing the C2f layer connected to the detection head network in the neck network of the original YOLOv8 model with C2f-MHSA layers.