Blood species identification based on deep learning analysis of Raman spectra

: Blood analysis is an indispensable means of detection in criminal investigation, customs security and quarantine, anti-poaching of wildlife, and other incidents. Detecting the species of blood is one of the most important analyses. In order to classify species by analyzing Raman spectra of blood, a recognition method based on deep learning principle is proposed in this paper. This method can realize multi-identiﬁcation blood species, by constructing a one-dimensional convolution neural network and establishing a Raman spectra database containing 20 kinds of blood. The network model is obtained through training, and then is employed to predict the testing set data. The average accuracy of blind detection is more than 97%. In this paper, we try to increase the diversity of data to improve the robustness of the model, optimize the network and adjust the hyperparameters to improve the recognition ability of the model. The evaluation results show that the deep learning model has high recognition performance to distinguish the species of blood.


Introduction
The discrimination between human and nonhuman blood and the identifications of blood interspecies play a vital role in customs inspection, forensic science, veterinary purpose and wildlife preservation [1].Several techniques have been developed for this purpose, such as high performance liquid chromatography (HPLC) [2,3], mass spectroscopy (MS) [4,5], quantitative PCR [6], and DNA profiling.HPLC methods have been developed to determine blood species and present good sensitivity and resolution.Human and nonhuman species of fresh blood and blood stains were analyzed by Inoue et al [2].MS method was used by Espinoza et al. with bloodstains and blood mixtures from over 16 different animal species analyzed and quantitated [4].MS was demonstrated as an effective tool in identifying species.Minor interspecies molecular mass differences in αand β-chains (α/β-pairs) of hemoglobin from 62 different species were detected by MS.HPLC and MS are of high performance.However, these methods need reagents and complex operation.They are time-consuming and destructive to samples.Moreover, they are dangerous for inspectors because of the contact with the blood samples.
The Raman spectroscopy and Fourier Transform Infrared Spectroscopy (FTIR) have shown effectiveness in analyzing blood droplets and stains in recent years.Vibrational spectroscopy is a rapid and noninvasive method exhibiting the fingerprint profile.The first study focused on blood identification using FTIR and Raman spectroscopy was done by K.D. Wael et al. in 2008 [7].They were able to identify bloodstains on different substrates but fail to differentiate cat, #376082 https://doi.org/10.1364/BOE.10.006129dog and human bloodstains for not using multivariate statistic method.I. K. Lednev group used Raman spectroscopy and principal component analysis (PCA) to distinguish between human, cat, and dog blood with 99% confidence in 2009 [8].Discrimination of bloods from the same three species was successful by attenuated total reflectance Fourier-transform infrared (ATR FT-IR) spectroscopy and partial least squares discriminant analysis (PLS-DA) [9].The application of statistical models to Raman spectra enhances the selectivity of Raman spectroscopy and similar classification models have been built extensively.PLS-DA of blood spectra collected using Raman spectroscopy, diffuse reflectance spectroscopy, or spatially resolved near-infrared transmission spectroscopy have been used to discriminate human and animal blood [10][11][12][13][14][15][16].Later, I. K. Lednev group expanded the animal species to 16 and built a binary model for discrimination of human and nonhuman blood [17].Up to now the most frequently studied blood samples are blood droplets or bloodstains in forensic science.The nondestructive and noncontact detection method needs to be established to discriminate the liquid whole blood in vacuum blood tube directly without sampling, because it's not only time-saving but also safe to the inspectors.
In our previous work, the discrimination of fresh blood droplet and whole blood in vacuum blood tube using combination of Raman spectroscopy and PLS were studied [18][19][20][21].
As a branch of machine learning, deep learning uses multi-layer network to transform data features.The concept of deep learning was first reported by G. Hinton in 2006 [22].With the improvement of algorithm and the enhancement of computer processing ability, deep learning opened a new era in 2012.Using convolutional neural network (CNN), effective features data can be extracted from complex spectral or image data and the inner structure of feature data can be learned for classification.CNN have been used to analyze time series signals [23], face recognition [24] in industrial field and EGG signals [25], CT&MRI images and pathological images in biomedical field.CNN has been applied to CT images to detect tumors such as mammographic lesions [26,27] and pulmonary nodule [28,29].CNN has also been used to help diagnosing histological images or stimulated Raman scattering microscopy images [30].Based on the successful application of CNN in above cases, it was illustrated that CNN has more powerful modeling capability compared with traditional models.
To the best of our knowledge, the CNN has not been used for classification of blood species.In this study, the CNN models were built combined with Raman spectroscopy to identify blood interspecies, including both discrimination between human and nonhuman blood and interspecies of animal bloods.Firstly, Raman spectra of human and animal bloods in blood collection tubes were adopted by Raman spectrometer equipped with large focal length microscope objective lens directly.This way facilitates the operator and decreases the opportunity of making contact with blood.Secondly, the CNN models with convolutional layers, pooling layers and full connectional layers were constructed and trained with a total of 2177 Raman spectra of human and 19 animals.Among the animals there are domestic fowl, livestock, experimental animals and wildlife animals.This choice ensures the application scope, robustness and specificity of the CNN model.Thirdly, blood components change slightly over time, which affects the quality of trained model.The Raman spectra measurements were then taken at time point of 8, 24, 48, 72 h, this was a second method to ensure the robustness of the model.The CNN model was then evaluated and the structure and parameters were optimized for accuracy, sensitivity and specificity.The CNN model trained with enough data showed higher accuracy.

