A method and system for evaluating the freshness of fish

The T2 spectral data of fish meat is inverted by low-field nuclear magnetic resonance technology and non-negative least squares method, and a regression model is constructed in combination with microbial indicators, which solves the problem of low lossless evaluation accuracy of fish meat freshness, and achieves high accuracy and comprehensive evaluation of fish meat freshness.

CN119470535BActive Publication Date: 2025-07-22ZHONGAN GREEN ENERGY (CHENGDU) GROUP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411545734.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-01
Publication Date
2025-07-22
Estimated Expiration
2044-11-01

AI Technical Summary

Technical Problem

The existing non-lossless evaluation methods for fish freshness have low accuracy and are difficult to accurately screen out feature quantities related to freshness from the NMR data, which affects the generalization performance of the evaluation model.

Method used

The T2 relaxation curve data of fish meat was obtained through low-field nuclear magnetic resonance technology, and the T2 spectrum data was obtained using non-negative least squares method inversion and divided into different water molecules' motion state areas. Nuclear magnetic characteristic parameters such as peak area and peak position of each region were extracted, and partial least squares regression model was constructed based on microbial indicators to realize quantitative evaluation of fish meat freshness.

Benefits of technology

It improves the accuracy and applicability of fish freshness non-destructive evaluation, can reflect the quality differences of fish meat from a micro level, provide more objective and comprehensive evaluation results, has adaptability and update capabilities, and is suitable for fish products of different varieties and processing technologies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119470535B_ABST
    Figure CN119470535B_ABST
Patent Text Reader

Abstract

The present application discloses a method and system for evaluating the freshness of fish meat, belonging to the field of fish meat detection, including: obtaining the T2 relaxation curve data of fish meat; using the non - negative least squares method (NNLS) to invert the T2 relaxation curve data to obtain the 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; respectively calculating the characteristic parameters of the T21 region, the T22 region and the T23 region to obtain the nuclear magnetic resonance characteristic data of fish meat; using the plate count method to determine the total number of colonies of fish meat, and taking the total number of colonies as the microbial value data for evaluating the freshness of fish meat; using the nuclear magnetic resonance characteristic data as the independent variable and the 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 for evaluating the freshness of fish meat. Aiming at the low non - destructive evaluation accuracy of fish meat freshness in the prior art, the present application improves the non - destructive evaluation accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of fish detection, and particularly to a method and system for evaluating the freshness of fish. 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 problem that urgently needs to be solved in the quality control and circulation and sales links of aquatic products.

[0003] Traditional methods for evaluating the freshness of fish mainly include two categories: sensory evaluation and physical and chemical index detection. 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 achieve quantification and standardization. Physical and chemical indexes such as volatile basic nitrogen, pH value, peroxide value, etc. can objectively reflect the freshness of fish, but they require destructive treatment of samples, have a long detection cycle, and are not suitable for on-line applications.

[0004] In recent years, modern analytical techniques such as nuclear magnetic resonance, hyperspectral, and electronic nose have been introduced into the field of non-destructive detection of fish quality. Among them, low-field nuclear magnetic resonance technology has attracted much attention due to its advantages such as fast speed, non-destructiveness, and sensitivity. Low-field nuclear magnetic resonance measures the relaxation characteristics of water molecules in a sample to obtain a signal fingerprint map reflecting the changes in the internal structure and components of the sample, providing new ideas and methods for evaluating the freshness of fish.

[0005] However, most of the existing research on evaluating the freshness of fish by nuclear magnetic resonance method is based on a single parameter of T2 relaxation time, ignoring 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 characteristic quantities related to the freshness of fish from complex nuclear magnetic resonance data, affecting the generalization performance of the evaluation model. Summary of the Invention

[0006] Aiming at the problem of low non-destructive evaluation accuracy of fish freshness in the existing technology, this application provides a method and system for evaluating fish freshness. By collecting the T2 relaxation curve of the nuclear magnetic resonance signal of a fish sample, using non-negative least squares method to invert the T2 spectral data of the sample and dividing it into different regions of water molecule motion states, extracting nuclear magnetic characteristic parameters such as peak area and peak position of each region, and then combining microbial indexes such as the total number of colonies in the fish, a partial least squares regression evaluation model is constructed to realize the quantitative evaluation of fish freshness and improve the non-destructive evaluation accuracy.

[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, including: performing nuclear magnetic resonance measurement on fish using a low-field pulsed nuclear magnetic resonance instrument, adopting a CPMG sequence, setting the echo time TE, repetition time TR, number of echoes Ne, and number of accumulations NS to obtain the T2 relaxation curve data of the fish; performing inversion on the T2 relaxation curve data using non-negative least squares NNLS to obtain the T2 distribution spectrum data of the fish; dividing the T2 distribution spectrum data into three regions T21, T22, and T23 according to the T2 value; where 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 100 ms, the T2 value of the T22 region is between 100 ms and 500 ms, and the T2 value of the T23 region is greater than 500 ms; calculating the characteristic parameters of the T21 region, T22 region, and T23 region respectively to obtain the nuclear magnetic resonance characteristic data of the fish; where the characteristic parameters include the peak areas A1, A2, and A3 of each region, and the peak positions T m21 , T m22 , T m23 ; measuring the total number of colonies of the fish using the plate counting method, and taking the total number of colonies as the microbial value data for evaluating the freshness of the fish; using the nuclear magnetic resonance characteristic data as the independent variable and the microbial value data as the dependent variable, and constructing a regression model using partial least squares PLSR to obtain a fish freshness evaluation model for evaluating the freshness of the fish.

[0009] Among them, low-field pulsed nuclear magnetic resonance spectrometer: It is an instrument and equipment that uses the principle of nuclear magnetic resonance to detect samples. Low field means using a relatively low magnetic field strength, usually below 0.5T. Pulse means using a radio frequency pulse sequence to excite and collect signals from the sample. CPMG sequence: Also known as Carr-Purcell-Meiboom-Gill sequence, it is a commonly used nuclear magnetic resonance pulse sequence for measuring the transverse relaxation time T2 of samples. By applying a series of 180° pulses with equal intervals, a series of decaying echo signals can be obtained, reflecting the T2 relaxation characteristics of different components in the sample. Non-negative least squares method NNLS: It 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 samples from T2 relaxation curve data. Compared with the traditional least squares method, NNLS introduces a non-negative constraint to ensure that the estimated parameter distribution is non-negative, which is more in line with physical meaning. T2 relaxation curve data: It is a series of decaying echo signal amplitude data measured by the CPMG sequence, reflecting the transverse relaxation characteristics of different components in the sample. The signal amplitude at each echo time is related to the T2 relaxation time and content of each component in the sample. T2 distribution spectrum data: It is 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 microscopic structure and physical and chemical state of the sample. Plate count method: It is a commonly used method for microbial detection. By diluting and spreading the sample on a plate medium and culturing for a certain period of time, the number of colonies formed on the plate is counted to estimate the microbial content 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 regression method PLSR to construct a regression model: It is a statistical method used to establish a linear relationship between independent variables and dependent variables. By extracting the principal components of independent variables and dependent variables and establishing a regression model in the principal component space, the problem of multicollinearity among independent variables can be effectively handled. In this solution, taking nuclear magnetic resonance characteristic data as independent variables and microbial value data as dependent variables, PLSR is used to establish a fish freshness evaluation model.

[0010] Furthermore, in S1, use a low-field pulsed nuclear magnetic resonance spectrometer to perform nuclear magnetic resonance measurement on the fish, adopt the CPMG sequence, set the echo time TE, repetition time TR, number of echoes Ne, and number of accumulations NS, and obtain the T2 relaxation curve data of the fish, including: the value range of the echo time TE is 0.2ms to 1ms; the value range of the repetition time TR is 1000ms to 5000ms; the value range of the number of echoes Ne is 500 to 5000; the value range of the number of accumulations NS is 2 to 128.

[0011] Among them, the echo time TE (Echo Time): In the CPMG sequence, it refers to the time interval between two adjacent 180° inversion pulses. TE determines the acquisition time of each echo signal and is related to the T2 relaxation times of different components in the sample. A shorter TE is beneficial for capturing the signals of fast-relaxing components, while a longer TE is more suitable for detecting slow-relaxing components. In this solution, the value range of TE is from 0.2 ms to 1 ms, and it can be optimally selected according to the actual relaxation characteristics of the fish meat sample. The repetition time TR (Repetition Time): In the CPMG sequence, it refers to the time interval between two consecutive 90° excitation pulses. TR determines the waiting time between each repeated measurement and needs to be long enough for 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 solution, the value range of TR is from 1000 ms to 5000 ms, and it can be reasonably set according to the T1 relaxation characteristics of the fish meat sample and the measurement time requirements. The number of echoes Ne (Number of Echoes): In the CPMG sequence, it refers to the number of echo signals collected. Ne determines the number of sampling points and the time range of the T2 relaxation curve and is related to the resolution ability 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 it will also extend the measurement time. In this solution, the value range of Ne is from 500 to 5000, and it can be optimally selected according to the T2 relaxation characteristics of the fish meat sample and the required resolution ability. The number of scans NS (Number of Scans): It refers to the number of times the CPMG sequence is repeatedly measured on the same sample. By accumulating and averaging the results of multiple measurements, the signal-to-noise ratio of the signal can be improved and the influence of random noise can be reduced. A larger NS can obtain higher-quality T2 relaxation curve data, but it will also extend the total measurement time. In this solution, the value range of NS is from 2 to 128, and it can be reasonably set according to the signal intensity of the fish meat sample and the measurement time requirements.

[0012] Further, in S2, the non-negative least squares method NNLS is used to invert the T2 relaxation curve data to obtain the T2 distribution spectrum data of the fish meat, including: S21, constructing the objective function of the regularized non-negative least squares method:

[0013] Among them, A is the observation matrix of the CPMG sequence, b is the column vector composed of the obtained T2 relaxation curve data, x is the column vector composed of the T2 distribution spectrum data to be solved, and λ is the regularization parameter; S22: randomly divide the T2 relaxation curve data into K subsets, each time select K - 1 of them as the training set, and the remaining 1 subset as the validation set; for different values of λ, 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] Further, substituting the optimal regularization parameter λ into the objective function to solve the T2 distribution spectrum data includes: initializing the initial value x (0) of the T2 distribution spectrum data x, setting the iteration step size a and the number of iterations N; for the k - th iteration, calculate the gradient g (k) at x (k) : g (k) = A T (Ax (k) - b)+λx (k) , where A T is the transpose of matrix A; update the 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; judge whether ||x (k+1) - x (k) ||2 ≤ ε. If it is satisfied, terminate the iteration; otherwise, let k = k + 1 and return to continue the iteration; where ε is the given error threshold; after the iteration terminates, take the finally obtained x (k+1) as the optimal T2 distribution spectrum data.

[0015] Further, calculate the characteristic parameters of the T21 region, T22 region and T23 region respectively to obtain the nuclear magnetic resonance characteristic data of fish meat, including: respectively extract the T2 spectrum data of each region according to the T2 value ranges of the T21 region, T22 region and T23 region to obtain the T21 region spectrum data, T22 region spectrum data and T23 region spectrum data; perform equally - spaced sampling on the T2 spectrum data of each region in the T2 dimension to obtain a series of discrete T2 values and corresponding signal amplitudes, forming a discretized T2 spectrum curve; perform numerical integration on the discretized T2 spectrum curve using the trapezoidal integration method: Among them, A is the peak area, y i and y i+1$S_{i}$ and $S_{i + 1}$ are the signal amplitudes corresponding to two adjacent T2 sampling points, $\Delta T2$ is the interval between T2 sampling points, and n is the number of sampling points; traverse the entire T2 region, and use the result obtained by numerical integration as the peak areas A1, A2, and A3 of the corresponding regions; perform smoothing processing on 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 amplitudes of each local maximum point, and select the T2 value corresponding to the maximum amplitude maximum point as the peak position parameter $T_{i}$ of the T2 spectrum of the corresponding region. m21 $T_{i}$ m22 $T_{j}$ m23 $T_{k}$, and the peak position parameter reflects the motion state information of water molecules in each region; use the calculated peak areas A1, A2, and A3 and peak position parameters $T_{i}$ m21 $T_{j}$ m22 $T_{k}$ m23 as the nuclear magnetic resonance characteristic data of fish.

[0016] Among them, the T2 spectral data is obtained by measuring the sample with a CPMG sequence and performing inversion processing on 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 solution, the T2 spectral data is divided into three regions according to the T2 value: the T21 region ($T2\leq100ms$), the T22 region ($100ms < T2\leq500ms$), and the T23 region ($T2 > 500ms$), 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 sample.

[0017] The T2 dimension refers to the horizontal axis coordinates corresponding to different T2 values in the T2 spectral data. In the T2 spectrogram, the horizontal axis represents the logarithm of the T2 relaxation time, usually in milliseconds (ms); the vertical axis represents the signal intensity or percentage content corresponding to the respective T2 values. The distribution of the T2 spectral data in the T2 dimension reflects the relative content and proportional relationship of different relaxation time components in the sample. In step S42 of this solution, in order to facilitate further analysis and feature extraction, it is necessary to perform equally spaced sampling on the T2 spectral data of each region in the T2 dimension. This process means selecting a series of discrete T2 values at a fixed interval on the horizontal axis of the T2 spectral data and extracting the signal amplitudes corresponding to the respective T2 values, thereby obtaining a discretized T2 spectral curve. Through the discretization process, the continuous T2 spectral data can be converted into a series of discrete data points, facilitating subsequent calculation of characteristic parameters and quantitative analysis.

[0018] Furthermore, the partial least squares regression (PLSR) method is used to construct a regression model to obtain a fish freshness evaluation model, including:

