Fish freshness evaluation method and system
Through the inversion of the nuclear magnetic resonance signal and the extraction of characteristic parameters, combined with microbial indicators, a partial least squares regression model is constructed, which solves the problem of low accuracy of fish freshness evaluation and achieves high-precision lossless evaluation.
Patent Information
- Application Number
- CN202411545734.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-01
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-11-01
AI Technical Summary
In the prior art, the non-destructive evaluation accuracy of fish freshness is low, and it is difficult to accurately screen out the characteristic quantities related to fish freshness from complex NMR data.
By collecting the NMR signal T2 relaxation curve of fish meat samples, the T2 spectrum data is obtained by inversion using non-negative least squares method, and divided into different water molecules motion state areas, extracting the peak area and peak position of each area. Combined with microbial indicators such as the total number of fish colonies, a partial least squares regression evaluation model is constructed to achieve quantitative evaluation of fish freshness.
It improves the accuracy of lossless evaluation and can more accurately reflect the freshness of fish. It is suitable for online applications and is simple and fast to operate.
Smart Images

Figure CN119470535A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of fish meat detection, and in particular to a method and system for evaluating the freshness of fish meat. Background Art
[0002] With the improvement of people's living standards and the enhancement of food safety awareness, consumers have put forward higher requirements for the freshness and quality of aquatic products such as fish. Fish is a perishable food, and its freshness directly affects the taste, nutritional value and safety of the product. Therefore, how to quickly, accurately and non-destructively evaluate the freshness of fish is a key issue that needs to be solved in the quality control and circulation and sales of aquatic products.
[0003] Traditional fish freshness evaluation methods mainly include sensory evaluation and physical and chemical index testing. Sensory evaluation relies on the experience and judgment of professional evaluators, and has disadvantages such as strong subjectivity and inconsistent standards, making it difficult to quantify and standardize. Physical and chemical indicators such as volatile basic nitrogen, pH value, and peroxide value can objectively reflect the freshness of fish, but they require destructive treatment of samples, have a long detection cycle, and are not suitable for online applications.
[0004] In recent years, modern analytical technologies such as nuclear magnetic resonance, hyperspectroscopy, and electronic nose have been introduced into the field of non-destructive testing of fish quality. Among them, low-field nuclear magnetic resonance technology has attracted much attention due to its advantages of rapidity, non-destructiveness, and sensitivity. Low-field nuclear magnetic resonance measures the relaxation characteristics of water molecules in the sample to obtain a signal fingerprint that reflects the changes in the internal structure and composition of the sample, providing new ideas and methods for evaluating the freshness of fish.
[0005] However, most of the existing studies on fish freshness evaluation using nuclear magnetic resonance are based on a single parameter, T2 relaxation time, which ignores the rich information contained in the relaxation signal, and the evaluation accuracy and applicability need to be further improved. In addition, due to the lack of effective spectral analysis and feature extraction methods, it is difficult to accurately screen out the feature quantities related to fish freshness from complex nuclear magnetic resonance data, which affects the generalization performance of the evaluation model. Summary of the invention
[0006] In response to the problem of low accuracy of non-destructive evaluation of fish freshness in the prior art, the present application provides a method and system for evaluating the freshness of fish meat. By collecting the T2 relaxation curve of the nuclear magnetic resonance signal of the fish meat sample, the T2 spectrum data of the sample is obtained by inversion using the non-negative least squares method and divided into regions with different water molecule motion states, and the nuclear magnetic characteristic parameters such as the peak area and peak position of each region are extracted. Combined with microbial indicators such as the total number of fish colonies, a partial least squares regression evaluation model is constructed to achieve quantitative evaluation of the freshness of fish meat and improve the accuracy of non-destructive evaluation.
[0007] The purpose of this application is achieved through the following technical solutions.
[0008] One aspect of the present application provides a method for evaluating the freshness of fish meat, comprising: using a low-field pulsed nuclear magnetic resonance instrument to perform nuclear magnetic resonance measurement on fish meat, using a CPMG sequence, setting an echo time TE, a repetition time TR, an echo number Ne and an accumulation number NS, to obtain T2 relaxation curve data of the fish meat; using a non-negative least squares method NNLS to invert the T2 relaxation curve data to obtain T2 distribution spectrum data of the fish meat; dividing the T2 distribution spectrum data into three regions T21, T22 and T23 according to the T2 value ; Wherein, T21 represents the bound water region, T22 represents the weakly bound water region, and T23 represents the free water region; the T2 value of the T21 region is less than or equal to 100ms, the T2 value of the T22 region is between 100ms and 500ms, and the T2 value of the T23 region is greater than 500ms; the characteristic parameters of the T21 region, the T22 region, and the T23 region are calculated respectively to obtain the nuclear magnetic resonance characteristic data of the fish meat; wherein the characteristic parameters include the peak areas A1, A2, and A3 of each region, the peak positions T m21 , T m22 , T m23 ; The plate counting method was used to determine the total colony count of fish meat, and the total colony count was used as the microbial value data for evaluating the freshness of fish meat; the nuclear magnetic resonance characteristic data was used as the independent variable and the microbial value data was used as the dependent variable. The partial least squares method (PLSR) was used to construct a regression model to obtain the fish meat freshness evaluation model and evaluate the freshness of fish meat.
[0009] Among them, low-field pulsed NMR: is an instrument that uses the principle of nuclear magnetic resonance to detect samples. Low field refers to the use of a lower magnetic field strength, usually below 0.5T. Pulse refers to the use of a radio frequency pulse sequence to excite the sample and collect signals. CPMG sequence: also known as the Carr-Purcell-Meiboom-Gill sequence, is a commonly used nuclear magnetic resonance pulse sequence used to measure the transverse relaxation time T2 of the sample. By applying a series of equally spaced 180° pulses, a series of attenuated echo signals can be obtained, reflecting the T2 relaxation characteristics of different components in the sample. Non-negative least squares method NNLS: is a data inversion algorithm used to estimate the distribution of unknown parameters from measurement data. In the field of nuclear magnetic resonance, NNLS is often used to invert the T2 distribution spectrum of the sample from the T2 relaxation curve data. Compared with the traditional least squares method, NNLS introduces non-negative constraints to ensure that the estimated parameter distribution is non-negative and more in line with physical meaning. T2 relaxation curve data: a series of attenuated echo signal amplitude data obtained by CPMG sequence measurement, reflecting the transverse relaxation characteristics of different components in the sample. The signal amplitude at each echo moment is related to the T2 relaxation time and content of each component in the sample. T2 distribution spectrum data: the distribution of different T2 components in the sample obtained by inverting the T2 relaxation curve data. The T2 distribution spectrum represents the proportion or signal intensity of components with different T2 values in the sample, reflecting the microstructure and physicochemical state of the sample. Plate counting method: a commonly used microbial detection method, by diluting the sample and spreading it on a plate culture medium, culturing for a certain period of time, and counting the number of colonies formed on the plate to estimate the content of microorganisms in the sample. The total number of colonies is an important indicator for evaluating the degree of microbial contamination of the sample. Partial least squares PLSR regression model construction: a statistical method for establishing a linear relationship between independent variables and dependent variables. By extracting the principal components of the independent variables and the dependent variables and establishing a regression model in the principal component space, the problem of multicollinearity between independent variables can be effectively handled. In this scheme, PLSR was used to establish a fish freshness evaluation model, with NMR characteristic data as the independent variable and microbial value data as the dependent variable.
[0010] Further, S1, a low-field pulsed nuclear magnetic resonance apparatus is used to perform nuclear magnetic resonance measurement on fish meat, a CPMG sequence is adopted, and the echo time TE, repetition time TR, echo number Ne and accumulation number NS are set to obtain T2 relaxation curve data of fish meat, including: the echo time TE value range is 0.2ms to 1ms; the repetition time TR value range is 1000ms to 5000ms; the echo number Ne value range is 500 to 5000; the accumulation number NS value range is 2 to 128.
[0011] Among them, echo time TE (Echo Time): refers to the time interval between two adjacent 180° inversion pulses in the CPMG sequence. TE determines the acquisition time of each echo signal and is related to the T2 relaxation time of different components in the sample. Shorter TE is conducive to capturing the signal of fast relaxation components, while longer TE is more suitable for detecting slow relaxation components. In this scheme, the value range of TE is 0.2ms to 1ms, which can be optimized according to the actual relaxation characteristics of the fish sample. Repetition time TR (Repetition Time): refers to the time interval between two consecutive 90° excitation pulses in the CPMG sequence. TR determines the waiting time between each repeated measurement and needs to be long enough to allow the longitudinal magnetization of the sample to fully recover to the equilibrium state. The value of TR is usually much larger than the T1 relaxation time of the sample to avoid the influence of the T1 relaxation effect on the measurement results. In this scheme, the value range of TR is 1000ms to 5000ms, which can be reasonably set according to the T1 relaxation characteristics of the fish sample and the measurement time requirements. Echo number Ne (Number of Echoes): refers to the number of echo signals collected in the CPMG sequence. Ne determines the number of sampling points and time range of the T2 relaxation curve, which is related to the resolution of different T2 components in the sample. A larger Ne can obtain more sampling points and improve the ability to distinguish different T2 components, but at the same time it will extend the measurement time. In this scheme, the value range of Ne is 500 to 5000, which can be optimized according to the T2 relaxation characteristics of the fish sample and the required resolution. Accumulated number NS (Number of Scans): refers to the number of times the CPMG sequence measurement is repeated on the same sample. By accumulating and averaging multiple measurement results, the signal-to-noise ratio can be improved and the influence of random noise can be reduced. A larger NS can obtain higher quality T2 relaxation curve data, but at the same time it will extend the total measurement time. In this scheme, the value range of NS is 2 to 128, which can be reasonably set according to the signal strength and measurement time requirements of the fish sample.
[0012] Further, S2, non-negative least squares method NNLS is used to invert the T2 relaxation curve data to obtain the T2 distribution spectrum data of fish meat, including: S21, constructing the objective function of regularized non-negative least squares method:
[0013] In the formula, A is the observation matrix of the CPMG sequence, b is the column vector of the obtained T2 relaxation curve data, x is the column vector of the T2 distribution spectrum data to be obtained, and λ is the regularization parameter; S22, randomly divide the T2 relaxation curve data into K subsets, select K-1 subsets as training sets each time, and the remaining 1 subset as the validation set; for different λ values, solve the regularized non-negative least squares problem on the training set, and calculate the mean square error of the inversion result on the validation set; repeat K times to obtain K mean square errors when λ takes different values, and take the λ value corresponding to the minimum mean square error as the optimal regularization parameter; S23, substitute the optimal regularization parameter λ into the objective function to solve the T2 distribution spectrum data.
[0014] Furthermore, the optimal regularization parameter λ is substituted into the objective function to solve the T2 distribution spectrum data, including: initializing the initial value x of the T2 distribution spectrum data x (0) , set the iteration step a and the number of iterations N; for the kth iteration, calculate the objective function at x (k) The gradient g (k) :g (k) =A T (Ax (k) -b)+λx (k) , where A T is the transpose of matrix A; update T2 distribution spectrum data x: x (k+1) =max(0,x (k) -ag (k) ), where max(0,x (k) -ag (k) ) means truncating negative values to 0 to ensure the non-negativity of x; check whether ||x is satisfied (k+1) -x (k) ||2≤ε, if it is satisfied, the iteration is terminated, otherwise let k=k+1 and return to continue the iteration; where ε is the given error threshold; after the iteration is terminated, the final x (k+1) As the optimal T2 distribution spectrum data.
[0015] Further, characteristic parameters of the T21 region, the T22 region, and the T23 region are calculated respectively to obtain nuclear magnetic resonance characteristic data of fish meat, including: extracting T2 spectrum data of each region according to the T2 value range of the T21 region, the T22 region, and the T23 region to obtain T21 region spectrum data, T22 region spectrum data, and T23 region spectrum data; sampling the T2 spectrum data of each region at equal intervals in the T2 dimension to obtain a series of discrete T2 values and corresponding signal amplitudes to form a discretized T2 spectrum curve; and numerically integrating the discretized T2 spectrum curve using the trapezoidal integration method: Where A is the peak area, y i and i+1$S_1$ and $S_2$ are the signal amplitudes corresponding to two adjacent T2 sampling points, $\Delta T_2$ is the interval between T2 sampling points, and $n$ is the number of sampling points; traverse the entire T2 region, and take the result obtained by numerical integration as the peak areas $A_1$, $A_2$, and $A_3$ of the corresponding regions; smooth the T2 spectral curves of each region; calculate the first derivative of the smoothed T2 spectral curve to obtain the first derivative curve; search for the zero-crossing points on the first derivative curve as the local maximum points of the T2 spectral curve; the zero-crossing point represents the position where the derivative value changes from positive to negative; compare the signal amplitude sizes of each local maximum point, and select the T2 value corresponding to the maximum amplitude maximum point as the peak position parameter $T$ of the T2 spectrum of the corresponding region. m21 $T_{21}$ m22 $T_{22}$ m23 $T_{23}$, the peak position parameter reflects the motion state information of water molecules in each region; take the calculated peak areas $A_1$, $A_2$, and $A_3$ and the peak position parameters $T$ m21 $T_{21}$ m22 $T_{22}$ m23 $T_{23}$ as the nuclear magnetic resonance characteristic data of fish meat.
[0016] Among them, the T2 spectral data is obtained by measuring the sample with a CPMG sequence and inverting the obtained T2 relaxation curve data. It reflects the distribution of different T2 relaxation time components in the sample. Specifically, the T2 spectral data represents the signal intensity or percentage content corresponding to different T2 values in the sample, reflecting the microscopic structure and physical and chemical state of the sample. In this scheme, the T2 spectral data is divided into three regions according to the T2 value: the T21 region ($T_2\leq100$ ms), the T22 region ($100$ ms < $T_2\leq500$ ms), and the T23 region ($T_2>500$ ms), which represent the distribution of bound water, weakly bound water, and free water respectively. By extracting the T2 spectral data of each region, the T21 region spectral data, the T22 region spectral data, and the T23 region spectral data can be obtained respectively, reflecting the relative content and distribution characteristics of water molecules in different states in the fish meat sample.
[0017] The T2 dimension refers to the horizontal axis coordinates corresponding to different T2 values in the T2 spectrum data. In the T2 spectrogram, the horizontal axis represents the logarithmic value of the T2 relaxation time, and the unit is usually milliseconds (ms); the vertical axis represents the signal intensity or content percentage of the corresponding T2 value. The distribution of the T2 spectrum data in the T2 dimension reflects the relative content and proportional relationship of the components with different relaxation times in the sample. In step S42 of this scheme, in order to facilitate further analysis and feature extraction, the T2 spectrum data of each region needs to be sampled at equal intervals in the T2 dimension. This process refers to selecting a series of discrete T2 values at fixed intervals on the horizontal axis of the T2 spectrum data, and extracting the signal amplitude corresponding to the corresponding T2 value, thereby obtaining a discretized T2 spectrum curve. Through discretization, continuous T2 spectrum data can be converted into a series of discrete data points, which is convenient for subsequent characteristic parameter calculation and quantitative analysis.
[0018] Furthermore, the partial least squares method (PLSR) was used to construct a regression model to obtain a fish freshness evaluation model, including:
[0019] The obtained NMR characteristic data were used as the independent variable matrix X, and the obtained microbial value data were used as the dependent variable matrix Y to construct a time-dependent PLSR model: Y(t)=X(t)B(t)+E(t), where t is the storage time, Y(t) is the microbial value matrix at time t, X(t) is the NMR characteristic matrix at time t, B(t) is the regression coefficient matrix at time t, and E(t) is the error matrix at time t; the number of components of the PLSR model was optimized using a cross-validation strategy based on the leave-one-out method; the regression coefficient matrix B(t) was calculated using the nonlinear iterative partial least squares (NIPALS) algorithm, and the time-dependent fish freshness evaluation model was obtained: Y(t)=X(t)B(t).
[0020] Among them, the leave-one-out cross-validation strategy (LOOCV) based on the leave-one-out method is a model optimization and evaluation method, which is particularly suitable for situations with small sample sizes. The basic idea is to use each sample as a validation set in turn through a cycle, and the remaining samples as training sets, so as to achieve the evaluation of model performance and parameter selection. In step S62 of this solution, a cross-validation strategy based on the leave-one-out method is used to optimize the number of components of the PLSR model. Each sample is used as a validation set in turn through a cycle, and the prediction performance of the PLSR model under different numbers of components is evaluated, so as to select the optimal number of components.
[0021] Furthermore, a cross-validation strategy based on the leave-one-out method was used to optimize the number of components of the PLSR model, including: for each storage time point t k , t k The NMR characteristic data matrix X(t k) and microbial value data matrix Y(t k ) Randomly arrange the samples to obtain a random sequence D with a sample number of n k ; Select D k The first fish sample in is used as the initial validation set V k (1), the remaining n-1 samples are used as the initial training set T k (1); In the training set T k (1) The PLSR model is established and the model parameters are calculated using the NIPALS algorithm to obtain the model set {PLSR a (T k (1))|a=1,2,......,A}; where a is the number of principal components, reflecting the number of NMR feature variables extracted by the PLSR model; in the validation set V k (1) The root mean square error (RMSE) of microbial prediction of each candidate PLSR model was calculated. a (T k (1)),V k (1)), select the model with the smallest RMSE and record its principal component number a(1) as the current optimal value; set the validation set V k The fish samples in (1) are added to the training set T k (1), get a new training set T k (2) At the same time, from T k (2) Select the next sample as the new validation set V k (2), get the current optimal number of principal components a(2); continue to iterate until D k All fish samples in were selected as validation sets once, i.e. repeated n times, to obtain a series of optimal principal component numbers {a(i)|i=1,2,......,n}; the RMSE of microbial value prediction of PLSR model (PLSR a(i) (T k (i)),V k The curves of the optimal principal component number a(i) and the change of the number of fish samples i were used to analyze the convergence trend and stability of the PLSR model in the prediction of fish freshness; the slope sequence of the RMSE change curve {s i |i=1,2,......,n}, where, Select the absolute value of the slope |s i |The interval [i min ,i max ], the optimal number of principal components in the interval {a(i)|i=i min ,i min+1 ,......,i max} Take the arithmetic mean and get t kThe final optimal number of principal components A at the moment k Repeat the above steps to obtain the optimal principal component number sequence for all storage time points {A k |k=1,2,......,K}, which is used to construct a time-dependent PLSR evaluation model for fish freshness.
[0022] Further, we get the model set {PLSR a (T k (1))|a=1,2,......,A}, including: initialization iteration number a=1, residual matrix in, and t k The local training set T at time k (1) weighted independent variable matrix and weighted dependent variable matrix; from the residual matrix R k (a) Extract the principal component t a (n k ×1) and the load vector p a (m×1), satisfying: t a =R k (a)×w a , Among them, w a For R k (a) The first eigenvector of k (a) Extract the principal component u a (n k ×1) and the load vector q a (1×1), satisfying: u a =S k (a)×c a , Among them, c a For S k (a) the first eigenvector; calculate the a-th regression coefficient b a : Calculate the residual matrix R k (a+1) and S k (a+1): R k (a+1)=R k (a)-t a ×p a T ,
[0023] S k (a+1)=S k (a)-b a ×u a ×q a TLet a = a + 1, repeat the above steps until a is greater than A, and get the local PLSR model set under A candidate principal components: {PLSR a (T k (1))|a=1,2,......,A}, where PLSR a (T k (1)) indicates that in the local training set T k (1) The PLSR model with a principal components is established. The model parameters include: the principal component matrix T k (n k ×a)=[t1,t2,......,t a ]; independent variable loading matrix
[0024] P a (m×a)=[p1,p2,......,p a ]; dependent variable loading matrix Q a (l×a)=[q1,q2,......,q a ]; regression coefficient vector b a (a×1)=[b1,b2,......,b a ].
[0025] Furthermore, the nonlinear iterative partial least squares NIPALS algorithm is used to calculate the regression coefficient matrix B(t), including: setting the time window width Δt, at t k When modeling the freshness of fish meat at any time, select t k -Δt to t k The fish samples in the interval constitute the local training set D k , including n k samples; extract local training set D k The NMR characteristic data matrix X(D k ) and microbial data matrix Y(D k ), respectively forming the initial matrix E k (n k ×m) and F k (n k ×1), where m is the number of NMR characteristic variables and l is the number of microbial indicators; the forgetting factor λ (0<λ≤1) is introduced to the local training set D k Each fish sample j in is assigned a time weight Among them, t j is the timestamp of sample j; construct a weight matrix based on the time weight Calculate the weighted independent variable matrix and the weighted dependent variable matrix Initialize the number of iterations a = 1, the residual matrix From the residual matrix R k Extract the principal component score vector t of NMR features a (n k ×1) and the load vector p a (m×1), from the residual matrix S k Extract the principal component score vector u of the microorganisms a (n k ×1) and the load vector q a (1×1); calculate the ath regression coefficient b a : Calculate the weighted residual matrix: R k '=R k -W k (t a p a T ), S k '=S k -b a (u a q a T ), let a=a+1, repeat until all A principal components are extracted, and obtain the local regression coefficient matrix B(t k )=[b1,b2,......,b A ]; using t k The NMR characteristic data matrix X(t k )(1×m) and the local regression coefficient matrix B(t k ) Establish t k Fish freshness evaluation model at the moment: Y(t k )=X(t k )×B(t k ), where Y(t k ) is t k Predicted freshness at the moment.
[0026] Another aspect of the present application also provides a fish freshness evaluation system for executing a fish freshness evaluation method of the present application.
[0027] Compared with the prior art, the advantages of this application are:
[0028] By using low-field nuclear magnetic resonance technology to obtain the T2 relaxation curve data of fish samples and using the non-negative least squares method to invert and analyze the T2 curve, the movement state information of water molecules inside the fish can be obtained without destroying the sample, including the distribution characteristics of bound water, weakly bound water and free water. Compared with conventional sensory evaluation and physical and chemical testing methods, this technology does not require sample pretreatment, is simple and quick to operate, and can reflect the differences in fish quality at the microscopic level, providing a more comprehensive and objective criterion for freshness evaluation.
[0029] On the basis of obtaining the T2 spectrum data of fish samples, characteristic parameters such as peak area and peak position in each water area were further extracted, and combined with the microbial data of fish, the freshness evaluation model was constructed using the partial least squares regression method. On the one hand, nuclear magnetic resonance detection can capture the changes in the migration and distribution of water molecules during the spoilage process of fish. The extracted peak area characteristics and their combination characterize the metabolic activity state of fish from different angles. On the other hand, the total colony count of fish is an important indicator for measuring freshness, which directly reflects the growth level of microorganisms and their influence on the tissue structure. By integrating multi-field information, the established partial least squares regression model can achieve a more accurate and comprehensive evaluation of fish quality compared to a single detection method.
[0030] This application innovatively proposes a time-dependent fish freshness evaluation model, which dynamically updates the model parameters by using weighted partial least squares regression in a local time window. This modeling strategy fully considers the dynamic changes of the fish storage environment and quality status over time, introduces time weights and forgetting factors, gives higher weights to recently acquired samples, and weakens the impact of historical data. Therefore, the model has adaptive and update capabilities, can track the real-time change trend of fish freshness, and the evaluation results are more accurate and reliable.
[0031] The cross-validation scheme and model optimization strategy designed in this application improve the robustness and generalization performance of the freshness evaluation results. The optimal number of principal components of the PLSR model is determined by leave-one-out cross-validation, avoiding the occurrence of underfitting or overfitting problems. The principal component number selection method based on slope changes can objectively measure the balance between model complexity and predictive ability, and achieve adaptive optimization of model structure parameters. After rigorous verification and optimization, the freshness evaluation model can accurately predict the microbial level of unknown samples and is suitable for fish products of different varieties, origins and processing technologies. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The present application will be further described in the form of exemplary embodiments, which will be described in detail by the accompanying drawings. These embodiments are not restrictive, and in these embodiments, the same number represents the same structure, wherein:
[0033] Figure 1 is an exemplary flow chart of a method for evaluating fish freshness according to the present application;
[0034] Figure 2 is an exemplary flow chart for obtaining peak position parameters according to the present application;
[0035] Figure 3 It is an exemplary flow chart for constructing a fish freshness evaluation model according to the present application. DETAILED DESCRIPTION
[0036] The method and system provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0037] Figure 1 The present invention is an exemplary flow chart of a fish meat freshness evaluation method according to the present application, comprising: using a low-field pulsed nuclear magnetic resonance instrument to perform nuclear magnetic resonance measurement on fish meat, using a CPMG sequence, setting the echo time TE, the repetition time TR, the echo number Ne and the accumulation number NS, to obtain T2 relaxation curve data of fish meat; using non-negative least squares method NNLS to invert the T2 relaxation curve data to obtain T2 distribution spectrum data of fish meat; dividing the T2 distribution spectrum data into three regions T21, T22 and T23 according to the T2 value. 23; wherein, T21 represents the bound water region, T22 represents the weakly bound water region, and T23 represents the free water region; the T2 value of the T21 region is less than or equal to 100ms, the T2 value of the T22 region is between 100ms and 500ms, and the T2 value of the T23 region is greater than 500ms; the characteristic parameters of the T21 region, the T22 region, and the T23 region are calculated respectively to obtain the nuclear magnetic resonance characteristic data of the fish meat; wherein the characteristic parameters include the peak areas A1, A2, and A3 of each region, the peak positions T m21 , T m22 , T m23 ; The plate counting method was used to determine the total colony count of fish meat, and the total colony count was used as the microbial value data for evaluating the freshness of fish meat; the nuclear magnetic resonance characteristic data was used as the independent variable and the microbial value data was used as the dependent variable. The partial least squares method (PLSR) was used to construct a regression model to obtain the fish meat freshness evaluation model and evaluate the freshness of fish meat.
[0038] The fish sample was tested using a low-field pulsed nuclear magnetic resonance instrument to obtain its T2 relaxation curve data. Specifically, the Carr-Purcell-Meiboom-Gill (CPMG) pulse sequence was used to measure the attenuation signal of the water molecules in the sample during the transverse relaxation process by applying a series of 180° refocusing pulses. The parameter setting of the CPMG sequence is crucial to obtaining high-quality T2 relaxation data. The present application preferably sets the echo time TE in the range of 0.2ms to 1ms, such as 0.2ms, 0.4ms, 0.6ms, 0.8ms or 1ms. A shorter echo time is conducive to capturing the fast relaxation signal of bound water in the fish and improving the resolution of the T2 spectrum. The repetition time TR is the time interval between two consecutive 180° pulses, and its selection should meet the condition of fully restoring the longitudinal magnetization of the water molecules in the sample. The value range of TR is 1000ms to 5000ms, preferably 2000ms to 4000ms, such as 2000ms, 3000ms or 4000ms. Properly extending TR can ensure that a stable and reliable T2 relaxation curve is obtained. The number of echoes Ne determines the time length and number of data points of the acquisition signal, affecting the signal-to-noise ratio and resolution of the T2 spectrum. The value range of Ne is 500 to 5000, preferably 1000 to 3000, such as 1000, 1500, 2000 or 2500. Increasing Ne helps to improve the signal-to-noise ratio of the T2 spectrum, but too many echoes will prolong the measurement time. The cumulative number NS is the number of times the signal is superimposed to increase the signal strength. The value range of NS is 2 to 128, such as 2, 4, 8, 16, 32, 64 or 128. Increasing NS can effectively reduce the noise level, but the measurement time will increase accordingly.
[0039] The non-negative least squares method NNLS is used to invert the T2 relaxation curve data to obtain the T2 distribution spectrum data of fish meat; the objective function of the regularized non-negative least squares problem is constructed. First, according to the parameter setting of the CPMG sequence, the observation matrix A is constructed. Assume that the sampling time points of the T2 spectrum are t1, t2, ....., t m , then the element a in the i-th row and j-th column of matrix A is ij Indicates that at time t i The relaxation time is T 2j The theoretical value of the water molecule signal intensity is calculated as follows: Observation matrix A:
[0040] Where m is the number of sampling points of T2 relaxation curve data, and n is the number of sampling points of T2 distribution spectrum. The sampling time of T2 spectrum is t i It is determined by the echo time TE and the number of echoes Ne, that is, t i =i×TE, i=1, 2, ..., m. The sampling point T of T2 distribution 2jIt can be preset according to the range and resolution of T2 relaxation time, such as T 2j =T 2min +(j-1)×ΔT2,j=1,2,......,n, where T 2min is the minimum relaxation time, and ΔT2 is the time interval between adjacent sampling points.
[0041] Then, the T2 relaxation curve data obtained in step S1 are arranged in the order of sampling time points to form a column vector b, that is, b = [b1, b2, ..., b m ] T , where b i For time t i The measured T2 relaxation signal intensity. Next, introduce the T2 distribution spectrum data vector x to be solved, that is, x = [x1, x2, ..., x n ] T , where x j The relaxation time is T 2j The true value of the water molecule signal intensity. Finally, combining the observation matrix A, the T2 relaxation curve data vector b, the T2 distribution spectrum data vector x, and the regularization parameter λ, the objective function of the regularized non-negative least squares problem is constructed: Constraints, x ≥ 0. The objective function consists of two terms, the first It represents the sum of squares of the fitting errors between the T2 relaxation curve data and the T2 distribution spectrum reconstruction results, that is, the L2 norm square of the difference between the observed value and the theoretical value. is the L2 regularization term, which is used to constrain the energy of the T2 distribution spectrum data to prevent overfitting. The regularization parameter λ is used to balance the fitting error and the sparsity of the solution. The larger the λ, the smoother the solution, and the smaller the λ, the closer the solution is to the observed data. At the same time, the non-negative constraint x ≥ 0 is introduced to ensure that each element in the T2 distribution spectrum data vector x obtained by the solution is non-negative, which conforms to the physical meaning of the signal intensity of water molecules.
[0042] The K-fold cross-validation method is used to optimize the regularization parameter λ. First, the T2 relaxation curve data sample set D obtained in step S1 is randomly divided into K subsets of similar size D1, D2, ..., D K , each subset contains m / K samples, where m is the total number of samples. Common values such as K = 5 or 10, that is, 5-fold or 10-fold cross-validation. Then, perform K cross-validation, each time selecting a different subset as the validation set, and the remaining K-1 subsets as the training set. Specifically, in the kth validation, let D K is the validation set, D\D Kis the training set, k = 1, 2, ..., K. For each validation, a series of candidate regularization parameter λ values are considered, such as λ∈{0.001, 0.01, 0.1, 1, 10, 100}. For each λ value, in the training set D\D K Solve the regularized non-negative least squares problem and get the corresponding T2 distribution spectrum solution x λ Specifically, construct the observation matrix A of the training set train and T2 relaxation curve data vector b train , solve the optimization problem: The solution x λ This is the T2 distribution spectrum estimate under the current λ value. Next, in the validation set D K Construct the observation matrix A of the validation set val and T2 relaxation curve data vector b val , calculate the mean square error (MSE) of the inversion result: Among them, n k The validation set D K Repeat the cross validation K times to obtain K mean square errors MSE1(λ), MSE2(λ), ..., MSE corresponding to each λ value. K (λ). Calculate the average of these K mean square errors as the performance measure for the current λ value: Finally, the λ value corresponding to the minimum mean square error is selected as the optimal
[0043] Using the optimal regularization parameter λ, the gradient descent method is used to solve the T2 distribution spectrum data. First, the initial value x of the T2 distribution spectrum vector x is initialized. (0) . You can use x (0) Assume uniform distribution, that is, all components take the same positive value, such as 1 of them n is a vector of all 1s. Or, based on prior knowledge, set x (0) To get a vector close to the true T2 distribution, the iterative convergence is accelerated. Then, the iteration step size α and the maximum number of iterations N are set. The step size α controls the update amplitude of each iteration, and the value is usually small, such as α = 0.01. The maximum number of iterations N limits the running time of the algorithm, and generally takes a larger value, such as N = 1000, to ensure sufficient optimization. Next, the gradient descent iterative optimization is performed. In the kth iteration, the objective function is first calculated at the current solution x (k) The gradient g (k) For the regularized non-negative least squares problem, the objective function is: Its gradient is: At the kth iteration, the gradient g (k) =A T (Ax (k)-b)+λx (k) , calculate the new solution x (k+1) =max(0,x (k) -ag (k) ). Determine whether the difference between two adjacent iterative solutions is less than a given threshold ε, that is, ||x (k+1) -x (k) ||2≤ε, where ε can be a smaller value, such as 10 -6 If this condition is met, the algorithm is considered to have converged and the iteration is terminated early. Otherwise, set k = k + 1 and continue iterating until the maximum number of iterations N is reached. After the iteration is terminated, the final x (k+1) As the optimal T2 distribution spectrum data, it is recorded as This means Under the condition of satisfying non-negativity constraints, the observed T2 relaxation curve data can be approximated with smaller fitting error and higher smoothness.
[0044] According to the T2 value, the T2 distribution spectrum data is divided into three regions T21, T22 and T23; among them, T21 represents the bound water region, T22 represents the weakly bound water region, and T23 represents the free water region; first, determine the T2 value range of each region. According to experience and physical meaning, the part with a T2 value less than or equal to 100ms is divided into the bound water region T21, the part with a T2 value between 100ms and 500ms is divided into the weakly bound water region T22, and the part with a T2 value greater than 500ms is divided into the free water region T23. The division of these regions reflects the different binding states and motion characteristics of water molecules in the sample. Then, according to the obtained optimal T2 distribution spectrum data Calculate the data index corresponding to the T2 value boundary of each region. Specifically, find The index i of the data point with T2 value equal to 100ms and 500ms 100 and i 500 , which is the smallest integer that satisfies the following conditions: T2(i 100 )≤100ms≤T2(i 100 +1), T2(i 500 )≤500ms≤T2(i 500 +1), T2(i) represents the relaxation time value of the i-th T2 sampling point. Among them, T2(i) represents the relaxation time value of the i-th T2 sampling point. Finally, according to index i 100 and i 500 , the T2 distribution spectrum data Divided into three areas: Combined water area T21: Right now The front i 100 Elements, corresponding to the part where T2 value is less than or equal to 100ms. Weakly bound water region T22: Right now The i_{100}+1th element to the i-th element 500 Elements, corresponding to the part of T2 value between 100ms and 500ms. Free water area T23: Right now The i 500 +1 element to the last element corresponds to the part where the T2 value is greater than 500ms.
[0045] Figure 2 is an exemplary flow chart for obtaining peak position parameters according to the present application, and characteristic parameters of the T21 region, the T22 region and the T23 region are calculated respectively to obtain the nuclear magnetic resonance characteristic data of fish meat; wherein the characteristic parameters include the peak areas A1, A2 and A3 of each region, the peak position T m21 , T m22 , T m23 ; First, determine the T2 value boundary of each region. According to the result of step S3, the T2 value of region T21 is less than or equal to 100ms, the T2 value of region T22 is between 100ms and 500ms, and the T2 value of region T23 is greater than 500ms. Then, find the data point index corresponding to each region boundary in the optimal T2 distribution spectrum data \hat{x}. Let The length of is n, and the corresponding T2 value vector is T2 = [T21, T22, ..., T2n], where T2i represents the T2 value of the i-th data point. Find the index i that satisfies the following conditions 100 and i 500 : Finally, according to index i 100 and i 500 ,from Extract the spectral data of each region: T21 regional spectral data Right now Include The front i 100 Elements, corresponding to the part where T2 value is less than or equal to 100ms. T22 area spectrum data Right now The i-th 100+1 elements to the i-th 500 Elements, corresponding to the part where T2 value is between 100ms and 500ms. T23 area spectrum data Right now Include The i 500+1 The first element to the last element corresponds to the part where the T2 value is greater than 500ms.
[0046] The T2 spectrum data of each region is sampled at equal intervals to obtain a discretized T2 spectrum curve. Specifically, within the T2 value range of each region, equally spaced sampling points T 2,i , extract the corresponding signal amplitude y i , forming a discretized T2 spectrum curve (T 2,i ,y i ). Then, the trapezoidal integration method is used to numerically integrate the discretized T2 spectrum curve and calculate the peak area: Where A is the peak area, y i and i+1 is the signal amplitude corresponding to two adjacent T2 sampling points, ΔT2 is the interval between T2 sampling points, and n is the number of sampling points. The T2 spectrum curve of each region is traversed to calculate the peak areas A1, A2 and A3 of the corresponding region.
[0047] The T2 spectrum data of each region is smoothed and the peak position parameters are calculated. First, the spectrum data of the T21, T22 and T23 regions are smoothed. Smoothing is performed separately to remove high-frequency noise and local fluctuations. Commonly used smoothing algorithms include: Moving average method: sliding window average of the spectrum data, that is, each data point is replaced by the average value of a certain number of data points around it. Assuming the window width is w, the smoothed spectrum data for: Where i is the index of the data point and j is the index of the data point in the window. Gaussian filtering method: Gaussian weighted averaging is performed on the spectral data, that is, each data point is replaced by the Gaussian weighted average of the surrounding data points. Let the Gaussian kernel function be G(x), then the smoothed spectral data for: Among them, G(x) is the Gaussian kernel function. The commonly used Gaussian kernel function is σ is the standard deviation of the Gaussian kernel function.
[0048] After smoothing, the smoothed spectrum data of each area is obtained and Then, the first-order derivative is calculated for the smoothed spectrum data of each region to obtain the first-order derivative curve. Let the T2 value vector of the spectrum data be T2, then the first-order derivative can be approximated by the difference between adjacent data points: in, is the first-order derivative of the ith data point, T 2,i is the T2 value of the i-th data point. Search for the zero-crossing point on the first-order derivative curve, that is, the position where the derivative value changes from positive to negative, as the local maximum point of the T2 spectrum curve. Specifically, for the first-order derivative curve of each region, find the data point index i that satisfies the following conditions max : and, That is, the i max-1 data point has a derivative greater than 0, the i-th max The derivative of a data point is less than or equal to 0, indicating that the derivative value changes from positive to negative, corresponding to the local maximum point of the spectrum curve. Compare the signal amplitudes of all local maximum points in each region, and select the T2 value corresponding to the maximum point with the largest amplitude as the peak position parameter of the region. The peak position parameters of the T21, T22 and T23 regions are T21, T22 and T23, respectively. m21 , T m22 , T m23 :
[0049] Wherein, argmax represents the independent variable corresponding to the maximum value, that is, the peak position parameter is the T2 value corresponding to the local maximum point with the largest signal amplitude in each region. S44: The calculated peak areas A1, A2, A3 and peak position parameters T of each region are m21 , T m22 , T m23 As the nuclear magnetic resonance characteristic data of fish meat samples, these characteristic data comprehensively reflect the content and movement characteristics of water molecules in different states in fish meat.
[0050] The plate count method is used to determine the total number of colonies in fish meat, and the total number of colonies is used as the microbial value data for evaluating the freshness of fish meat; First, prepare a sterile operating environment, equipment and culture medium. Commonly used culture media include nutrient agar medium, plate count agar medium, etc. Then, the fish meat sample is aseptically sampled and diluted. The specific steps are as follows: weigh 10g of fish meat sample, put it into a sterile homogenizing bag, add 90ml of sterile physiological saline, use a slapping homogenizer to fully homogenize it, and get 10 -1 Dilution of sample solution. From 10 -1 Take 1 ml of the diluted sample solution and add it to a test tube containing 9 ml of sterile saline. Mix well to obtain 10 -2 Repeat the preparation for 10 dilutions. -3 , 10 -4 , 10 -5For the sample solution of equal dilution, choose the appropriate dilution range according to the freshness of the fish. Then, inoculate the diluted sample solution onto the culture medium for plate culture. The specific steps are as follows: Select at least two consecutive dilutions, and make two parallel samples for each dilution. Pipette 1ml of the diluted sample solution and add it to a sterile plate. Add 15-20ml of culture medium that has been melted and cooled to 45-50°C to each plate and mix quickly. After the culture medium solidifies, turn the plate upside down and place it in a 37°C constant temperature incubator for incubation for 24-48 hours. After the incubation is completed, count the number of colonies on the plate. Select a plate with a colony count between 30-300, and calculate the average colony count of each dilution parallel sample. Finally, calculate the total colony count of the fish sample based on the dilution multiple and inoculation volume. The total colony count after setting the amount is N (CFU / g), then: Where C is the total number of colonies on the plate, ∑V is the total volume of the sample solution inoculated on the plate (ml), and d is the dilution multiple of the sample solution. The calculated total number of colonies N is used as the microbial value data for the evaluation of fish freshness, reflecting the degree of contamination and growth of microorganisms in the fish sample. Generally, the higher the total number of colonies, the lower the freshness of the fish and the more serious the microbial contamination.
[0051] Figure 3 This is an exemplary flow chart of constructing a fish meat freshness evaluation model according to the present application, with nuclear magnetic resonance characteristic data as the independent variable and microbial value data as the dependent variable, and using the partial least squares method PLSR to construct a regression model to obtain a fish meat freshness evaluation model to evaluate the fish meat freshness. First, the obtained nuclear magnetic resonance characteristic data is used as the independent variable matrix X, and the obtained microbial value data is used as the dependent variable matrix Y. Assume that at m different storage time points t1, t2, ..., t m The fish samples were subjected to nuclear magnetic resonance detection and microbial determination, and m groups of data were obtained. Then, a time-dependent PLSR model was constructed to describe the quantitative relationship between nuclear magnetic resonance characteristics and microbial values, and the influence of storage time was considered. The mathematical expression of the model is: Y(t) = X(t)B(t) + E(t), where t is the storage time, Y(t) is the microbial value matrix at time t, X(t) is the nuclear magnetic resonance characteristic matrix at time t, B(t) is the regression coefficient matrix at time t, and E(t) is the error matrix at time t.
[0052] The number of components of the PLSR model was optimized using a cross-validation strategy based on the leave-one-out method; including: for each storage time point t k , t k The NMR characteristic data matrix X(t k ) and microbial value data matrix Y(t k ) Randomly arrange the samples to obtain a random sequence D with a sample number of nk ; Select D k The first fish sample in is used as the initial validation set V k (1), the remaining n-1 samples are used as the initial training set T k (1); In the training set T k (1) The PLSR model is established and the model parameters are calculated using the NIPALS algorithm to obtain the model set {PLSR a (T k (1))|a=1,2,......,A}; where a is the number of principal components, reflecting the number of NMR feature variables extracted by the PLSR model, including: initialization iteration number a=1, residual matrix in, and t k The local training set T at time k (1) weighted independent variable matrix and weighted dependent variable matrix; from the residual matrix R k (a) Extract the principal component t a (n k ×1) and the load vector p a (m×1), satisfying: t a =R k (a)×w a , Among them, w a For R k (a) The first eigenvector of k (a) Extract the principal component u a (n k ×1) and the load vector q a (1×1), satisfying: u a =S k (a)×c a , Among them, c a For S k (a) the first eigenvector; calculate the a-th regression coefficient b a : Calculate the residual matrix R k (a+1) and S k (a+1): R k (a+1)=R k (a)-t a ×p a T , S k (a+1)=S k (a)-b a ×u a ×q aT Let a = a + 1, repeat the above steps until a is greater than A, and get the local PLSR model set under A candidate principal components: {PLSR a (T k (1))|a=1,2,......,A}, where PLSR a (T k (1)) indicates that in the local training set T k (1) The PLSR model with a principal components is established. The model parameters include: the principal component matrix T k (n k ×a)=[t1,t2,......,t a ]; independent variable loading matrix P a (m×a)=[p1,p2,......,p a ]; dependent variable loading matrix Q a (l×a)=[q1,q2,......,q a ]; regression coefficient vector b a (a×1)=[b1,b2,......,b a ]. In the validation set V k (1) The root mean square error (RMSE) of microbial prediction of each candidate PLSR model was calculated. a (T k (1)),V k (1)), select the model with the smallest RMSE and record its principal component number a(1) as the current optimal value; set the validation set V k The fish samples in (1) are added to the training set T k (1), get a new training set T k (2) At the same time, from T k (2) Select the next sample as the new validation set V k (2), get the current optimal number of principal components a(2); continue to iterate until D k All fish samples in were selected as validation sets once, i.e. repeated n times, to obtain a series of optimal principal component numbers {a(i)|i=1,2,......,n}; the RMSE of microbial value prediction of PLSR model (PLSR a(i) (T k (i)),V k The curves of the optimal principal component number a(i) and the change of the number of fish samples i were used to analyze the convergence trend and stability of the PLSR model in the prediction of fish freshness; the slope sequence of the RMSE change curve {s i |i=1,2,......,n}, where, Select the absolute value of the slope |si |The interval [i min ,i max ], the optimal number of principal components in the interval {a(i)|i=i min ,i min+1 ,......,i max} Take the arithmetic mean and get t k The final optimal number of principal components A at the moment k Repeat the above steps to obtain the optimal principal component number sequence for all storage time points {A k |k=1,2,......,K}, which is used to construct a time-dependent PLSR evaluation model for fish freshness.
[0053] The nonlinear iterative partial least squares (NIPALS) algorithm is used to calculate the regression coefficient matrix B(t) and obtain the time-dependent fish freshness evaluation model: the time window width Δt is set, and at t k When modeling the freshness of fish meat at any time, select t k -Δt to t k The fish samples in the interval constitute the local training set D k , including n k samples;
[0054] Extract local training set D k The NMR characteristic data matrix X(D k ) and microbial data matrix Y(D k ), respectively forming the initial matrix E k (n k ×m) and F k (n k ×1), where m is the number of NMR characteristic variables and l is the number of microbial indicators; the forgetting factor λ (0<λ≤1) is introduced to the local training set D k Each fish sample j in is assigned a time weight Among them, t j is the timestamp of sample j; construct the weight matrix W according to the time weight k =diag(w1,w2,......,w nk ), calculate the weighted independent variable matrix and the weighted dependent variable matrix Initialize the number of iterations a = 1, the residual matrix S k =F kw ; From the residual matrix R k Extract the principal component score vector t of NMR features a (n k ×1) and the load vector p a(m×1), from the residual matrix S k Extract the principal component score vector u of the microorganisms a (n k ×1) and the load vector q a (1×1); calculate the ath regression coefficient b a : Calculate the weighted residual matrix: R k '=R k -W k (t a p a T ), S k '=S k -b a (u a q a T ), let a=a+1, repeat until all A principal components are extracted, and obtain the local regression coefficient matrix B(t k )=[b1,b2,......,b A ]; using t k The NMR characteristic data matrix X(t k )(1×m) and the local regression coefficient matrix B(t k ) Establish t k Fish freshness evaluation model at the moment: Y(t k )=X(t k )×B(t k ), where Y(t k ) is t k Predicted freshness at the moment.
[0055] Get the fish freshness evaluation model to evaluate the fish freshness. Get the nuclear magnetic resonance characteristic data x of the fish sample to be tested new ∈R 1×m , where m is the number of NMR characteristic variables. The NMR characteristic data can be obtained by performing NMR detection on the fish sample to be tested, such as measuring the NMR relaxation time T2, NMR image parameters, etc. of the sample. Determine the timestamp t of the fish sample to be tested new , which is the time when the sample is collected or tested. The timestamp can be obtained by recording the sampling time or the testing time, and is used to determine the time point at which the freshness evaluation model is applied. new , select the fish freshness evaluation model Y(t new )=X(t new )B(t new ), where B(t new ) is t newThe local regression coefficient matrix at time. The NMR characteristic data X(t new ) is input into the selected freshness evaluation model to calculate the predicted freshness value Y(t new ): Y(t new )=X(t new )B(t new ), where Y(t new ) is the fish sample to be tested at t new The predicted freshness value at the time can be the predicted value of one or more microbial indicators, such as the total number of colonies, the number of coliform bacteria, etc. new ), evaluate the freshness of the fish sample to be tested. The predicted value can be compared with the preset freshness threshold to determine whether the fish sample meets the freshness standard. For example, if the predicted total colony count exceeds a certain threshold, the fish sample is considered not fresh; otherwise, the fish sample is considered fresh. The setting of the freshness threshold can refer to relevant standards or be determined according to actual needs. Output the freshness evaluation results of the fish sample to be tested, such as "fresh" or "not fresh", and the predicted microbial index value. The evaluation results can be presented in a visual way, such as displaying the freshness level, predicted value, etc. on the interface, which is convenient for users to understand intuitively.
Claims
1. A method for evaluating the freshness of fish, characterized in that: include: The fish meat was measured by NMR using a low-field pulsed NMR instrument, and the CPMG sequence was used to set the echo time TE, repetition time TR, echo number Ne and accumulation number NS to obtain the T2 relaxation curve data of the fish meat. The non-negative least squares method NNLS was used to invert the T2 relaxation curve data to obtain the T2 distribution spectrum data of fish meat; According to the T2 value, the T2 distribution spectrum data is divided into three regions, T21, T22 and T23; wherein, T21 represents the bound water region, T22 represents the weakly bound water region, and T23 represents the free water region; the T2 value of the T21 region is less than or equal to 100ms, the T2 value of the T22 region is between 100ms and 500ms, and the T2 value of the T23 region is greater than 500ms; The characteristic parameters of the T21 region, the T22 region and the T23 region are calculated respectively to obtain the nuclear magnetic resonance characteristic data of the fish meat; wherein the characteristic parameters include the peak areas A1, A2 and A3 of each region, the peak positions T m21 、T m22 、T m23 ; The total number of colonies in fish meat was determined by plate counting method, and the total number of colonies was used as the microbial value data for evaluating the freshness of fish meat; Taking NMR characteristic data as independent variable and microbial value data as dependent variable, partial least squares method (PLSR) was used to construct regression model and obtain fish freshness evaluation model to evaluate fish freshness. The non-negative least squares method NNLS was used to invert the T2 relaxation curve data to obtain the T2 distribution spectrum data of fish meat, including: Construct the objective function of the regularized non-negative least squares method: Constraints: x≥0 Where A is the observation matrix of the CPMG sequence, b is the column vector of the obtained T2 relaxation curve data, x is the column vector of the T2 distribution spectrum data to be obtained, and λ is the regularization parameter; The T2 relaxation curve data is randomly divided into K subsets, and K-1 subsets are selected as training sets each time, and the remaining 1 subset is used as the validation set; for different λ values, the regularized non-negative least squares problem is solved on the training set, and the mean square error of the inversion result is calculated on the validation set; repeat K times to obtain K mean square errors when λ takes different values, and the λ value corresponding to the minimum mean square error is taken as the optimal regularization parameter; Substitute the optimal regularization parameter λ into the objective function and solve the T2 distribution spectrum data.
2. The method for evaluating fish freshness according to claim 1, characterized in that: The fish meat was measured by NMR using a low-field pulsed NMR instrument. The CPMG sequence was used to set the echo time TE, repetition time TR, echo number Ne and accumulation number NS to obtain the T2 relaxation curve data of the fish meat, including: The echo time TE value range is 0.2ms to 1ms; The repetition time TR ranges from 1000ms to 5000ms; The value range of echo number Ne is 500 to 5000; The value range of the accumulation number NS is 2 to 128.
3. The method for evaluating fish freshness according to claim 1, characterized in that: Substitute the optimal regularization parameter λ into the objective function and solve the T2 distribution spectrum data, including: Initialize the initial value x of the T2 distribution spectrum data x (0) , set the iteration step a and the number of iterations N; For the kth iteration, calculate the objective function at x (k) The gradient g (k) : g (k) =A T (Ax (k) -b)+λx (k) Among them, A T is the transpose of matrix A; Update T2 distribution spectrum data x: x (k+1) =max(0,x (k) -ag (k) ) Among them, max(0,x (k) -ag (k) ) means truncating negative values to 0 to ensure the non-negativity of x; Determine whether ||x is satisfied (k+1) -x (k) ||2≤ε, if it is satisfied, the iteration is terminated, otherwise let k=k+1 and return to continue the iteration; where ε is the given error threshold; After the iteration is terminated, the final x (k+1) As the optimal T2 distribution spectrum data.
4. The method for evaluating fish freshness according to claim 3, characterized in that: The characteristic parameters of the T21 region, the T22 region and the T23 region are calculated respectively to obtain the nuclear magnetic resonance characteristic data of the fish meat, including: According to the T2 value range of the T21 region, the T22 region and the T23 region, the T2 spectrum data of each region is extracted to obtain the T21 region spectrum data, the T22 region spectrum data and the T23 region spectrum data; The T2 spectrum data of each region is sampled at equal intervals in the T2 dimension to obtain a series of discrete T2 values and corresponding signal amplitudes to form a discretized T2 spectrum curve; The trapezoidal integration method is used to perform numerical integration on the discretized T2 spectrum curve: Where A is the peak area, y i and i+1 is the signal amplitude corresponding to two adjacent T2 sampling points, ΔT2 is the interval between T2 sampling points, and n is the number of sampling points; Traverse the entire T2 region and use the results of numerical integration as the peak areas A1, A2, and A3 of the corresponding regions; Smoothing the T2 spectrum curve of each region; calculating the first-order derivative of the smoothed T2 spectrum curve to obtain a first-order derivative curve; Search for the zero-crossing point on the first-order derivative curve as the local maximum point of the T2 spectrum curve; the zero-crossing point indicates the position where the derivative value changes from positive to negative; Compare the signal amplitudes of each local maximum point, and select the T2 value corresponding to the maximum point with the largest amplitude as the peak position parameter T of the T2 spectrum of the corresponding area. m21 、T m22 、T m23 , the peak position parameters reflect the motion state information of water molecules in each region; The calculated peak areas A1, A2 and A3 and peak position parameters T m21 、T m22 、T m23 , as the NMR characteristic data of fish meat.
5. The method for evaluating fish freshness according to claim 4, characterized in that: The partial least squares method (PLSR) was used to construct a regression model, and the fish freshness evaluation model was obtained, including: The obtained NMR characteristic data are used as the independent variable matrix X, and the obtained microbial value data are used as the dependent variable matrix Y to construct a time-dependent PLSR model: Y(t)=X(t)B(t)+E(t) Where t is the storage time, Y(t) is the microbial value matrix at time t, X(t) is the NMR characteristic matrix at time t, B(t) is the regression coefficient matrix at time t, and E(t) is the error matrix at time t; A cross-validation strategy based on the leave-one-out method was used to optimize the number of components in the PLSR model; The nonlinear iterative partial least squares NIPALS algorithm is used to calculate the regression coefficient matrix B(t) and obtain the time-dependent fish freshness evaluation model: Y(t)=X(t)B(t).
6. The method for evaluating fish freshness according to claim 5, characterized in that: The number of components of the PLSR model is optimized using a cross-validation strategy based on the leave-one-out method, including: For each storage time point t k , t k The NMR characteristic data matrix X(t k ) and microbial value data matrix Y(t k ) Randomly arrange the samples to obtain a random sequence D with a sample number of n k ; Select D k The first fish sample in is used as the initial validation set V k (1), the remaining n-1 samples are used as the initial training set T k (1); In the training set T k (1) The PLSR model is established and the model parameters are calculated using the NIPALS algorithm to obtain the model set {PLSR a (T k (1))|a=1,2,......,A}; where a is the number of principal components, reflecting the number of NMR characteristic variables extracted by the PLSR model; On the validation set V k (1) The root mean square error (RMSE) of microbial prediction of each candidate PLSR model was calculated. a (T k (1)),V k (1)), select the model with the smallest RMSE and record its principal component number a(1) as the current optimal value; The validation set V k The fish samples in (1) are added to the training set T k (1), get a new training set T k (2) At the same time, from T k (2) Select the next sample as the new validation set V k (2), get the current optimal number of principal components a(2); Continue iterating until D k All fish samples in are selected as validation sets once, i.e. repeated n times, to obtain a series of optimal principal component numbers {a(i)|i=1,2,......,n}; Plot the RMSE of the microbial value prediction of the PLSR model (PLSR a(i) (T k (i)),V k The curves of the optimal principal component number a(i) and the change of the number of fish samples i are used to analyze the convergence trend and stability of the PLSR model in the prediction of fish freshness; Calculate the slope sequence of the RMSE change curve {s i |i=1,2,......,n}, where, Select the absolute value of the slope |s i |The interval [i min ,i max ], the optimal number of principal components in the interval {a(i)|i=i min ,i min+1 ,......,i max } Take the arithmetic mean and get t k The final optimal number of principal components A at the moment k ; Repeat the above steps to obtain the optimal principal component number sequence for all storage time points {A k |k=1,2,......,K}, which is used to construct a time-dependent PLSR evaluation model for fish freshness.
7. The method for evaluating fish freshness according to claim 6, characterized in that: Get the model set {PLSR a (T k (1))|a=1,2,...,A}, including: Initialize the number of iterations a = 1, the residual matrix in, and t k The local training set T at time k (1) The weighted independent variable matrix and the weighted dependent variable matrix; From the residual matrix R k (a) Extract the principal component t a (n k ×1) and the load vector p a (m×1), satisfying: t a =R k (a)×w a Among them, w a For R k The first eigenvector of (a); From the residual matrix S k (a) Extract the principal component u a (n k ×1) and the load vector q a (1×1), which satisfies: u a =S k (a)×c a Among them, c a For S k The first eigenvector of (a); Calculate the ath regression coefficient b a : Calculate the residual matrix R k (a+1) and S k (a+1): R k (a+1)=R k (a)-t a ×p a T S k (a+1)=S k (a)-b a ×u a ×q a T Let a=a+1, repeat the above steps until a is greater than A, and obtain the local PLSR model set with A candidate principal components: {PLSR a (T k (1))|a=1,2,......,A} Among them, PLSR a (T k (1)) indicates that in the local training set T k The PLSR model with a principal components established in (1) has model parameters including: The principal component matrix T k (n k ×a)=[t1,t2,......,t a ]; Independent variable loading matrix P a (m×a)=[p1,p2,......,p a ]; Dependent variable loading matrix Q a (l×a)=[q1,q2,......,q a ]; Regression coefficient vector b a (a×1)=[b1,b2,......,b a ].
8. The method for evaluating fish freshness according to claim 7, characterized in that: The regression coefficient matrix B(t) is calculated using the nonlinear iterative partial least squares NIPALS algorithm, including: Set the time window width Δt, at t k When modeling the freshness of fish meat at any time, select t k -Δt to t k The fish samples in the interval constitute the local training set D k , including n k samples; Extract local training set D k The NMR characteristic data matrix X(D k ) and microbial data matrix Y(D k ), respectively forming the initial matrix E k (n k ×m) and F k (n k ×1), where m is the number of NMR characteristic variables and l is the number of microbial indicators; Introducing the forgetting factor λ(0<λ≤1), for the local training set D k Each fish sample j in is assigned a time weight Among them, t j is the timestamp of sample j; Construct a weight matrix based on time weights Calculate the weighted independent variable matrix and the weighted dependent variable matrix Initialize the number of iterations a = 1, the residual matrix From the residual matrix R k Extract the principal component score vector t of NMR features a (n k ×1) and the load vector p a (m×1), from the residual matrix S k Extract the principal component score vector u of the microorganisms a (n k ×1) and the load vector q a (1×1); Calculate the ath regression coefficient b a : Compute the weighted residual matrix: R k '=R k -W k (t a p a T ) S k '=S k -b a (u a q a T ) Let a = a + 1, repeat until all A principal components are extracted, and obtain the local regression coefficient matrix B (t k )=[b1,b2,......,b A ]; Using t k The NMR characteristic data matrix X(t k )(1×m) and the local regression coefficient matrix B(t k ) Establish t k Fish freshness evaluation model at the moment: Y(t k )=X(t k )×B(t k ), where Y(t k ) is t k Predicted freshness at the moment.
9. A fish meat freshness evaluation system, characterized in that: include: At least one processing unit; used to execute instructions to implement the fish freshness evaluation method according to any one of claims 1 to 8.
Citation Information
Patent Citations
NMR methods for monitoring blood clot formation
CN103917658A
QRS wave starting point end point positioning method based on regularized least square regression learning
CN106063704A
Novel method for separating and pickling salted egg yolk
CN113995099A
Food quality image classification
US20190392262A1
Data based cancer research and treatment systems and methods
US20210090694A1