Sample preparation
Human blood and 19 kinds of animal blood were collected.The animal species include: chicken, duck, geese, pigeon, Bama Xiang pig, dog(beagles), Oriental Short-tailed cat, New Zealand rabbit, SD rat, Kunming mice, monkey (rhesus & cynomolgus), sika deer, fallow deer, cattle, carp, Argali sheep, Asian swamp eel, alpaca and alpaca (Suri).Human blood was provided by Dongzhu hospital, the chickens, ducks, goose and pigeons were provided by the poultry market in Dongzhu Town, Suzhou city.Bama Xiang pig, beagles, Oriental Short-tailed cat, New Zealand rabbit, SD rat and Kunming mice were provided by experimental breeding center of modern agriculture, Shanghai Jiao Tong University.Monkey blood was provided by Suzhou Xishan Zhongke Laboratory Animal Co., Ltd.The blood samples of fallow deer, sika deer, argali, alpaca and alpaca (Suri) were provided by Suzhou Zoo.The blood samples of cattle, carp and Asian swamp eel were provided by Guangzhou Hongquan Biological Co., Ltd.All the above sources were licensed and meet the safety and quarantine standards.
All the samples were fresh whole blood and contained in 2 mL EDTA-K2 glass blood collection tubes uniformly with labels.There are 2-20 tubes of blood collected for each kind of animal.The blood samples need to be fresh and prevented from deterioration, which would have an impact on the Raman spectra.Therefore, the blood samples were cryopreserved immediately after collection.The temperature was kept as 4 degrees Celsius.

Equipment and instrument
A Renishaw inVia confocal Raman spectrometer was equipped with a long focal length Leica microscope (50× objective, with a numerical aperture of 0.35, focal length ∼7.5 mm), and a WiRE 4.3 software.The 532 nm laser has a maximum power of ∼50 mW.The instrument was calibrated with a silicon basis (the central peak at 520.5 cm −1 ) before each group of experiments.The spectrum range was set to be from 100 to 2000cm −1 , the exposure time was 10 s, and the laser power at the sample was about 4.8 mW.The experiments were conducted in a clean booth (the room temperature was 20∼25 degrees Celsius and the atmospheric humidity was less than 45%).The data analysis softwares were Matlab R2018b and Pycharm2017.
The experimental device is shown in Fig. 1.The glass test tube containing fresh blood was put on the fixture.The focal point was on the surface between blood and the glass tube, in order to avoid the interference from fluorescence to the maximum extent.The remaining fluorescence interference induced by glass tube could be removed through data preprocessing of baseline correction.In this way, the practitioner could take the measurement in a direct and non-contact way.

Experimental procedure
Blood components may change slightly over time, which could affect the quality of experimental data.Therefore, different measurement time points of 8, 24, 48, 72 h were set in our experiment.Each group of samples measured 5 sets of spectra at each time point, that is, a total of 20 sets of spectra were obtained for each group.This method could increase the non-uniformity of Raman spectra and improve the robustness of the model.For the data acquisition of each sample, remove the tube from the fixture after the test, roll the tube or shake it to remix the ingredients, and then proceed to the next measurement to ensure the Raman spectrum of blood in each measurement was relatively independent.

