A cat food taurine detection method based on hyperspectral imaging and sg-cck deep learning model

By combining near-infrared hyperspectral imaging with the SG-CCK deep learning model, the problems of long detection cycle, strong sample destructiveness, and insufficient model generalization ability in cat food taurine detection have been solved, realizing rapid and non-destructive qualitative and quantitative detection, and improving detection accuracy and stability.

CN122176541APending Publication Date: 2026-06-09ZHEJIANG FORESTRY UNIVERSITY

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZHEJIANG FORESTRY UNIVERSITY
Filing Date
2026-05-13
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Existing methods for detecting taurine in cat food have long detection cycles, are highly destructive to samples, are difficult to extract weak spectral features under complex matrices, and have insufficient generalization ability of deep learning models under small sample conditions.

Method used

By employing near-infrared hyperspectral imaging combined with the SG-CCK deep learning model, and through multi-scale spectral domain feature extraction, convolutional spectral attention module, and KAN nonlinear mapping module, rapid, non-destructive, qualitative, and quantitative detection of taurine is achieved.

Benefits of technology

It enables rapid, non-destructive, qualitative, and quantitative detection of taurine in complex cat food matrices, improving detection accuracy and stability, and is suitable for batch testing in pet food production and distribution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122176541A_ABST
    Figure CN122176541A_ABST
Patent Text Reader

Abstract

The present application relates to pet food detection, near-infrared hyperspectral imaging and deep learning technical field, especially in kind of based on hyperspectral imaging and SG-CCK deep learning model's cat food taurine detection method, including model training stage and sample detection stage: collect cat food sample near-infrared hyperspectral image, carry out black and white correction, average spectrum extraction of region of interest and Savitzky-Golay smoothing pretreatment;The SG-CCK model including multiscale spectral feature extraction module, convolutional spectral attention module and KAN nonlinear mapping module is constructed;Known taurine content sample is used to train the model, and the sample to be measured is input into the trained model, and the qualitative grading result and / or quantitative concentration result of taurine is output.The method can enhance the weak characteristic signal of taurine in complex cat food matrix, realize rapid nondestructive testing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of pet food testing, near-infrared hyperspectral imaging, and deep learning technology, and particularly to a method for detecting taurine in cat food based on hyperspectral imaging and an SG-CCK deep learning model. Background Technology

[0002] Taurine is an essential nutrient for maintaining normal physiological functions in felines, playing a vital role in regulating myocardial contraction, maintaining retinal structural stability, protecting nerve function, and ensuring normal reproductive performance. Because cats have limited capacity to synthesize taurine, they typically need to maintain their taurine levels through dietary intake. The taurine content in commercially prepared cat food is affected by factors such as formula composition, raw material quality, and processing methods. Insufficient taurine content may negatively impact a cat's health with long-term consumption.

[0003] Existing methods for detecting taurine content in cat food mainly include high-performance liquid chromatography (HPLC), amino acid analyzer method, and liquid chromatography-tandem mass spectrometry (LC-MS / MS). While these methods offer high accuracy, they typically require complex sample pretreatment, chemical reagents, and lengthy testing times. Furthermore, the testing process can damage the sample, making it difficult to meet the needs for rapid, non-destructive, and batch testing in pet food production and distribution.

[0004] In recent years, hyperspectral imaging technology has been used for food quality testing. This technology can simultaneously acquire the spectral and spatial information of a sample, making it suitable for qualitative and quantitative analysis of sample components. However, cat food is a complex matrix food, with proteins, fats, moisture, and various additives all responding in the near-infrared band. Taurine, as a trace component, has relatively weak spectral absorption characteristics and is easily masked by the strong background signal in the cat food matrix. Traditional preprocessing methods and shallow models such as partial least squares and support vector machines have limited analytical capabilities for high-dimensional, strongly collinear, and low signal-to-noise ratio spectral data, resulting in insufficient sensitivity and stability in complex matrix samples.

[0005] While deep learning models such as convolutional neural networks and Transformers possess certain feature extraction capabilities, they are prone to overfitting or training instability in small-sample applications of hyperspectral detection. Traditional multilayer perceptrons typically employ fixed activation functions, which lack the adaptive fitting ability to the complex nonlinear mapping between taurine concentration and hyperspectral response, making it difficult to simultaneously achieve both detection accuracy and cross-matrix generalization ability.

[0006] Therefore, it is necessary to provide a method for detecting taurine in cat food based on hyperspectral imaging and SG-CCK deep learning model, so as to achieve rapid, non-destructive, qualitative and quantitative detection of taurine in complex cat food matrix backgrounds. Summary of the Invention

[0007] The purpose of this invention is to provide a method for detecting taurine in cat food based on hyperspectral imaging and an SG-CCK deep learning model, in order to solve the problems of existing methods for detecting taurine in cat food, such as long detection cycle, strong sample destructiveness, difficulty in extracting weak spectral features under complex matrices, and insufficient generalization ability of deep learning models under small sample conditions.

[0008] To achieve the above objectives, this invention provides a method for detecting taurine in cat food based on hyperspectral imaging and an SG-CCK deep learning model, including a model training phase and a sample detection phase. The model training phase includes: Obtain near-infrared hyperspectral images of training samples of cat food with known taurine content; The near-infrared hyperspectral image is black and white corrected, and the average spectrum of the region of interest is extracted from the corrected near-infrared hyperspectral image to obtain the training sample spectrum; The Savitzky-Golay smoothing algorithm is used to preprocess the spectra of the training samples to obtain the training input spectra; Construct an SG-CCK deep learning model and train the SG-CCK deep learning model using the training input spectrum and the corresponding taurine content label; The sample testing phase includes: Acquire near-infrared hyperspectral images of the cat food sample to be tested; The near-infrared hyperspectral image of the cat food sample to be tested is corrected for black and white, and the average spectrum of the region of interest is extracted from the corrected near-infrared hyperspectral image to obtain the spectrum of the sample to be tested. The spectral data of the test sample is preprocessed using the same Savitzky-Golay smoothing algorithm as in the model training phase to obtain the test input spectrum; The test spectrum is input into the trained SG-CCK deep learning model, which outputs the taurine detection results of the cat food sample to be tested. The SG-CCK deep learning model includes a multi-scale spectral domain feature extraction module, a convolutional spectral attention module, and a KAN nonlinear mapping module connected in sequence. The multi-scale spectral domain feature extraction module is used to extract multi-scale spectral features related to taurine in cat food samples along the spectral dimension. The convolutional spectral attention module is used to perform weight calibration on the multi-scale spectral features through spectral channel attention and spatial attention, so as to enhance taurine-related features and suppress background interference from cat food matrix. The KAN nonlinear mapping module is used to map the weighted calibrated spectral features into qualitative grading results and / or quantitative concentration results of taurine.

[0009] Furthermore, the spectral range of the near-infrared hyperspectral image is 900 nm to 1700 nm; The cat food training samples with known taurine content were prepared by adding taurine standard to different matrix cat food samples according to a preset addition ratio, wherein the preset addition ratio includes at least two of 0%, 0.05%, 0.1%, 0.2% and 0.4%; Before acquiring near-infrared hyperspectral images of the cat food training samples, the cat food samples and taurine standards were ground, sieved, and mixed.

[0010] Furthermore, the black-and-white correction includes: calculating the corrected hyperspectral image reflectance based on the reflectance of the original hyperspectral image, the reflectance of the white reference image, and the reflectance of the dark field reference image; The white reference image is obtained by using a white reference board, and the dark reference image is obtained by covering the camera lens. The corrected hyperspectral image reflectance is obtained by dividing the difference between the original hyperspectral image reflectance and the dark field reference image reflectance by the difference between the white board reference image reflectance and the dark field reference image reflectance.

[0011] Furthermore, the region of interest is the effective sample region of the cat food sample in the corrected near-infrared hyperspectral image; The average spectrum is obtained by averaging the reflectance of each pixel in each band within the region of interest; The Savitzky-Golay smoothing algorithm smooths the spectrum through a sliding window and local polynomial fitting, and uses derivative transformation to correct baseline drift caused by uneven particle distribution in the sample.

