CN113313059A - One-dimensional spectrum classification method and system - Google Patents

One-dimensional spectrum classification method and system Download PDF

Info

Publication number
CN113313059A
CN113313059A CN202110666072.XA CN202110666072A CN113313059A CN 113313059 A CN113313059 A CN 113313059A CN 202110666072 A CN202110666072 A CN 202110666072A CN 113313059 A CN113313059 A CN 113313059A
Authority
CN
China
Prior art keywords
data
dimensional
layer
dimensional spectral
field matrix
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110666072.XA
Other languages
Chinese (zh)
Other versions
CN113313059B (en
Inventor
王书涛
刘诗瑜
孔德明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Yanshan University
Original Assignee
Yanshan University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Yanshan University filed Critical Yanshan University
Priority to CN202110666072.XA priority Critical patent/CN113313059B/en
Publication of CN113313059A publication Critical patent/CN113313059A/en
Application granted granted Critical
Publication of CN113313059B publication Critical patent/CN113313059B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2218/00Aspects of pattern recognition specially adapted for signal processing
    • G06F2218/12Classification; Matching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/213Feature extraction, e.g. by transforming the feature space; Summarisation; Mappings, e.g. subspace methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Data Mining & Analysis (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • General Health & Medical Sciences (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Evolutionary Biology (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Signal Processing (AREA)
  • Image Analysis (AREA)

Abstract

The invention relates to a one-dimensional spectrum classification method and a system, wherein the method comprises the following steps: acquiring near infrared spectrum original data of m samples to be detected; intercepting peak data of all single spectrum sequences in the near infrared spectrum original data, preprocessing the peak data, and then zooming to obtain one-dimensional spectrum signal data; carrying out polar coordinate coding on the zoomed one-dimensional spectral signal data; reconstructing the one-dimensional spectral signal data after polar coordinate coding to obtain a gram angle and field matrix and a gram angle difference field matrix; storing a gram angle and field matrix and the gram angle difference field matrix as an image; dividing the image to obtain a training set and a test set; training the convolutional neural network by adopting a training set; and inputting the test set into the trained convolutional neural network to obtain a classification result. The method can make up the defect of losing useful characteristic information through the double mapping relation between the one-dimensional spectrum and the two-dimensional image.

Description

One-dimensional spectrum classification method and system
Technical Field
The invention relates to the field of one-dimensional spectrum data processing, in particular to a one-dimensional spectrum classification method and system.
Background
The near infrared spectrum technology is to fully utilize the characteristic absorption of frequency doubling and frequency combination of the vibration of hydrogen-containing groups X-H (such as O-H, C-H and N-H) in a near infrared spectrum interval in a measured substance so as to realize the detection of the measured substance. The technology has the advantages of wide applicable sample range, small sample consumption, no damage and easy operation. The method has the advantages of high analysis speed, low detection cost and the like because the single-dimensional absorption spectrum signals are collected. Through the intensive research of people for many years and the continuous improvement of detection technology, the near infrared spectrum comprehensively utilizes a plurality of subjects such as mathematical statistics, chemometrics, machine learning and the like, and is practically applied in the fields of medicine, food and agriculture, environmental pollution, petroleum, chemical industry and the like, and the performance of the constructed classification recognition model is continuously improved.
The current commonly used one-dimensional spectral sequence classification methods include nearest neighbor, logistic regression, naive Bayes, decision trees, support vector machines, neural networks and the like. The machine learning methods can theoretically realize the classification task of a one-dimensional spectrum sequence, but because the near infrared spectrum has the defects of wide spectrum range, high data dimension, weak useful information intensity, more noise interference and the like, the traditional methods have to combine a large amount of spectrum preprocessing, characteristic wavelength extraction, dimensionality reduction and other preprocessing, so that the task amount is increased invisibly, the useful characteristic information is inevitably missed, and the accuracy of the classification result and the applicability of the model cannot be ensured.
At present, with the rapid development of deep learning, researchers begin to focus on the design of deep neural network structures. A deep Convolutional Neural Network (CNN) represents deep learning, and exhibits excellent performance in the fields of speech recognition, computer vision, natural language processing, and the like. In the field of one-dimensional spectra, relevant research for constructing a suitable one-dimensional CNN exists, but an established model is complex, low in precision and poor in robustness. However, to apply the advantage of CNN two-dimensional image recognition to the classification of one-dimensional near infrared spectrum sequences, the following problems need to be solved: firstly, converting one-dimensional spectrum sequence data into a two-dimensional image capable of highlighting the spectral characteristics of the one-dimensional spectrum sequence data through mathematical transformation; and secondly, a proper convolutional neural network structure is designed to realize automatic classification of the special spectrum image.
Disclosure of Invention
The invention aims to provide a one-dimensional spectrum classification method and a one-dimensional spectrum classification system, which can make up the defect of losing useful characteristic information through a double mapping relation between a one-dimensional spectrum and a two-dimensional image.
In order to achieve the purpose, the invention provides the following scheme:
a method of one-dimensional spectral classification, the method comprising:
acquiring near infrared spectrum original data of m samples to be detected, and recording the data as X ═ X1,x2,…,xi,…,xnN is the total number of wavelength points, xiIs a scalar;
specifically, the collected near infrared spectrum data includes two categories, which are gasoline and diesel data, respectively. Gasoline corresponds to class 0 and diesel corresponds to class 1, and each group has 60 groups, namely, the total number m of samples is 120. The gasoline spectrum sampling range is 900 nm-1700 nm, and the sampling interval is 2 nm. The diesel spectrum sampling range is 750 nm-1550 nm, and the sampling interval is 2nm, that is, the number of wavelength points n is 401. The data sample matrix is denoted as X (120 × 401), and the output class matrix is Y (120 × 1). For subsequent two-dimensional CNN modeling, the class labels are converted into a one-hot coded form.
Intercepting peak data of all single spectrum sequences in the near infrared spectrum original data;
the length of the intercepted peak data is t, and the intercepted data is recorded as Xi={x1,…,xi,…,xtAnd t is the number of the current wavelength points.
Preprocessing the peak data;
zooming the preprocessed peak data to obtain one-dimensional spectral signal data Xf
Performing polar coordinate encoding on the scaled one-dimensional spectral signal data;
reconstructing the one-dimensional spectral signal data after the polar coordinate coding to obtain a gram angle and field matrix and a gram angle difference field matrix;
storing the gram angle sum field matrix and the gram angle difference field matrix as an image;
dividing the image to obtain a training set and a test set;
training a convolutional neural network by adopting the training set;
and inputting the test set into a trained convolutional neural network to obtain a classification result.
Optionally, after the image is divided to obtain a training set and a test set, the method further includes:
and performing data enhancement processing on the training set, wherein the data enhancement processing comprises rotation, scaling, translation, turning, shearing transformation and channel shifting.
Optionally, the scaling the preprocessed peak data specifically includes:
scaling the preprocessed peak data to [0,1], the formula is as follows:
Figure BDA0003117462150000031
wherein the content of the first and second substances,
Figure BDA0003117462150000032
is the normalized effective spectral absorbance value, x, corresponding to a wavelength iiIs the original spectral absorbance value, X, corresponding to a wavelength iiIs the sequence of the spectral absorbances in the peak wavelength range.
Optionally, the polar coordinate encoding of the scaled one-dimensional spectral signal data specifically adopts the following formula:
Figure BDA0003117462150000033
wherein the content of the first and second substances,
Figure BDA0003117462150000034
the normalized effective spectral absorbance value corresponding to the wavelength i, r is the radius, i ═ 1,2, … …, t is the current number of wavelength points, XfIs a local one-dimensional spectrum absorbance sequence after being scaled in a peak wavelength range。
As can be seen from the formula, the converted angle phi has a value range of [0, pi ]]The other chord values are monotonically decreased within the range, and as the wavelength is increased, x in each Cartesian coordinate systemiUnder the mapping relation, corresponding bending occurs between different angle points on a polar coordinate circle only corresponding to a unique value in a polar coordinate system.
Optionally, the expression of the gram angle and the field matrix is as follows:
Figure BDA0003117462150000035
wherein I is a unit vector, XfIs a local one-dimensional spectral absorbance sequence phi after being scaled in the peak wavelength rangeiAnd phijRespectively the angle of point i and point j,
Figure BDA0003117462150000041
and
Figure BDA0003117462150000042
respectively, the normalized effective spectral absorbance values corresponding to the wavelengths i/j.
Optionally, an expression of the gram angle difference field matrix is as follows:
Figure BDA0003117462150000043
wherein I is a unit vector, XfIs a local one-dimensional spectral absorbance sequence phi after being scaled in the peak wavelength rangeiAnd phijRespectively the angle of point i and point j,
Figure BDA0003117462150000044
and
Figure BDA0003117462150000045
respectively, the normalized effective spectral absorbance values corresponding to the wavelengths i/j.
Optionally, the trained convolutional neural network includes: the device comprises an input layer, a first coiling layer, a second coiling layer, a first pooling layer, a second pooling layer, a first full-connection layer and a second full-connection layer, wherein the input layer, the first coiling layer, the second coiling layer, the first pooling layer, the second pooling layer, the first full-connection layer and the second full-connection layer are sequentially connected.
Optionally, the trained convolutional neural network further includes: a normalization layer and a regularization layer, the normalization layer and the regularization layer being located intermediate the second volume base layer and the first pooling layer.
Optionally, the loss function in the convolutional neural network is a cross entropy loss function, and the specific formula is as follows:
Figure BDA0003117462150000046
where a represents the actual output of the neuron and y represents the desired output.
The present invention additionally provides a one-dimensional spectral classification system, the system comprising:
the original data acquisition module is used for acquiring near infrared spectrum original data of the m samples to be detected, and the near infrared spectrum original data is recorded as X ═ X1,x2,…,xi,…,xnN is the total number of wavelength points, xiIs a scalar;
the intercepting module is used for intercepting peak data of all single spectrum sequences in the near infrared spectrum original data;
the preprocessing module is used for preprocessing the peak data;
a scaling module for scaling the preprocessed peak data to obtain one-dimensional spectral signal data
Figure BDA0003117462150000051
The polar coordinate coding module is used for carrying out polar coordinate coding on the zoomed one-dimensional spectral signal data;
the reconstruction module is used for reconstructing the one-dimensional spectral signal data after the polar coordinate coding to obtain a gram angle and field matrix and a gram angle difference field matrix;
a format conversion module to store the gram angle and field matrix and the gram angle difference field matrix as an image;
the image dividing module is used for dividing the image to obtain a training set and a test set;
the training module is used for training the convolutional neural network by adopting the training set;
and the classification result determining module is used for inputting the test set into the trained convolutional neural network to obtain a classification result.
According to the specific embodiment provided by the invention, the invention discloses the following technical effects:
the method does not need a large amount of complex operations such as manual feature extraction, dimension reduction and the like in the traditional method, has strong interpretability of features, and can realize automatic extraction, learning and classification of spectral signals; the method realizes the bidirectional mapping from the one-dimensional spectrum signal to the two-dimensional image through the gram angular field, and does not lose any characteristics of the original one-dimensional spectrum; the Graham matrix established through mathematical operation does not destroy the dependence of spectral data on wavelength characteristics, and is favorable for improving the classification performance of the model; according to the invention, the one-dimensional spectral data is subjected to two-dimensional imaging, so that the key technical problem that a more mature two-dimensional image processing method cannot be directly utilized to perform high-performance classification and identification on the one-dimensional spectral sequence data is solved, and a new thought is provided for spectral data processing research; the one-dimensional spectrum classification and identification method based on the Graham angular field imaging and the CNN is suitable for any one-dimensional spectrum data, has strong applicability and expandability, and is beneficial to realizing the development of an industrial Internet system unit which is based on one-dimensional spectrum signals, has high accuracy, is simple to operate and can quickly detect in practical application.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without inventive exercise.
FIG. 1 is a flow chart of a one-dimensional spectral classification method according to an embodiment of the present invention;
FIG. 2 is a graph of an original near infrared spectrum of an embodiment of the present invention;
FIG. 3 is a schematic diagram of a partial near infrared spectrogram and a transformation to a polar coordinate system according to an embodiment of the present invention;
FIG. 4 is a two-dimensional gasoline image of an embodiment of the present invention;
FIG. 5 is a two-dimensional diesel image of an embodiment of the present invention;
FIG. 6 is a schematic diagram showing the first 21 images of the training set after data enhancement according to the embodiment of the present invention;
FIG. 7 is a schematic diagram of a two-dimensional convolutional neural network structure according to an embodiment of the present invention;
fig. 8 is a schematic diagram of a CNN training process according to an embodiment of the present invention;
FIG. 9 is a diagram illustrating predicted results and actual results according to an embodiment of the present invention;
fig. 10 is a schematic structural diagram of a one-dimensional spectrum classification system according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention aims to provide a one-dimensional spectrum classification method and a one-dimensional spectrum classification system, which can make up the defect of losing useful characteristic information through a double mapping relation between a one-dimensional spectrum and a two-dimensional image.
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
Fig. 1 is a flowchart of a one-dimensional spectrum classification method according to an embodiment of the present invention, as shown in fig. 1, the method includes:
step 101: acquiring near infrared spectrum original data of m samples to be detected, and recording a spectrum sequence of each sample in given near infrared wavelength as X ═ X1,x2,…,xi,…,xnN is the total number of wavelength points, xiIs a scalar quantity.
In this embodiment, the near infrared spectral data collected includes two categories, gasoline and diesel data, respectively. Gasoline corresponds to class 0 and diesel corresponds to class 1, and each group has 60 groups, namely, the total number m of samples is 120. The gasoline spectrum sampling range is 900 nm-1700 nm, and the sampling interval is 2 nm. The diesel spectrum sampling range is 750 nm-1550 nm, and the sampling interval is 2nm, that is, the number of wavelength points n is 401. The data sample matrix is denoted as X (120 × 401), and the output class matrix is Y (120 × 1). For subsequent two-dimensional CNN modeling, the class labels are converted into a one-hot coded form. The near infrared spectrum of gasoline is shown in part (a) of FIG. 2, and the near infrared spectrum of diesel is shown in part (b) of FIG. 2. The spectra of both oils have two distinct peaks and are also substantially similar in shape.
Step 102: respectively intercepting peak data of all single spectrum sequences in the near infrared spectrum original data, wherein the length of an intercepting interval is t, and the intercepted peak data is recorded as Xi={x1,…,xi,…,xtAnd t is the number of the current wavelength points.
Step 103: preprocessing the peak data.
Specifically, the peak data is normalized.
Step 104: scaling the preprocessed peak data to [0,1]]In the interior, new one-dimensional spectral signal data is obtained and recorded as Xf
The specific formula is as follows:
Figure BDA0003117462150000071
wherein the content of the first and second substances,
Figure BDA0003117462150000072
is the normalized effective spectral absorbance value, x, corresponding to a wavelength iiIs the original spectral absorbance value, X, corresponding to a wavelength iiIs the sequence of the spectral absorbances in the peak wavelength range.
Step 105: the scaled new one-dimensional spectral signal data XfPolar coordinate coding is carried out, namely, the numerical value is regarded as an angle value, the wavelength step length i is regarded as a radius, and the specific formula is as follows:
Figure BDA0003117462150000073
Figure BDA0003117462150000074
the normalized effective spectral absorbance value corresponding to the wavelength i, r is the radius, i ═ 1,2, … …, t is the current number of wavelength points, XfIs a local one-dimensional spectral absorbance sequence after scaling in the peak wavelength range.
As can be seen from the above formula, the converted angle phi has a value range of [0, pi ]]The other chord values are monotonically decreased within the range, and as the wavelength is increased, x in each Cartesian coordinate systemiUnder the mapping relation, corresponding bending occurs between different angle points on a polar coordinate circle only corresponding to a unique value in a polar coordinate system.
In this embodiment, the truncated local spectral sequence
Figure BDA0003117462150000081
The spectral data corresponding to 100 wavelength points near the first peak is normalized, and then converted to a polar coordinate system by taking the numerical value as an angle value and the wavelength step length i as a radius according to a formula (2). Localized near infrared of gasoline and dieselThe spectrogram and the connecting lines of points transformed into a polar coordinate system are shown in FIG. 3, wherein part (a) in FIG. 3 is gasoline and part (b) is diesel.
Step 106: and reconstructing the one-dimensional spectral signal data after the polar coordinate coding to obtain a gram angle and field matrix and a gram angle difference field matrix.
Specifically, cosine values of angle sums and sine values of angle differences between different points are calculated, and one-dimensional data are reconstructed into a gram angle sum field matrix and a gram angle difference field matrix.
The gram angle and field calculation formula is defined as follows:
Figure BDA0003117462150000082
in the formula, theta1And theta2Representing the angles of x and y in a polar coordinate system, respectively, the gram angle and the field matrix can be obtained:
Figure BDA0003117462150000083
trigonometric function transformation of equation (4) can result in:
Figure BDA0003117462150000091
wherein I is a unit vector, XfIs a local one-dimensional spectral absorbance sequence phi after being scaled in the peak wavelength rangeiAnd phijRespectively the angle of point i and point j,
Figure BDA0003117462150000092
and
Figure BDA0003117462150000093
respectively, the normalized effective spectral absorbance values corresponding to the wavelengths i/j.
Similarly, the calculation formula of the available gram angle difference field matrix is shown in (6).
Figure BDA0003117462150000094
Wherein I is a unit vector, XfIs a local one-dimensional spectral absorbance sequence phi after being scaled in the peak wavelength rangeiAnd phijRespectively the angle of point i and point j,
Figure BDA0003117462150000095
and
Figure BDA0003117462150000096
respectively, the normalized effective spectral absorbance values corresponding to the wavelengths i/j.
It can be seen that the main diagonal in the matrix is formed by the original spectrum sequence, and the elements in the matrix are continuously moved from left to right and from top to bottom through the phi value, so that the wavelength dependence of the spectrum signal can be maintained.
Step 107: storing the gram angle sum field matrix and the gram angle difference field matrix as an image.
In this embodiment, the gray angle and field and gray angle difference field matrices are calculated according to equations (5) and (6), all samples are converted into corresponding two-dimensional images, the white edges of the coordinate axis display and the images are removed, and the pixel size of the drawn image is 218 × 218. The gasoline sample No. 1 and the diesel sample No. 61 were selected and subjected to generation of pictures, as shown in fig. 4 and fig. 5, in which (a) part is a gram angle and field image, and (b) part is a gram angle difference field image. It can be seen that the characteristic difference between gasoline and diesel oil is amplified and the discrimination is obviously improved by two-dimensionally processing the one-dimensional spectral data. In addition, in view of computer performance, the image is scaled to 100 × 100 on the basis of ensuring clarity and saved in a designated folder in jpg format.
Step 108: and dividing the image to obtain a training set and a testing set, and performing data enhancement processing on the training sample to improve the generalization capability of the model in order to reduce the overfitting risk because the spectrum difference between different samples is not large. The image data generator module is specifically adopted to realize random rotation, random scaling, horizontal/vertical movement, horizontal/vertical overturning, shearing transformation and channel shifting of the image.
In this embodiment, the random seed is set to be 3, and 120 sample image sets are divided into training sets and testing sets at a ratio of 8:2, so as to obtain 96 training sets and 24 testing sets. Because the spectrum difference between different samples is not large, in order to reduce the overfitting risk, the training samples are subjected to data enhancement processing, so that the generalization capability of the model is improved. Random rotation (angle 10), random scaling (scale 10%), horizontal/vertical panning (scale 10%), horizontal/vertical flipping (scale 10%), shear transformation (scale 10%) and channel shift (range 10%) of the image are implemented specifically using the ImageDataGenerator module. The first 21 pictures of the data enhanced training set are shown, for example, in gram angle and field images, as shown in fig. 6. The randomness of the samples can be greatly increased, and the robustness and the generalization performance of the model can be improved.
Step 109: and training the convolutional neural network by adopting the training set.
The designed CNN model consists of an input layer, two convolutional layers, two pooling layers and two fully-connected layers, as shown in fig. 7.
The input layer is used for inputting data, and a three-dimensional neuron is input. The convolution layer has a convolution kernel structure with trainable parameters, and can realize automatic feature extraction. The pooling layer is also called as down-sampling, so that network parameters and the size of data volume can be compressed, and the automatic compression of the image can be realized on the premise of ensuring the image characteristics. The fully-connected layer mainly realizes the mapping between abstract features extracted by the convolutional layer and the pooling layer to target output.
To avoid overfitting, batch normalization and regularization layers are added to the CNN structure to optimize the network. Specifically, after two batches of normalization are respectively added into the convolution operation, the data after the convolution processing is corrected, the training data are ensured to obey normal distribution, and the expression capacity of the network is improved. And adding a regularization layer before the full-connection layer, and setting the proportion of disconnected neurons as alpha.
Furthermore, the method of model compilation is matched. An Adam optimizer is selected, the loss function is a cross entropy loss function, such as a formula (7), and the evaluation index is accuracy, such as a formula (8).
Figure BDA0003117462150000111
Where a represents the actual output of the neuron and y represents the desired output.
Figure BDA0003117462150000112
In the formula, miThe number of prediction classes is the same as the number of actual classes.
And setting batch size batch _ size and training round epochs, verifying 20% of the training sample set, completing a training task, and observing the descending process of the training loss and the change condition of the accuracy.
In the present embodiment, since the size of each image is 100 × 100, the input layer input image shape is (100, 1).
The convolution kernel size of the first layer convolution layer is set to (5,5), the step size is 1, and the number of convolution kernels is 16. The convolution kernel size of the second convolutional layer is set to (3,3), the step size is 1, and the number of convolution kernels is 128. The zero padding of both convolutional layers is selected by default not to cross the edge sampling, and the activation functions are both relu functions.
And (3) respectively connecting a pooling layer behind each convolution layer, wherein the pooling layers are prepared by a common maximum pooling method, and the pooling size is (2, 2).
A batch normalization layer is connected between the convolution layer and the pooling layer.
Next, there is a regularization layer that sets the Dropout parameter α to 25% of the neurons to be randomly inactivated.
All data is flattened to one dimension, the first fully-connected layer setting parameter is set to 128, and the activation function is relu. The second full connectivity layer parameter is set to 2, i.e. corresponding to two classes, the activation function is softmax.
After the model is constructed, a matching training method is needed, and the method specifically comprises the following steps: the cross entropy is used as a loss function, an Adam optimizer is adopted, the initial learning rate is set to be 0.001, and the accuracy accurve is used as an evaluation index. Setting the batch sample number batch _ size to 64 and the training round epochs to 30, inputting the enhanced training set image into the model, randomly selecting 20% of the training set for verification, and obtaining an iteration curve of the loss value and the accuracy as shown in fig. 8. With the increase of the iteration times, the training loss and the verification loss gradually approach to 0, the training accuracy and the verification accuracy gradually approach to 1, the training process is relatively stable, and the constructed model has good performance.
Step 110: and inputting the test set into a trained convolutional neural network to obtain a classification result.
The 24 test samples are tested by using the constructed model, and the obtained prediction type and real type results are shown in fig. 9. It can be obviously seen that the prediction results are all correct, and the accuracy rate reaches 100%.
Fig. 10 is a schematic structural diagram of a one-dimensional spectrum classification system according to an embodiment of the present invention, and as shown in fig. 10, the system includes:
an original data obtaining module 201, configured to obtain near infrared spectrum original data of m samples to be detected, where the original data is recorded as X ═ X1,x2,…,xi,…,xnN is the total number of wavelength points, xiIs a scalar;
an intercepting module 202, configured to intercept peak data of all single spectrum sequences in the near infrared spectrum raw data, where the intercepted peak data is recorded as Xi={x1,…,xi,…,xtT is the number of the current wavelength points;
a preprocessing module 203, configured to preprocess the peak data;
a scaling module 204, configured to scale the preprocessed peak data to obtainTo one-dimensional spectral signal data
Figure BDA0003117462150000121
A polar coordinate encoding module 205, configured to perform polar coordinate encoding on the scaled one-dimensional spectral signal data;
a reconstruction module 206, configured to reconstruct the polar coordinate encoded one-dimensional spectral signal data to obtain a gram angle and field matrix and a gram angle difference field matrix;
a format conversion module 207 for storing the gram angle sum field matrix and the gram angle difference field matrix as an image;
an image dividing module 208, configured to divide the image to obtain a training set and a test set;
a training module 209, configured to train the convolutional neural network by using the training set;
and a classification result determining module 210, configured to input the test set into a trained convolutional neural network to obtain a classification result.
In summary, the one-dimensional spectrum classification method based on the gram angular field imaging and the CNN not only solves the key technical problem that the two-dimensional image processing method cannot be directly utilized to perform high-performance classification and identification on the one-dimensional spectrum sequence data, but also avoids the complex preprocessing processes of manual feature selection, dimension reduction and the like required by the traditional one-dimensional spectrum modeling. All the characteristics of the original one-dimensional spectrum can be reserved, and the method has the advantages of better automatic characteristic extraction capability, higher identification accuracy, strong generalization capability of the model and higher practical value. The method provides a novel and efficient scheme for intelligent qualitative analysis of the one-dimensional spectrum.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For the system disclosed by the embodiment, the description is relatively simple because the system corresponds to the method disclosed by the embodiment, and the relevant points can be referred to the method part for description.
The principles and embodiments of the present invention have been described herein using specific examples, which are provided only to help understand the method and the core concept of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, the specific embodiments and the application range may be changed. In view of the above, the present disclosure should not be construed as limiting the invention.

Claims (10)

1. A method for one-dimensional spectral classification, the method comprising:
acquiring near infrared spectrum original data of m samples to be detected, and recording the data as X ═ X1,x2,…,xi,…,xnN is the total number of wavelength points, xiIs a scalar;
intercepting peak data X of all single spectrum sequences in the near infrared spectrum original dataf
Preprocessing the peak data;
zooming the preprocessed peak data to obtain one-dimensional spectral signal data;
performing polar coordinate encoding on the scaled one-dimensional spectral signal data;
reconstructing the one-dimensional spectral signal data after the polar coordinate coding to obtain a gram angle and field matrix and a gram angle difference field matrix;
storing the gram angle sum field matrix and the gram angle difference field matrix as an image;
dividing the image to obtain a training set and a test set;
training a convolutional neural network by adopting the training set;
and inputting the test set into a trained convolutional neural network to obtain a classification result.
2. The one-dimensional spectral classification method of claim 1, further comprising, after the dividing the image into a training set and a test set:
and performing data enhancement processing on the training set.
3. The one-dimensional spectral classification method of claim 1, wherein scaling the preprocessed peak data specifically comprises:
scaling the preprocessed peak data to [0,1], the formula is as follows:
Figure FDA0003117462140000011
wherein the content of the first and second substances,
Figure FDA0003117462140000012
is the normalized effective spectral absorbance value, x, corresponding to a wavelength iiIs the original spectral absorbance value, X, corresponding to a wavelength iiIs the sequence of the spectral absorbances in the peak wavelength range.
4. The one-dimensional spectral classification method of claim 1, wherein the polar coordinate encoding of the scaled one-dimensional spectral signal data specifically employs the following formula:
Figure FDA0003117462140000021
wherein the content of the first and second substances,
Figure FDA0003117462140000022
the normalized effective spectral absorbance value corresponding to the wavelength i, r is the radius, i ═ 1,2, … …, t is the current number of wavelength points, XfIs a local one-dimensional spectral absorbance sequence after scaling in the peak wavelength range.
5. The method for one-dimensional spectral classification according to claim 1, characterized in that the expression of the gram angle and field matrix is as follows:
Figure FDA0003117462140000023
wherein I is a unit vector, XfIs a local one-dimensional spectral absorbance sequence phi after being scaled in the peak wavelength rangeiAnd phijRespectively the angle of point i and point j,
Figure FDA0003117462140000024
and
Figure FDA0003117462140000025
respectively, the normalized effective spectral absorbance values corresponding to the wavelengths i/j.
6. The method for one-dimensional spectral classification according to claim 1, characterized in that the gram angle difference field matrix is expressed as follows:
Figure FDA0003117462140000026
wherein I is a unit vector, XfIs a local one-dimensional spectral absorbance sequence phi after being scaled in the peak wavelength rangeiAnd phijRespectively the angle of point i and point j,
Figure FDA0003117462140000027
and
Figure FDA0003117462140000028
respectively, the normalized effective spectral absorbance values corresponding to the wavelengths i/j.
7. The one-dimensional spectral classification method of claim 1, wherein the trained convolutional neural network comprises: the device comprises an input layer, a first coiling layer, a second coiling layer, a first pooling layer, a second pooling layer, a first full-connection layer and a second full-connection layer, wherein the input layer, the first coiling layer, the second coiling layer, the first pooling layer, the second pooling layer, the first full-connection layer and the second full-connection layer are sequentially connected.
8. The one-dimensional spectral classification method of claim 7, wherein the trained convolutional neural network further comprises: a normalization layer and a regularization layer, the normalization layer and the regularization layer being located intermediate the second volume base layer and the first pooling layer.
9. The one-dimensional spectrum classification method according to claim 1, wherein the loss function in the convolutional neural network is a cross entropy loss function, and the specific formula is as follows:
Figure FDA0003117462140000031
where a represents the actual output of the neuron and y represents the desired output.
10. A one-dimensional spectral classification system, the system comprising:
the original data acquisition module is used for acquiring near infrared spectrum original data of the m samples to be detected, and the near infrared spectrum original data is recorded as X ═ X1,x2,…,xi,…,xnN is the total number of wavelength points, xiIs a scalar;
the intercepting module is used for intercepting peak data of all single spectrum sequences in the near infrared spectrum original data, and the intercepted peak data is recorded as Xi={x1,…,xi,…,xtT is the number of the current wavelength points;
the preprocessing module is used for preprocessing the peak data;
a scaling module for scaling the preprocessed peak data to obtain one-dimensional spectral signal data
Figure FDA0003117462140000032
The polar coordinate coding module is used for carrying out polar coordinate coding on the zoomed one-dimensional spectral signal data;
the reconstruction module is used for reconstructing the one-dimensional spectral signal data after the polar coordinate coding to obtain a gram angle and field matrix and a gram angle difference field matrix;
a format conversion module to store the gram angle and field matrix and the gram angle difference field matrix as an image;
the image dividing module is used for dividing the image to obtain a training set and a test set;
the training module is used for training the convolutional neural network by adopting the training set;
and the classification result determining module is used for inputting the test set into the trained convolutional neural network to obtain a classification result.
CN202110666072.XA 2021-06-16 2021-06-16 One-dimensional spectrum classification method and system Active CN113313059B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110666072.XA CN113313059B (en) 2021-06-16 2021-06-16 One-dimensional spectrum classification method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110666072.XA CN113313059B (en) 2021-06-16 2021-06-16 One-dimensional spectrum classification method and system

Publications (2)

Publication Number Publication Date
CN113313059A true CN113313059A (en) 2021-08-27
CN113313059B CN113313059B (en) 2022-10-04

Family

ID=77379212

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110666072.XA Active CN113313059B (en) 2021-06-16 2021-06-16 One-dimensional spectrum classification method and system

Country Status (1)

Country Link
CN (1) CN113313059B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114323105A (en) * 2021-12-23 2022-04-12 中山大学 Fiber grating spectral analysis method, system and storage medium
CN116310399A (en) * 2023-03-22 2023-06-23 中南大学 AE-CNN-based high-dimensional feature map target identification method and system
CN116359169A (en) * 2023-06-02 2023-06-30 谱宁医学科技(天津)有限责任公司 Disease screening model construction device, disease screening device, equipment and medium
CN117093918A (en) * 2023-10-18 2023-11-21 成都信息工程大学 Overlapping spike identification method based on Gellam angle, field and CBAM-Resnet34
CN117849193A (en) * 2024-03-07 2024-04-09 江西荧光磁业有限公司 Online crack damage monitoring method for neodymium iron boron sintering
CN118172627A (en) * 2024-05-11 2024-06-11 华东交通大学 Near infrared spectrum generation method and system

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107203779A (en) * 2017-05-11 2017-09-26 中国科学院西安光学精密机械研究所 Hyperspectral dimensionality reduction method based on spatial-spectral information maintenance
CN110020635A (en) * 2019-04-15 2019-07-16 中国农业科学院农业资源与农业区划研究所 Growing area crops sophisticated category method and system based on unmanned plane image and satellite image
CN110717368A (en) * 2018-07-13 2020-01-21 北京服装学院 Qualitative classification method for textiles
CN112016041A (en) * 2020-08-27 2020-12-01 重庆大学 Time sequence real-time classification method based on gram sum angular field imaging and short-CNN
CN112179654A (en) * 2020-09-28 2021-01-05 西南交通大学 Rolling bearing fault identification method based on GAF-CNN-BiGRU network
CN112370015A (en) * 2020-10-30 2021-02-19 复旦大学 Physiological signal quality evaluation method based on gram angular field
CN112712063A (en) * 2021-01-18 2021-04-27 贵州大学 Tool wear value monitoring method, electronic device and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107203779A (en) * 2017-05-11 2017-09-26 中国科学院西安光学精密机械研究所 Hyperspectral dimensionality reduction method based on spatial-spectral information maintenance
CN110717368A (en) * 2018-07-13 2020-01-21 北京服装学院 Qualitative classification method for textiles
CN110020635A (en) * 2019-04-15 2019-07-16 中国农业科学院农业资源与农业区划研究所 Growing area crops sophisticated category method and system based on unmanned plane image and satellite image
CN112016041A (en) * 2020-08-27 2020-12-01 重庆大学 Time sequence real-time classification method based on gram sum angular field imaging and short-CNN
CN112179654A (en) * 2020-09-28 2021-01-05 西南交通大学 Rolling bearing fault identification method based on GAF-CNN-BiGRU network
CN112370015A (en) * 2020-10-30 2021-02-19 复旦大学 Physiological signal quality evaluation method based on gram angular field
CN112712063A (en) * 2021-01-18 2021-04-27 贵州大学 Tool wear value monitoring method, electronic device and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
SAJILA D. WICKRAMARATNE ET AL: "A Deep Learning Based Ternary Task Classification System Using Gramian Angular Summation Field in fNIRS Neuroimaging Data", 《ARXIV》 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114323105A (en) * 2021-12-23 2022-04-12 中山大学 Fiber grating spectral analysis method, system and storage medium
CN114323105B (en) * 2021-12-23 2024-02-27 中山大学 Fiber bragg grating spectrum analysis method, system and storage medium
CN116310399A (en) * 2023-03-22 2023-06-23 中南大学 AE-CNN-based high-dimensional feature map target identification method and system
CN116310399B (en) * 2023-03-22 2024-04-09 中南大学 AE-CNN-based high-dimensional feature map target identification method and system
CN116359169A (en) * 2023-06-02 2023-06-30 谱宁医学科技(天津)有限责任公司 Disease screening model construction device, disease screening device, equipment and medium
CN116359169B (en) * 2023-06-02 2023-09-05 谱宁医学科技(天津)有限责任公司 Disease screening model construction device, disease screening device, equipment and medium
CN117093918A (en) * 2023-10-18 2023-11-21 成都信息工程大学 Overlapping spike identification method based on Gellam angle, field and CBAM-Resnet34
CN117849193A (en) * 2024-03-07 2024-04-09 江西荧光磁业有限公司 Online crack damage monitoring method for neodymium iron boron sintering
CN118172627A (en) * 2024-05-11 2024-06-11 华东交通大学 Near infrared spectrum generation method and system

Also Published As

Publication number Publication date
CN113313059B (en) 2022-10-04

Similar Documents

Publication Publication Date Title
CN113313059B (en) One-dimensional spectrum classification method and system
CN107316013B (en) Hyperspectral image classification method based on NSCT (non-subsampled Contourlet transform) and DCNN (data-to-neural network)
Zhang et al. Classification modeling method for near‐infrared spectroscopy of tobacco based on multimodal convolution neural networks
CN110705525A (en) Method and device for diagnosing rolling bearing fault
CN111680176A (en) Remote sensing image retrieval method and system based on attention and bidirectional feature fusion
He et al. Spectral super-resolution meets deep learning: Achievements and challenges
CN113538246B (en) Remote sensing image super-resolution reconstruction method based on unsupervised multi-stage fusion network
CN111695456A (en) Low-resolution face recognition method based on active discriminability cross-domain alignment
CN110599502B (en) Skin lesion segmentation method based on deep learning
CN110796022B (en) Low-resolution face recognition method based on multi-manifold coupling mapping
Plichoski et al. A face recognition framework based on a pool of techniques and differential evolution
CN113378971B (en) Classification model training method and system for near infrared spectrum and classification method and system
Wang et al. A hybrid convolution network for serial number recognition on banknotes
CN112818920B (en) Double-temporal hyperspectral image space spectrum joint change detection method
CN111695455B (en) Low-resolution face recognition method based on coupling discrimination manifold alignment
CN114511502A (en) Gastrointestinal endoscope image polyp detection system based on artificial intelligence, terminal and storage medium
Jiang et al. Forgery-free signature verification with stroke-aware cycle-consistent generative adversarial network
CN115457568A (en) Historical document image noise reduction method and system based on generation countermeasure network
Wu et al. Hprn: Holistic prior-embedded relation network for spectral super-resolution
Farooque et al. Swin transformer with multiscale 3D atrous convolution for hyperspectral image classification
CN114881916A (en) Remote sensing image change detection method
CN114418027A (en) Hyperspectral image characteristic waveband selection method based on waveband attention mechanism
CN116258914B (en) Remote Sensing Image Classification Method Based on Machine Learning and Local and Global Feature Fusion
Trevino-Sanchez et al. Hybrid pooling with wavelets for convolutional neural networks
CN114842384B (en) 6G-oriented haptic mode signal reconstruction method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant