CN114577671B - Near infrared wood density detection method based on parameter correction and transfer learning - Google Patents
Near infrared wood density detection method based on parameter correction and transfer learning Download PDFInfo
- Publication number
- CN114577671B CN114577671B CN202210265823.1A CN202210265823A CN114577671B CN 114577671 B CN114577671 B CN 114577671B CN 202210265823 A CN202210265823 A CN 202210265823A CN 114577671 B CN114577671 B CN 114577671B
- Authority
- CN
- China
- Prior art keywords
- training
- model
- svr
- wood
- spectrum
- 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.)
- Active
Links
- 239000002023 wood Substances 0.000 title claims abstract description 73
- 238000001514 detection method Methods 0.000 title claims abstract description 22
- 238000012937 correction Methods 0.000 title claims abstract description 21
- 238000013526 transfer learning Methods 0.000 title claims abstract description 20
- 238000012549 training Methods 0.000 claims abstract description 62
- 238000001228 spectrum Methods 0.000 claims abstract description 51
- 238000000034 method Methods 0.000 claims abstract description 47
- 230000013016 learning Effects 0.000 claims abstract description 19
- 238000012360 testing method Methods 0.000 claims abstract description 19
- 238000013508 migration Methods 0.000 claims abstract description 10
- 230000005012 migration Effects 0.000 claims abstract description 10
- 239000002245 particle Substances 0.000 claims abstract description 10
- 238000007781 pre-processing Methods 0.000 claims abstract description 6
- 238000002329 infrared spectrum Methods 0.000 claims abstract description 5
- 125000004122 cyclic group Chemical group 0.000 claims abstract description 4
- 230000006870 function Effects 0.000 claims description 24
- 238000009826 distribution Methods 0.000 claims description 10
- 239000011159 matrix material Substances 0.000 claims description 8
- 230000004913 activation Effects 0.000 claims description 6
- 238000002790 cross-validation Methods 0.000 claims description 6
- 238000010606 normalization Methods 0.000 claims description 6
- 230000007613 environmental effect Effects 0.000 claims description 5
- 238000005457 optimization Methods 0.000 claims description 5
- 238000011156 evaluation Methods 0.000 claims description 4
- 238000002474 experimental method Methods 0.000 claims description 4
- 238000001914 filtration Methods 0.000 claims description 4
- 238000009499 grossing Methods 0.000 claims description 4
- 238000004445 quantitative analysis Methods 0.000 claims description 4
- 239000013598 vector Substances 0.000 claims description 4
- ORILYTVJVMAKLC-UHFFFAOYSA-N Adamantane Natural products C1C(C2)CC3CC1CC2C3 ORILYTVJVMAKLC-UHFFFAOYSA-N 0.000 claims description 3
- 238000012886 linear function Methods 0.000 claims description 3
- 238000011176 pooling Methods 0.000 claims description 3
- 230000009326 social learning Effects 0.000 claims description 3
- 238000002203 pretreatment Methods 0.000 claims description 2
- 238000005259 measurement Methods 0.000 abstract description 6
- 230000000694 effects Effects 0.000 abstract description 5
- 238000004519 manufacturing process Methods 0.000 abstract description 5
- 239000000523 sample Substances 0.000 description 33
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 25
- 238000012546 transfer Methods 0.000 description 11
- 230000003595 spectral effect Effects 0.000 description 7
- 241000218652 Larix Species 0.000 description 6
- 235000005590 Larix decidua Nutrition 0.000 description 6
- 230000008569 process Effects 0.000 description 5
- 238000010521 absorption reaction Methods 0.000 description 3
- 230000008859 change Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 238000004497 NIR spectroscopy Methods 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000001035 drying Methods 0.000 description 2
- 238000000605 extraction Methods 0.000 description 2
- 230000006872 improvement Effects 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 241000894007 species Species 0.000 description 2
- 230000003746 surface roughness Effects 0.000 description 2
- 238000005303 weighing Methods 0.000 description 2
- UFHFLCQGNIYNRP-UHFFFAOYSA-N Hydrogen Chemical compound [H][H] UFHFLCQGNIYNRP-UHFFFAOYSA-N 0.000 description 1
- 206010020751 Hypersensitivity Diseases 0.000 description 1
- 244000137852 Petrea volubilis Species 0.000 description 1
- 229920002522 Wood fibre Polymers 0.000 description 1
- 238000009825 accumulation Methods 0.000 description 1
- 238000007605 air drying Methods 0.000 description 1
- 208000026935 allergic disease Diseases 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000009435 building construction Methods 0.000 description 1
- 238000005336 cracking Methods 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 238000002716 delivery method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 230000005484 gravity Effects 0.000 description 1
- 229910052739 hydrogen Inorganic materials 0.000 description 1
- 239000001257 hydrogen Substances 0.000 description 1
- 230000009610 hypersensitivity Effects 0.000 description 1
- 230000001788 irregular Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000000704 physical effect Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000004451 qualitative analysis Methods 0.000 description 1
- 239000002994 raw material Substances 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 230000008439 repair process Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 239000011347 resin Substances 0.000 description 1
- 229920005989 resin Polymers 0.000 description 1
- 238000005316 response function Methods 0.000 description 1
- 238000002791 soaking Methods 0.000 description 1
- 238000012306 spectroscopic technique Methods 0.000 description 1
- 238000010561 standard procedure Methods 0.000 description 1
- 239000000126 substance Substances 0.000 description 1
- 238000012706 support-vector machine Methods 0.000 description 1
- 230000009897 systematic effect Effects 0.000 description 1
- 238000001429 visible spectrum Methods 0.000 description 1
- 239000002025 wood fiber Substances 0.000 description 1
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N9/00—Investigating density or specific gravity of materials; Analysing materials by determining density or specific gravity
- G01N9/24—Investigating density or specific gravity of materials; Analysing materials by determining density or specific gravity by observing the transmission of wave or particle radiation through the material
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N21/00—Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
- G01N21/17—Systems in which incident light is modified in accordance with the properties of the material investigated
- G01N21/25—Colour; Spectral properties, i.e. comparison of effect of material on the light at two or more different wavelengths or wavelength bands
- G01N21/31—Investigating relative effect of material at wavelengths characteristic of specific elements or molecules, e.g. atomic absorption spectrometry
- G01N21/35—Investigating relative effect of material at wavelengths characteristic of specific elements or molecules, e.g. atomic absorption spectrometry using infrared light
- G01N21/3563—Investigating relative effect of material at wavelengths characteristic of specific elements or molecules, e.g. atomic absorption spectrometry using infrared light for analysing solids; Preparation of samples therefor
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N21/00—Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
- G01N21/17—Systems in which incident light is modified in accordance with the properties of the material investigated
- G01N21/25—Colour; Spectral properties, i.e. comparison of effect of material on the light at two or more different wavelengths or wavelength bands
- G01N21/31—Investigating relative effect of material at wavelengths characteristic of specific elements or molecules, e.g. atomic absorption spectrometry
- G01N21/35—Investigating relative effect of material at wavelengths characteristic of specific elements or molecules, e.g. atomic absorption spectrometry using infrared light
- G01N21/359—Investigating relative effect of material at wavelengths characteristic of specific elements or molecules, e.g. atomic absorption spectrometry using infrared light using near infrared light
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Spectroscopy & Molecular Physics (AREA)
- Theoretical Computer Science (AREA)
- Biochemistry (AREA)
- Immunology (AREA)
- Pathology (AREA)
- Analytical Chemistry (AREA)
- Chemical & Material Sciences (AREA)
- Artificial Intelligence (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Biomedical Technology (AREA)
- Investigating Or Analysing Materials By Optical Means (AREA)
Abstract
The invention discloses a near infrared wood density detection method based on parameter correction and transfer learning. The method comprises the following steps: acquiring near infrared spectrum data of wood density measured under different measurement conditions, preprocessing the data, dividing a sample set, training Resnet a network pre-training main model, transferring network super-parameters to a slave model, fine-tuning weight parameters of the slave model, and storing a pre-training model with optimal prediction effect; setting SVR as a regressor of Resnet network model and a learning algorithm of TrAdaBoost.R2 migration learning framework, and optimizing the super-parameters of the SVR by using a particle swarm algorithm; inputting the spectrum data of the test set into a master-slave pre-training model to extract neck characteristics of the bottle and respectively inputting the neck characteristics of the bottle into a TrAdaBoost.R2 transfer learning framework for cyclic training; and finally, outputting a wood density prediction result. The method solves the problems of equipment performance overflow and high cost in the traditional prediction flow, controls the prediction cost at a reasonable level, is suitable for spectrum prediction of small sample size, can dynamically adjust the sample weight, and has stronger generalization capability and accuracy in actual production.
Description
Technical Field
The invention relates to the field of spectrum detection and spectrum model transmission, mainly relates to the field of wood density nondestructive detection, and in particular relates to a near infrared wood density detection method based on parameter correction and transfer learning.
Background
Wood density is an important physical property for checking mechanical properties of wood and is also an important index for identifying the quality of wood. In the forestry field, wood density can be used to predict the physical and mechanical properties of wood, such as wet expansion, hardness and strength. The accurate prediction and evaluation of the wood properties can provide theoretical and scientific basis for material improvement, artificial forest cultivation, improvement of the comprehensive utilization rate of wood, repair and maintenance of a wood structure building and the like. Therefore, the rapid and accurate acquisition of wood density is of great importance to modern forestry production. Conventional wood density detection methods include drainage, weighing, and mechanical force-based density detection. However, the above method is complicated and time-consuming in process, and is disadvantageous for detection of a large amount of wood. The principle of near infrared spectroscopy is to record the combined vibrations of hydrogen-containing groups at the molecular level of the sample, which can be combined with chemometric techniques to perform rapid, nondestructive qualitative and quantitative analysis of wood properties.
However, the strong collinearity of near infrared spectral data, the hypersensitivity of the spectrum to equipment and the environment, and the poor performance of predictive models remain major obstacles to the widespread use of spectroscopic techniques in wood density estimation. At present, various model transfer methods have been proposed, which can improve the generalization capability of the model and improve the difference between different data sets, but the effect is irregular and mostly non-ideal. Moreover, most model delivery methods are limited by data dimension and sample size and cannot flexibly deal with the related problems.
At present, a deep learning and migration learning method is applied to a spectrum model transfer technology in the related technology, a CNN (computer numerical network) is widely applied in a plurality of fields, the CNN is verified to have strong feature extraction capability, the CNN is used as a feature extractor, the segmentability of a linear inseparable spectrum data set can be improved, but the execution condition of CNN requires a large number of samples, and each sample can influence the position of a classification hyperplane in the training process, which can definitely lead to the great reduction of the prediction precision of small sample data (such as spectrum data). Unlike the principle of CNN, SVR maps nonlinear features to high-dimensional space to achieve classification, and some studies prove that using SVR as a regressor for CNN can improve the ability of CNN to predict small sample data sets, while CNN-SVR can reduce the risk of CNN model overfitting, in the migration learning domain, CNN-SVR also lacks the ability to dynamically adjust sample weights when the sample weights of the source and target domains change significantly. Meanwhile, CNN-SVR cannot update the hyperplane division rule in time, and lacks flexibility in the face of unpredictable external interference in actual production.
Disclosure of Invention
Based on the above, in order to solve the technical problems, resnet networks with stronger feature extraction capability and deeper layers are selected, SVR is used as a regression device of Resnet networks, meanwhile, a TrAdaBoost.R2 algorithm is called in the process of network training to adjust sample weights in real time, and a near-infrared wood density detection method with higher prediction precision and stronger generalization capability is provided.
In order to achieve the above purpose, the present invention solves the above technical problems by the following technical scheme:
the invention provides a near infrared wood density detection method based on parameter correction and transfer learning, which specifically comprises the following steps:
s1: collecting wood samples, collecting spectra, collecting a plurality of wood samples, numbering, measuring wood density by adopting a drainage method, respectively placing the samples under different environmental conditions such as temperature, humidity and the like, and collecting near infrared spectra of the wood samples under different environmental conditions, wherein the environmental conditions are single variables;
s2: preprocessing spectrum data by adopting traditional spectrum preprocessing methods such as smoothing, standard normal variable correction and the like, increasing signal to noise ratio, eliminating interference, and obtaining a preprocessed standardized spectrum matrix, wherein different rows in the standardized spectrum matrix correspond to spectrums of different samples and correspond to numbers one by one;
s3: dividing a sample set, dividing the standardized spectrum matrix into a training set and a testing set, wherein the training set and the testing set comprise a training set and a testing set of a source domain and a target domain data set, the training set and the testing set of the source domain are spectrum data sets collected under the environment condition of measuring wood density, and the training set and the testing set of the target domain are spectrum data sets collected under other environment conditions;
S4: constructing a master-slave Resnet network pre-training model, respectively inputting a source domain training set and a target domain training set for multiple training, storing a master pre-training model with optimal prediction capability, transferring a super-parameter value of the master pre-training model into a slave pre-training model, and finely adjusting weight parameters of the slave pre-training model to optimize and store the weight parameters;
S5: setting SVR as a regressor of the Resnet network and a learning algorithm of a TrAdaBoost.R2 transfer learning framework, and optimizing the super-parameters of the SVR by using a particle swarm algorithm;
s6: taking Resnet network as a feature extractor, respectively inputting a source domain and a target domain test set into a master-slave Resnet network pre-training model to extract bottle neck features, wherein the bottle neck features are low-dimensional effective features extracted by a Resnet network, so that the readability and the learning property of spectrum data can be remarkably improved;
S7: and respectively inputting the neck characteristics of the bottles extracted by the master-slave pre-training model into a TrAdaBoost.R2 transfer learning framework for cyclic training, and outputting a wood density prediction result.
Further, the drainage method described in step S1 refers to the national standard wood Density determination method (GB/T1933-2009) and in order to control a single environmental variable, the wood sample is placed in a constant temperature and humidity cabinet for at least 48 hours in the experiment.
Further, the spectrum of the wood sample is scanned by the near infrared spectrometer in the step S1, the sample is repeatedly scanned 3 times at the same position to obtain an average value, the scanning time is about 1.5 seconds each time, the sample is continuously scanned 30 times in a set scanning period, and the scanning range is 350-2500nm.
Further, the spectrum pretreatment method in step S2 specifically includes: firstly, carrying out 21-point 3-order smoothing treatment on the original spectrum acquired in the step S1 by adopting a Savitzky-Golay filtering method to eliminate noise, and then eliminating the influence of the particle size and scattering on the spectrum on the surface of a sample by adopting a standard normal variable correction method.
Further, the Resnet network pre-training model in step S4 is mainly formed by sequentially connecting 1 Input layer (Input), a plurality of convolution blocks (Basic block), 1 flattening layer (flat), a plurality of full-connection layers (Fc) and 1 Output layer (Output), wherein the convolution blocks comprise two convolution layers (Conv), a batch normalization layer (BN) and a shortcut, the flattening layers are formed by sequentially connecting the Output results of the last pooling layer, the Input layers are original spectrum curves, and the Output layers are predicted values of quantitative analysis.
Further, in the Resnet network pre-training model described in step S4, the activation function of each layer except the output layer is set to a corrected linear element function (RELU), and the activation function of the output layer is set to a linear function (Line) to make the network become a regression model, the ADAM optimizer is used to train the super-parameters of the network, take the Mean Square Error (MSE) as the loss function of Resnet, select the decision coefficient (R 2) and the Mean Absolute Error (MAE) as the evaluation index of the model, and introduce the ReduceLROnPlatform function and EarlyStopping function provided by Keras in order to avoid the model falling into the local optimum.
Further, the kernel function of the SVR described in step S5 is determined as a Radial Basis Function (RBF), and super parameters (penalty factor C, kernel parameters, etc.) of the SVR are optimized using a particle swarm optimization algorithm (PSO) in which the population size is set to 50, the individual learning factor c1=1.5, the social learning factor c2=1.7, the maximum number of iterations is set to 50, and the cross-validation score is set to 10.
Further, the specific steps of the tradaboost.r2 described in step S5 are as follows:
Initializing the distribution of weight vectors w 1 i of bottleneck characteristics extracted by a master-slave pre-training model, wherein the formula is as follows:
wherein m and n are the sizes of the source domain and target domain datasets, respectively; combining neck features of the master bottle and the slave bottle into a data set T;
the cycle times are as follows: t=1, 2, …, K,
Invoking AdaBoost.R2 to obtain an SVR t model, calculating a loss error t of the SVR t by using F-fold cross validation, gradually reducing and tending to zero the weight value of a source domain dataset when the maximum iteration number K is reached, updating the weight distribution of the source domain by using the error rate e t i learned each time by the SVR t, fixing the weight of the source domain dataset when the weight distribution of the source domain reaches the optimal value, invoking AdaBoost.R2 to update the weight of a target domain dataset, and updating the weight according to the following formula:
Wherein w t+1 i is the updated sample weight, w t i is the sample weight of the previous iteration, Z t is a normalization constant, β t is the weight of the source domain and target domain dataset SVR t, and β t is adjusted to make the weight of the target domain neck feature be:
And determining an optimal SVR t model, completing a Resnet-SVR-TrAdaBoost.R2 migration model, and outputting a wood density prediction result.
Compared with the prior art, the invention has the beneficial effects that:
the invention provides a depth migration learning strategy based on TrAdaBoost.R2 parameter calibration and SVR feature optimization, which solves the problem of lower optimization performance of the traditional model transfer method when the spectrum has obvious nonlinear difference under different measurement environments, and avoids the limitations of expensive instruments and high detection cost.
The method can extract high-dimensional nonlinear spectrums, weaken nonlinear difference between a source domain and a target domain by using a support vector machine, and finally perform parameter calibration on each sample by using TrAdaBoost.R2; the need for a calibration sample number for the target domain is low; and when the source domain and the target domain have larger difference, the method can flexibly adjust the weight of the sample, has better universality, accuracy and portability in wood density inversion, and is an accurate and feasible method. The method is expected to effectively promote the development and application of near infrared analysis technology in the forestry field.
Drawings
The accompanying drawings are included to provide a further understanding of the invention, and are incorporated in and constitute a part of this specification, illustrate the invention and together with the embodiments of the invention, serve to explain the invention, without limitation to the invention. In the drawings:
fig. 1 is a flowchart of a near infrared wood density detection method based on parameter correction and transfer learning according to an embodiment of the present invention;
FIG. 2 is a near infrared spectrum of larch wood density at different water contents (10%, 30%, 50%, 70%) provided by the example of the present invention;
Fig. 3 is a network structure diagram of 1DResnet according to an embodiment of the present invention;
FIG. 4 is a diagram of a framework for transfer learning of Resnet-SVR-TrAdaBoost.R2 model provided by an embodiment of the present invention;
FIG. 5 is a graph showing R 2 contrast of different model transfer methods in the source domain and the target domain according to an embodiment of the present invention;
FIG. 6 is a graph showing the linear correlation between standard measurement values and predicted values for different water contents according to an embodiment of the present invention;
Detailed Description
The following description of the embodiments of the present invention will be made more apparent and fully by reference to the accompanying drawings, in which it is shown, by way of illustration, only some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to fall within the scope of the invention.
Examples:
In the embodiment, larch is used as a research object, and near infrared spectroscopy is used for predicting the air-drying density of the wood under the condition of different water contents. The larch is taken as an object to be introduced, and the larch is considered to be a main tree species of coniferous forests in northeast China, is rich in wood accumulation, is also a main tree species of forestation and forest updating in the future in the area, has slightly heavy wood, medium hardness, easy cracking, straight texture, compact structure and specific gravity of 0.32-0.52, has resin, is durable and can be used as a material for building construction, civil engineering, electric poles, boats and vehicles, thin wood processing, wood fiber industry raw materials and the like. The successful application of the method in the embodiment in the density detection of larch wood is typical, can be popularized to other parts of wood, and has strong representativeness.
In this embodiment, the conditions of gradient water content are set as follows: 10%, 30%, 50%, 70%. The water content gradient is selected, and a typical comparison is set by referring to the climate change law of the Heilongjiang province in the last five years and combining the local production operation law and the characteristics of larch. In practical application, the production and experimental modes can be determined according to the variety and physical and chemical properties of the specific wood.
As shown in fig. 1, the process of the above embodiment is specifically as follows:
S1: and (5) wood sample collection and spectrum collection. Several wood samples were collected and numbered, and the air-dry density of the wood was measured using a drainage method, which referred to the national standard method for wood Density determination (GB/T1933-2009). To avoid the influence of the surface roughness, each side of the sample was polished 5 times with 80-mesh sand paper so that the surface roughness parameter Ra was close to 12.5 μm. Controlling the temperature to 20 ℃, setting the water content to be 4 gradients of 70%, 50%, 30% and 10%, soaking the wood sample in water for 20d, then drying in an oven, weighing and calculating the water content of the sample every 5-15 minutes after drying, and immediately measuring near infrared spectrum data of the sample when the water content of the wood reaches the specified water content gradient. Using ASD Pro FR/A114260 portable spectrometer, wavelength range 350-2500nm, consisting of 2151 data points. The scanning was repeated 3 times at the same position on the cross section of the sample using a fiber optic probe, each scan time being about 1.5 seconds. The sample is scanned 30 times consecutively in the set scanning period. The average of three measurements was taken as raw spectral data.
As shown in fig. 2, the internal structure of the wood sample varies with the moisture content, resulting in different spectral distributions such as baseline drift, small shifts in absorption peak, variation in absorption peak shape, etc., but similar overall trends. In this example, spectral data of wood samples with water content of 10% was used as a source domain data set, and spectral data of wood samples with other water content levels (70%, 50%, 30%) was used as a target domain data set. And model propagation was studied from the viewpoint of the measurement environment.
S2: spectral data preprocessing. Firstly, carrying out 21-point 3-order smoothing treatment on the original spectrum acquired in the step S1 by adopting a Savitzky-Golay filtering method to eliminate noise, and then eliminating the influence of the particle size and scattering on the spectrum on the surface of a sample by adopting a standard normal variable correction method to obtain a pretreated standardized spectrum matrix, wherein different rows in the standardized spectrum matrix correspond to the spectrums of different samples and correspond to the numbers one by one;
S3: the sample set is partitioned. In the embodiment of the invention, a sample set dividing method based on joint x-y distance (SPXY) is adopted to divide the four groups of spectrum data in the step S1 into a training set and a testing set respectively. Wherein the training set and the test set of the source domain and the target domain of each set of spectral data have 118 and 51 samples, respectively.
S4: and constructing a master-slave Resnet network pre-training model, respectively inputting a source domain training set and a target domain training set for multiple training, storing a master pre-training model with optimal prediction capability, transferring a super-parameter value of the master pre-training model into a slave pre-training model, and finely adjusting weight parameters of the slave pre-training model to achieve the optimal and storing.
In the embodiment of the present invention, as shown in fig. 3, the Resnet network pre-training model in step S4 is mainly formed by sequentially connecting 1 Input layer (Input), eight convolution blocks (Basic block), 1 flattening layer (flat), four full connection layers (Fc) and 1 Output layer (Output), where the convolution blocks are composed of two convolution layers (Conv), a batch normalization layer (BN) and a shortcut, the flattening layers are formed by sequentially connecting the Output results of the last pooling layer, the Input layers are original spectrum curves, and the Output layers are predicted values of quantitative analysis.
In the embodiment of the invention, the activation function of each layer except the output layer is set as a correction linear element function (RELU), the activation function of the output layer is set as a linear function (Line) so as to enable the network to become a regression model, the ADAM optimizer is used for training super parameters of the network, the Mean Square Error (MSE) is used as a loss function of Resnet, the decision coefficient (R2) and the average absolute error (MAE) are selected as evaluation indexes of the model, and ReduceLROnPlatform functions and EarlyStopping functions provided by Keras are introduced for avoiding the model from falling into local optimum.
S5: and setting SVR as a regressor of the Resnet network and a learning algorithm of a TrAdaBoost.R2 migration learning framework, and optimizing the super-parameters of the SVR by using a particle swarm algorithm. Wherein the kernel function of the SVR is determined as a Radial Basis Function (RBF) and the super-parameters (penalty factor C, kernel parameters, etc.) of the SVR are optimized using a particle swarm optimization algorithm (PSO) in which the population size is set to 50, the individual learning factor c1=1.5, the social learning factor c2=1.7, the maximum number of iterations is set to 50, and the cross-validation fold is set to 10.
S6: taking Resnet network as a feature extractor, respectively inputting a source domain and a target domain test set into a master-slave Resnet network pre-training model to extract bottle neck features, wherein the bottle neck features are low-dimensional effective features extracted by a Resnet network, so that the readability and the learning property of spectrum data can be remarkably improved;
in the embodiment of the present invention, as shown in fig. 4, the specific steps of the tradaboost.r2 described in step S5 are as follows:
Initializing the distribution of weight vectors w 1 i of bottleneck characteristics extracted by a master-slave pre-training model, wherein the formula is as follows:
wherein m and n are the sizes of the source domain and target domain datasets, respectively; combining neck features of the master bottle and the slave bottle into a data set T;
the cycle times are as follows: t=1, 2, …, K,
Invoking AdaBoost.R2 to obtain an SVR t model, calculating a loss error t of the SVR t by using F-fold cross validation, gradually reducing and tending to zero the weight value of a source domain dataset when the maximum iteration number K is reached, updating the weight distribution of the source domain by using the error rate e t i learned each time by the SVR t, fixing the weight of the source domain dataset when the weight distribution of the source domain reaches the optimal value, invoking AdaBoost.R2 to update the weight of a target domain dataset, and updating the weight according to the following formula:
Wherein w t+1 i is the updated sample weight, w t i is the sample weight of the previous iteration, Z t is a normalization constant, β t is the weight of the source domain and target domain dataset SVR t, and β t is adjusted to make the weight of the target domain neck feature be:
S7: and respectively inputting the neck characteristics of the bottles extracted by the master-slave pre-training model into a TrAdaBoost.R2 transfer learning framework for cyclic training, determining an optimal SVR t model, completing the Resnet-SVR-TrAdaBoost.R2 transfer model, and outputting a wood density prediction result.
In the embodiment of the invention, whether the Resnst D-SVR-TrAdaBoost.R2 method is effective or not is better than the traditional method or not. A partial least squares direct prediction model (PLSR-Target), a support vector regression direct prediction model (SVR-Target), a PLSR model (PLSR+SBC) based on intercept/slope method transfer, a PLSR model (PLSR+PDS) based on segment direct correction method transfer, a SVR model (SVR+PDS) based on segment direct correction method transfer, a Resnet D model (Resnet D-TL) based on migration learning and a Resnet D-SVR model (Renst D-SVR) based on migration learning are added in the experiment for comparison. Experiments were performed in target domains with wood moisture contents of 70%, 50% and 30% using Resnet D-SVR-tradaboost.r2 as model transfer method proposed by the present invention, and the average of 3 sets of results was taken. Wherein each set of results was run 20 times on average, overcoming the effect of random parameters. The results are shown in FIG. 5. In general, the model prediction established by the transfer learning method has higher precision. Wherein Resnet D-SVR-tradaboost.r2 has a strong generalization ability, and can be represented in both the source domain (R 2 =0.7152) and the target domain (R 2 = 0.4106), and the performance of the prediction model is the best among all methods.
In the embodiment of the invention, model transfer among different water contents is also studied, prediction models of each water content group are respectively established, and the method provided by the invention is tested by taking the prediction models as a standard and taking PLSR-Target as a comparison. In actual measurement, there is often an individual difference in the water content of a batch of wood. Thus, a new mixed water content set was set up in the experimental set, 40 samples (30%, 50%, 70% moisture content, respectively) were selected from each of the target field experimental sets using the SPXY method, and these samples were combined into a training set of 120 samples. Likewise, 30 samples were selected from the remaining samples and pooled into a test set of 90 samples. The results of the model transfer are shown in fig. 6.
The above results indicate that the scatter points of the direct predicted values (PLSR-Target) of 50% and 70% water content are mostly above the PLSR predicted line, and the overall predicted result is large. The scatter point of the direct predicted value of 30% water content is located substantially near the PLSR prediction line. This means that as the moisture content increases, the hygroscopic effect of the wood increases and the free moisture in the cells increases. The increase in moisture content and the change in internal structure during the moisture absorption process of wood can severely interfere with the visible spectrum, resulting in poor prediction effect of the model. Different water contents influence response functions, and larger systematic errors can be generated when a 10% water content model is used for predicting spectrums under other water content conditions. Intuitively, it can be seen that the predicted scatter points for the 30%, 50% and 70% water cut groups are very close to the PLSR prediction line, while the scatter points for the mixed water cut groups are relatively close. The test result shows that Resnet D-SVR-TrAdaBoost.R2 has strong generalization capability and potential for practical application even if the spectrum is greatly affected by the measuring environment for different water contents or mixed water contents.
The foregoing examples illustrate only a few embodiments of the invention and are described in detail herein without thereby limiting the scope of the invention. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the invention, which are all within the scope of the invention. Accordingly, the scope of protection of the present invention is to be determined by the appended claims.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It should be understood that, although the steps in the flowcharts of the embodiments of the present invention are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in various embodiments may include multiple sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor do the order in which the sub-steps or stages are performed necessarily performed in sequence, but may be performed alternately or alternately with at least a portion of the sub-steps or stages of other steps or other steps.
The technical features of the above-described embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above-described embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
Claims (8)
1. A near infrared wood density detection method based on parameter correction and transfer learning, the method comprising:
Step S1: collecting wood samples, collecting spectra, numbering, measuring wood density by adopting a drainage method, respectively placing the samples under different temperature and humidity environment conditions, and collecting near infrared spectra of the wood samples under different temperature and humidity environment conditions, wherein the environment conditions are all single variables;
Step S2: preprocessing spectrum data by adopting two traditional spectrum preprocessing methods, namely a Savitzky-Golay filtering method and a standard normal variable correction method, increasing signal to noise ratio and eliminating interference to obtain a preprocessed standardized spectrum matrix, wherein different rows in the standardized spectrum matrix correspond to spectrums of different samples and correspond to numbers one by one;
Step S3: dividing a sample set, dividing the standardized spectrum matrix into a training set and a testing set, wherein the training set and the testing set comprise a training set and a testing set of a source domain and a target domain data set, the training set and the testing set of the source domain are spectrum data sets collected under the environment condition of measuring wood density, and the training set and the testing set of the target domain are spectrum data sets collected under other environment conditions;
Step S4: constructing a master-slave Resnet network pre-training model, respectively inputting a source domain training set and a target domain training set for multiple training, storing a master pre-training model with optimal prediction capability, transferring a super-parameter value of the master pre-training model into a slave pre-training model, and finely adjusting weight parameters of the slave pre-training model to optimize and store the weight parameters;
Step S5: setting SVR as a regressor of the Resnet network and a learning algorithm of a TrAdaBoost.R2 transfer learning framework, and optimizing the super-parameters of the SVR by using a particle swarm algorithm;
Step S6: taking Resnet network as a feature extractor, respectively inputting a source domain test set and a target domain test set into a master-slave Resnet network pre-training model to extract bottleneck features, wherein the bottleneck features are low-dimensional effective features extracted by the Resnet network, so that the readability and the learning property of spectrum data can be remarkably improved;
Step S7: and respectively inputting bottleneck characteristics extracted by the master-slave Resnet network pre-training model into a TrAdaBoost.R2 transfer learning framework for cyclic training, and outputting a wood density prediction result.
2. The near infrared wood density detection method based on parameter correction and transfer learning according to claim 1, wherein the wood density is measured by a drainage method in step S1, and the wood sample is placed in a constant temperature and humidity cabinet for at least 48 hours in an experiment in order to control a single environmental variable.
3. The near infrared wood density detection method based on parameter correction and transfer learning according to claim 1, wherein in the step S1, a near infrared spectrometer is adopted to scan the spectrum of a wood sample, the sample is repeatedly scanned for 3 times at the same position to obtain an average value, the scanning time is 1.5 seconds each time, the sample is continuously scanned for 30 times in a set scanning period, and the scanning range is 350-2500nm.
4. The near infrared wood density detection method based on parameter correction and transfer learning according to claim 1, wherein the spectrum pretreatment method in step S2 is specifically: firstly, carrying out 21-point 3-order smoothing treatment on the original spectrum acquired in the step S1 by adopting a Savitzky-Golay filtering method to eliminate noise, and then eliminating the influence of the particle size and scattering on the spectrum on the surface of a sample by adopting a standard normal variable correction method.
5. The near infrared wood density detection method based on parameter correction and migration learning according to claim 1, wherein the Resnet network pre-training model in the step S4 is mainly formed by sequentially connecting 1 Input layer Input, a plurality of convolution blocks Basic block, 1 flattening layer flat, a plurality of full connection layers Fc and 1 Output layer Output, the convolution blocks comprise two convolution layers Conv, a batch normalization layer BN and a shortcut, the flattening layers are formed by sequentially connecting the Output results of the last pooling layer, the Input layers are original spectrum curves, and the Output layers are predicted values of quantitative analysis.
6. The near infrared wood density detection method according to claim 1, wherein in the pre-training model of Resnet networks in step S4, the activation function of each layer except the output layer is set to correct the linear element function RELU, and the activation function of the output layer is set to be the linear function Line, so that the network becomes a regression model, the ADAM optimizer is used to train the super parameters of the network, the mean square error MSE is used as the loss function of Resnet, the decision coefficient R 2 and the mean absolute error MAE are selected as the evaluation index of the model, and the ReduceLROnPlatform function and EarlyStopping function provided by Keras are introduced in order to avoid the model falling into the local optimum.
7. The near infrared wood density detection method based on parameter correction and transfer learning according to claim 1, wherein the kernel function of the SVR in the step S5 is determined as a radial basis function RBF, and the super parameters of the SVR are optimized by using a particle swarm optimization algorithm PSO, the super parameters being a penalty factor C and a kernel parameter, in the PSO, the population size is set to 50, the individual learning factor c1=1.5, the social learning factor c2=1.7, the maximum iteration number is set to 50, and the cross-validation fold number is set to 10.
8. The near infrared wood density detection method based on parameter correction and transfer learning according to claim 1, wherein the specific steps of tradaboost.r2 in step S5 are as follows:
Initializing weight vectors of bottleneck characteristics extracted by master-slave pre-training models The distribution, formula is as follows:
wherein m and n are the sizes of the source domain and target domain datasets, respectively; merging the main bottleneck characteristics and the auxiliary bottleneck characteristics into a data set T;
The cycle times are as follows: t=1, 2, K,
Calling AdaBoost.R2 to obtain an SVR t model, calculating a loss error t of the SVR t by using F-fold cross validation, gradually reducing and approaching to zero the weight of a source domain data set when the maximum iteration number K is reached, and learning the error rate each time by using the SVR t Updating the weight distribution of the source domain, when the weight distribution of the source domain reaches the optimal, fixing the weight of the source domain data set, and calling AdaBoost.R2 to update the weight of the target domain data set, wherein the updating weight has the following formula:
Wherein the method comprises the steps of In order to update the weights of the samples,For the sample weight of the previous iteration, Z t is a normalization constant, β t is the weight of the source domain and target domain dataset SVR t, and β t is adjusted to make the weight of the target domain bottleneck feature be:
And determining an optimal SVR t model, completing a Resnet-SVR-TrAdaBoost.R2 migration model, and outputting a wood density prediction result.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210265823.1A CN114577671B (en) | 2022-03-17 | 2022-03-17 | Near infrared wood density detection method based on parameter correction and transfer learning |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210265823.1A CN114577671B (en) | 2022-03-17 | 2022-03-17 | Near infrared wood density detection method based on parameter correction and transfer learning |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114577671A CN114577671A (en) | 2022-06-03 |
CN114577671B true CN114577671B (en) | 2024-07-26 |
Family
ID=81779505
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210265823.1A Active CN114577671B (en) | 2022-03-17 | 2022-03-17 | Near infrared wood density detection method based on parameter correction and transfer learning |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114577671B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115165795A (en) * | 2022-06-28 | 2022-10-11 | 中国烟草总公司郑州烟草研究院 | Tobacco chemical composition prediction method and device based on spectrum conversion |
CN115049025B (en) * | 2022-08-16 | 2022-11-04 | 山东钢铁股份有限公司 | Model migration method and system based on elastic segmentation standardization algorithm |
CN115684074B (en) * | 2022-10-09 | 2024-04-30 | 东北林业大学 | Pear quality prediction method based on visible near infrared spectrum and migration learning |
CN116128049B (en) * | 2023-04-04 | 2023-06-30 | 厦门大学 | XGBoost model-based migration condition selection method for water quality prediction model |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1936537A (en) * | 2006-10-12 | 2007-03-28 | 中国林业科学研究院木材工业研究所 | Method for measuring density of Huoli Wood using near infrared spectrum |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6606568B2 (en) * | 2000-06-28 | 2003-08-12 | Midwest Research Institute | Method for predicting dry mechanical properties from wet wood and standing trees |
CN102735580A (en) * | 2012-07-16 | 2012-10-17 | 东北林业大学 | Quasi nondestructive detection method of wood density of standing timber |
CN106442382A (en) * | 2016-07-15 | 2017-02-22 | 中国林业科学研究院热带林业研究所 | Method for rapid prediction of Eucapyptus urophylla * E. tereticornis wood basic density |
CN109064553B (en) * | 2018-10-26 | 2023-07-07 | 东北林业大学 | Solid wood board section morphology inversion method based on near infrared spectrum analysis |
US12079730B2 (en) * | 2020-05-28 | 2024-09-03 | International Business Machines Corporation | Transfer learning for molecular structure generation |
CN113959974B (en) * | 2021-09-27 | 2024-06-07 | 桂林电子科技大学 | Transmission method of universal near infrared spectrum model |
-
2022
- 2022-03-17 CN CN202210265823.1A patent/CN114577671B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1936537A (en) * | 2006-10-12 | 2007-03-28 | 中国林业科学研究院木材工业研究所 | Method for measuring density of Huoli Wood using near infrared spectrum |
Also Published As
Publication number | Publication date |
---|---|
CN114577671A (en) | 2022-06-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN114577671B (en) | Near infrared wood density detection method based on parameter correction and transfer learning | |
CN110455722A (en) | Rubber tree blade phosphorus content EO-1 hyperion inversion method and system | |
CN110726694A (en) | Characteristic wavelength selection method and system of spectral variable gradient integrated genetic algorithm | |
Cao et al. | Spectral demodulation of fiber Bragg grating sensor based on deep convolutional neural networks | |
CN114626304B (en) | Online prediction soft measurement modeling method for ore pulp copper grade | |
CN114330114B (en) | Beryllium bronze alloy corrosion rate prediction method based on quantum support vector machine | |
CN114611582B (en) | Method and system for analyzing substance concentration based on near infrared spectrum technology | |
CN115855860A (en) | Method for predicting moisture content in tea drying process and processing terminal | |
CN112651173B (en) | Agricultural product quality nondestructive testing method based on cross-domain spectral information and generalizable system | |
CN105466885B (en) | Based on the near infrared online measuring method without measuring point temperature-compensating mechanism | |
CN106529680B (en) | A kind of multiple dimensioned extreme learning machine integrated modelling approach based on empirical mode decomposition | |
Bagher Shemirani et al. | Prediction of tensile strength of concrete using the machine learning methods | |
CN110909492B (en) | Sewage treatment process soft measurement method based on extreme gradient lifting algorithm | |
CN117092059A (en) | Cashmere and wool component content identification method based on infrared spectrum technology | |
CN113722988B (en) | Method for predicting organic PDMS film-air distribution coefficient by quantitative structure-activity relationship model | |
CN114878508A (en) | Hyperspectral imaging-based method for detecting surface water content of cultural relic in earthen site | |
CN112881333A (en) | Near infrared spectrum wavelength screening method based on improved immune genetic algorithm | |
CN112229816A (en) | Wood elastic modulus prediction method based on OPLS-SPA-MIX-PLS | |
CN117077509B (en) | Modeling method for optimizing KELM neural network electric spindle thermal error by northern eagle algorithm | |
CN115355932B (en) | Demodulation method of sea water temperature, salt pressure and multi-parameter optical fiber sensing signal | |
CN111256890B (en) | Long-period fiber grating axial stress estimation method based on random forest | |
CN117764454B (en) | Method for evaluating development degree of site flaky stripping | |
Li et al. | Sparse attention double-channel FCN network for numerical analysis tracheid features in larch | |
Che et al. | Grey Information Relational Estimation Model of Soil Organic Matter Content Based on Hyperspectral data. | |
CN105259135A (en) | Near-infrared measurement method applicable to real-time on-line measuring-point-free temperature compensation |
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 |