基于卷积神经网络的恒星光谱自动分类方法
石超君1, 邱波1,*, 周亚同1, 段福庆2,*
1. 河北工业大学电子信息工程学院, 天津 300401
2. 北京师范大学信息科学与技术学院, 北京 100875
*通讯联系人 e-mail: qiubo@hebut.edu.cn; fqduan@hnu.edu.cn

作者简介: 石超君, 1992年生, 河北工业大学电子信息工程学院博士研究生 e-mail: 474756323@qq.com

摘要

恒星光谱自动分类是研究恒星光谱的基础内容, 快速、 准确自动识别、 分类恒星光谱可提高搜寻特殊天体速度, 对天文学研究有重大意义。 目前我国大型巡天项目LAMOST每年发布数百万条光谱数据, 对海量恒星光谱进行快速、 准确自动识别与分类研究已成为天文学大数据分析与处理领域的研究热点之一。 针对恒星光谱自动分类问题, 提出一种基于卷积神经网络(CNN)的K和F型恒星光谱分类方法, 并与支持向量机(SVM)、 误差反向传播算法(BP)对比, 采用交叉验证方法验证分类器性能。 与传统方法相比CNN具有权值共享, 减少模型学习参数; 可直接对训练数据自动进行特征提取等优点。 实验采用Tensorflow深度学习框架, Python3.5编程环境。 K和F恒星光谱数据集采用国家天文台提供的LAMOST DR3数据。 截取每条光谱波长范围为3 500~7 500 Å部分, 对光谱均匀采样生成数据集样本, 采用min-max归一化方法对数据集样本进行归一化处理。 CNN结构包括: 输入层, 卷积层C1, 池化层S1, 卷积层C2, 池化层S2, 卷积层C3, 池化层S3, 全连接层, 输出层。 输入层为一批K和F型恒星光谱相同的3 700个波长点处流量值。 C1层设有10个大小为1×3步长为1的卷积核。 S1层采用最大池化方法, 采样窗口大小为1×2, 无重叠采样, 生成10张特征图, 与C1层特征图数量相同, 大小为C1层特征图的二分之一。 C2层设有20个大小为1×2步长为1的卷积核, 输出20张特征图。 S2层对C2层20张特征图下采样输出20张特征图。 C3层设有30个大小为1×3步长为1的卷积核, 输出30张特征图。 S3层对C3层30张特征图下采样输出30张特征图。 全连接层神经元个数设置为50, 每个神经元都与S3层的所有神经元连接。 输出层神经元个数设置为2, 输出分类结果。 卷积层激活函数采用ReLU函数, 输出层激活函数采用softmax函数。 对比算法SVM类型为C-SVC, 核函数采用径向基函数, BP算法设有3个隐藏层, 每个隐藏层设有20, 40和20个神经元。 数据集分为训练数据和测试数据, 将训练数据的40%, 60%, 80%和100%作为5个训练集, 测试数据作为测试集。 分别将5个训练集放入模型中训练, 共迭代8 000次, 每次训练好的模型用测试集进行验证。 对比实验采用100%的训练数据作为训练集, 测试数据作为测试集。 采用精确率、 召回率、 F-score、 准确率四个评价指标评价模型性能, 对实验结果进行详细分析。 分析结果表明CNN算法可对K和F型恒星光谱快速自动分类和筛选, 训练集数据量越大, 模型泛化能力越强, 分类准确率越高。 对比实验结果表明采用CNN算法对K和F型恒星光谱自动分类较传统机器学习SVM和BP算法自动分类准确率更高。

关键词: 恒星光谱; 自动分类; 卷积神经网络; 交叉验证; 评价指标
中图分类号:P157.2 文献标识码:A
Automatic Classification Method of Star Spectra Data Based on Convolutional Neural Network
SHI Chao-jun1, QIU Bo1,*, ZHOU Ya-tong1, DUAN Fu-qing2,*
1. School of Electronics and Information Engineering, Hebei University of Technology, Tianjin 300401, China
2. College of Information Science and Technology, Beijing Normal University, Beijing 100875, China
Abstract

