Method for detecting rabbit meat grade based on hyperspectral imaging technology
Through hyperspectral imaging technology and convolutional neural network models, the problem of traditional rabbit meat grade assessment methods that are time-consuming and labor-intensive and subject to subjective differences has been solved, accurate and automatic detection of rabbit meat grade has been achieved, and the efficiency and accuracy of assessment have been improved.
Patent Information
- Application Number
- CN202410661590.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-27
- Publication Date
- 2024-09-03
AI Technical Summary
The traditional rabbit meat grade assessment method requires a lot of time and human resources, and there are subjective differences, resulting in inaccurate assessment results.
Hyperspectral imaging technology and convolutional neural network model are used to obtain rabbit meat hyperspectral data for preprocessing and training to build a rabbit meat grade detection model to achieve automated grade detection.
Hyperspectral imaging technology captures multi-wavelength spectral information, combined with the feature extraction capabilities of convolutional neural networks, to achieve accurate automatic detection and classification of rabbit meat grades, reducing manual intervention and improving assessment efficiency and accuracy.
Smart Images

Figure CN118583791A
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of spectral image processing, and in particular relates to a method for detecting rabbit meat grade based on hyperspectral imaging technology. Background Art
[0002] Rabbit meat grading ensures that the product consumers purchase meets certain quality standards. This helps to ensure the taste, texture and nutritional value of rabbit meat. Through the grading system, consumers can have a clearer understanding of the quality of rabbit meat. This transparency helps to build trust and consumers can make purchasing decisions more easily. In addition, different grades of rabbit meat may have different market values. The grading system can help producers and consumers determine a reasonable price for rabbit meat, while also promoting the normal functioning of the market.
[0003] Traditional rabbit meat grading may require more time and human resources, and the process of human subjective judgment may have errors, especially when there are subjective differences or inconsistent experience levels among assessors. This may lead to differences between different assessment results and affect the accurate assessment of rabbit meat quality. Therefore, an intelligent rabbit meat grading method is urgently needed to solve the above problems. Summary of the invention
[0004] In order to solve the above technical problems, the present invention proposes a method for detecting the grade of rabbit meat based on hyperspectral imaging technology to solve the problems existing in the above prior art.
[0005] To achieve the above object, the present invention provides a method for detecting the grade of rabbit meat based on hyperspectral imaging technology, comprising:
[0006] Obtaining a rabbit meat sample, collecting data on the rabbit meat sample, and obtaining rabbit meat hyperspectral data;
[0007] Preprocessing the rabbit meat hyperspectral data to obtain a rabbit meat hyperspectral data set;
[0008] Constructing a convolutional neural network model, inputting the rabbit meat hyperspectral data set into the convolutional neural network model for training, and obtaining a rabbit meat grade detection model;
[0009] The hyperspectral data of the rabbit meat to be detected is acquired in real time, and the hyperspectral data of the rabbit meat to be detected is input into the rabbit meat grade detection model for calculation to obtain the rabbit meat grade.
[0010] Preferably, the process of obtaining a rabbit meat sample, collecting data on the rabbit meat sample, and obtaining rabbit meat hyperspectral data includes:
[0011] Set the hyperspectral camera to cover the required wavelength range of 400-2500 nm;
[0012] Rabbit meat samples of different grades are prepared, and the rabbit meat samples are imaged by a set hyperspectral camera to obtain the rabbit meat hyperspectral data.
[0013] Preferably, the process of obtaining the rabbit meat hyperspectral dataset comprises:
[0014] Correcting the rabbit meat hyperspectral data to generate correction data;
[0015] Key spectral features in the correction data are marked to generate the rabbit meat hyperspectral data set.
[0016] Preferably, the rabbit meat hyperspectral data is corrected, and the process of generating the corrected data includes:
[0017] Acquiring background data of dark current, performing signal extraction on the background data of dark current, and obtaining characteristics of dark current signal;
[0018] Performing dark current correction on the rabbit meat hyperspectral data according to the characteristics of the dark current signal to obtain dark current correction data;
[0019] Acquiring spectral data reflected from a standard white surface, and processing the spectral data reflected from the standard white surface to obtain white balance coefficients at each wavelength;
[0020] The dark current correction data is weightedly corrected by using the white balance coefficients at each wavelength to obtain the correction data.
[0021] Preferably, the key spectral features in the correction data include spectral range, spectral resolution and spectral feature index;
[0022] The spectral range includes the visible light region, the near infrared region and the short-wave infrared region;
[0023] The spectral characteristic indicators include moisture indicators, fat and protein indicators, and sugar and cellulose indicators.
[0024] Preferably, the process of constructing a convolutional neural network model, inputting the rabbit meat hyperspectral data set into the convolutional neural network model for training, and obtaining a rabbit meat grade detection model includes:
[0025] Constructing a convolutional network model, replacing the convolutional layer of the convolutional network model with a depthwise separable convolution, and connecting batch normalization and an activation function after the depthwise separable convolution to obtain an improved convolutional neural network;
[0026] The rabbit meat hyperspectral dataset is labeled with level labels and auxiliary attributes and then divided to generate a training set and a test set;
[0027] Constructing a composite loss function, wherein the composite loss function is obtained based on regression loss and classification loss;
[0028] Dividing the tasks of the improved convolutional neural network model into regression tasks and classification tasks, training the improved convolutional neural network using the training set until the loss function converges, and obtaining a training model;
[0029] Testing the training model using a test set to obtain a test result;
[0030] Based on the test results, the hyperparameters and learning rate of the relative weights between the two losses of the improved convolutional neural network are adjusted, and retraining is performed to obtain the rabbit meat grade detection model.
[0031] Preferably, the expression of the composite loss function is:
[0032] total_loss=classification_loss+alpha*regression_loss;
[0033] Among them, total_loss is the composite loss function, classification_loss is the classification loss, regression_loss is the regression loss, and alpha is the hyperparameter that adjusts the relative weight between the two losses.
[0034] Preferably, the process of obtaining the rabbit meat grade comprises:
[0035] Acquire the hyperspectral data of the rabbit meat to be detected, input the hyperspectral data of the rabbit meat to be detected into the rabbit meat grade detection model for calculation, and obtain the calculation result;
[0036] The confidence of the calculation result is corrected to obtain the rabbit meat grade.
[0037] Compared with the prior art, the present invention has the following advantages and technical effects:
[0038] The hyperspectral imaging technology in the present invention can capture spectral information at multiple wavelengths, providing rich spectral features for each pixel. These features can provide detailed information about the texture, water content, fat content, etc. of rabbit meat, which helps to more accurately distinguish different grades of rabbit meat. : Convolutional neural networks have excellent feature extraction capabilities when processing image data and can effectively capture spatial features in images. By combining hyperspectral images with CNN, spectral and spatial features can be used simultaneously to more comprehensively describe the characteristics of rabbit meat samples and achieve automatic detection and classification of rabbit meat grades without human intervention. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0040] Figure 1 This is a flow chart of a method for detecting rabbit meat grade based on hyperspectral imaging technology according to an embodiment of the present invention. DETAILED DESCRIPTION
[0041] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0042] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0043] Embodiment 1
[0044] like Figure 1 As shown, this embodiment provides a method for detecting the grade of rabbit meat based on hyperspectral imaging technology, comprising:
[0045] Obtaining a rabbit meat sample, collecting data on the rabbit meat sample, and obtaining rabbit meat hyperspectral data;
[0046] Preprocessing the rabbit meat hyperspectral data to obtain a rabbit meat hyperspectral data set;
[0047] Constructing a convolutional neural network model, inputting the rabbit meat hyperspectral data set into the convolutional neural network model for training, and obtaining a rabbit meat grade detection model;
[0048] The hyperspectral data of the rabbit meat to be detected is acquired in real time, and the hyperspectral data of the rabbit meat to be detected is input into the rabbit meat grade detection model for calculation to obtain the rabbit meat grade.
[0049] The scheme is further optimized, rabbit meat samples are obtained, data is collected on the rabbit meat samples, and the process of obtaining rabbit meat hyperspectral data includes:
[0050] Set the hyperspectral camera to cover the required wavelength range of 400-2500 nm;
[0051] The wavelength range is set based on:
[0052] Visible light region (approximately 400-700 nm): In this region, hyperspectral data can capture color changes in rabbit meat, which are related to the content and oxidation state of hemoglobin and myoglobin.
[0053] Near-infrared region (approximately 700-1000 nm): In this region, hyperspectral data mainly reflect the content of water and protein.
[0054] Short-wave infrared region (approximately 1000-2500 nanometers): Spectral data in this region can reveal more information about fat, water, protein and other chemical components.
[0055] Spectral resolution:
[0056] Spectral resolution describes the ability of a device to distinguish different wavelengths, usually measured in nanometers. Higher spectral resolution means that subtle changes in wavelength can be measured more accurately, allowing different material components to be identified more accurately.
[0057] Spectral characteristic indicators:
[0058] Moisture indicators: Such as the first and second water bands (around 960 and 1200 nanometers), these bands are often used to estimate the moisture content in meat.
[0059] Fat and protein indicators: With absorption peaks at 1450 nm and 1740 nm, these wavelengths can help identify fat and protein levels in meat.
[0060] Other biochemical components such as sugars and cellulose may also exhibit absorption characteristics in specific bands.
[0061] Rabbit meat samples of different grades are prepared, and the rabbit meat samples are imaged by a set hyperspectral camera to obtain the rabbit meat hyperspectral data.
[0062] Further optimizing the scheme, the process of obtaining the rabbit meat hyperspectral dataset includes:
[0063] Correcting the rabbit meat hyperspectral data to generate correction data;
[0064] Key spectral features in the correction data are marked to generate the rabbit meat hyperspectral data set.
[0065] The scheme is further optimized to correct the rabbit meat hyperspectral data. The process of generating the corrected data includes:
[0066] Acquiring background data of dark current, performing signal extraction on the background data of dark current, and obtaining characteristics of dark current signal;
[0067] Performing dark current correction on the rabbit meat hyperspectral data according to the characteristics of the dark current signal to obtain dark current correction data;
[0068] Acquiring spectral data reflected from a standard white surface, and processing the spectral data reflected from the standard white surface to obtain white balance coefficients at each wavelength;
[0069] The dark current correction data is weightedly corrected by using the white balance coefficients at each wavelength to obtain the correction data.
[0070] Specifically
[0071] Collect background data for dark current correction. This data should include images taken by the camera without any light source to capture the dark current signal generated by the sensor.
[0072] Process the collected background data to extract the characteristics of the dark current signal. This may involve calculating the average dark current value for each pixel in the image or building a dark current model.
[0073] In the rabbit meat hyperspectral data, the resulting dark current signal is used for correction. This can be achieved by subtracting the dark current signal from the rabbit meat data to offset the effect of the dark current.
[0074] Collect reference data for white balance correction. This data can be spectral data reflected from a standard white surface to determine the white reference value at different wavelengths.
[0075] The collected reference data is processed to determine the white balance coefficient or reference value at each wavelength.
[0076] In the rabbit hyperspectral data, correction is performed using white balance coefficients or reference values. This is achieved by weighting or adjusting the rabbit data by wavelength so that it reflects a color that matches a white reference at each wavelength.
[0077] Further optimizing the scheme, the key spectral features in the correction data include spectral range, spectral resolution and spectral feature index;
[0078] The spectral range includes the visible light region, the near infrared region and the short-wave infrared region;
[0079] The spectral characteristic indicators include moisture indicators, fat and protein indicators, and sugar and cellulose indicators.
[0080] Further optimizing the scheme, the process of constructing a convolutional neural network model, inputting the rabbit meat hyperspectral data set into the convolutional neural network model for training, and obtaining a rabbit meat grade detection model includes:
[0081] Constructing a convolutional network model, replacing the convolutional layer of the convolutional network model with a depthwise separable convolution, and connecting batch normalization and an activation function after the depthwise separable convolution to obtain an improved convolutional neural network;
[0082] In the depthwise convolution step, a convolution kernel is applied to each channel of the input feature map. This means that if the input feature map has (D) channels, then (D) different convolution kernels will be used, each of which slides and is calculated only on the corresponding single input channel, generating (D) single-channel feature maps.
[0083] Compared with traditional convolution, this method greatly reduces the number of parameters and computational complexity because it does not require convolution calculations between channels.
[0084] Point-wise convolution uses a 1x1 convolution kernel to process the output of depthwise convolution. The purpose of this step is to combine the features of each channel generated by depthwise convolution.
[0085] In this way, the relationship between features extracted from different channels can be learned, effectively increasing the depth and nonlinear expression ability of the network while keeping the number of parameters and computation relatively low.
[0086] When designing a network, the traditional convolutional layer (usually a 3x3 or larger convolution kernel) can be replaced with a depth-wise separable convolutional layer.
[0087] The depthwise separable convolutional layer is connected with batch normalization and activation functions (such as ReLU) to help stabilize network training and improve nonlinear capabilities.
[0088] The rabbit meat hyperspectral dataset is labeled with level labels and auxiliary attributes and then divided to generate a training set and a test set;
[0089] Constructing a composite loss function, wherein the composite loss function is obtained based on regression loss and classification loss;
[0090] Dividing the tasks of the improved convolutional neural network model into regression tasks and classification tasks, training the improved convolutional neural network using the training set until the loss function converges, and obtaining a training model;
[0091] Testing the training model using a test set to obtain a test result;
[0092] Based on the test results, the hyperparameters and learning rate of the relative weights between the two losses of the improved convolutional neural network are adjusted, and retraining is performed to obtain the rabbit meat grade detection model.
[0093] Specifically:
[0094] Give each rabbit meat sample a clear grade label (classification task) and annotate some auxiliary attributes, such as water content, fat content, etc. (regression task).
[0095] The dataset is divided into training set, validation set and test set to ensure that the distribution of each level and auxiliary attribute in each dataset is consistent.
[0096] Design or use a deep neural network as a feature extractor (e.g., ResNet, VGG, 1D / 2D convolutional network, etc.), input hyperspectral data into the network and extract high-level feature representations.
[0097] Multi-task learning branch:
[0098] Classification branch: Output branch for rabbit meat grade classification.
[0099] Auxiliary attribute regression branch: Output branch used to predict auxiliary attributes, such as moisture, fat content, etc. Using Python as a tool, the code for the combined network architecture is:
[0100]
[0101] The composite loss function design includes:
[0102] Classification loss: Use cross entropy loss function or Focal Loss for training of hierarchical classification tasks.
[0103] Regression loss: Use mean squared error (MSE) or mean absolute error (MAE) as the loss function for auxiliary attribute regression.
[0104] Using Python as a technical means, the code for the composite loss function is:
[0105]
[0106] Among them, alpha is a hyperparameter that adjusts the relative weight between the two losses and needs to be adjusted during the training process.
[0107] The training process includes:
[0108]
[0109]
[0110] Then adjust parameters such as alpha and learning rate based on the performance on the validation set to find the best combination.
[0111] Verify the performance of the model on the test set, including classification accuracy and regression indicators (such as MSE or MAE). Evaluate the effect of multi-task learning strategy on improving the overall model performance.
[0112] Further optimizing the scheme, the expression of the composite loss function is:
[0113] total_loss=classification_loss+alpha*regression_loss;
[0114] Among them, total_loss is the composite loss function, classification_loss is the classification loss, regression_loss is the regression loss, and alpha is the hyperparameter that adjusts the relative weight between the two losses.
[0115] Further optimizing the scheme, the process of obtaining the rabbit meat grade includes:
[0116] Acquire the hyperspectral data of the rabbit meat to be detected, input the hyperspectral data of the rabbit meat to be detected into the rabbit meat grade detection model for calculation, and obtain the calculation result;
[0117] The confidence of the calculation result is corrected to obtain the rabbit meat grade.
[0118] The above are only preferred specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for detecting the grade of rabbit meat based on hyperspectral imaging technology, characterized in that: The following steps are involved: Obtaining a rabbit meat sample, collecting data on the rabbit meat sample, and obtaining rabbit meat hyperspectral data; Preprocessing the rabbit meat hyperspectral data to obtain a rabbit meat hyperspectral data set; Constructing a convolutional neural network model, inputting the rabbit meat hyperspectral data set into the convolutional neural network model for training, and obtaining a rabbit meat grade detection model; The hyperspectral data of the rabbit meat to be detected is acquired in real time, and the hyperspectral data of the rabbit meat to be detected is input into the rabbit meat grade detection model for calculation to obtain the rabbit meat grade.
2. The method for detecting the grade of rabbit meat based on hyperspectral imaging technology according to claim 1, characterized in that: The process of obtaining a rabbit meat sample, collecting data on the rabbit meat sample, and obtaining rabbit meat hyperspectral data includes: Set the hyperspectral camera to cover the required wavelength range of 400-2500 nm; Rabbit meat samples of different grades are prepared, and the rabbit meat samples are imaged by a set hyperspectral camera to obtain the rabbit meat hyperspectral data.
3. The method for detecting the grade of rabbit meat based on hyperspectral imaging technology according to claim 1, characterized in that: The process of obtaining the rabbit meat hyperspectral dataset includes: Correcting the rabbit meat hyperspectral data to generate correction data; Key spectral features in the correction data are marked to generate the rabbit meat hyperspectral data set.
4. The method for detecting the grade of rabbit meat based on hyperspectral imaging technology according to claim 3, characterized in that: The process of correcting the rabbit meat hyperspectral data and generating the corrected data includes: Acquiring background data of dark current, performing signal extraction on the background data of dark current, and obtaining characteristics of dark current signal; Performing dark current correction on the rabbit meat hyperspectral data according to the characteristics of the dark current signal to obtain dark current correction data; Acquiring spectral data reflected from a standard white surface, and processing the spectral data reflected from the standard white surface to obtain white balance coefficients at each wavelength; The dark current correction data is weightedly corrected by using the white balance coefficients at each wavelength to obtain the correction data.
5. The method for detecting the grade of rabbit meat based on hyperspectral imaging technology according to claim 3, characterized in that: The key spectral features in the calibration data include spectral range, spectral resolution and spectral feature index; The spectral range includes the visible light region, the near infrared region and the short-wave infrared region; The spectral characteristic indicators include moisture indicators, fat and protein indicators, and sugar and cellulose indicators.
6. The method for detecting rabbit meat grade based on hyperspectral imaging technology according to claim 1, characterized in that: The process of constructing a convolutional neural network model, inputting the rabbit meat hyperspectral data set into the convolutional neural network model for training, and obtaining a rabbit meat grade detection model includes: Constructing a convolutional network model, replacing the convolutional layer of the convolutional network model with a depthwise separable convolution, and connecting batch normalization and an activation function after the depthwise separable convolution to obtain an improved convolutional neural network; The rabbit meat hyperspectral dataset is labeled with level labels and auxiliary attributes and then divided to generate a training set and a test set; Constructing a composite loss function, wherein the composite loss function is obtained based on regression loss and classification loss; Dividing the tasks of the improved convolutional neural network model into regression tasks and classification tasks, training the improved convolutional neural network using the training set until the loss function converges, and obtaining a training model; Testing the training model using a test set to obtain a test result; Based on the test results, the hyperparameters and learning rate of the relative weights between the two losses of the improved convolutional neural network are adjusted, and retraining is performed to obtain the rabbit meat grade detection model.
7. The method for detecting rabbit meat grade based on hyperspectral imaging technology according to claim 6, characterized in that: The expression of the composite loss function is: total_loss=classification_loss+alpha*regression_loss; Among them, total_loss is the composite loss function, classification_loss is the classification loss, regression_loss is the regression loss, and alpha is the hyperparameter that adjusts the relative weight between the two losses.
8. The method for detecting rabbit meat grade based on hyperspectral imaging technology according to claim 1, characterized in that: The process of obtaining the rabbit meat grade includes: Acquire the hyperspectral data of the rabbit meat to be detected, input the hyperspectral data of the rabbit meat to be detected into the rabbit meat grade detection model for calculation, and obtain the calculation result; The confidence of the calculation result is corrected to obtain the rabbit meat grade.
Citation Information
Cited By
Method for establishing rapid prediction of important quality indexes of green soy beans based on near infrared spectrum and deep learning
CN119517204A
Pork flavor nondestructive testing method, device, equipment and medium
CN121141545A