[0012] Furthermore, the multi-scale spectral domain feature extraction module includes a first one-dimensional convolutional layer, a second one-dimensional convolutional layer, and a third one-dimensional convolutional layer connected in sequence; The kernel size of the first one-dimensional convolutional layer is 7, and the number of output channels is 64. The kernel size of the second one-dimensional convolutional layer is 5, and the number of output channels is 128. The kernel size of the third one-dimensional convolutional layer is 3, and the number of output channels is 256. Each of the first, second, and third one-dimensional convolutional layers includes one-dimensional convolution operations, batch normalization, linear rectified activation, and max pooling.

[0013] Furthermore, the convolutional spectral attention module includes a spectral channel attention unit and a spatial attention unit; The spectral channel attention unit is used to perform one-dimensional global average pooling on the input features to obtain channel descriptors, and to generate spectral channel weights through a bottleneck structure. The spatial attention unit is used to perform a one-dimensional convolution operation on the features after weighting the spectral channel weights to obtain spatial weights. The convolutional spectral attention module applies the spectral channel weights and the spatial weights to the input features to obtain attention-enhanced features; The bottleneck structure has a reduction rate of 4, and the one-dimensional convolution kernel size in the spatial attention unit is 7.

[0014] Furthermore, the KAN nonlinear mapping module includes a flattening unit, a first KAN layer, a second KAN layer, and an output layer; The flattening unit is used to flatten the attention-enhancing features output by the convolutional spectral attention module into a one-dimensional feature vector; The first KAN layer has 512 hidden units, and the second KAN layer has 128 hidden units. Both the first KAN layer and the second KAN layer use learnable nonlinear functions set on the connection edges of neurons for feature mapping, and the learnable nonlinear functions are third-order polynomial basis functions; A batch normalization layer, a linear rectification activation layer, and a Dropout layer are set after the first KAN layer, and the dropout probability of the Dropout layer is 0.3. A batch normalization layer and a linear rectification activation layer are set after the second KAN layer.

[0015] Furthermore, the model training phase also includes: dividing the training samples using a five-fold cross-validation strategy; In each fold cross-validation, standardized parameters are fitted using only the training fold, and these standardized parameters are applied to both the training and validation folds. When training the SG-CCK deep learning model, the cross-entropy loss function is used for the classification task, the mean squared error loss function is used for the regression task, and the Adam optimizer is used to update the model parameters. The Adam optimizer has an initial learning rate of 5×10^-4 and L2 regularization is introduced during training.

[0016] Furthermore, an early stopping mechanism is employed when training the SG-CCK deep learning model; Training is terminated when the validation set loss does not decrease within 20 consecutive rounds, and the model weights corresponding to the lowest validation set loss are saved.

[0017] Furthermore, the output layer is used to output the taurine detection results; The taurine detection results include the taurine concentration level of the cat food sample and / or the predicted taurine concentration value of the cat food sample.

[0018] Compared with the prior art, the present invention has at least the following beneficial effects: First, this invention uses near-infrared hyperspectral imaging to obtain spectral information of cat food samples, and combines region of interest average spectral extraction and Savitzky-Golay smoothing preprocessing to obtain effective spectral input for taurine detection without damaging the sample.

[0019] Secondly, this invention uses a multi-scale spectral domain feature extraction module to extract multi-scale features from broad peak contours to narrow peak details along the spectral dimension using one-dimensional convolution kernels of different sizes, which is beneficial for capturing weak taurine feature signals in complex cat food matrices.

[0020] Third, this invention uses a convolutional spectral attention module to adaptively calibrate the weights of spectral channels and spatial locations, which can enhance taurine-related features and suppress interference from matrix backgrounds such as proteins, fats, and water, thereby improving the model's ability to identify trace taurine signals.

[0021] Fourth, this invention deploys learnable nonlinear functions on the neuron connection edges through the KAN nonlinear mapping module, which improves the model's ability to fit the complex nonlinear relationship between taurine concentration and hyperspectral response, thereby improving detection accuracy and generalization stability.

[0022] Fifth, this invention can output qualitative and / or quantitative taurine concentration results using the same model framework, making it suitable for rapid and non-destructive detection of taurine content in cat food. Attached Figure Description