Data preprocessing
Raman spectrum data preprocessing could remove the interference of invalid information in Raman spectrum, including background fluorescence, instrument noise, and environmental noise and so on.For example, in the measurement of the spectrum, sharp peaks with narrow bands and abnormally high peaks may occur by chance.Such peaks may be identified as cosmic ray peaks and need to be eliminated.In this study, the Raman signal of blood would be interfered by the background fluorescence generated from vacuum glass tube.The background fluorescence spectra could be deducted by the 3 rd order polynomial fitting algorithm, which was used to remove baseline.And the function of WiRE software could realize it.Consequently, all the spectral data corresponding to the category labels were integrated into the Matlab software to construct a matrix.Then all data was 0-1 normalized, which allows sample data of different spectral intensities to reach a uniform metric.The effects of the preprocessing are shown in Fig. 2.

Training and testing
It is a systematic process to establish a training model of convolution neural network and identify blood samples of unknown species by using the model.Firstly, the Raman spectral data of the blood were pre-processed uniformly to form the characteristic data with labels, and then the whole training data set was sent to the initialization network for iterative training.During each round of training, 20% of the data in the training set was selected as the validation set to monitor the training effect, this process was cross-validation.After preliminary obtaining the network model, the test set was pretreated by the same method, and the whole test set was fed into the model.The network model could judge the Raman spectrum data of unknown blood species and give the recognition result.The flow chart is shown in Fig. 3.
In this study, there were Raman spectral data of 20 kinds of blood as training data set.In order to know the external validation accuracy of the training model, we use the known blood Raman spectrum data as test set to detect the external validation accuracy of the model.A total of 3138 sets of Raman spectral data were collected in the experiment.Among them, 2177 Raman spectral data were divided into training set and validation set, and 961 sets of data were test sets.The number of blood samples of each kind and the number of spectra of training and testing sets are shown in Table 1.

Analytical method
The deep learning method was realized by constructing a network model.Due to the data of Raman spectrum was one-dimensional, in this study, a one-dimensional convolution neural network (1D-CNN) model was proposed to identify blood species, which could realize multi-class identification.Figure 4 is a hierarchical construction of convolution neural network applied to blood classification.It consists of input layer, hidden layer, full connection layer and output layer.The hidden layer consists of two convolution layers and two pooling layers.The preprocessed data was loaded into the input layer of the network, there were 1030 features in a spectrum.The feature extraction was performed after two convolution operation and two pooling operation, and the data is input to the fully connected layer after being flattened.Considering the problem of over-fitting, we introduced the dropout method in the network, which randomly discarded some neurons in the full connectivity layer.After the two full connection layers, the output value is obtained through the softmax function, and the probability distribution of various results could be given by the softmax function.The formula is as follows: In the training process of network, the backward propagation algorithm was used to perform training of convolution kernel, weights between neurons, and bias value.Backward propagation (BP) algorithm is an iterative algorithm.In each iteration, generalized perceptual machine learning rules were used to update and estimate parameters.Under continuous iterative training, the network parameters would change in a direction that loss function value decreases gradually.The value of loss function is the error between the predict value and the real value.When the training is finished, the value of loss function reaches a very low level, and the network training is regarded as convergence, which means that the predicted value is close to the real value.At this moment, the newly generated network weight structure forms a network model.However, there may be a problem of local convergence, which would lead to lower accuracy of actual prediction, thus we should judge the convergence of model further by external verification.External validation is used to test the prediction effect of the model.That is to predict the Raman spectra of blood outside the training set, which can test the generalization performance of the model.

Time effect
It is important to determine whether Raman spectra of the blood would change gradually with time.For liquid blood stored at low temperature, the Raman spectra of blood at different times (up to 100 days) were measured.The results of dog blood are shown in Fig. 5.The position and intensity of Raman signal have hardly changed until 100 days, and no significant changes were observed in other animals (rabbit, mouse, cat, etc.).Nevertheless, we cannot directly judge that the Raman spectra of blood do not change over time.This merely illustrate that primitive blood stored at low temperatures can be preservation for a long time.It is also possible that the blood changes slightly but could not be observed, which requires a longer experimental time to verify the problem.For this study, it could be determined that Raman spectra of blood collected in 72 hours can be used for research.