[0019] The obtained nuclear magnetic resonance characteristic data is used as the independent variable matrix X, and the obtained microorganism value data is used as the dependent variable matrix Y to construct a time-related PLSR model: Y(t) = X(t)B(t) + E(t), where t is the storage time, Y(t) is the microorganism 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; a cross-validation strategy based on the leave-one-out method is used to optimize the number of components of the PLSR model; the nonlinear iterative partial least squares (NIPALS) algorithm is used to calculate the regression coefficient matrix B(t) to obtain a time-related fish freshness evaluation model: Y(t) = X(t)B(t).

[0020] Among them, the cross-validation strategy based on the leave-one-out method (Leave-one-out cross-validation, LOOCV) is a model optimization and evaluation method, especially suitable for the case of a small sample size. Its basic idea is to cycle through each sample as the validation set in turn, and the remaining samples as the training set, so as to evaluate the model performance and select parameters. 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. By cycling through each sample as the validation set in turn, 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 is used to optimize the number of components of the PLSR model, including: for each storage time point t k , t k the nuclear magnetic resonance characteristic data matrix X(t k) and the microbial value data matrix Y(t k ) are randomly arranged by sample to obtain a random sequence D with a sample number of n k ; Select the first fish sample in D k as the initial validation set V k (1), and the remaining n - 1 samples as the initial training set T k (1); Build a PLSR model on the training set T k (1), use the NIPALS algorithm to calculate the model parameters, and obtain a model set {PLSR a (T k (1))|a = 1, 2,......, A} under A alternative principal component numbers; where a is the number of principal components, which reflects the number of nuclear magnetic resonance characteristic variables extracted by the PLSR model; Calculate the root mean square error of microbial prediction RMSE(PLSR k (T a (1)), V k (1)) of each alternative PLSR model on the validation set V k (1) respectively, select the model with the smallest RMSE, and record its principal component number a(1) as the current optimal value; Add the fish samples in the validation set V k (1) to the training set T k (1) to obtain a new training set T k (2), and at the same time select the next sample from T k (2) as the new validation set V k (2) to obtain the current optimal principal component number a(2); Continuously iterate until all fish samples in D k are selected as the validation set once, that is, repeat n times to obtain a series of optimal principal component numbers {a(i)|i = 1, 2,......, n}; Plot the change curves of the root mean square error of microbial value prediction RMSE(PLSR a(i) (T k (i)), V k (i)) and the optimal principal component number a(i) with the number of fish samples i, and analyze the convergence trend and stability of the PLSR model in predicting the freshness of fish; Calculate the slope sequence {s i |i = 1, 2,......, n} of the RMSE change curve, where Select the interval [i i , i min where the absolute value of the slope |s max | is less than the preset threshold ε, and take the arithmetic average of the optimal principal component numbers {a(i)|i = i min , i min+1 ,......, i max} in the interval to obtain t kThe final optimal number of principal components A at a given time k ; Repeat the above steps for the optimal number of principal components to obtain the sequence of optimal numbers of principal components {A k | k = 1, 2,......, K} at all storage time points, which is used to construct a time-related PLSR evaluation model for fish freshness.

[0022] Furthermore, obtain the model set {PLSR a (T k (1)) | a = 1, 2,......, A} under A alternative numbers of principal components, including: Initialize the iteration number a = 1, and the residual matrix where and are the weighted independent variable matrix and the weighted dependent variable matrix of the local training set T k (1) at time t k respectively; Extract the principal component t k (a) and the loading vector p a (n k ×1) from the residual matrix R a (a), satisfying: t a = R k (a) × w a , where w a is the first eigenvector of R k (a); Extract the principal component u k (a) and the loading vector q a (n k ×1) from the residual matrix S a (a), satisfying: u a = S k (a) × c a , where c a is the first eigenvector of S k (a); Calculate the a-th regression coefficient b a : Calculate the residual matrices 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\), and repeat the above steps until \(a\) is greater than \(A\) to obtain a set of local PLSR models under \(A\) alternative principal component numbers: \(\{PLSR a (T k (1))|a = 1,2,......,A\}\), where \(PLSR a (T k (1))\) represents the PLSR model with \(a\) principal components established on the local training set \(T k (1)\). The model parameters include: the principal component matrix \(T k (n k \times a)=[t1,t2,......,t a \); the independent variable loading matrix

[0024] P a (m\times a)=[p1,p2,......,p a \); the dependent variable loading matrix \(Q a (l\times a)=[q1,q2,......,q a \); the regression coefficient vector \(b a (a\times1)=[b1,b2,......,b a \).

[0025] Furthermore, use the non - linear iterative partial least squares NIPALS algorithm to calculate the regression coefficient matrix \(B(t)\), including: setting the time window width \(\Delta t\). When building the fish freshness model at time \(t k \), select the fish samples in the interval from \(t k -\Delta t\) to \(t k \) to form the local training set \(D k \), which contains \(n k \) samples; extract the nuclear magnetic resonance characteristic data matrix \(X(D k )\) and the microbial data matrix \(Y(D k )\) of each fish sample in the local training set \(D k \), and form the initial matrices \(E k (n k \times m)\) and \(F k (n k \times1)\) respectively, where \(m\) is the number of nuclear magnetic resonance characteristic variables and \(l\) is the number of microbial indicators; introduce the forgetting factor \(\lambda(0\lt\lambda\leq1)\), and assign the time weight k to each fish sample \(j\) in the local training set \(D where \(t j \) is the timestamp of sample \(j\); construct the weight matrix and calculate the weighted independent variable matrix and the weighted dependent variable matrix Initialize the iteration number a = 1, the residual matrix Extract the principal component score vector t k of the nuclear magnetic resonance features from the residual matrix R a (n k × 1) and the loading vector p a (m × 1), extract the principal component score vector u k of the microorganisms from the residual matrix S a (n k × 1) and the loading vector q a (1 × 1); Calculate the a-th 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 A principal components are extracted, and obtain the local regression coefficient matrix B(t k ) = [b1, b2,......, b A ; Use the nuclear magnetic resonance feature data matrix X(t k )(1 × m) of the fish sample to be measured at time t k and the local regression coefficient matrix B(t k ) to establish a fish freshness evaluation model at time t k : Y(t k ) = X(t k ) × B(t k ), where Y(t k ) is the predicted freshness at time t k .

[0026] Another aspect of the present application also provides a fish freshness evaluation system for performing a fish freshness evaluation method of the present application.

[0027] Compared with the prior art, the advantages of the present application are as follows:

[0028] By using low-field nuclear magnetic resonance technology to obtain the T2 relaxation curve data of fish meat samples and inversely analyzing the T2 curve by non-negative least squares method, the motion state information of water molecules inside the fish meat can be obtained without destroying the samples, including the distribution characteristics of bound water, weakly bound water and free water. Compared with conventional sensory evaluation and physicochemical detection methods, this technology does not require pretreatment of samples, is simple and fast to operate, and can reflect the differences in fish meat quality from a microscopic level, providing a more comprehensive and objective criterion for freshness evaluation.

[0029] On the basis of obtaining the T2 spectral data of fish meat samples, characteristic parameters such as peak area and peak position in each water region are further extracted, and combined with the microbial data of fish meat, a freshness evaluation model is constructed by using 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 meat, and the extracted peak area characteristics and their combinations characterize the metabolic activity state of fish meat from different angles. On the other hand, the total number of colonies in fish meat is an important indicator to measure freshness, directly reflecting the growth level of microorganisms and their impact on tissue structure. By integrating information from multiple fields, the established partial least squares regression model can achieve a more accurate and comprehensive assessment of fish meat quality compared with single detection methods.

[0030] This application innovatively proposes a time-related fish meat freshness evaluation model, which dynamically updates the model parameters by using weighted partial least squares regression within a local time window. This modeling strategy fully considers the dynamic change laws of the storage environment and quality state of fish meat over time, introduces time weights and forgetting factors, assigns higher weights to recently obtained samples, and weakens the influence of historical data. Therefore, this model has self-adaptability and update ability, can track the real-time change trend of fish meat 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 method of selecting the number of principal components based on slope change can objectively measure the balance between model complexity and prediction ability, and realize the adaptive optimization of model structure parameters. After strict verification and optimization, this freshness evaluation model can accurately predict the microbial level of unknown samples and is applicable to fish meat products of different varieties, origins and processing technologies. Brief Description of the Drawings

[0032] This application will be further described in the form of exemplary embodiments, and these exemplary embodiments will be described in detail through the drawings. These embodiments are not restrictive. In these embodiments, the same numbers represent the same structures, where:

[0033] Figure 1 is an exemplary flowchart of a method for evaluating the freshness of fish according to the present application;

[0034] Figure 2 is an exemplary flowchart of obtaining peak position parameters according to the present application;

[0035] Figure 3 is an exemplary flowchart of constructing a fish freshness evaluation model according to the present application. Detailed Embodiments

[0036] The methods and systems provided in the embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0037] Figure 1 is an exemplary flowchart of a method for evaluating the freshness of fish according to the present application, including: performing nuclear magnetic resonance measurement on fish using a low-field pulsed nuclear magnetic resonance instrument, adopting a CPMG sequence, setting the echo time TE, repetition time TR, number of echoes Ne, and number of accumulations NS to obtain T2 relaxation curve data of the fish; performing inversion on the T2 relaxation curve data using the non-negative least squares method NNLS to obtain T2 distribution spectrum data of the fish; 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 in the T21 region is less than or equal to 100 ms, the T2 value in the T22 region is between 100 ms and 500 ms, and the T2 value in the T23 region is greater than 500 ms; respectively calculating the characteristic parameters of the T21 region, T22 region, and T23 region to obtain the nuclear magnetic resonance characteristic data of the fish; wherein, the characteristic parameters include the peak areas A1, A2, and A3 of each region, and the peak positions T m21 、T m22 、T m23 ; measuring the total number of colonies of the fish using the plate count method, and taking the total number of colonies as the microbial value data for evaluating the freshness of the fish; using the nuclear magnetic resonance characteristic data as the independent variable and the microbial value data as the dependent variable, and adopting the partial least squares method PLSR to construct a regression model to obtain a fish freshness evaluation model for evaluating the freshness of the fish.

[0038] The fish meat samples were detected using a low-field pulsed nuclear magnetic resonance instrument to obtain their T2 relaxation curve data. Specifically, the Carr-Purcell-Meiboom-Gill (CPMG) pulse sequence was adopted, and by applying a series of 180° refocusing pulses, the decay signal of water molecules in the sample during transverse relaxation was measured. The parameter settings of the CPMG sequence are crucial for obtaining high-quality T2 relaxation data. In this application, preferably, the echo time TE is set within the range of 0.2 ms to 1 ms, such as 0.2 ms, 0.4 ms, 0.6 ms, 0.8 ms, or 1 ms. A shorter echo time is beneficial for capturing the fast relaxation signal of bound water in fish meat 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 recovering the longitudinal magnetization of water molecules in the sample. The value range of TR is 1000 ms to 5000 ms, preferably 2000 ms to 4000 ms, such as 2000 ms, 3000 ms, or 4000 ms. Appropriately extending TR can ensure obtaining a stable and reliable T2 relaxation curve. The number of echoes Ne determines the time length and the number of data points of the acquired 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 number of accumulations NS is the number of times the signal is superimposed to increase the signal intensity. 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 will correspondingly increase the measurement time.

[0039] The non-negative least squares method NNLS was used to invert the T2 relaxation curve data to obtain the T2 distribution spectrum data of the fish meat; the objective function of the regularized non-negative least squares problem was constructed. First, according to the parameter settings of the CPMG sequence, the observation matrix A was constructed. Assume that the sampling time points of the T2 spectrum are t1, t2,....., t m , then the element a ij in the i-th row and j-th column of the matrix A i represents the theoretical value of the signal intensity of water molecules with a relaxation time of T 2j at time t The observation matrix A:

[0040] where m is the number of sampling points of the T2 relaxation curve data, and n is the number of sampling points of the T2 distribution spectrum. The sampling time t i of the T2 spectrum 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 points T 2jIt can be preset according to the range and resolution of the 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, arrange the T2 relaxation curve data obtained in step S1 in the order of sampling time points to form a column vector b, that is, b = [b1, b2,......, b m T , where b i is the T2 relaxation signal intensity measured at time t i . Next, introduce the T2 distribution spectrum data vector x to be solved, that is, x = [x1, x2,......, x n T , where x j represents the true value of the water molecule signal intensity with a relaxation time of T 2j . Finally, combine the observation matrix A, the T2 relaxation curve data vector b, the T2 distribution spectrum data vector x, and the regularization parameter λ to construct the objective function of the regularized non - negative least - squares problem: Constraint condition, x ≥ 0. The objective function consists of two terms. The first term represents the sum of the squares of the fitting errors between the T2 relaxation curve data and the reconstructed result of the T2 distribution spectrum, that is, the square of the L2 norm of the difference between the observed value and the theoretical value. The second term 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 λ is, the smoother the solution is; the smaller λ is, the closer the solution is to the observed data. At the same time, introduce the non - negative constraint x ≥ 0 to ensure that each element in the T2 distribution spectrum data vector x obtained by solving is non - negative, which conforms to the physical meaning of the water molecule signal intensity.

[0042] Use the K - fold cross - validation method to optimize the regularization parameter λ. First, randomly divide the T2 relaxation curve data sample set D obtained in step S1 into K subsets D1, D2,......, D K with similar sizes. Each subset contains m / K samples, where m is the total number of samples. Common values are such as K = 5 or 10, that is, 5 - fold or 10 - fold cross - validation. Then, perform K - fold cross - validation. Each time, select a different subset as the validation set, and the remaining K - 1 subsets as the training set. Specifically, in the k - th validation, let D K be the validation set, and D\D K ​​is the training set, where 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, solve the regularized non - negative least - squares problem on the training set D\D K to obtain the corresponding T2 - distribution spectrum solution x λ . Specifically, construct the observation matrix A train of the training set and the T2 - relaxation curve data vector b train , and solve the optimization problem: The obtained solution x λ is the T2 - distribution spectrum estimate under the current λ value. Then, evaluate the performance of the inversion result on the validation set D K . Construct the observation matrix A val of the validation set and the T2 - relaxation curve data vector b val , and calculate the mean square error (MSE) of the inversion result: where n k is the number of samples in the validation set D K . Repeat the K - fold cross - validation K times to obtain K mean square errors MSE1(λ), MSE2(λ),......, MSE K (λ) corresponding to each λ value. Calculate the average of these K mean square errors as the performance metric for the current λ value: Finally, select the λ value corresponding to the minimum average mean square error as the optimal

[0043] Using the optimal regularization parameter λ, solve the T2 - distribution spectrum data by the gradient - descent method. First, initialize the initial value x (0) of the T2 - distribution spectrum vector x. x (0) can be set to a uniform distribution, that is, all components take the same positive value, such as where 1 n is the all - one vector. Or, according to prior knowledge, set x (0) as a vector close to the true T2 - distribution to accelerate the iterative convergence. Then, set the iteration step size α and the maximum number of iterations N. The step size α controls the update amplitude of each iteration, and usually takes a small value, such as α = 0.01. The maximum number of iterations N limits the running time of the algorithm and generally takes a large value, such as N = 1000, to ensure sufficient optimization. Then, perform the gradient - descent iterative optimization. In the k - th iteration, first calculate the gradient g (k) of the objective function at the current solution x (k) . For the regularized non - negative least - squares problem, the objective function is: Its gradient is: In the k - th 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 the solutions of two adjacent iterations is less than the given threshold ε, that is, ||x (k+1) - x (k) ||2 ≤ ε, where ε can take a relatively small value, such as 10 -6 . If this condition is satisfied, it is considered that the algorithm has converged and the iteration is terminated in advance. Otherwise, let k = k + 1 and continue the iteration until the maximum number of iterations N is reached. After the iteration is terminated, the finally obtained x (k+1) is used as the optimal T2 distribution spectrum data, denoted as This means it can approximate the observed T2 relaxation curve data with a small fitting error and high smoothness under the condition of satisfying the non - negative constraint.

[0044] According to the T2 value, divide the T2 distribution spectrum data 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 T2 value less than or equal to 100 ms is divided into the bound water region T21, the part with T2 value between 100 ms and 500 ms is divided into the weakly bound water region T22, and the part with T2 value greater than 500 ms 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 indices corresponding to the T2 value boundaries of each region. Specifically, find the indices i and i 100 in 500 such that the relaxation time value of the i - th T2 sampling point T2(i 100 ) ≤ 100 ms ≤ T2(i 100 + 1), T2(i 500 ) ≤ 500 ms ≤ T2(i 500 + 1), where 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 the indices i 100 and i 500 , divide the T2 distribution spectrum data into three regions: Bound water region T21: That is the first i 100 elements, corresponding to the part with T2 value less than or equal to 100 ms. Weakly bound water region T22: That is from the (i100 + 1)-th element to the i-th element, corresponding to the part where the T2 value is between 100 ms and 500 ms. Free water region T23: 500 That is from the (i + 1)-th element to the last element, corresponding to the part where the T2 value is greater than 500 ms. 500

[0045] Figure 2 is an exemplary flowchart for obtaining peak position parameters according to the present application, calculating the characteristic parameters of the T21 region, the T22 region, and the T23 region 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, and the peak positions T m21 , T m22 , T m23 of each region; First, determine the T2 value boundaries of each region. According to the result of step S3, the T2 value of the T21 region is less than or equal to 100 ms, the T2 value of the T22 region is between 100 ms and 500 ms, and the T2 value of the T23 region is greater than 500 ms. Then, find the data point indices corresponding to the boundaries of each region in the optimal T2 distribution spectrum data \(\hat{x}\). Let have a length of n, and the corresponding T2 value vector be T2 = [T21, T22,......, T2n], where T2i represents the T2 value of the i-th data point. Find the indices i 100 and i 500 that satisfy the following conditions: Finally, according to the indices i 100 and i 500 , extract the spectral data of each region from : T21 region spectral data That is contains the first i 100 elements of \(\hat{x}\), corresponding to the part where the T2 value is less than or equal to 100 ms. T22 region spectral data That is contains the i-th 100+1 element to the i 500 -th element of \(\hat{x}\), corresponding to the part where the T2 value is between 100 ms and 500 ms. T23 region spectral data That is contains the i 500+1 -th element to the last element of \(\hat{x}\), corresponding to the part where the T2 value is greater than 500 ms.

[0046] ​Equally spaced sampling is performed on the T2 spectral data of each region to obtain a discretized T2 spectral curve. Specifically, within the range of T2 values of each region, equally spaced sampling points T 2,i are selected, and the corresponding signal amplitudes y i are extracted to form a discretized T2 spectral curve (T 2,i , y i ). Then, the trapezoidal integration method is used to numerically integrate the discretized T2 spectral curve to calculate the peak area: where A is the peak area, y i and y i+1 are the signal amplitudes 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 spectral curves of each region are traversed to calculate the peak areas A1, A2, and A3 of the corresponding regions.

[0047] The T2 spectral data of each region is smoothed and the peak position parameter is calculated. First, the spectral data of the T21, T22, and T23 regions are smoothed separately to remove high-frequency noise and local fluctuations. Commonly used smoothing algorithms include: Moving average method: The spectral data is averaged by a sliding window, that is, each data point is replaced by the average value of a certain number of surrounding data points. Let the window width be w, then the smoothed spectral data is: where i is the index of the data point and j is the index of the data point within the window. Gaussian filtering method: The spectral data is averaged with Gaussian weights, that is, each data point is replaced by the Gaussian weighted average value of its surrounding data points. Let the Gaussian kernel function be G(x), then the smoothed spectral data is: where G(x) is the Gaussian kernel function, and the commonly used Gaussian kernel function is σ is the standard deviation of the Gaussian kernel function.

[0048] After smoothing, the smoothed spectral data of each region and are obtained. Then, the first derivative is calculated for the smoothed spectral data of each region to obtain the first derivative curve. Let the vector of T2 values of the spectral data be T2, then the first derivative can be approximated by the difference of adjacent data points: where is the first derivative of the i-th data point, and T 2,i is the T2 value of the i-th data point. The zero-crossing points are searched on the first derivative curve, that is, the positions where the derivative value changes from positive to negative, as the local maximum points of the T2 spectral curve. Specifically, for the first derivative curve of each region, find the index i of the data point that satisfies the following conditions max : and, that is, the i-th max- The derivative of one data point is greater than 0, and the derivative of the i max th 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 spectral curve. Compare the signal amplitudes of all local maximum points in each region, and select the T2 value corresponding to the maximum-amplitude maximum point as the peak position parameter for that region. Denote the peak position parameters of the T21, T22, and T23 regions as T m21 、T m22 、T m23 :

[0049] Among them, 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: Take the calculated peak areas A1, A2, A3 and peak position parameters T m21 、T m22 、T m23 as the nuclear magnetic resonance characteristic data of the fish meat sample. These characteristic data comprehensively reflect the content and motion characteristics of water molecules in different states in the fish meat.

[0050] The total number of colonies in the fish meat was determined by the plate count method, and the total number of colonies was used as the microbial value data for evaluating the freshness of the 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, perform aseptic sampling and dilution on the fish meat sample. The specific steps are as follows: Weigh 10 g of the fish meat sample, put it into a sterile homogenization bag, add 90 ml of sterile normal saline, and use a beating homogenizer to fully homogenize it to obtain a sample solution with a dilution of 10 -1 . Pipette 1 ml from the sample solution with a dilution of 10 -1 and add it to a test tube containing 9 ml of sterile normal saline. After mixing, a sample solution with a dilution of 10 -2 is obtained. Repeat the above steps in turn to prepare 10 -3 、10 -4 、10 -5Sample solutions of equal dilution, select an appropriate dilution range according to the freshness of the fish meat. Then, inoculate the diluted sample solution onto the culture medium and perform plate cultivation. The specific steps are as follows: Select at least two consecutive dilutions, and make two parallel samples for each dilution. Pipette 1 ml of the diluted sample solution and add it to a sterile petri dish. Add 15 - 20 ml of the melted and cooled medium at 45 - 50 °C to each petri dish and mix quickly. After the medium solidifies, invert the petri dish and place it in an incubator at 37 °C for 24 - 48 hours. After the cultivation is completed, count the number of colonies on the petri dish. Select the petri dishes with the number of colonies between 30 - 300, and calculate the average number of colonies of the parallel samples for each dilution. Finally, calculate the total number of colonies of the fish meat sample according to the dilution factor and the inoculation volume. If the set total number of colonies is N (CFU / g), then: Among them, C is the total number of colonies on the petri dish, ∑V is the total volume (ml) of the sample solution inoculated onto the petri dish, and d is the dilution factor of the sample solution. Take the calculated total number of colonies N as the microbial value data for evaluating the freshness of the fish meat, which reflects the degree of microbial contamination and growth in the fish meat sample. Generally, the higher the total number of colonies, the lower the freshness of the fish meat and the more serious the microbial contamination.

[0051] Figure 3 is an exemplary flowchart for constructing a fish meat freshness evaluation model according to the present application. Using nuclear magnetic resonance characteristic data as the independent variable and microbial value data as the dependent variable, a regression model is constructed by partial least squares method PLSR to obtain a fish meat freshness evaluation model for evaluating the freshness of fish meat. First, take the obtained nuclear magnetic resonance characteristic data as the independent variable matrix X, and take the obtained microbial value data as the dependent variable matrix Y. Assume that at m different storage time points t1, t2,......, t m Nuclear magnetic resonance detection and microbial determination were performed on the fish meat samples, and m sets of data were obtained. Then, a time-related PLSR model is constructed to describe the quantitative relationship between nuclear magnetic resonance characteristics and microbial values, and the influence of storage time is 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] Use a leave-one-out cross-validation strategy to optimize the number of components of the PLSR model; including: for each storage time point t k , k At time t k ), the nuclear magnetic resonance characteristic data matrix X(t k ) and the microbial value data matrix Y(tk ; Select D k The first fish sample in k (1) is used as the initial validation set V k (1); In the training set T k (1), a PLSR model is established, and the NIPALS algorithm is used to calculate the model parameters to obtain a model set {PLSR a (T k (1))|a = 1, 2,......, A}; where a is the number of principal components, which reflects the number of nuclear magnetic resonance feature variables extracted by the PLSR model, including: the initialization iteration number a = 1, the residual matrix Among them, and are the weighted independent variable matrix and the weighted dependent variable matrix of the local training set T k (1) at time t k respectively; Extract the principal component t k (a) and the loading vector p a (n k ×1) from the residual matrix R a (a), satisfying: t a = R k (a)×w a , where w a is the first eigenvector of R k (a); Extract the principal component u k (a) and the loading vector q a (n k ×1) from the residual matrix S a (1×1), satisfying: u a = S k (a)×c a , where c a is the first eigenvector of S k (a); Calculate the a-th regression coefficient b a : Calculate the residual matrices 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\), and repeat the above steps until \(a\) is greater than \(A\) to obtain a set of local PLSR models under \(A\) alternative principal component numbers: \(\{PLSR a (T k (1))|a = 1,2,......,A\}, where \(PLSR a (T k (1))\) represents the PLSR model with \(a\) principal components established on the local training set \(T k (1)\). The model parameters include: the principal component matrix \(T k (n k \times a)=[t1,t2,......,t a ; the independent variable loading matrix \(P a (m\times a)=[p1,p2,......,p a ; the dependent variable loading matrix \(Q a (l\times a)=[q1,q2,......,q a ; the regression coefficient vector \(b a (a\times1)=[b1,b2,......,b a . Calculate the root mean square error of microbial prediction RMSE(PLSR k (1)),V a (T k (1)),V k (1))\) for each alternative PLSR model on the validation set \(V k (1)\), select the model with the minimum RMSE, and record its principal component number \(a(1)\) as the current optimal value; add the fish samples in the validation set \(V k (1)\) to the training set \(T k (1)\) to obtain a new training set \(T k (2)\), and at the same time select the next sample from \(T k (2)\) as the new validation set \(V k (2)\) to obtain the current optimal principal component number \(a(2)\); continue to iterate until all fish samples in \(D a(i) (T k (i)),V k (i))\) and the optimal principal component number \(a(i)\) with the change curve of the fish sample number \(i\), and analyze the convergence trend and stability of the PLSR model in predicting the freshness of fish; calculate the slope sequence \(\{s i |i = 1,2,......,n\}\), where, Select the absolute value of the slope \(|si |The interval [i min , i max that is less than the preset threshold ε, and the arithmetic mean of the optimal principal component numbers {a(i)|i = i min , i min+1 ,......, i max} within the interval is calculated to obtain the final optimal principal component number A k at time t k ; repeat the above steps of the optimal principal component number to obtain the sequence of optimal principal component numbers {A k |k = 1, 2,......, K} for constructing a time-related PLSR evaluation model of fish freshness.

[0053] Using the non-linear iterative partial least squares NIPALS algorithm to calculate the regression coefficient matrix B(t), a time-related fish freshness evaluation model is obtained: Set the time window width Δt. When building the fish freshness model at time t k , select the fish samples within the interval from t k - Δt to t k to form a local training set D k , which contains n k samples;

[0054] Extract the nuclear magnetic resonance characteristic data matrix X(D k ) and the microbial data matrix Y(D k ) of each fish sample in the local training set D k to form the initial matrices E k (n k × m) and F k (n k × 1), where m is the number of nuclear magnetic resonance characteristic variables and l is the number of microbial indicators; introduce a forgetting factor λ(0 < λ ≤ 1), and assign a time weight k to each fish sample j in the local training set D where, t j is the timestamp of sample j; construct a weight matrix W 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, and the residual matrix S k = F kw ; extract the principal component score vector t k of the nuclear magnetic resonance characteristics and the loading vector p a (n k × 1) from the residual matrix R a(m×1), extracting the principal component score vector u of microorganisms from the residual matrix S k and the load vector q a (n k ×1); calculating the a-th regression coefficient b a : a Calculating 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 ), letting a = a + 1, repeating until A principal components are extracted, obtaining the local regression coefficient matrix B(t k ) = [b1, b2,......, b A ; using the nuclear magnetic resonance characteristic data matrix X(t k )(1×m) of the fish sample to be measured at time t and the local regression coefficient matrix B(t k ) to establish the fish freshness evaluation model at time t k : Y(t k ) = X(t k ) × B(t k ), where Y(t k ) is the predicted freshness at time t k . k

[0055] Obtaining the fish freshness evaluation model to evaluate the fish freshness. Obtaining the nuclear magnetic resonance characteristic data x new ∈R 1×m of the fish sample to be measured, where m is the number of nuclear magnetic resonance characteristic variables. The nuclear magnetic resonance characteristic data can be obtained by performing nuclear magnetic resonance detection on the fish sample to be measured, such as measuring the nuclear magnetic resonance relaxation time T2, nuclear magnetic resonance image parameters, etc. Determining the timestamp t new of the fish sample to be measured, that is, the collection or detection time of the sample. The timestamp can be obtained by recording the sampling time or detection time, and is used to determine which time point's freshness evaluation model to apply. According to the timestamp t new of the fish sample to be measured, selecting the fish freshness evaluation model Y(t new ) = X(t new )B(t new ) at the corresponding time, where B(t new ) is at time t new ​​The local regression coefficient matrix at a moment. Input the nuclear magnetic resonance characteristic data X(t new ) of the fish sample to be tested into the selected freshness evaluation model, and calculate the predicted freshness value Y(t new ) as follows: Y(t new ) = X(t new )B(t new ), where Y(t new ) is the predicted freshness value of the fish sample to be tested at time t new , and it can be the predicted value of one or more microbial indicators, such as total colony count, coliform count, etc. Evaluate the freshness of the fish sample to be tested according to the predicted freshness value Y(t new ). The predicted value can be compared with a 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, it 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 result of the fish sample to be tested, such as "fresh" or "not fresh", as well as the predicted microbial indicator values. The evaluation result 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 intuitively understand.

Claims

1. A method for evaluating the freshness of fish meat, characterized in that, Comprising: Performing nuclear magnetic resonance measurement on fish meat using a low-field pulsed nuclear magnetic resonance instrument, adopting a CPMG sequence, setting the echo time TE, repetition time TR, number of echoes Ne, and number of accumulations NS, to obtain the T2 relaxation curve data of the fish meat; Inverting the T2 relaxation curve data by non-negative least squares method NNLS to obtain the 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 in the T21 region is less than or equal to 100 ms, the T2 value in the T22 region is between 100 ms and 500 ms, and the T2 value in the T23 region is greater than 500 ms; Calculate the characteristic parameters of regions T21, T22, and T23 respectively to obtain the nuclear magnetic resonance characteristic data of the fish meat; among them, the characteristic parameters include the peak areas A1, A2, and A3 of each region, and the peak positions T m21 , T m22 , T m23 ; Measuring the total number of colonies of the fish meat by the plate count method, and taking the total number of colonies as the microbial value data for evaluating the freshness of the fish meat; Using the partial least squares method PLSR to construct a regression model with the nuclear magnetic resonance characteristic data as the independent variable and the microbial value data as the dependent variable, to obtain a fish meat freshness evaluation model and evaluate the freshness of the fish meat; Inverting the T2 relaxation curve data by non-negative least squares method NNLS to obtain the T2 distribution spectrum data of the fish meat, including: Constructing the objective function of the regularized non-negative least squares method: Constraints: x≥0 Wherein, A is the observation matrix of the CPMG sequence, b is the column vector composed of the obtained T2 relaxation curve data, x is the column vector composed of the to-be-solved T2 distribution spectrum data, and λ is the regularization parameter; Randomly dividing the T2 relaxation curve data into K subsets, each time selecting K - 1 of them as the training set and the remaining 1 subset as the validation set; for different λ values, solving the regularized non-negative least squares problem on the training set and calculating the mean square error of the inversion result on the validation set; repeating K times to obtain K mean square errors when λ takes different values, and taking the λ value corresponding to the minimum mean square error as the optimal regularization parameter; Substituting the optimal regularization parameter λ into the objective function to solve the T2 distribution spectrum data.

2. The fish meat freshness evaluation method according to claim 1, wherein: Performing nuclear magnetic resonance measurement on fish meat using a low-field pulsed nuclear magnetic resonance instrument, adopting a CPMG sequence, setting the echo time TE, repetition time TR, number of echoes Ne, and number of accumulations NS, to obtain the T2 relaxation curve data of the fish meat, including: The value range of the echo time TE is 0.2 ms to 1 ms; The value range of the repetition time TR is 1000 ms to 5000 ms; The value range of the number of echoes Ne is 500 to 5000; The value range of the number of accumulations NS is 2 to 128.

3. The fish meat freshness evaluation method according to claim 1, wherein: Substituting the optimal regularization parameter λ into the objective function to solve the T2 distribution spectrum data, including: Initialize the initial value \(x_0\) of the T2 distribution spectrum data \(x\). (0) , set the iteration step size \(a\) and the number of iterations \(N\). For the k-th iteration, compute the gradient g (k) of the objective function at x (k) : g (k) = A T (Ax (k) - b) + λx (k) Among them, A T is the transpose of matrix A; Updating the T2 distribution spectrum data x: x (k+1) = max(0, x (k) - ag (k) ) where max(0, x (k) - ag (k) ) truncates negative values to 0 to ensure the non - negativity of x; Determine whether ||x (k+1) -x (k) ||2 ≤ ε is satisfied. If it is satisfied, terminate the iteration; otherwise, let k = k + 1 and return to continue the iteration. Here, ε is the given error threshold; After the iteration terminates, the finally obtained x (k+1) is used as the optimal T2 distribution spectrum data.

4. The fish meat freshness evaluation method according to claim 3, wherein: Calculating the characteristic parameters of the T21 region, T22 region, and T23 region respectively to obtain the nuclear magnetic resonance characteristic data of the fish meat, including: Extract the T2 spectral data of each region according to the T2 value ranges of the T21 region, T22 region, and T23 region, to obtain the T21 region spectral data, T22 region spectral data, and T23 region spectral data; Perform equally spaced sampling on the T2 spectral data of each region in the T2 dimension to obtain a series of discrete T2 values and corresponding signal amplitudes, constituting a discretized T2 spectral curve; Perform numerical integration on the discretized T2 spectral curve using the trapezoidal integration method: where A is the peak area, y i and y i+1 are the signal amplitudes 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 result obtained from numerical integration as the peak areas A1, A2, and A3 of the corresponding regions; Perform smoothing processing on the T2 spectral curve of each region; calculate the first derivative of the smoothed T2 spectral curve to obtain a 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 magnitudes 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 for the corresponding region m21 、T m22 、T m23 , and the peak position parameter reflects 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 are used as the nuclear magnetic resonance characteristic data of the fish meat.

5. The method for evaluating the freshness of fish meat according to claim 4, wherein: Adopt the partial least squares method PLSR to construct a regression model to obtain a fish meat freshness evaluation model, including: Use the obtained nuclear magnetic resonance characteristic data as the independent variable matrix X, and use the obtained microbial value data as the dependent variable matrix Y to construct a time-related 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 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; Adopt a cross-validation strategy based on the leave-one-out method to optimize the number of components of the PLSR model; Use the non-linear iterative partial least squares NIPALS algorithm to calculate the regression coefficient matrix B(t) to obtain a time-related fish meat freshness evaluation model: Y(t) = X(t)B(t).

6. The method for evaluating the freshness of fish meat according to claim 5, wherein: Adopt a cross-validation strategy based on the leave-one-out method to optimize the number of components of the PLSR model, including: For each storage time point t k , the nuclear magnetic resonance characteristic data matrix X(t k ) and the microbial value data matrix Y(t k ) of the fish meat obtained at time t k ) are randomly arranged by sample to obtain a random sequence D k with a sample number of n; Select D k The first fish sample in k (1) is used as the initial validation set V k (1); On the training set T k (1), establish a PLSR model, use the NIPALS algorithm to calculate the model parameters, and obtain a model set {PLSR a (T k (1))|a = 1, 2,......, A}; where a is the number of principal components, which reflects the number of nuclear magnetic resonance characteristic variables extracted by the PLSR model; On the validation set V k (1), calculate the root mean square error RMSE(PLSR a (T k (1)), V k (1)) of each alternative PLSR model for microbial prediction respectively. Select the model with the smallest RMSE, and record its number of principal components a(1) as the current optimal value; Add the fish samples in the validation set V k in (1) to the training set T k (1) to obtain a new training set T k (2). Meanwhile, select the next sample from T k (2) as the new validation set V k (2) to obtain the current optimal number of principal components a(2); Iterate continuously until all fish samples in D k are selected as the validation set once, that is, repeat n times to obtain a series of optimal principal component numbers {a(i)|i = 1, 2,......, n}; Plot the change curves of the RMSE(PLSR) for predicting microbial values of the PLSR model a(i) (T k (i)), V k (i)) and the optimal number of principal components a(i) with the number of fish meat samples i, and analyze the convergence trend and stability of the PLSR model in predicting the freshness of fish meat; Calculate the slope sequence {s i | i = 1, 2,......, n} of the RMSE change curve, where, Select the interval [i i where the absolute value of the slope |s min is less than the preset threshold ε, and calculate the arithmetic mean of the optimal number of principal components {a(i)|i = i max , i min , i min+1 ,......, i max} within this interval to obtain the final optimal number of principal components A at time t k ; k ​ Repeat the above steps of the optimal number of principal components to obtain the sequence {A k |k = 1, 2,......, K} of the optimal number of principal components at all storage time points for constructing a time-related PLSR evaluation model of fish freshness.

7. The method for evaluating the freshness of fish meat according to claim 6, wherein: Obtain a model set {PLSR a (T k (1))|a = 1, 2,......, A} under A alternative principal component numbers, including: Initialize the number of iterations \(a = 1\), the residual matrix wherein, and are respectively the weighted independent variable matrix and the weighted dependent variable matrix of the local training set \(T\) at time \(t\) of k (1); k (1); Extract the principal component t from the residual matrix R k (a), and the loading vector p a (n k × 1) and satisfy: a (m × 1), satisfying: t a = R k (a) × w a where w a is the first eigenvector of R k (a); Extract the principal component u k from the residual matrix S a (n k × 1) and the loading vector q a (1 × 1), satisfying: u a = S k (a) × c a Among them, c a is the first eigenvector of S k (a); 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 a T Let a = a + 1, and repeat the above steps until a is greater than A, to obtain a set of local PLSR models under A alternative numbers of principal components; {PLSR a (T k (1))|a = 1, 2,......, A} Among them, PLSR a (T k (1)) represents the PLSR model with a principal components established on the local training set T k (1), and the model parameters include: Principal component matrix T k (n k ×a) = [t1, t2,......, t a ; Independent variable load matrix P a (m×a) = [p1, p2,......, p a ; Dependent variable load 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 the freshness of fish meat according to claim 7, wherein: Use the non-linear iterative partial least squares NIPALS algorithm to calculate the regression coefficient matrix B(t), including: Set the time window width Δt. When building the fish freshness model at time t k , select the fish samples within the interval from t k -Δt to t k to form the local training set D k , which contains n k samples; Extract the local training set D k The nuclear magnetic resonance feature data matrix X(D k ) and the microbial data matrix Y(D k ) of each fish sample in it respectively form the initial matrices E k (n k ×m) and F k (n k ×1), where m is the number of nuclear magnetic resonance feature variables and l is the number of microbial indicators; Introduce a forgetting factor λ (0 < λ ≤ 1) to assign a time weight to each fish sample j in the local training set D k where t is the timestamp of sample j; j ​ Construct a weight matrix according to time weights Calculate the weighted independent variable matrix and the weighted dependent variable matrix Initialize the number of iterations \(a = 1\), the residual matrix Extract the principal component score vector t of the nuclear magnetic resonance features from the residual matrix R k and the loading vector p a (n k ×1), and extract the principal component score vector u of the microorganisms from the residual matrix S a (m×1), and the loading vector q k from the residual matrix S a (n k ×1) and the loading vector q a (1×1); Calculate the regression coefficient b of the a-th 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, and repeat until A principal components are extracted to obtain the local regression coefficient matrix B(t k ) = [b1, b2,......, b A ; Using t k At time t, the nuclear magnetic resonance characteristic data matrix X(t k )(1×m) and the local regression coefficient matrix B(t k ) are used to establish the fish freshness evaluation model at time t k : Y(t k ) = X(t k ) × B(t k ), where Y(t k ) is the predicted freshness at time t k .

9. A fish meat freshness evaluation system, wherein, including: At least one processing unit; used to execute instructions to implement the fish meat 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