Star spectral automatic classification is the basis for the study of Star Spectral analysis. The fast and accurate automatic identification and classification of the star spectra can improve the search for the speed of the special celestial bodies, which is of great significance to the study of astronomy. At present, LAMOST, a large-scale spacecraft project in China, releases millions of spectral data every year. Fast and accurate automatic identification and classification of massive star spectra has become one of the hot spots in the field of astronomical data analysis and processing. Aiming at the problem of star spectral automatic classification, a new spectral classification method of K, F stellar based on convolutional neural network (CNN) is proposed. Support Vector Machine (SVM) and Back Propagation (BP) neural network algorithms are compared algorithms. The cross-validation method is used to verify the performance of the classifier. Compared with the traditional method, CNN has the advantages of sharing the weight and reducing the learning parameters of the model. It can automatically extract training data features. The experiment uses the Tensorflow depth learning framework and the Python 3.5 programming environment. The K, F stellar spectral dataset uses the LAMOST DR3 data provided by the National astronomical observatory of the Chinese academy of sciences. Spectra with wavelengths in the 3 500 to 7 500 range are sampled evenly to generate data sets. Data sets were normalized using the min-max normalization method. The CNN structure includes an input layer, a convolution layer C1, a pooling layer S1, a convolution layer C2, a pooling layer S2, a convolution layer C3, a pooling layer S3, a full connection layer and an output layer. The input layer is the flow value at 3 700 wavelength points of a group of K and F stars. The C1 layer has 10 convolution kernels in size of 1×3 steps of 1. S1 layer using the maximum pooling method. The size of the sampling window is 1×2, no overlapping sampling. The sampling result produces 10 features, which is the same as the number of the C1 features, and each feature is one-half the size of the C1 feature. The C2 layer has 20 convolution kernels of size 1×2 steps of 1 which outputs 20 feature maps. S2 layer outputs 20 features. The C3 layer has 30 convolution kernels of size 1×3 steps of 1 which outputs 30 feature maps. S3 layer outputs 30 features. The number of fully connected layer neurons is set to 50, and each neuron is connected to all the neurons in the S3 layer. The number of neurons in the output layer is set to 2, and the output classification results are obtained. The activation function of convolution layer uses the ReLU function, and the activation function of output layer uses the softmax function. The contrast algorithm SVM type is C-SVC, and its kernel function uses the radial basis function. The BP algorithm has three hidden layers, each with 20, 40 and 20 neurons. Data set is divided into training data and test data. The training data of 40%, 60%, 80% and 100% are used as training sets and the test data is used as a test set. The training sets are put into the model for training. Each training iteration 8 000 times. Each trained model is validated with a test set. The training data of 100% are used as a training set for comparative experiments. And test data are used as a test set. The accuracy, recall, F-score and accuracy are used to evaluate the performance of the model. The results of experiments are analyzed in detail. Analysis results show that CNN algorithm can quickly and automatically classify and screen K, F star spectra. The greater the amount of data in the training set, the stronger the model generalization ability and the higher the classification accuracy. Contrast experiment results demonstrate that CNN algorithm significantly outperform the competitors SVM and BP algorithms on automatic classification method of K and F star spectra data.

Key words: Star spectra data; Automatic classification; Convolutional neural network; Cross-validation; Evaluation index
引 言

恒星光谱自动分类是研究恒星光谱的基础内容, 快速、 准确自动识别、 分类恒星光谱可提高搜寻特殊天体速度, 对天文学研究有重大意义。 目前通用恒星光谱分类方法是基南系统(MK系统), 该方法根据恒星温度由高至低排序, 将恒星光谱分为O, B, A, F, G, K和M七类光谱型光谱, 每类光谱细分为0~9个数量不统一的次型光谱[1]。 目前, 国内大型巡天项目如: LAMOST和SDSS每年产生数百万恒星光谱数据, 对海量恒星光谱进行快速、 准确自动识别与分类[2, 3]研究已成为天文学大数据分析[4, 5]与处理领域研究热点之一。

在恒星光谱自动分类方面, Zhang[6]等提出一种基于自动恒星光谱分类的分层方法, 该方法采用非参数回归算法确定恒星光谱主类和子类, 使用偏最小二乘回归算法确定发光类型。 YI[7]等将随机森林算法应用于恒星光谱分类, 实验表明随机森林比多层感知器网络效率高, 均方根值(RMS)误差小。 刘超[8]等提出基于恒星轨迹线指数对LAMOST恒星光谱自动分类。 Kheirdastan[9]等提出基于概率神经网络的恒星光谱分类方法, 分类效果优于SVM和K-means算法。 刘蓉[1]等提出基于非参数回归与Adaboost的恒星光谱自动分类方法, 提升了恒星光谱次型和光度型分类精度。 Jiang[10]等采用改进Fisher分类器对WDMS光谱自动分类。

CNN[11, 12]在特征提取、 识别与分类等方面优于浅层网络, 泛化能力强, 已广泛应用于各个科研领域[13], 但尚未应用于天文领域恒星光谱自动分类。 本文提出基于高学习效率CNN算法对K和F型恒星光谱自动分类, 同时与文献[11]提出的SVM和BP算法对比。

1 卷积神经网络原理

CNN是一种经典深层神经网络结构。 与传统方法相比, 其具有权值共享、 对训练数据自动特征提取等优点。

1.1 CNN通用结构

CNN通用结构如图1所示, 包括: 输入层、 卷积层、 池化层、 全连接层和输出层。 数据集进入网络与卷积层多个卷积核卷积生成特征图, 池化层对特征图下采样, 生成新特征图, 全连接层将池化层生成的多个特征图融合、 分类, 输出分类结果。

1.2 恒星光谱分类CNN结构

本文提出九层卷积神经网络结构, 包括: 输入层, 卷积层C1, 池化层S1, 卷积层C2, 池化层S2, 卷积层C3, 池化层S3, 全连接层, 输出层, 如图2所示。

图1 卷积神经网络通用结构Fig.1 The basic structure of convolutional neural network

图2 恒星光谱分类卷积神经网络结构Fig.2 The structure of convolutional neural network

输入层为训练集, 本文训练集为一批恒星光谱同样的3 700个波长点处流量值, 大小为1× 3 700。 C1层设有10个大小为1× 3步长为1的卷积核, 不同卷积核可提取输入数据不同特征。 输入数据与每个卷积核进行卷积, 加偏置后经过激活函数得到卷积层C1, 生成10张大小为1× 3 698的特征图。 卷积计算公式如式(1)所示

xj(l)=iNjai(l-1)kij(l)+bC(l)ai(l)=f(xj(l))(1)

其中, l为神经网络层数, j为特征图, k为卷积核, bC为偏置值, Nj为输入特征图集合, f为激活函数, 本文采用ReLU激活函数, 表达式为

f(xj(l))=max(0, xj(l))(2)

S1层称下采样层, 本文采用最大池化方法, 采样窗口大小为1× 2, 无重叠采样, 生成10张特征图, 数量与C1层相同, 大小为1× 1 849, 是C1层二分之一。 C2层设有20个大小为1× 2步长为1的卷积核, 输出20张大小为1× 1 848的特征图。 S2层对C2层20张特征图下采样输出20张大小为1× 924的特征图。 C3层设有30个大小为1× 3步长为1的卷积核, 输出30张大小为1× 922的特征图。 S3层对C3层30张特征图下采样输出30张大小为1× 461特征图。 全连接层神经元个数设置为50, 每个神经元与S3层所有神经元连接。 输出层神经元个数设置为2, 激活函数采用softmax函数, 表达式为

f(xj(l))=exj(l)iexi(l)(3)

2 实验与结果分析

实验采用Tensorflow深度学习框架, 软件编程环境为Python3.5。 K和F恒星光谱数据集采用国家天文台提供的10 800条LAMOST DR3数据。 其中, 训练数据为7 800条, K和F型光谱各3 900条, 测试数据3 000条, K和F型光谱各1 500条。 截取每条光谱波长范围为3 500~7 500 Å 部分, 对光谱均匀采样生成数据集样本, 每个样本大小为1× 3 700。 采用min-max归一化方法对数据集样本归一化处理, 归一化公式为

x* =x-minmax-min(4)

其中, min为单样本最小值, max为单样本最大值, x单为样本, x* 为归一化后单样本。 实验选取训练数据的40%, 60%, 80%和100%作为训练集, 测试数据作为测试集, 如表1所示。

表1 光谱数据 Table 1 Spectra data

训练集预处理后放入图2网络训练, 迭代8 000次。 实验采用精确率P、 召回率R、 F-score、 准确率A四个指标评价模型性能, P指被正确分为K(F)型光谱条数与模型分类结果中K(F)型光谱条数的比值。 R指被正确分为K(F)型光谱条数与测试集中K(F)型光谱条数的比值。 F-score为PR的调和平均值, 计算公式为

Fscore=2PR(P+R)(5)