Biochemical analysis
Fresh blood contains the most primitive information of blood components.In previous customs quarantine security incidents, there are much of illegal bloods were passed through port including human blood.Faced with this problem, the identification and detection of blood should be targeted to ensure the legitimate blood transport.As we know, the composition of blood components is extremely complex.Blood components mainly include plasma, red blood cells, white blood cells and platelets [31].These components have important functions in the blood system, among which there are many factors affecting the composition.In previous studies, blood compositions are different among different species, even among different subgroups of the same species.There are differences in blood composition between donors of different ages and between donors of different genders, even between donors of different races [13][14][15].And patients with certain diseases (such as diabetes, malaria, etc.) also have different blood components from normal people [31].The above differences can be characterized by Raman spectroscopy combined with stoichiometric analysis.The average Raman spectrum of the blood shows the comprehensive information of the blood components of multiple samples of a certain species.In this paper, in order to observe the position and intensity of Raman characteristic peaks of different blood species, we averaged hundreds of data of each blood species and compared the average Raman spectra.Figure 6 is the average Raman spectrum of 20 kinds of blood species.The band range of Raman spectra given in Fig. 6 is 300∼1800cm −1 .It can be observed that the characteristic peaks are concentrated in 650∼1650 cm −1 .There is difference in the position and intensity of the characteristic peaks between any two different kinds of blood in the figure .As shown in the figure, the main characteristic peaks are 672, 752, 974, 1000, 1083, 1169, 1210, 1300, 1335, 1355, 1373, 1393, 1423, 1544, 1582, 1603, 1636 cm −1 .There are similarities and differences of Raman spectra between different blood species can be observed roughly.Among them, it is obvious that the Raman spectrum of the chicken blood has two characteristic peaks at the 1155 and 1521 cm −1 , which are significantly different from the other blood.This indicated that chicken blood may have components distinctly different from other kinds of blood.Compared with mature mammalian blood, mature red blood cells in chicken blood contain cellular nucleus.The vibration modes corresponding to the positions of characteristic peaks observed in the figure include A 1g (ν 4 , ν 5 , ν 7 ), B 1g (ν 10 , ν 11 , ν 15 , ν 18 , ν 21 ), A 2g (ν 20 ), B 2g (ν 28 , ν 30 ), E u (ν 37 , ν 41 ), as shown in Table 2 [14,32,33].There vibration modes were derived from some components of the blood, such as hemoglobin, albumin, globulin, amino acid, glucose, cholesterol, triglyceride, etc.According to verifiable literature reports, hemoglobin accounts for more than 95% of the dry weight of the red blood cells, and most of the Raman spectra obtained from whole blood were contributed by hemoglobin [31,33,34].In addition, some studies have shown that the Raman spectra obtained by oxygenated hemoglobin (oxyHb) and deoxygenated hemoglobin (deoxyHb) under the same experimental conditions showed that some bands have shifted [33], which needs to be considered in the analysis of Raman spectra for blood.Similarly, the location and intensity of the characteristic peaks obtained by choosing different excitation light also have different results obviously [35].
The characteristic peaks position of a certain blood is like the others, while there are visible differences in spectral intensity.However, only these minor differences are still difficult to directly determine the blood attributions.Therefore, it is necessary to use statistical analysis methods to help identify the blood species by extracting features and establishing the statistical models.

