Deep learning-based galaxy classification method and system
By using adaptive multi-scale fusion and convolutional and attention feature fusion modules, the problems of scale differences and background interference in sky survey images are solved, improving the accuracy and robustness of galaxy morphology classification.
Patent Information
- Application Number
- CN202511774332.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-28
- Publication Date
- 2026-05-01
AI Technical Summary
Existing technologies are insufficient in handling scale differences, structural blurring, and background interference in sky survey images, and lack the ability to identify details of complex galaxy morphologies.
An adaptive multi-scale fusion module is used to align and fuse multi-scale features output from different semantic levels of the ResNet-18 network. Combined with a convolutional and attention feature fusion module, the modeling ability for blurred regions such as spiral arms and edges is enhanced. An adaptive cropping preprocessing strategy is used to reduce background noise interference.
It significantly improves the accuracy and robustness of galaxy morphology classification, effectively handles complex galaxy morphologies, reduces background noise interference, and enhances the ability to distinguish between smooth galaxies and galaxies with rich details.
Smart Images

Figure CN121962690A_ABST
Abstract
Description
A Deep Learning-Based Galaxy Classification Method and System Technical Field
[0001] This invention relates to a galaxy classification method and system based on deep learning, belonging to the field of astronomical data processing and intelligent image recognition technology. Background Technology
[0002] Galaxietylist classification is a crucial research area in extragalactic astronomy, its scientific significance tracing back to the galaxy sequence proposed by Hubble in 1926. This system classifies galaxies based on their ellipticity (E0–E7) and spiral arm structure (Sa–Sd), establishing a correspondence between morphology and evolutionary stages. Subsequent studies have shown that galaxy morphology is closely related to various physical factors, such as the mass distribution of dark matter halos, star formation rates (Kennicutt–Schmidt's law), and ambient density (Dressler relation). The isoluminescence profiles of elliptical galaxies (such as M87) can reflect their merger history and dynamical evolution, while the spiral arm characteristics of spiral galaxies depend on the distribution of molecular gas. Therefore, in-depth research into galaxy morphology helps reveal their formation and evolution mechanisms and provides support for understanding the large-scale structure of the universe. With the advancement of large-scale sky surveys such as SDSS (2000–2020) and DESI (2021–), the amount of observational data is growing exponentially. For example, LSST is expected to collect approximately 20 TB of data each night, ultimately discovering over 10 billion galaxies. Faced with such a massive amount of data, traditional classification methods that rely on expert or crowdsourced annotation are no longer adequate. There is an urgent need for automated and intelligent classification methods to improve data processing efficiency and scientific output.
[0003] Driven by the rapid development of artificial intelligence, galaxy morphology classification methods have evolved from traditional machine learning to deep learning. Early research mainly relied on traditional algorithms such as Support Vector Machines (SVM) and Artificial Neural Networks (ANN), using artificial features such as color, brightness, and texture to achieve classification in small-sample scenarios. However, these methods, dependent on artificial feature construction, have limited generalization ability and struggle to handle complex sky survey images. With the rise of deep learning, Convolutional Neural Networks (CNNs) have become mainstream. However, traditional CNNs still have limitations in handling non-ideal structures such as blurred boundaries and broken spiral arms, and lack effective multi-scale semantic fusion capabilities. To further optimize the model, researchers have proposed various improved structures. For example, improving edge feature extraction capabilities through multi-channel input, and effectively mitigating overfitting in deep networks through activation functions. Although these improvements enhance model stability, they are still insufficient for the collaborative modeling of multi-scale heterogeneous structures. When samples are insufficient, few-sample learning and self-supervised methods are applied. Metric learning expands the training space or momentum contrastive learning achieves high accuracy on unlabeled data. However, these methods have simplified structures and still have limited ability to identify details of complex galaxy morphologies. In recent years, the introduction of the Transformer architecture has further expanded the global modeling capabilities of models. FPN-ViT, which combines pyramid features with the Transformer encoder, exhibits good robustness in complex contexts, but its ability to perceive local features is still insufficient. Summary of the Invention
[0004] The technical problem to be solved by the present invention is that the existing technology is still insufficient in dealing with scale differences, structural ambiguity and background interference in sky survey images, and has insufficient ability to identify details of complex galaxy morphology.
[0005] To solve the above-mentioned technical problems, the present invention is implemented using the following technical solution.
[0006] On the one hand, the present invention provides a galaxy classification method, comprising:
[0007] Acquire large-scale survey galaxy images and perform preprocessing;
[0008] The preprocessed image is input into the ResCAFMS-Net network;
[0009] An adaptive multi-scale fusion module is used to align and fuse the multi-scale features output from different semantic levels of the ResNet-18 network.
[0010] Adaptive pooling is performed on the features of the fused large-scale survey galaxy image, and then input into the classification layer of the ResCAFMS-Net network to obtain the probability distribution of galaxy morphology categories and output the final classification result.
[0011] The ResCAFMS-Net network is an optimized ResNet-18 network. The optimization includes embedding a convolutional and attention feature fusion module between the two convolutional kernels inside each residual basic block, and introducing an adaptive multi-scale fusion module at the back end of the network.
[0012] This invention significantly improves classification performance and robustness to observational interference while maintaining a moderate number of model parameters by introducing an adaptive pruning preprocessing strategy, a convolutional and attention feature fusion module, and an adaptive multi-scale fusion module.
[0013] The preprocessing includes:
[0014] The acquired RGB image is converted to grayscale and then smoothed using a Gaussian filter to suppress unstructured noise, as shown in the following formula:
[0015]
[0016] in, For pixel coordinates, variance is Two-dimensional Gaussian kernel, It is a grayscale image;
[0017] The global background is estimated using a large window mid-range filter and then subtracted from the original image. The formula for the enhanced image after background subtraction is as follows:
[0018]
[0019] in, The image after initial smoothing. To obtain a background estimation image by applying large window midpoint filtering or mean filtering to the initially smoothed image;
[0020] Otsu's adaptive thresholding algorithm is used to segment the foreground and background. The segmentation result can be represented as a binary mask image, as shown in the following formula:
[0021]
[0022] in, To enhance the image, The optimal threshold;
[0023] Perform a morphological closing operation to fill holes and merge fragmented regions. The closing operation formula is as follows:
[0024]
[0025] in, It is a binary mask image. For expansion, To select structural elements of varying sizes and shapes, For corrosion;
[0026] Candidate contours are extracted based on 8-neighborhood connectivity detection, and the contour containing the image center point and having the largest area is selected as the main galaxy target.
[0027] The minimum bounding rectangle is calculated based on the outline of the main galaxy, and then the boundary is expanded according to the margin ratio before cropping to obtain the image region of the main galaxy. The formula is as follows:
[0028]
[0029]
[0030] in, , Candidate connected components, The center coordinates of the image size This is the margin ratio. The coordinates of the left boundary of the rectangle in the horizontal direction. The coordinates of the right boundary of the rectangle in the horizontal direction. The coordinates of the upper boundary of the rectangle in the vertical direction are: The coordinates of the lower boundary of the rectangle in the vertical direction.
[0031] Adaptive cropping preprocessing improves the structural density of galaxies in the input image and reduces background noise interference.
[0032] The convolutional and attention feature fusion module consists of local branches and global branches, which are used for local detail enhancement and global semantic modeling, respectively.
[0033] The local branches sequentially perform convolution to compress channels and shuffle channels to reduce channel redundancy, and then extract spatial texture features through depthwise separable convolution.
[0034] The global branch generates three sets of features—Query, Key, and Value—through convolution, and performs normalized dot product calculation using a multi-head attention mechanism to obtain an attention mapping matrix, which is then used to weight and fuse the Value.
[0035] The outputs of the local and global branches are convolved to restore the channel dimensions, then added to the input residual and normalized. The normalized output feature mapping relationship satisfies:
[0036]
[0037] in, For input features, For convolution, Norm is the normalization function. For the output features of local branches, This refers to the output characteristics of the global branch.
[0038] By using a convolutional and attention feature fusion module, the network's ability to model ambiguous regions such as spiral arms and edges is enhanced, significantly improving the recognition rate of structurally complex samples.
[0039] The calculation formula for the multi-head attention mechanism is as follows:
[0040]
[0041]
[0042] in, For the number of attention heads, For the Key dimension, Number the attention head. For the query features of the m-th attention head, For the key features of the m-th attention head, The linear transformation matrix of the multi-head attention output. Let be the Value feature of the m-th attention head.
[0043] Through a multi-head attention mechanism, the ResCAFMS-Net network model can jointly model local spatial structures and long-range dependencies between channels, thereby improving the ability to recognize complex shapes such as spiral arm blurring, edge breakage, and dust occlusion.
[0044] The adaptive multi-scale fusion module implementation steps include:
[0045] Output features of each layer of the backbone network Bilinear interpolation upsampling is performed to unify the spatial dimensions to the lowest layer output dimensions. The formula is as follows:
[0046]
[0047] in, The output features of each layer of the backbone network;
[0048] The formula for splicing and compressing channels is as follows:
[0049]
[0050] in, This is the first layer feature map after upsampling. This is the fused feature map after convolutional compression. This is the stitched multi-scale feature map;
[0051] The SE mechanism is adopted, which extracts the channel response through global average pooling and calculates the weights through two fully connected layers, as shown in the following formula:
[0052]
[0053] in, It is Sigmoid. For feature weights, It is the ReLU activation function. For the flattened feature channels, To weight each channel, This is the channel attention weight vector;
[0054] Among them, the compression ratio of SE channel recalibration satisfy ,and , , This represents the number of channels in the SE module.
[0055] The adaptive multi-scale fusion module aligns and fuses semantic features at multiple scales and dynamically adjusts the importance weights of channels at different scales to solve the scale misalignment problem between features at different semantic levels and improve the ability to distinguish between smooth galaxies and galaxies with rich details.
[0056] By suppressing redundant channels through the SE mechanism, the ability to distinguish different galaxy structures, such as those dominated by the nucleus bulge and those with smooth disk surfaces, is enhanced.
[0057] The residual backbone adopts a ResNet structure, with each BasicBlock embedding a CAFM module, and inter-layer residual connections are used.
[0058] During the input phase, convolution and max pooling operations are used to spatially compress the image and extract edge features to form an initial receptive field;
[0059] The output stage achieves classification prediction through adaptive average pooling and fully connected layers, and uses Softmax to output the probability distribution of galaxy morphology categories.
[0060] The residual backbone uses cross-layer residual connections to ensure stable gradient propagation.
[0061] The ResCAFMS-Net network is an optimized ResNet-18 network, and the optimization further includes:
[0062] The classification network parameters are optimized using a loss function, with the average loss over the entire training set as the optimization objective. The network parameters are updated iteratively using stochastic gradient descent or an optimizer. The formula for the cross-entropy loss of a single sample is as follows:
[0063]
[0064] in, The true class label vector of the input sample. The predicted probability is the output of the network. This represents the number of categories.
[0065] Embedding convolutional and attention feature fusion modules can enhance local details and global dependencies, while introducing adaptive multi-scale fusion modules can achieve alignment and fusion of multi-scale semantic features.
[0066] The training loss function of the classification network is cross-entropy or a function with a smoothing coefficient. Label smooth cross-entropy.
[0067] Secondly, the present invention provides a galaxy classification system, comprising:
[0068] The image preprocessing module is used to perform adaptive threshold segmentation, morphological closing operations, and connected component detection to locate and crop the main galaxy.
[0069] The feature extraction module includes a four-stage residual backbone, with each residual block embedding a CAFM module for jointly extracting local and global features;
[0070] An adaptive multi-scale fusion module is used to perform upsampling alignment, channel splicing, and weight recalibration on features at different levels;
[0071] The classification and evaluation module is used to perform adaptive pooling and fully connected mapping on the fused features, output the galaxy morphology classification results and perform confidence evaluation.
[0072] The system achieves precise localization of the main galaxy target by adaptive threshold segmentation, morphological closing operation, and connected component detection. It also expands and crops the image based on the minimum bounding rectangle of the main contour to obtain a structurally complete and noise-suppressed image input, providing high-quality data for the subsequent feature extraction module.
[0073] The image preprocessing module is also used to perform brightness normalization, size resampling, rotation enhancement, mirror flipping, color dithering, and random erasure on the input image.
[0074] Compared with the prior art, the beneficial effects achieved by the present invention are as follows:
[0075] Adaptive cropping preprocessing significantly improves the structural density of galaxies in the input image and reduces background noise interference; the convolution and attention feature fusion module enhances the network's ability to model blurred regions such as spiral arms and edges, significantly improving the recognition rate of structurally complex samples; the adaptive multi-scale fusion module performs unified scale alignment and adaptive channel weighting on multi-layer features, solving the scale misalignment problem between features at different semantic levels and improving the ability to distinguish between smooth galaxies and galaxies with rich details. Attached Figure Description
[0076] Figure 1 is a schematic flowchart of the galaxy classification method described in Embodiment 1 of the present invention;
[0077] Figure 2 is a schematic diagram of the adaptive cropping preprocessing flow described in Embodiment 1 of the present invention;
[0078] Figure 3 is a schematic diagram of the structure of the convolution and attention feature fusion module described in Embodiment 1 of the present invention;
[0079] Figure 4 is a schematic diagram of the adaptive multi-scale fusion module described in Embodiment 1 of the present invention;
[0080] Figure 5 is a schematic diagram of the overall network structure of the ResCAFMS-Net network model described in Embodiment 1 of the present invention. Detailed Implementation
[0081] 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.
[0082] Example 1
[0083] As shown in Figure 1, this embodiment introduces a galaxy classification method, including:
[0084] Acquire large-scale survey galaxy images and perform preprocessing;
[0085] The preprocessed image is input into the ResCAFMS-Net network;
[0086] An adaptive multi-scale fusion module is used to align and fuse the multi-scale features output from different semantic levels of the ResNet-18 network.
[0087] Adaptive pooling is performed on the features of the fused large-scale survey galaxy image, and then input into the classification layer of the ResCAFMS-Net network to obtain the probability distribution of galaxy morphology categories and output the final classification result.
[0088] The ResCAFMS-Net network is an optimized ResNet-18 network. The optimization includes embedding a convolutional and attention feature fusion module between the two convolutional kernels inside each residual basic block, and introducing an adaptive multi-scale fusion module at the back end of the network.
[0089] Specifically, large-scale survey galaxy images can be obtained from publicly available galaxy morphology datasets, such as the Galaxy Zoo dataset, which provides galaxy images acquired by survey telescopes and corresponding volunteer voting results. Depending on the mission requirements, the raw data can be filtered according to pre-set threshold rules to obtain various target samples, including spiral galaxies, edge disk galaxies, and smooth galaxies of different circularity levels, which are then divided into training and testing sets according to a certain ratio.
[0090] Specifically, a convolution and attention feature fusion module is embedded between two 3*3 convolution kernels inside each residual basic block.
[0091] In the five-class classification task of the Galaxy Zoo 2 dataset, the proposed method achieves an overall classification accuracy of 96.42%, which is significantly better than many existing mainstream models, and still maintains high robustness under the conditions of adding noise and fuzzy interference.
[0092] As shown in Figure 2, the preprocessing includes:
[0093] The acquired RGB image is converted to grayscale and then smoothed using a Gaussian filter to suppress unstructured noise, as shown in the following formula:
[0094]
[0095] in, For pixel coordinates, variance is Two-dimensional Gaussian kernel, It is a grayscale image;
[0096] The global background is estimated using a large window mid-range filter and then subtracted from the original image. The formula for the enhanced image after background subtraction is as follows:
[0097]
[0098] in, The image after initial smoothing. To obtain a background estimation image by applying large window midpoint filtering or mean filtering to the initially smoothed image;
[0099] Otsu's adaptive thresholding algorithm is used to segment the foreground and background. The segmentation result can be represented as a binary mask image, as shown in the following formula:
[0100]
[0101] in, To enhance the image, The optimal threshold;
[0102] Perform a morphological closing operation to fill holes and merge fragmented regions. The closing operation formula is as follows:
[0103]
[0104] in, It is a binary mask image. For expansion, To select structural elements of varying sizes and shapes, For corrosion;
[0105] Candidate contours are extracted based on 8-neighborhood connectivity detection, and the contour containing the image center point and having the largest area is selected as the main galaxy target.
[0106] The minimum bounding rectangle is calculated based on the outline of the main galaxy, and then the boundary is expanded according to the margin ratio before cropping to obtain the image region of the main galaxy. The formula is as follows:
[0107]
[0108]
[0109] in, , Candidate connected components, The center coordinates of the image size This is the margin ratio. The coordinates of the left boundary of the rectangle in the horizontal direction. The coordinates of the right boundary of the rectangle in the horizontal direction. The coordinates of the upper boundary of the rectangle in the vertical direction are: The coordinates of the lower boundary of the rectangle in the vertical direction.
[0110] Specifically, margin ratio The value can range from 0.1 to 0.3; in this embodiment, it is 0.2.
[0111] As shown in Figure 3, the convolution and attention feature fusion module consists of local branches and global branches, which are used for local detail enhancement and global semantic modeling, respectively.
[0112] The local branches sequentially perform convolution to compress channels and shuffle channels to reduce channel redundancy, and then extract spatial texture features through depthwise separable convolution.
[0113] The global branch generates three sets of features—Query, Key, and Value—through convolution, and performs normalized dot product calculation using a multi-head attention mechanism to obtain an attention mapping matrix, which is then used to weight and fuse the Value.
[0114] The outputs of the local and global branches are convolved to restore the channel dimensions, then added to the input residual and normalized. The normalized output feature mapping relationship satisfies:
[0115]
[0116] in, For input features, For convolution, Norm is the normalization function. For the output features of local branches, This refers to the output characteristics of the global branch.
[0117] Specifically, the local branch sequentially performs 1×1 convolutions to compress channels and shuffle channels to reduce channel redundancy, and then extracts spatial texture features through 3×3 depthwise separable convolutions; the global branch generates three sets of features, Query, Key, and Value, through 1×1 convolutions; the outputs of both branches are restored to channel dimensions through 1×1 convolutions.
[0118] Specifically, It is a 1×1 convolution.
[0119] Specifically, the structure of the convolution and attention feature fusion module is as follows: Let the feature map input to the convolution and attention feature fusion module be... ,in For the number of channels, Given the spatial dimensions, the convolutional branch first performs a 1×1 convolution on the input to compress the channels. Let the kernel parameters be denoted as . The compressed features are:
[0120]
[0121] Channel shuffling is performed on the compressed features to break the fixed grouping correlation between channels. This operation is denoted as... ,get:
[0122]
[0123] Subsequently Apply a 3×3 convolution with kernel parameters of 1000. The local enhancement features are obtained:
[0124]
[0125] In the attention branch, this embodiment employs a lightweight self-attention mechanism to model long-range dependencies between spatial locations. First, three 1×1 convolutions are used to generate Query, Key, and Value features, respectively, with their convolution kernel parameters denoted as follows: Then we have:
[0126]
[0127] Will Flattened into a matrix in the spatial dimension, let be... , , ,in ;
[0128] Calculate the attention weight matrix:
[0129]
[0130] in, , The scaling factor can be taken as the query channel dimension. , Normalization is performed on each row so that the sum of the attention weights corresponding to each query position is 1. Then, the attention weights are used to... We perform a weighted summation to obtain the global augmented features:
[0131]
[0132] in, The features after convolution of Value, This is the attention weight matrix;
[0133] Then Restored to It is in tensor form. A 1×1 convolution can be used if necessary. Channel number mapping back to Same number of channels;
[0134] The outputs of the convolutional and attention branches are added or concatenated element-wise and then fused through a linear transformation to obtain the output features of the convolutional and attention feature fusion module. When using element-wise addition, it can be represented as:
[0135]
[0136] in, The output features of the convolution and attention feature fusion module This is a global enhancement feature.
[0137] The calculation formula for the multi-head attention mechanism is as follows:
[0138]
[0139]
[0140] in, For the number of attention heads, For the Key dimension, Number the attention head. For the query features of the m-th attention head, For the key features of the m-th attention head, The linear transformation matrix of the multi-head attention output. Let be the Value feature of the m-th attention head.
[0141] As shown in Figure 4, the implementation steps of the adaptive multi-scale fusion module include:
[0142] Output features of each layer of the backbone network Bilinear interpolation upsampling is performed to unify the spatial dimensions to the lowest layer output dimensions. The formula is as follows:
[0143]
[0144] in, The output features of each layer of the backbone network;
[0145] The formula for splicing and compressing channels is as follows:
[0146]
[0147] in, This is the first layer feature map after upsampling. This is the fused feature map after convolutional compression. This is the stitched multi-scale feature map;
[0148] The SE mechanism is adopted, which extracts the channel response through global average pooling and calculates the weights through two fully connected layers, as shown in the following formula:
[0149]
[0150] in, It is Sigmoid. For feature weights, It is the ReLU activation function. For the flattened feature channels, To weight each channel, This is the channel attention weight vector;
[0151] Among them, the compression ratio of SE channel recalibration satisfy ,and , , This represents the number of channels in the SE module.
[0152] The residual backbone adopts a ResNet structure, with each BasicBlock embedding a CAFM module, and inter-layer residual connections are used.
[0153] During the input phase, convolution and max pooling operations are used to spatially compress the image and extract edge features to form an initial receptive field;
[0154] The output stage achieves classification prediction through adaptive average pooling and fully connected layers, and uses Softmax to output the probability distribution of galaxy morphology categories.
[0155] Specifically, the input stage performs spatial compression and edge feature extraction on the image through 7×7 convolution and max pooling operations.
[0156] Specifically, the ResNet structure embeds a CAFM module between two 3x3 convolutional kernels in each BasicBlock residual block.
[0157] Specifically, the structure of the adaptive multi-scale fusion module is as follows: Let the feature maps output by the four residual stages of the network be respectively... ,in Highest spatial resolution, The lowest spatial resolution, firstly Space dimensions For reference, bilinear interpolation upsampling is performed on the remaining feature maps to ensure consistent spatial dimensions, i.e.
[0158]
[0159] in, This indicates that the input features are interpolated to the... Using the same spatial dimensions, the feature maps of the four scales aligned are then concatenated along the channel dimension to obtain multi-scale combined features:
[0160]
[0161] in , This is the sum of the number of channels at each scale;
[0162] To adaptively learn the importance of channels at each scale, this embodiment... The above introduces a channel attention mechanism in the form of SE, which first performs global average pooling on each channel to obtain the channel description vector:
[0163]
[0164] Combine the pooling results of all channels into a vector. , is represented as:
[0165]
[0166] in, This is the sum of the number of channels at each scale. This represents the pooling result of the channel;
[0167] Then, channel dependency modeling and nonlinear transformation are implemented through a two-layer fully connected network to obtain the channel weight vector. Specifically:
[0168]
[0169] in This is the weight matrix of the first fully connected layer. This is the weight matrix for the second fully connected layer. For bias term one, For the biased term, For example, the ReLU activation function. The sigmoid function is used to constrain channel weights to a certain value. interval;
[0170] The obtained channel weights are applied channel by channel. The recalibrated feature map is obtained:
[0171]
[0172] in This process can be simplified as
[0173]
[0174] in, Represents element-wise multiplication along the channel dimension. Apply a 1×1 convolution:
[0175]
[0176] in, The convolution kernel parameters, and the number of output channels can be set to be consistent with the number of feature channels in the high-level layers of the backbone network. The feature representation after multi-scale fusion will be fed into a global average pooling layer, and then output as the final class probability through a fully connected layer.
[0177] The ResCAFMS-Net network is an optimized ResNet-18 network, and the optimization further includes:
[0178] The classification network parameters are optimized using a loss function, with the average loss over the entire training set as the optimization objective. The network parameters are updated iteratively using stochastic gradient descent or an optimizer. The formula for the cross-entropy loss of a single sample is as follows:
[0179]
[0180] in, The true class label vector of the input sample. The predicted probability is the output of the network. This represents the number of categories.
[0181] Specifically, in the embodiment, an initial learning rate can be selected. The training rounds are 300, the batch size is 32, and the learning rate decay strategy is used to further improve convergence stability.
[0182] The training loss function of the classification network is cross-entropy or a function with a smoothing coefficient. Label smooth cross-entropy.
[0183] Specifically, as shown in Figure 5, the overall structure of the ResCAFMS-Net network is as follows: The input layer first passes through a 7×7 convolutional layer, a downsampling operation with a stride of 2, and a subsequent max pooling layer to compress the spatial size of the input image to one-quarter of its original size, while obtaining initial edge and texture features. Then, it passes through four residual layers in sequence, each of which is composed of several stacked residual blocks. A convolutional and attention feature fusion module is inserted inside each residual block to enhance the feature representation capability. Based on the feature maps output by each residual layer, an adaptive multi-scale fusion module is used to perform multi-scale fusion. The fusion result is mapped to the target class space through global average pooling and a fully connected layer to output the predicted probability of each galaxy class.
[0184] Example 2
[0185] This embodiment introduces a galaxy classification method, including:
[0186] Large-scale survey galaxy images were acquired and preprocessed using an adaptive cropping preprocessing strategy;
[0187] Based on the ResCAFMS-Net network, the preprocessed image is input into a feature extraction network containing a four-stage residual backbone, and a convolutional and attention feature fusion module is embedded in each residual block.
[0188] The multi-scale features output from different semantic levels of the backbone network are aligned and fused. An adaptive multi-scale fusion module is used for scale alignment, channel recalibration and dimensionality reduction.
[0189] Adaptive pooling is performed on the fused features and input into the classification head to obtain the probability distribution of galaxy morphology categories, and the final classification result is output.
[0190] The above method refers to the relevant content in Example 1, and will not be repeated here. It should be noted that:
[0191] This embodiment can test the generalization ability of a trained model under conditions of additive Gaussian noise and spatial ambiguity. For additive Gaussian noise, the noise term can be... Add to the input image to obtain the perturbation image:
[0192]
[0193] By changing the noise variance This simulates different signal-to-noise ratios and observes the changes in the model's classification accuracy. For spatial ambiguity, a Gaussian blur kernel can be used. Convolutional processing of the image yields:
[0194]
[0195] By varying the fuzzy kernel size and variance, the diffusion function effect of observation points is simulated to different degrees. Experimental results show that, under conditions of gradually increasing noise variance and fuzzy kernel size, the model accuracy only decreases slowly and is significantly better than the comparison model, indicating that the method of this invention has good robustness in real-world observation interference scenarios.
[0196] Example 3
[0197] Based on the same inventive concept as Embodiment 1, this embodiment introduces a galaxy classification system, including:
[0198] The image preprocessing module is used to perform adaptive threshold segmentation, morphological closing operations, and connected component detection to locate and crop the main galaxy.
[0199] The feature extraction module includes a four-stage residual backbone, with each residual block embedding a CAFM module for jointly extracting local and global features;
[0200] An adaptive multi-scale fusion module is used to perform upsampling alignment, channel splicing, and weight recalibration on features at different levels;
[0201] The classification and evaluation module is used to perform adaptive pooling and fully connected mapping on the fused features, output the galaxy morphology classification results and perform confidence evaluation.
[0202] Specifically, the above modules can run as software on the same server, or they can be deployed in a distributed manner on multiple devices.
[0203] The image preprocessing module is also used to perform brightness normalization, size resampling, rotation enhancement, mirror flipping, color dithering, and random erasure on the input image.
[0204] In summary, the present invention effectively solves the problems of large target scale variation, structural ambiguity, and strong background noise in large-scale survey galaxy images. While ensuring controllable computational complexity, it significantly improves the accuracy and robustness of galaxy morphology classification and has good application prospects for future large-sample galaxy evolution research based on next-generation survey projects such as LSST.
Claims
1. A method for classifying galaxies, characterized in that, include: Acquire large-scale survey galaxy images and perform preprocessing; The preprocessed image is input into the ResCAFMS-Net network; An adaptive multi-scale fusion module is used to align and fuse the multi-scale features output from different semantic levels of the ResNet-18 network. Adaptive pooling is performed on the fused large-scale survey galaxy image features, and the results are input into the classification layer of the ResCAFMS-Net network to obtain the probability distribution of galaxy morphology categories and output the final classification result. The ResCAFMS-Net network is an optimized ResNet-18 network. The optimization includes embedding a convolution and attention feature fusion module between the two convolution kernels inside each residual basic block and introducing an adaptive multi-scale fusion module at the back end of the network.
2. The galaxy classification method according to claim 1, characterized in that, The preprocessing includes: converting the acquired large-scale survey galaxy images to grayscale and smoothing them with Gaussian filtering to suppress unstructured noise, as shown in the following formula: in, For pixel coordinates, The variance is expressed as Two-dimensional Gaussian kernel, The image is a grayscale image; a large window mid-range filter is used to estimate the global background and subtract it from the original image. The formula for the enhanced image after background subtraction is as follows: in, The image after initial smoothing. To obtain a background estimation image by applying large-window mid-range filtering or mean filtering to the initially smoothed image, the Otsu method adaptive thresholding algorithm is used to segment the foreground and background. The segmentation result can be represented as a binary mask image. The formula is as follows: in, To enhance the image, To find the optimal threshold, perform a morphological closing operation to fill the holes and merge the fragmented regions. The closing operation formula is as follows: in, It is a binary mask image. For expansion, To select structural elements of varying sizes and shapes, For erosion; candidate contours are extracted based on 8-neighborhood connectivity detection, and the contour containing the image center point and having the largest area is selected as the main galaxy target; the minimum bounding rectangle is calculated based on the main galaxy contour, and the boundary is expanded according to the margin ratio before cropping to obtain the main galaxy image region, as shown in the following formula: in, , Candidate connected components, The center coordinates of the image size This refers to the margin ratio. The coordinates of the left boundary of the rectangle in the horizontal direction. The coordinates of the right boundary of the rectangle in the horizontal direction. The coordinates of the upper boundary of the rectangle in the vertical direction are: The coordinates of the lower boundary of the rectangle in the vertical direction.
3. The galaxy classification method according to claim 1, characterized in that, The convolutional and attention feature fusion module consists of local and global branches, used for local detail enhancement and global semantic modeling, respectively. The local branch sequentially performs convolution to compress channels and shuffle channels to reduce redundancy, then extracts spatial texture features through depthwise separable convolution. The global branch generates three sets of features—Query, Key, and Value—through convolution, and uses a multi-head attention mechanism to perform normalized dot product calculations to obtain an attention mapping matrix, which is used for weighted fusion of the Value. The outputs of the local and global branches are convolved to restore the channel dimensions, added to the input residual, and normalized. The normalized output feature mapping relationship satisfies: in, As input features, For convolution, Norm is the normalization function. For the output features of local branches, This refers to the output characteristics of the global branch.
4. The galaxy classification method according to claim 3, characterized in that, The calculation formula for the multi-head attention mechanism is as follows: in, For the number of attention heads, For the Key dimension, Number the attention head. For the first Query features of attention heads, For the first Key features of each attention head, The linear transformation matrix of the multi-head attention output. For the first Value features of each attention head.
5. The galaxy classification method according to claim 1, characterized in that, The adaptive multi-scale fusion module implementation steps include: outputting features from each layer of the backbone network. Bilinear interpolation upsampling is performed to unify the spatial dimensions to the lowest layer output dimensions. The formula is as follows: in, The output features of each layer of the backbone network. To perform channel splicing and compression, the formula is as follows: in, This is the first layer feature map after upsampling. This is the fused feature map after convolutional compression. The result is a multi-scale feature map after concatenation. The SE mechanism is used to extract channel responses through global average pooling, and the weights are calculated using two fully connected layers, as shown in the following formula: in, It is Sigmoid. For feature weights, It is the ReLU activation function. For the flattened feature channels, To weight each channel, Here, SE represents the channel attention weight vector; where SE is the compression ratio of the channel recalibration. satisfy ,and , , This represents the number of channels in the SE module.
6. The galaxy classification method according to claim 1, characterized in that, The residual backbone adopts a ResNet structure, with a CAFM module embedded between the two convolutional kernels in each BasicBlock residual block, and cross-layer residual connections are used between layers. In the input stage, convolution and max pooling operations are used to perform spatial compression and edge feature extraction on the image to form an initial receptive field. In the output stage, adaptive average pooling and fully connected layers are used to achieve classification prediction, and Softmax is used to output the probability distribution of galaxy morphology categories.
7. The galaxy classification method according to claim 1, characterized in that, The ResCAFMS-Net network is an optimized ResNet-18 network. The optimization further includes: optimizing the classification network parameters using a loss function, taking the average loss over the entire training set as the optimization objective, and updating the network parameters through stochastic gradient descent or iterative optimization. The formula for the cross-entropy loss of a single sample is as follows: in, The true class label vector of the input sample. The predicted probability is the output of the network. This represents the number of categories.
8. The galaxy classification method according to claim 7, characterized in that, The training loss function of the classification network is cross-entropy or a function with a smoothing coefficient. Label smooth cross-entropy.
9. A galaxy classification system, characterized in that, include: The image preprocessing module performs adaptive thresholding, morphological closing operations, and connected component detection to locate and crop the main galaxy; the feature extraction module contains a four-stage residual backbone, with each residual block embedding a CAFM module for jointly extracting local and global features. The adaptive multi-scale fusion module is used to perform upsampling alignment, channel concatenation, and weight recalibration on features at different levels; the classification evaluation module is used to perform adaptive pooling and fully connected mapping on the fused features, output galaxy morphology classification results, and perform confidence evaluation.
10. The galaxy classification system according to claim 9, characterized in that, The image preprocessing module is also used to perform brightness normalization, size resampling, rotation enhancement, mirror flipping, color dithering, and random erasure on the input image.