A指被正确分类光谱条数与测试集中光谱条数的比值。 图3为迭代过程中K和F恒星光谱训练集和测试集分类准确率曲线。 其中, 图3(a)表示占训练数据40%, 60%, 80%和100%的训练集分类准确率曲线, 图3(b)表示测试集分类准确率曲线。 由图3(a)和(b)可看出, 训练集数据量越大, 模型泛化能力越强, 分类效果越好。

表2为实验结果分析, 由表2可看出, K型光谱自动分类的P值比F型高, F型光谱自动分类的R值比K型高, 两类光谱自动分类的F-score值无限接近。 随着训练集增大, K和F型恒星光谱自动分类的A值逐步提高, 训练集为100%训练数据时, 恒星光谱自动分类的A值为99.83%。

图3 光谱自动分类准确率曲线
(a): 训练集分类准确率曲线; (b): 测试集分类准确率曲线
Fig.3 Spectral automatic classification accuracy curve
(a): Training set classification accuracy curve; (b): Test set classification accuracy curve

表2 分类实验及结果分析 Table 2 Classification experiment and result analysis

采用SVM和BP算法进行对比实验, 用交叉验证方法验证分类器性能, 训练数据为训练集, 测试数据为测试集。 其中, SVM类型为C-SVC, 核函数采用径向基函数; BP算法设有三个隐藏层, 每个隐藏层神经元个数分别为20, 40和20, 对比实验结果如表3所示。 由表3可看出, CNN对K和F型光谱分类A值为99.83%, 比SVM和BP算法分类A值更高。

表3 分类对比实验及结果分析 Table 3 Classification comparative experiment and result analysis
3 结 论

提出了采用高学习效率的CNN算法对LAMOST DR3 K和F恒星光谱自动分类。 分别以训练数据的40%, 60%, 80%和100%作为训练集训练CNN模型, 以测试数据作为测试集分别对训练好的模型测试。 采用精确率P、 召回率R、 F-score、 准确率A四个指标评价模型性能。 分析结果表明CNN算法可以对K和F型恒星光谱进行自动分类和筛选, 训练集数据量越大, 模型泛化能力越强, 分类准确率越高。 对比实验结果表明采用CNN算法对K和F型恒星光谱自动分类较传统机器学习SVM和BP算法自动分类准确率更高。

The authors have declared that no competing interests exist.

参考文献
[1] LIU Rong, QIAO Xue-jun, ZHANG Jian-nan, et al(刘蓉, 乔学军, 张健楠, ). Spectroscopy and Spectral Analysis(光谱学与光谱分析), 2017, 37(5): 1553. [本文引用:2]
[2] Li Xiangru, Pan Ruyang, Duan Fuqing. Research in Astronomy and Astrophysics, 2017, 17(4): 36. [本文引用:1]
[3] Navarro S G, Corradi R L M, Mampaso A. Astronomy and Astrophysics, 2012, 538(1): 76. [本文引用:1]
[4] Lazer D, Kennedy R, King G, et al. Science, 2014, 343(6176): 1203. [本文引用:1]
[5] Fan J, Han F, Liu H. National Science Review, 2014, 1(2): 293. [本文引用:1]
[6] Zhang J N, Luo A L, Tu L P. 2008 Congress on Image and Signal Processing, 2008, 5: 249. [本文引用:1]
[7] Yi Zhenping, Pan Jingchang. 2010 3rd International Congress on Image and Signal Processing, 2010, 7: 3129. [本文引用:1]
[8] Liu Chao, Cui Wenyuan, Zhang Bo, et al. Research in Astronomy and Astrophysics, 2015, 15(8): 1137. [本文引用:1]
[9] Kheirdastan S, Bzarghan M. Astrophysics and Space Science, 2016, 361(9): 304. [本文引用:1]
[10] Jiang Bin, Cao Rui, Li Mingze, et al. 2017 IEEE 3rd International Conference on Control Science and Systems Engineering, 2017. 457. [本文引用:1]
[11] Yann LeCun, Leon Bottou, Yoshua Bengio, et al. Proceedings of the IEEE, 1998, 86(11): 2278. [本文引用:2]
[12] Yann LeCun, Boser B, Denker J S, et al. Neural Computation, 1989, 1(4): 541. [本文引用:1]
[13] ZHOU Fei-yan, JIN Lin-peng, DONG Jun(周飞燕, 金林鹏, 董军). Chinese Journal of Computers(计算机学报), 2017, 40(6): 1229. [本文引用:1]