[0023] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a schematic flowchart of the method for detecting taurine in cat food according to the present invention; Figure 2 This is a schematic diagram of the overall structure of the SG-CCK deep learning model of the present invention, wherein, Figure 2 In the diagram, 'a' represents a schematic representation of the three-dimensional topological structure of the SG-CCK deep learning model. Figure 2 In the diagram, 'b' represents the logical flow of the SG-CCK deep learning model. Figure 2 In this diagram, 'c' represents the structured hierarchical feature mapping of the SG-CCK deep learning model. Figure 3 This is a schematic diagram of the structure of the convolutional spectrum attention module of the present invention; Figure 4This is a schematic diagram of the structure of the KAN nonlinear mapping module of the present invention; Figure 5 This is a performance comparison diagram between the SG-CCK model of this invention and the comparative model, wherein, Figure 5 In the figure, 'a' represents a comparison of the qualitative classification accuracy of different models. Figure 5 In this context, b represents the coefficient of determination R for different models. 2 Comparison chart, Figure 5 In the figure, 'c' represents a comparison of the root mean square error (RMSE) of different models. Figure 5 In the figure, d represents a comparison of the mean absolute error (MAE) of different models. Figure 6 This is a schematic diagram showing the distribution of the importance of key feature bands in this invention, wherein, Figure 6 Figures a through c represent the principal component analysis clustering results for different cat food matrices. Figure 6 In the figure, d to f represent the distribution of the importance of characteristic bands under different cat food substrates. Detailed Implementation

[0024] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0025] Example 1 This embodiment provides a method for detecting taurine in cat food based on hyperspectral imaging and an SG-CCK deep learning model. Figure 1 As shown, the method includes a model training phase and a sample detection phase.

[0026] First, a training sample set is constructed. Training samples can be cat food samples from different brands or with different matrix compositions. Taurine standards are added to these samples in varying proportions to create training samples with known taurine content labels. The taurine addition proportions can include 0%, 0.05%, 0.1%, 0.2%, and 0.4%. To reduce the scattering effects of particle size and uneven stacking on spectral acquisition, the cat food samples and taurine standards can be ground, sieved, and mixed. The mixed samples can be sealed and stored under the same environmental conditions before testing.

[0027] Subsequently, near-infrared hyperspectral imaging systems were used to acquire near-infrared hyperspectral images of the training samples and the cat food samples to be tested. The acquisition band of the near-infrared hyperspectral imaging system can be from 900 nm to 1700 nm. Before acquisition, the imaging equipment can be preheated, and acquisition parameters such as the distance between the sample and the lens, exposure conditions, and transport speed should be kept consistent to reduce the impact of changes in acquisition conditions on the spectral data.

[0028] After acquisition, the original near-infrared hyperspectral image is subjected to black-and-white correction. The black-and-white correction can be performed according to the following formula:

[0029] in This represents the reflectance of each pixel in the corrected hyperspectral image at the corresponding wavelength. This represents the reflectance of each pixel in the original hyperspectral image at the corresponding wavelength. This represents the reflectance of the corresponding band in the whiteboard reference image. This represents the reflectance of the corresponding band in the dark-field reference image. The white reference image can be obtained using a white reference plate, and the dark-field reference image can be obtained by covering the camera lens. Through the above corrections, the influence of instrument dark current and uneven illumination intensity on the reflectance of hyperspectral images can be reduced.

[0030] After black-and-white correction, the effective region containing the cat food sample is selected as the region of interest from the corrected near-infrared hyperspectral image. The reflectance of each pixel within the region of interest is averaged across all wavelengths to obtain the average spectrum of each sample. In this way, hyperspectral image data can be converted into a one-dimensional spectral sequence for model training and prediction.

[0031] To address interference from surface scattering, particle distribution differences, and instrument random noise in cat food powder, the Savitzky-Golay smoothing algorithm was employed to preprocess the average spectrum. This algorithm smooths the spectral curve through local polynomial fitting within a sliding window, filtering out random noise while preserving the morphological information of the taurine characteristic absorption peak. Simultaneously, derivative transformation can be used to correct baseline drift caused by uneven sample particle distribution. After preprocessing, the training input spectrum and the target input spectrum were obtained.