Network optimization and design
The convolutional neural network model obtained by training is not optimal by default.The recognition ability of the model can be improved by modifying the parameters and network structure.The contents worthy of adjusting include network structure and parameters: the size of training set batches, training rounds, convolution kernel size, learning rate of optimizer, number of neurons in the full connection layer, and the numbers of hidden layers, optimizer, activation function, loss function, etc.The adjusting records of each hyperparameter and corresponding accuracies are shown in Fig. 7.
By modifying the hyperparameters, the recognition effect would change obviously.There were two kinds of hyperparameters in this study.One is numerical hyperparameter, the method of optimization was to control other parameters as default values firstly, and a series of gradient values for the parameters were tuned, such as parameter "learning rate" could be set as listed in the Fig. 7.The corresponding blind test accuracy under each hyperparameter can be obtained by training the model in turn, the corresponding value of hyperparameter with the highest accuracy is selected as the optimal value of the parameter.The second is the non-numerical hyperparameter, such as the selection of the activation function.Adjust other hyperparameters in the same way.We also adjusted the parameters by increasing the structure of feature layer, adding Dropout mechanism, selecting the most appropriate loss function and so on.By synthesizing all the above optimal single hyperparameter, this model will be globally optimal.This process can be adjusted with a small amount of data firstly, because it can save much time.Under the optimal conditions, the model has excellent generalization performance.The optimal parameters and default parameters in our study are listed in Table 3.Using default network parameters, the prediction accuracy of network model was 89.94%.After designing the network structure and setting more appropriate hyperparameters, the network model with better performance was finally obtained under the optimal network structure, and the prediction accuracy was improved to be 97.33%.

Classification results
There are similarities and differences among different blood components, which are reflected in the position and intensity of the characteristic peaks in Raman spectra.For different kinds of animals, their blood components may be similar, and the characteristic peaks of Raman spectra may be similar.This will lead to errors in predicting unknown blood samples, caused confusion in blood identification.The confusion matrix is established to determine whether there is recognition confusion among different species.Figure 8a shows the recognition statistics of all kinds of samples.There are a few confusions in the identification of blood species.Figure 8b is the normalized confusion matrix of the classification result, which shows the proportion of samples.
As a result, confusion of identification between different bloods occurred.10% (1/10) of cat blood samples were mistaken for dog blood.About 4% (2/45) of cat blood samples were mistaken for dog blood.About 14% (8/57) of dog blood samples were mistaken for cat blood.About 2% (2/101) of monkey blood samples were mistaken for cat blood.Separately, about 2% (1/49) of pig blood samples were misidentified as dog blood and about 4% (2/49) were misidentified as monkey blood.4% (1/25) of rat blood sample were mistaken for monkey blood.The categories listed above are confusion of identification between different animal bloods.About the recognition of human blood, there are two situations: one is that human blood is mistaken for animal blood, in this study, about 1% (1/195) and 3% (6/195) of human blood samples were misidentified as argali blood and monkey blood separately.The other situation is that animal blood is mistaken for human blood, about 2% (1/49) of rabbit blood samples were misidentified as human blood in this result.Other than these, a large number of samples were still recognition correctly with high accuracy.
All those confusions may be caused by the following reasons: firstly, the blood components of the confused species are close, so the Raman spectra between them are similar; secondly, the Raman spectra data of individual samples are abnormal in the measurement process; thirdly, there is a deviation in fitting the data when training the model, because the random mechanism of training has influence on the model.Therefore, it is particularly important to ensure a unified data acquisition standard, data preprocessing, and adjusting the hyper-parameters of the model, which may improve the recognition ability.