[0032] Example 2 This embodiment describes the structure of the SG-CCK deep learning model based on Embodiment 1.

[0033] like Figure 2As shown, the SG-CCK deep learning model includes a multi-scale spectral domain feature extraction module, a convolutional spectral attention module, and a KAN nonlinear mapping module. In SG-CCK, SG corresponds to Savitzky-Golay smoothing preprocessing, and CCK corresponds to a combination of the convolutional spectral attention module, convolutional neural network, and KAN nonlinear mapping module.

[0034] The multi-scale spectral domain feature extraction module employs a three-stage hierarchical one-dimensional convolutional structure to extract spectral features at different scales along the spectral dimension. The first one-dimensional convolutional layer uses a kernel size of 7 to capture macroscopic morphological features such as spectral baselines and broad peak distributions over a wide range, with 64 output channels. The second one-dimensional convolutional layer uses a kernel size of 5 to extract mesoscale spectral features, with 128 output channels. The third one-dimensional convolutional layer uses a kernel size of 3 to focus on local narrow peaks and subtle slope changes, with 256 output channels.

[0035] For the The first in the layer For each feature map, its one-dimensional convolution operation can be represented as:

[0036] In the formula, Indicates the first The first layer Each output feature map; Indicates the first The number of input feature maps for the layer; Indicates the first The first layer One input feature map; Indicates the connection of the first The input feature map and the first input feature map One-dimensional convolutional kernels for each output feature map (whose size corresponds to...) ); Indicates the first The bias term corresponding to each output feature map; This represents a one-dimensional convolution operation performed along the spectral dimension. This indicates that a linear rectifier function is used to introduce nonlinear characteristics.

[0037] Each one-dimensional convolutional layer is followed by a batch normalization layer, a linear rectified activation layer, and a max pooling layer. The batch normalization layer is used to normalize the distribution of intermediate features, the linear rectified activation layer is used to introduce nonlinear expressive power, and the max pooling layer is used to reduce the spectral domain dimension while retaining significant response features.

[0038] Batch normalization can be expressed as:

[0039] In the formula, This represents the input features of the batch normalization layer. This represents the output characteristics after batch normalization. This represents the mean of the current batch features. This represents the characteristic variance of the current batch. This represents a constant used to prevent the denominator from being zero. This represents the learnable scaling parameter. This represents the learnable offset parameter.

[0040] Max pooling can be expressed as:

[0041] In the formula, Indicates the position of the input features Starting point, length is Local window, This represents the maximum response value within the local window. Max pooling can preserve significant spectral responses while compressing the spectral feature dimensions.

[0042] Through the aforementioned multi-scale cascade structure, the model is able to extract multi-scale spectral features related to taurine from the cat food spectrum.

[0043] Example 3 This embodiment describes the convolutional spectrum attention module based on embodiment 2.

[0044] like Figure 3 As shown, the convolutional spectral attention module is positioned after the multi-scale spectral domain feature extraction module to enhance and filter the extracted high-dimensional spectral features. The convolutional spectral attention module includes spectral channel attention units and spatial attention units.

[0045] The spectral channel attention unit first compresses the spectral domain information of each channel into channel descriptors using one-dimensional global average pooling. Then, it models the inter-channel dependencies using a bottleneck structure with a reduction rate of 4, and generates spectral channel attention weights using the Sigmoid function. The spectral channel attention weights can be expressed as:

[0046] In the formula, This represents the feature map of the input convolutional spectral attention module. This represents one-dimensional global average pooling. This represents a bottleneck structure multilayer perceptron. This represents the Sigmoid function. This represents the attention weights of the spectral channels.

[0047] Applying the spectral channel attention weights to the input feature map enhances the feature channels that contribute significantly to taurine detection and suppresses redundant background channels. The feature map after spectral channel attention weighting can be represented as follows: .

[0048] The spatial attention unit further processes the feature map after attention weighting of the spectral channels. The spatial attention unit models the local correlation of the spectral sequence using a one-dimensional convolution operator with a kernel size of 7 to locate the spectral positions associated with the taurine-sensitive absorption peak. The spatial attention weights can be expressed as:

[0049] In the formula, This represents the feature map after attention weighting of the spectral channels. This indicates the calculation of the mean along the channel direction. This represents a one-dimensional convolution operation with a kernel size of 7. This represents the Sigmoid function. This represents the spatial attention weights.

[0050] The spatial attention weights are applied to the feature map after spectral channel attention weighting to obtain attention-enhanced features. Through the cascaded effect of spectral channel attention and spatial attention, the convolutional spectral attention module can enhance the correlation features of taurine-sensitive absorption peaks and suppress strong interference signals from the matrix background of cat food, such as protein, fat, and moisture.

[0051] Example 4 This embodiment describes the KAN nonlinear mapping module based on the above embodiments.

[0052] like Figure 4 As shown, the KAN nonlinear mapping module is used to map attention-enhanced features to taurine detection results. Before inputting into the KAN nonlinear mapping module, the attention-enhanced features can be flattened to obtain a one-dimensional feature vector.

[0053] The KAN nonlinear mapping module comprises a first KAN layer and a second KAN layer connected sequentially. The first KAN layer has 512 hidden units, and the second KAN layer has 128 hidden units. Unlike traditional multilayer perceptrons that set fixed activation functions at neuron nodes, the KAN layer sets learnable nonlinear functions on the neuron connection edges, thereby transforming the traditional linear weighted mapping into an adaptive function approximation. For the complex nonlinear relationship between taurine concentration and hyperspectral response, the learnable nonlinear function can employ a third-order polynomial basis function.

[0054] The nonlinear mapping of the KAN layer can be expressed as:

[0055] In the formula, This represents the features input to the KAN layer. This represents the nonlinear mapping output of the KAN layer. For polynomial basis functions, The coefficients are dynamically optimized through backpropagation. This indicates the number of basis functions. In this embodiment, the basis functions are third-order polynomial basis functions.

[0056] Following the first KAN layer, a batch normalization layer, a linear rectification activation layer, and a Dropout layer are set, with the dropout probability of the Dropout layer being 0.3. Following the second KAN layer, a batch normalization layer and a linear rectification activation layer are also set. The output layer is configured according to the detection task: when performing a qualitative taurine grading task, the output layer outputs the taurine concentration level of the cat food sample; when performing a quantitative taurine detection task, the output layer outputs the predicted taurine concentration value of the cat food sample.

[0057] Through the KAN nonlinear mapping module, the model can adaptively fit the nonlinear mapping relationship between taurine concentration and hyperspectral response, improving the accuracy and stability of trace taurine detection in complex matrix backgrounds.

[0058] Example 5 This embodiment describes the model training and detection process based on the above embodiments.

[0059] During the model training phase, the training input spectra and taurine content labels corresponding to the training samples are input into the SG-CCK deep learning model. To improve the objectivity and robustness of model evaluation, a five-fold cross-validation strategy can be used to divide the training samples. In each fold of cross-validation, the standardized parameters are fitted only using the training fold, and the resulting standardized parameters are applied to both the training and validation folds. This approach avoids data leakage caused by validation data participating in preprocessing parameter fitting.

[0060] For the qualitative classification task of taurine, the model training uses the cross-entropy loss function; for the quantitative regression task of taurine, the model training uses the mean squared error loss function. Model parameters can be updated using the Adam optimizer, with an initial learning rate of 5 × 10^-4. To suppress overfitting under small sample conditions, L2 regularization can be introduced during training.

[0061] During model training, an early stopping mechanism based on validation set loss can also be used. If the validation set loss does not decrease within 20 consecutive rounds, training is terminated early, and the model weights corresponding to the lowest validation set loss are saved as the final detection model.

[0062] During the detection phase, near-infrared hyperspectral images of the cat food samples to be tested are acquired. These images undergo black-and-white correction, region-of-interest (ROI) average spectral extraction, and Savitzky-Golay smoothing preprocessing to obtain the input spectrum. This input spectrum is then fed into the trained SG-CCK deep learning model, which outputs the qualitative grading results and / or quantitative concentration results of taurine in the cat food samples.