Model assessment
The evaluation results of multi-classification blood recognition are shown in Fig. 8.By calculating macro-precision rate, we can know the precision of blood recognition.By dividing the multivariate classification into several binary classifications, it is recorded as (P 1 , R 1 ), (P 2 , R 2 ), The abscissa corresponds to the predicted blood species and the ordinate corresponds to the actual blood species.The number of samples appearing on the diagonal line, that is, the predicted values were consistent with the actual values, which can be judged as the number of samples correctly identified, and the data appearing outside the diagonal line, that is the number of samples confused by recognition.The legend on the right indicates that darker the color is, the more samples occupied.(b) The coordinate interpretation as figure (a).Data were normalized.The proportions that appear on the diagonal line were predicted correctly, and those outside the diagonal line were confused proportions.
we can calculate the average precision.The formula is defined as: The macro-recall rate is calculated to reflect the ability of the classifier to find all positive blood samples.It is defined as follows: Macro-F β score represents the results of weighted average calculation of precision and recall rate.It can measure the relative importance between precision and recall rate.When β<1, it focuses on the impact of precision, when β >1, it focuses on the impact of recall rate, and when β = 1, it is the standard situation.Definitions are as follows: To evaluate the consistency checking method of multi-classification model, kappa coefficient can be used to characterize the precision of model.The consistency degree of different κ-value is shown in Table 4.If there is a 3×3 confusion matrix as shown in Table 5, the kappa coefficient is defined as follows [35]: The performance measurement of the blood species identification was obtained according to the above methods.The results are shown in Table 6.For the evaluation of the model, we analyze the performance of the model from the following aspects: precision rate, recall rate, F β -score, consistency test, Receiver Operating Characteristic (ROC) and Area Under ROC Curve (AUC).
For the identification of blood species, it is important to ensure the precision of the classifier, because it has great practical significance in various situations such as judicial investigation, customs security and quarantine, wildlife protection investigation.For example, in customs safety and quarantine, human blood is regarded as positive and non-human as negative, so the precision rate is the proportion of how many of the human blood samples were correctly identified as human blood, and the recall rate is the proportion of how many human blood samples were correctly identified of the all human sample.As we know, in customs security inspection, the precision rate is relatively important.The recall rate is relatively important when it occurs in wildlife protection investigation, and other application scenes can choose different focus according to needs.F β -score can be compared comprehensively, and different emphases can be selected by different β value.In this paper, the corresponding F β -score values of β=0.5, 1 and 2 were given respectively.Then, the kappa coefficient is used to characterize the classification consistency of the whole model and check the recognition precision of various blood.By calculating the κ value, corresponding to the degree of consistency level in Table 4, it could be evaluated that the accuracy of this model is of almost prefect consistency.The ROC and AUC of 20 classifiers are drawn in the Fig. 9, and the AUC value was reserving only three decimal digits after the decimal point.The ROC can be used to evaluate the generalization performance of the classifier [36].The abscissa is False Positive Rate (FPR), and the ordinate is True Positive Rate (TPR).In this study, the ROC of all classifiers is plotted in the same coordinate system to identify the advantages and disadvantages intuitively.The ROC near the upper left corner represents the most accurate work of the subjects.The AUC can compare the performance of different classifiers, that is, the larger the AUC (The range of values is [0.5, 1]) is, the better the performance of the classifier is.When the area equals 1, it is an ideal state.There two performance metrics reflect intuitive classification accuracy and the performance comparison of different classifiers for the multi-classification recognition of blood species.

Conclusions
In this paper, Raman spectrum technology and deep-learning analysis method are used to realize multi-identification blood species.It was mainly based on the actual situation of customs security inspection.Moreover, the combination of Raman spectroscopy technology and deep learning method can also be applied in other fields.Considering the particularity of Raman spectra, we proposed to establish a 1D-CNN model to recognition different blood species.With a total of 3138 spectra from 20 blood species, a recognition accuracy as high as 97.33% was achieved by data preprocessing, model training, optimization and evaluation.In addition, time effect and biochemical analyses of the Raman spectra of bloods were studied.Compared with the reported studies, this study can not only recognize human or non-human blood, but also identify the species of blood, which has more intelligent performance.Finally, future work needs to supplement more animal blood species and build a comprehensive classification model.

Fig. 2 .
Fig. 2. The effects of baseline correction and normalization.(a) Raman spectrum before baseline correction (b) Raman spectrum after baseline correction, (c) Raman spectrum after baseline correction and normalization

Fig. 4 .
Fig. 4. Architecture diagram of blood recognition based on one-dimensional convolutional neural network model.

Fig. 6 .
Fig. 6.Average Raman spectrum comparison of 20 kinds of blood species.The locations of the main characteristic peaks are shown.According to these locations, the corresponding vibration modes can be known and the blood components can be judged, thus realizing biochemical analysis.

Fig. 8 .
Fig. 8. Multiple classification of confusion matrix and normalized confusion matrix.(a)The abscissa corresponds to the predicted blood species and the ordinate corresponds to the actual blood species.The number of samples appearing on the diagonal line, that is, the predicted values were consistent with the actual values, which can be judged as the number of samples correctly identified, and the data appearing outside the diagonal line, that is the number of samples confused by recognition.The legend on the right indicates that darker the color is, the more samples occupied.(b) The coordinate interpretation as figure (a).Data were normalized.The proportions that appear on the diagonal line were predicted correctly, and those outside the diagonal line were confused proportions.