[0063] Example 6 This embodiment illustrates the experimental verification results of the method of the present invention. For example... Figure 5 As shown, the performance of the SG-CCK deep learning model described in this invention was compared with that of SVM / SVR, Random Forest, XGBoost, Transformer and other comparative models.

[0064] In an experimental verification, a dataset was constructed using cat food samples with three different matrices, and multiple taurine concentration gradients were set, covering a range of 0% to 0.4%. After collecting near-infrared hyperspectral data for each sample, black-and-white correction, region-of-interest average spectrum extraction, and Savitzky-Golay smoothing preprocessing were performed according to the aforementioned method. The SG-CCK deep learning model described in this invention, along with comparative models such as SVM / SVR, Random Forest, XGBoost, and Transformer, were then used for classification and regression detection.

[0065] Experimental results show that the SG-CCK deep learning model described in this invention can detect taurine content under different cat food matrices. In complex matrix samples, the SG-CCK model exhibits higher classification accuracy and more stable regression prediction ability compared to the comparison model, indicating that the combination of SG preprocessing, multi-scale spectral domain feature extraction, convolutional spectral attention enhancement, and KAN nonlinear mapping can improve the extraction ability of weak spectral features of taurine in complex backgrounds.

[0066] Furthermore, such as Figure 6 As shown, interpretability analysis using the model's feature weight distribution reveals that the model assigns high weights to the feature band near 1420 nm, which corresponds to the first harmonic absorption characteristic of amino groups in nitrogen-containing organic matter and is related to the taurine molecular structure. Simultaneously, the model suppresses background interference such as oil features near 1210 nm and moisture features near 1450 nm. This demonstrates that the method described in this invention can enhance weak taurine-related signals and suppress irrelevant matrix background signals in complex cat food matrices, thereby improving the accuracy and stability of non-destructive detection of taurine in cat food.

[0067] Finally, it should be noted that the above descriptions are merely preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for detecting taurine in cat food based on hyperspectral imaging and an SG-CCK deep learning model, characterized in that, This includes the model training phase and the sample detection phase; The model training phase includes: Obtain near-infrared hyperspectral images of training samples of cat food with known taurine content; The near-infrared hyperspectral image is preprocessed with black and white correction, average spectrum extraction of the region of interest, and Savitzky-Golay smoothing algorithm to obtain the training input spectrum; Construct an SG-CCK deep learning model and train the SG-CCK deep learning model using the training input spectrum and the corresponding taurine content label; The sample testing phase includes: Acquire near-infrared hyperspectral images of the cat food sample to be tested; The near-infrared hyperspectral image of the cat food sample to be tested is preprocessed by black and white correction, average spectrum extraction of the region of interest, and Savitzky-Golay smoothing algorithm to obtain the input spectrum to be tested; The test spectrum is input into the trained SG-CCK deep learning model, which outputs the taurine detection results of the cat food sample to be tested. The SG-CCK deep learning model includes a multi-scale spectral domain feature extraction module, a convolutional spectral attention module, and a KAN nonlinear mapping module connected in sequence.

2. The method for detecting taurine in cat food according to claim 1, characterized in that, The spectral range of the near-infrared hyperspectral image is 900 nm to 1700 nm; The cat food training samples with known taurine content were prepared by adding taurine standard to different matrix cat food samples according to a preset addition ratio, wherein the preset addition ratio includes at least two of 0%, 0.05%, 0.1%, 0.2% and 0.4%; Before acquiring near-infrared hyperspectral images of the cat food training samples, the cat food samples and taurine standards were ground, sieved, and mixed.

3. The method for detecting taurine in cat food according to claim 1, characterized in that, The black-and-white correction includes: calculating the corrected hyperspectral image reflectance based on the reflectance of the original hyperspectral image, the reflectance of the white reference image, and the reflectance of the dark field reference image; The white reference image is obtained by using a white reference board, and the dark reference image is obtained by covering the camera lens. The corrected hyperspectral image reflectance is obtained by dividing the difference between the original hyperspectral image reflectance and the dark field reference image reflectance by the difference between the white board reference image reflectance and the dark field reference image reflectance.

4. The method for detecting taurine in cat food according to claim 1, characterized in that, The region of interest is the effective sample area of ​​the cat food sample in the corrected near-infrared hyperspectral image; The average spectrum is obtained by averaging the reflectance of each pixel in each band within the region of interest; The Savitzky-Golay smoothing algorithm smooths the spectrum through a sliding window and local polynomial fitting, and uses derivative transformation to correct baseline drift caused by uneven particle distribution in the sample.

5. The method for detecting taurine in cat food according to claim 1, characterized in that, The multi-scale spectral domain feature extraction module is used to extract multi-scale spectral features related to taurine in cat food samples along the spectral dimension. The multi-scale spectral domain feature extraction module includes a first one-dimensional convolutional layer, a second one-dimensional convolutional layer, and a third one-dimensional convolutional layer connected in sequence. The kernel size of the first one-dimensional convolutional layer is 7, and the number of output channels is 64. The kernel size of the second one-dimensional convolutional layer is 5, and the number of output channels is 128. The kernel size of the third one-dimensional convolutional layer is 3, and the number of output channels is 256. Each of the first, second, and third one-dimensional convolutional layers includes one-dimensional convolution operations, batch normalization, linear rectified activation, and max pooling.

6. The method for detecting taurine in cat food according to claim 1, characterized in that, The convolutional spectral attention module is used to perform weight calibration on the multi-scale spectral features through spectral channel attention and spatial attention, so as to enhance taurine-related features and suppress background interference from cat food matrix. The convolutional spectral attention module includes spectral channel attention units and spatial attention units; The spectral channel attention unit is used to perform one-dimensional global average pooling on the input features to obtain channel descriptors, and to generate spectral channel weights through a bottleneck structure. The spatial attention unit is used to perform a one-dimensional convolution operation on the features after weighting the spectral channel weights to obtain spatial weights. The convolutional spectral attention module applies the spectral channel weights and the spatial weights to the input features to obtain attention-enhanced features; The bottleneck structure has a reduction rate of 4, and the one-dimensional convolution kernel size in the spatial attention unit is 7.

7. The method for detecting taurine in cat food according to claim 1, characterized in that, The KAN nonlinear mapping module is used to map the weighted calibrated spectral features into taurine detection results; The KAN nonlinear mapping module includes a flattening unit, a first KAN layer, a second KAN layer, and an output layer; The flattening unit is used to flatten the attention-enhancing features output by the convolutional spectral attention module into a one-dimensional feature vector; The first KAN layer has 512 hidden units, and the second KAN layer has 128 hidden units. Both the first KAN layer and the second KAN layer use learnable nonlinear functions set on the connection edges of neurons for feature mapping, and the learnable nonlinear functions are third-order polynomial basis functions; A batch normalization layer, a linear rectification activation layer, and a Dropout layer are set after the first KAN layer, and the dropout probability of the Dropout layer is 0.

3. A batch normalization layer and a linear rectification activation layer are set after the second KAN layer.

8. The method for detecting taurine in cat food according to claim 1, characterized in that, The model training phase also includes: dividing the training samples using a five-fold cross-validation strategy; In each fold cross-validation, standardized parameters are fitted using only the training fold, and these standardized parameters are applied to both the training and validation folds. When training the SG-CCK deep learning model, the cross-entropy loss function is used for the classification task, the mean squared error loss function is used for the regression task, and the Adam optimizer is used to update the model parameters. The Adam optimizer has an initial learning rate of 5×10^-4 and L2 regularization is introduced during training.

9. The method for detecting taurine in cat food according to claim 1, characterized in that, An early stopping mechanism is used when training the SG-CCK deep learning model; Training is terminated when the validation set loss does not decrease within 20 consecutive rounds, and the model weights corresponding to the lowest validation set loss are saved.

10. The method for detecting taurine in cat food according to claim 7, characterized in that, The output layer is used to output the taurine detection results; The taurine detection results include the taurine concentration level of the cat food sample and / or the predicted taurine concentration value of the cat food sample.