Method for discriminating chicken breast with white grain and wood symbiosis defect based on hyperspectral microscopic imaging technology

Through hyperspectral microscopy imaging technology and deep learning algorithms, the accuracy and efficiency of detection of white grain and wood defects in chicken breasts are solved, and high-precision classification and distribution visualization of white grain and wood meat are realized.

CN119901743APending Publication Date: 2025-04-29NANJING FORESTRY UNIV
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411973650.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-04-29

AI Technical Summary

Technical Problem

When detecting white grain and wood defects in chicken breasts, the prior art has poor accuracy, strong subjectivity and low efficiency, and it is impossible to effectively identify white grain wood symbiotic defects.

Method used

Hyperspectral microscopy imaging technology combined with deep learning algorithms is used to obtain and process hyperspectral microscopy images of chicken breasts, extract texture features and feature wavelengths, and classify defect categories and levels using Transformer multi-task learning model.

Benefits of technology

It realizes high-precision classification of white grains and wooden meat, improves detection efficiency and accuracy, and can intuitively display the defect distribution in the samples, making up for the shortcomings of traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119901743A_ABST
    Figure CN119901743A_ABST
Patent Text Reader

Abstract

The invention discloses a method for discriminating chicken breast with a white line and wood symbiosis defect based on a hyperspectral microscopic imaging technology, which comprises the following steps: acquiring normal meat, white line meat, wood meat and white line and wood symbiosis chicken breast samples, and cutting the samples into microsections; building a hyperspectral microscopic imaging system, and collecting and correcting microscopic spectral data; extracting a region of interest by using an image processing algorithm; performing defect grade labeling on each region of interest; extracting texture features of the microscopic hyperspectral image of each region of interest; selecting the characteristic wavelength of the spectral data in each region of interest; the obtained spectral data under the characteristic wavelength of each region of interest is fused with image texture features to serve as the input of a model, the defect category and defect grade score of the corresponding region of interest serve as the output of the model, and a Transform model is established and trained; compared with the existing visual and palpation methods, the method provided by the invention has the advantages of high accuracy and high efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of nondestructive detection of meat quality, and in particular to a method for distinguishing chicken breast meat with white-grain wood symbiosis defects based on hyperspectral microscopy imaging technology. Background Art

[0002] Chicken meat is one of the main sources of meat for humans, with high protein content, low fat content, rich nutrition and easy processing. It accounts for more than 90% of the consumption share of the poultry meat market. With the improvement of living standards, people's dietary consumption concepts have gradually changed from quantity requirements to quality pursuits, and the requirements for chicken quality have become higher and higher. At present, most poultry meat industries pursue fast-growing breeding, but with it comes a series of muscle defect problems, among which the more serious ones are white stripes (WS) and wooden breast (WB). White stripes appear on the surface of the meat, with a large number of white stripes parallel to the direction of the muscle fibers, and mostly appear on the pectoral and leg muscles. Wooden meat is characterized by a hard texture, with an obvious hard part in the front of the chicken breast, a ridge-like protrusion at the tail, and thicker than normal chicken breast. Histologically, it shows fiber hardening, which is currently only found in the pectoral muscles. Studies have found that white stripes and wooden defects often occur together, and the edible quality level is so low that it can only be discarded, causing huge economic losses to the poultry industry. Currently, the evaluation of white grain and wood is mostly done by visual and palpation methods, which have the disadvantages of poor accuracy, strong subjectivity and low efficiency. Therefore, there is an urgent need to develop a fast and accurate identification method.

[0003] As an emerging nondestructive testing method with great potential, hyperspectral microscope imaging (HMI) technology integrates hyperspectral imaging and microscopic imaging to achieve a spatial resolution of micrometers. In terms of the detection of white grain and wood defects, it can observe the fat characteristics of the white grain area and the hardened fiber characteristics of the wood area, and can focus on the area of ​​interest in the sample, so as to find specific wavelengths according to the specific spectral characteristics of its distribution area, and realize the accurate classification of white grain, wood and symbiotic defects. In addition, the micrometer-level spatial distribution of spectral characteristics can be displayed through pseudo-color images, which can more intuitively show the distribution of white grain, wood and symbiotic areas in the sample. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide a method for distinguishing chicken breast with white-grain wood symbiosis defects based on hyperspectral microscopy technology in response to the deficiencies of the above-mentioned prior art. Compared with the existing methods using visual inspection and palpation, the method for distinguishing chicken breast with white-grain wood symbiosis defects based on hyperspectral microscopy technology has high accuracy and efficiency.

[0005] In order to achieve the above technical objectives, the technical solution adopted by the present invention is:

[0006] A method for distinguishing chicken breast meat with white-grain wood symbiosis defects based on hyperspectral microscopy technology comprises the following steps:

[0007] Step 1: Obtain a sufficient number of normal meat, white-grained meat, woody meat and white-grained woody symbiotic chicken breast meat samples, and cut the samples into microscopic slices of uniform size;

[0008] Step 2: Build a hyperspectral microscopy imaging system to collect and correct microspectral data;

[0009] Step 3: Use image processing algorithms to extract the region of interest;

[0010] Step 4: Label the defect category and defect grade score for each region of interest;

[0011] Step 5: Extract texture features from the microscopic hyperspectral image of each region of interest;

[0012] Step 6: Select characteristic wavelengths of the spectral data in each region of interest;

[0013] Step 7: The average spectral data at the characteristic wavelength of each region of interest is fused with the image texture features as the input of the Transformer multi-task learning model, and the defect category and defect grade score of the corresponding region of interest are used as the output of the Transformer multi-task learning model. The Transformer multi-task learning model is established and trained;

[0014] Step 8: Collect the microscopic hyperspectral image of the chicken breast with white-grain wood symbiosis defects to be tested and extract the spectral information of each pixel at its characteristic wavelength. Input the spectral information of each pixel at the characteristic wavelength into the trained Transformer multi-task learning model. The model outputs the classification result of each pixel, indicating the defect category and defect grade score of the pixel, whether it belongs to woody meat or white-grain meat.

[0015] As a further improved technical solution of the present invention, the step 1 is specifically as follows:

[0016] Step 1.1: Use visual inspection and palpation to identify and select normal meat, white-grained meat, woody meat, and white-grained and woody chicken breast meat samples to ensure the diversity of subsequent sliced ​​samples.

[0017] Step 1.2: Cut the chicken sample into microscopic slices of uniform size and check the flatness and integrity of the sample under a microscope to ensure that there is no damage or air bubbles.

[0018] As a further improved technical solution of the present invention, the step 2 is specifically as follows:

[0019] Step 2.1: Build a hyperspectral microscopy system, which consists of a portable hyperspectral imager (SOC710VP), an upright microscope (NE910) and a computer. The imaging spectrometer is equipped with two built-in CCD cameras with a resolution of 4.69nm, a band number of 256, and a translation push scanning method; the microscope is equipped with a 75W adjustable halogen tungsten lamp and a 40x objective lens magnification; the computer is equipped with spectrum acquisition and correction software (Hyper Scanner_2.0.127 and SRAnal710e) for the acquisition, correction and storage of spectral data. Before data acquisition, the hyperspectral microscopy system was preheated for 20 minutes to ensure the stability of data acquisition and the uniformity of illumination.

[0020] Step 2.2: The original microscopic hyperspectral image R raw Perform black and white correction to obtain the corrected microscopic hyperspectral image R fianl , the calculation formula is as follows (1). That is, turn off the light source, collect the dark field image D in the microscopic field of view, place the standard white board on the focal plane of the microscope system, adjust the light source intensity and focus of the microscope, and collect the white reference image W after ensuring that the white board completely fills the field of view.

[0021]

[0022] As a further improved technical solution of the present invention, the step 3 is specifically:

[0023] The microscopic hyperspectral image obtained after step 2.2 is segmented into multiple regions of interest using the K-means clustering algorithm. The core of the K-means clustering algorithm is to iteratively optimize the category assignment of each pixel and the update of the cluster center by minimizing the objective function. The specific method is as follows:

[0024] According to the preliminary classification of chicken breast into different categories (normal meat, white meat and woody meat), the number of clusters K is set to 3, and 3 sample points are randomly selected in the data matrix V as the initial cluster centers:

[0025] u1,u2,u3∈R k (2);

[0026] Among them, u1, u2, u3 are the coordinates of the three initial cluster centers, R k is a k-dimensional real number space.

[0027] For each pixel point, the spectral vector v i , calculate its Euclidean distance to each cluster center:

[0028] d ij =||v i -u j || 2 ,j∈{1,2,3} (3);

[0029] Among them, v i is the spectral vector of the i-th pixel, u j Represents the spectral vector of the j-th cluster center.

[0030] The spectral vector v of the pixel point i Assign to the category of the nearest cluster center:

[0031]

[0032] Among them, c i Indicates the cluster category label to which the i-th pixel belongs. It means to find the value of j such that d ij Minimum, that is, the spectral vector v for a given pixel i , find a spectral vector u of the cluster center j , so that the sample v i to u j The Euclidean distance d ij Minimum.

[0033] According to the currently assigned category, the average spectral vector of each category is calculated and the cluster center is updated so that each cluster center better represents all the pixels it contains:

[0034]

[0035] Among them, C j is the collection of pixel samples of the jth category, n j For Collection C j The number of pixels in .

[0036] If the update amplitude of the cluster center is less than the threshold e, the clustering process is considered to have converged and the iteration can be stopped; otherwise, return to formula (3) and continue the clustering process:

[0037]

[0038] Among them, t is the number of iterations, u j (t) is the cluster center of the j-th type pixel sample set after t iterations, u j (t-1) is the cluster center of the j-type pixel sample set after t-1 iterations.

[0039] As a further improved technical solution of the present invention, the step 4 is specifically as follows:

[0040] Based on the reflectance threshold of the key band, determine whether a pixel is a fat pixel or a hardened fiber pixel. For white-grained meat, the reflectance of the spectral curve at the band of 930nm (fat-sensitive band) is 0.35 as the threshold. The reflectance greater than 0.35 is defined as a fat pixel, and the reflectance less than or equal to 0.35 is defined as a non-fat pixel. The number of fat pixels in each region of interest (N) obtained in step 3 is z ) divided by the total number of pixels in the region of interest (N a ) to obtain the fat percentage P z , as shown in formula (7):

[0041]

[0042] The defect level scores were evaluated with 0.2, 0.4, and 0.6 as thresholds, respectively. z The meat between 0 and 0.2 is normal (score is 0), P z The meat with white grain between 0.2-0.4 is slightly white grain (score 1), P z The meat with white grain between 0.4 and 0.6 is moderate (score 2). z Between 0.6-1 is severe white meat (score 3).

[0043] For wood fiber, the reflectance of the spectrum curve at 850nm (hardened fiber sensitive band) was set as the threshold value, and the reflectance greater than 0.48 was defined as hardened fiber pixels, and the reflectance less than or equal to 0.48 was defined as non-hardened fiber pixels. The number of hardened fiber pixels (N) in each region of interest obtained in step 3 was calculated. x ) divided by the total number of pixels in the region of interest (N a ) to obtain the proportion of hardened fibers P x , as shown in formula (8):

[0044]

[0045] The defect level scores were evaluated with 0.2, 0.4, and 0.6 as thresholds, respectively. x The meat between 0 and 0.2 is normal (score is 0), P x The meat with a score between 0.2 and 0.4 is lightly woody (score 1), x The woodiness is moderate (score is 2) between 0.4 and 0.6. x Between 0.6 and 1 is considered heavily woody (score 3).

[0046] As a further improved technical solution of the present invention, the step 5 is specifically as follows:

[0047] The gray level difference matrix (GLDM) is used to extract texture information features such as average gray difference, gray difference variance, gray contrast, gray difference entropy and energy from the region of interest obtained in step 4.

[0048] As a further improved technical solution of the present invention, the step 6 is specifically as follows:

[0049] The competitive adaptive reweighted sampling (CARS) method is used to screen the characteristic wavelengths of the region of interest obtained in step 4. The specific method is as follows:

[0050] First, initialize: the initial wavelength set is recorded as S0, the purpose is to select the wavelength set S0 that has the most influence on the prediction of sample label y from the entire spectral data matrix X as the starting point for subsequent iterations;

[0051]

[0052] X0=X[:,S0](10);

[0053] Among them, X[:, S0] refers to all sample rows in the original spectral matrix X composed of all regions of interest in all samples and all columns corresponding to wavelengths in the wavelength set S0, that is, X0 is a column corresponding to m wavelengths in the initially selected wavelength set S0 including all sample rows in the original spectral matrix X. X is the original spectral matrix of all samples (assuming the size is n×p). y is the category score of the region of interest (assuming the size is n×1). Among them, n is the total number of all regions of interest in all samples. According to this formula, the regression coefficient vector w0 can be obtained;

[0054] Assume that there are m wavelengths in the initially saved wavelength set S0, then find the wavelengths corresponding to the first m values ​​of the regression coefficient absolute values ​​in the regression coefficient vector w0 arranged from large to small to form the wavelength set S0;

[0055] Evaluate the relative importance of each wavelength in the current vector w0 to determine its contribution in the model:

[0056]

[0057] w 0,j is the regression coefficient of the jth wavelength in vector w0, p 0,j is the importance weight of the jth wavelength in iteration 0.

[0058] The number of wavelengths r0 that need to be retained is calculated through the exponential decay function. These wavelengths will gradually decrease with the increase of iterations, so as to gradually eliminate wavelengths with less influence:

[0059] r0=round(m·exp(-λ·0))(12);

[0060] Where m is the number of wavelengths initially retained, λ is the exponential decay coefficient, which is used to control the decay rate of the number of wavelengths retained as the iteration proceeds, 0 is 0 iterations, exp is the exponential decay function, which is used to calculate the decay rate of the number of wavelengths based on the iteration number 0 and the decay coefficient λ, and round is the rounding function, which converts the result after the decay calculation to an integer to ensure that the number of wavelengths retained is in integer form.

[0061] By weight p 0,j Arrange in descending order, retain the first r0 wavelengths, and eliminate the rest;

[0062] S k =top-r0(p 0,j ), k=1(13);

[0063] Among them, S k (k=0) is the set of wavelengths retained after 0 iterations, which contains the indices of the most important r0 wavelengths, top-r0(p 0,j ) refers to the 0,j Select r0 most important wavelengths.

[0064] Start iteration:

[0065] X k =X[:,S k ],k≥2(14);

[0066]

[0067] Construct the spectral submatrix X k ,X[:,S k ] refers to selecting all sample rows and S in the original spectral matrix X composed of all regions of interest in all samples k All columns corresponding to wavelengths in the wavelength set;

[0068] Evaluate each wavelength in the current vector w k , to determine its contribution in the model:

[0069]

[0070] w k,j is the regression coefficient vector w k The regression coefficient of the jth wavelength ink,j is the importance weight of the jth wavelength in the kth iteration;

[0071] The number of wavelengths r that need to be retained in the current iteration k is calculated using the exponential decay function. k The number of these wavelengths is gradually reduced with each iteration, in order to phase out less influential wavelengths:

[0072] r k =round(m·exp(-λ·k))(17);

[0073] Where m is the number of wavelengths initially retained, λ is the exponential decay coefficient, which is used to control the decay rate of the number of wavelengths retained as the iteration proceeds, k is the current number of iterations, exp is the exponential decay function, which is used to calculate the decay rate of the number of wavelengths according to the number of iterations k and the decay coefficient λ, and round is the rounding function, which converts the result after the attenuation calculation into an integer to ensure that the number of wavelengths retained is in integer form;

[0074] The vector w k The wavelength in the k,j Sort in descending order, keep the first r k wavelengths, and the rest are eliminated:

[0075] S k+1 =top-r k (p k,j ) (18);

[0076] Among them, S k+1 is the set of wavelengths retained after the current iteration k operation, including the most important r k The index of wavelengths, top-r k (p k,j ) refers to the weight p k,j Sort in descending order, keep the first r k wavelength.

[0077] Iterate in sequence according to the operation method in the start iteration until the preset number of iterations G is reached.

[0078] In all iterations k = 1, 2, 3, ... G, choose the cross validation error RMSE CV The smallest set of wavelengths:

[0079]

[0080]

[0081] Where S optimal is the optimal wavelength set finally selected, k *is the number of iterations that minimizes the cross-validation error, It refers to the root mean square error of cross validation when the number of iterations is k.

[0082] As a further improved technical solution of the present invention, the step 7 is specifically as follows:

[0083] The average spectral data at the characteristic wavelength of the region of interest screened by CARS features were fused with the image texture features to establish a simplified Transformer multi-task classification model, which includes the white meat classification task and the woody meat classification task. The architecture of the Transformer multi-task classification model is based on the self-attention mechanism. The spectral data of white meat and woody meat are jointly learned through a shared feature extraction layer, thereby improving the classification performance and generalization ability of the model. The entire model consists of an input layer, a Transformer encoder module, a task branch network, and an output layer, which are used to predict the classification scores of white meat and woody meat and the discrimination of symbiotic defective chicken breast meat.

[0084] The beneficial effects of the present invention are:

[0085] 1. This invention uses hyperspectral microscopy technology combined with deep learning algorithms to perform non-destructive detection and accurate classification of white streaks and woody meat tissues in chicken breast, making up for the defects of strong subjectivity and low accuracy of traditional methods. The precise spectral information provided by hyperspectral microscopy technology achieves high resolution and high precision of tissue classification, significantly improving detection efficiency and accuracy.

[0086] 2. Hyperspectral microscopy can not only detect the presence of white grain and woody meat, but also generate a high-resolution visual distribution map of their distribution in muscle tissue. Through the combination of spectral separation and classification model, this invention has realized the joint detection of white grain and woody meat symbiotic tissue for the first time, intuitively displaying the symbiotic state of the two types of defective tissues, and providing a new analytical method and theoretical basis for further analysis of their common distribution law and formation mechanism.

[0087] 3. The present invention provides scientific support for controlling key common distribution points through accurate identification of white grain and woody meat tissue, and at the same time reversely guides genetic selection optimization and nutritional regulation strategies in chicken production, promoting meat quality improvement and quality enhancement. In addition, the extracted spectral characteristic wavelengths are helpful for the development of portable, high-throughput detection equipment, providing important technical support for accurate sorting and real-time monitoring of chicken quality. BRIEF DESCRIPTION OF THE DRAWINGS

[0088] Figure 1 This is a flow chart of the high-spectral microscopy imaging technology used in the present invention to detect white-grained wood-symbiotic chicken breast.

[0089] Figure 2It is the sampling position of the chicken breast microslice in the present invention.

[0090] Figure 3 Schematic diagram of normal, white-grained and woody areas in the microscopic hyperspectral image of the present invention.

[0091] Figure 4 This is a structural diagram of the multi-task Transformer classification model used in the present invention. DETAILED DESCRIPTION

[0092] The specific implementation of the present invention is further described below in conjunction with the accompanying drawings and technical solutions.

[0093] The present invention proposes a method for distinguishing chicken breast meat with white-grain wood symbiosis defects based on hyperspectral microscopy technology. The specific process is as follows: Figure 1 As shown; the sampling position of the chicken breast sample for preparing microscopic slices according to the embodiment of the present invention is as follows Figure 2 As shown; the normal, white grain and wood areas in the microscopic hyperspectral image of the present invention are as shown Figure 3 As shown; the specific implementation method includes the following steps:

[0094] Step a: Obtain a sufficient number of chicken breast samples from the slaughterhouse to ensure that the sample types cover normal meat, white-grained meat, woody meat, and white-grained and woody symbiotic meat. The specific experimental conditions include: (1) Obtain 6-week-old Cobb 500 white-feathered broilers with consistent feeding conditions; (2) Ensure the same fasting time conditions before slaughter, and the slaughter process includes electric stunning, slaughtering and bleeding, scalding and depilation, head and feet removal, separation of internal organs, carcass cutting, high-pressure washing, and air cooling for 60 minutes; (3) After deboning, skinning, and removing the surface fascia, the staff cut out the chicken breast samples, and preliminarily screened the required white-grained, woody, and symbiotic defect samples based on the morphological characteristics of white-grained meat and woody meat; (4) Refrigerate at 0-4℃ in the laboratory for the next step of microscopic sectioning.

[0095] Step b: For each chicken breast sample Figure 2Cut a 2cm×2cm×1cm chicken breast at the position shown, and store the sample block in a frozen condition (-20℃) for about 30 minutes to increase its hardness and facilitate subsequent slicing. Use a microtome (Leica CM1950) to cut the sample into 1mm slices, carefully remove the slices with tweezers, place them on a clean slide, and gently cover the slices with 0.9% saline to prevent the slices from drying or cracking during the transfer process. Immerse the sample slices on the slide in 4% paraformaldehyde solution for 10 minutes to keep the tissue structure stable, rinse the slices with distilled water to remove the residual paraformaldehyde, and then seal the sample with a cover glass to ensure that there are no bubbles and no movement in the sample after sealing. Randomly select some slices and use a microscope to check the sample quality to ensure that the slice thickness is uniform and the tissue structure is clear.

[0096] Step c: Build a hyperspectral microscopy system, which consists of a portable hyperspectral imager (SOC710VP), an upright microscope (NE910) and a computer. The portable hyperspectral imager is equipped with two built-in CCD cameras with a resolution of 4.69nm and 256 bands. The spectrometer uses a translational push-scan method to obtain spectral data. This scanning method is suitable for accurately capturing the spectral characteristics of samples at high resolution. The microscope is equipped with a 75W adjustable halogen tungsten lamp as a light source to provide uniform and stable illumination. The objective lens has a magnification of 40 times, which is suitable for imaging microscopic tissue structures. The computer is equipped with spectral acquisition software (Hyper Scanner_2.0.127) and spectral correction software (SRAnal710e) for data acquisition, real-time correction and storage of spectral images. Before formally collecting data, the system needs to be preheated for 20 minutes to ensure the stability of the imaging instrument and the uniformity of the light source, and to avoid acquisition errors caused by unstable instrument temperature. In order to eliminate the influence of factors such as light source, equipment and background on the acquisition results of hyperspectral images, it is necessary to perform a spectral calibration on the original microscopic hyperspectral image R. raw Perform black and white calibration. First, turn off the light source in the imaging system to ensure that there is no external light interference, and collect the dark field image D in the microscopic field of view; second, place a standard white board on the focal plane of the microscope system and ensure that the white board completely fills the field of view, adjust the light source intensity and focal length of the microscope to ensure that the surface of the white board is evenly illuminated and obtain uniform reflected light, and collect the white reference image W under this condition; finally, use the following formula to perform black and white calibration to obtain the final corrected image R fianl .

[0097]

[0098] Step d: Obtain the black-and-white corrected microscopic hyperspectral image R fianlFinally, the K-means clustering algorithm is used to segment the image to extract the region of interest. The core goal of K-means clustering is to divide the data (pixels in the image) into K clusters by minimizing the objective function, where each cluster is represented by a cluster center. Each pixel is assigned to the cluster with the closest cluster center, and the cluster center is updated iteratively until convergence. The specific method is as follows:

[0099] According to the preliminary classification of chicken breast into different categories (normal meat, white meat and woody meat), the number of clusters K is set to 3, and 3 sample points are randomly selected in the data matrix V as the initial cluster centers:

[0100] u1,u2,u3∈R k (2);

[0101] Among them, u1, u2, u3 are the coordinates of the three initial cluster centers, R k is a k-dimensional real number space.

[0102] For each pixel point, the spectral vector v i , calculate its Euclidean distance to each cluster center:

[0103] d ij =||v i -u j || 2 ,j∈{1,2,3} (3);

[0104] Among them, v i is the spectral vector of the i-th pixel, u j Represents the spectral vector of the j-th cluster center.

[0105] The spectral vector v of the pixel point i Assign to the category of the nearest cluster center:

[0106]

[0107] Among them, c i Indicates the cluster category label to which the i-th pixel belongs. It means to find the value of j such that d ij Minimum, that is, the spectral vector v for a given pixel i , find a spectral vector u of the cluster center j , so that the sample v i to u j The Euclidean distance d ij Minimum.

[0108] According to the currently assigned category, the average spectral vector of each category is calculated and the cluster center is updated so that each cluster center better represents all the pixels it contains:

[0109]

[0110] Among them, C j is the collection of pixel samples of the jth category, n j For Collection C j The number of pixels in .

[0111] If the update amplitude of the cluster center is less than the threshold e, the clustering process is considered to have converged and the iteration can be stopped; otherwise, return to formula (3) and continue the clustering process:

[0112]

[0113] Among them, t is the number of iterations, u j (t) is the cluster center of the j-th type pixel sample set after t iterations, u j (t-1) is the cluster center of the j-type pixel sample set after t-1 iterations.

[0114] Step e: Based on the reflectance threshold of the key band, determine whether a certain pixel is a fat pixel or a hardened fiber pixel, and complete the labeling of the defect level of each region of interest according to the proportion of fat pixels or hardened microscopic pixels. For white-grained meat, the reflectance of the spectral curve at the band of 930nm (fat-sensitive band) is 0.35 as the threshold, and the reflectance greater than 0.35 is defined as fat pixels, and the reflectance less than or equal to 0.35 is defined as non-fat pixels. The number of fat pixels in each region of interest (N z ) divided by the total number of pixels in the region of interest (N a ) to obtain the fat percentage P z , as shown in formula (7):

[0115]

[0116] For wood fiber, the reflectance of the spectrum curve at 850nm (hardened fiber sensitive band) was set as the threshold value, and the reflectance greater than 0.48 was defined as hardened fiber pixels, and the reflectance less than or equal to 0.48 was defined as non-hardened fiber pixels. The number of hardened fiber pixels (N) in each region of interest obtained in step 3 was calculated. x ) divided by the total number of pixels in the region of interest (N a ) to obtain the proportion of hardened fibers P x , as shown in formula (8):

[0117]

[0118] The defect level scores were evaluated with 0.2, 0.4, and 0.6 as thresholds, respectively. z The meat between 0 and 0.2 is normal (score is 0), P z The meat with white grain between 0.2-0.4 is slightly white grain (score 1), P z The meat with white grain between 0.4 and 0.6 is moderate (score 2). z The score between 0.6 and 1 is severe white meat (score 3). x The meat between 0 and 0.2 is normal (score is 0), P x The meat with a score between 0.2 and 0.4 is lightly woody (score 1), x The woodiness is moderate (score is 2) between 0.4 and 0.6. x The score between 0.6 and 1 is severe woodiness (score 3). See Table 1 for details:

[0119] Table 1. Sample grading standards:

[0120] grade Score White meat grading standards Woody meat grading standards normal 0 <![CDATA[P z <0.2]]> <![CDATA[P x <0.2]]> Mild 1 <![CDATA[0.2≤P z <0.4]]> <![CDATA[0.2≤P x <0.4]]> Moderate 2 <![CDATA[0.4≤P z <0.6]]> <![CDATA[0.4≤P x <0.6]]> Severe 3 <![CDATA[P z ≥0.6]]> <![CDATA[P x ≥0.6]]>

[0121] Step f: Use the gray level difference matrix (GLDM) to extract texture information features such as average gray difference, gray difference variance, gray contrast, gray difference entropy and energy from the region of interest obtained in step e, as follows:

[0122] Find the average grayscale difference:

[0123]

[0124] Among them, d is the grayscale difference value, P D (d) is the probability of grayscale difference d in the grayscale difference matrix, and D is the range of possible grayscale differences.

[0125] Find the grayscale difference variance:

[0126]

[0127] Find the grayscale contrast:

[0128]

[0129] Find the grayscale differential entropy:

[0130]

[0131] Find energy:

[0132]

[0133] Step g: Using competitive adaptive reweighted sampling (CARS) to screen the characteristic wavelengths of the region of interest obtained in step e, the specific method is as follows:

[0134] First, initialize: the initial wavelength set is recorded as S0, the purpose is to select the wavelength set S0 that has the most influence on the prediction of sample label y from the entire spectral data matrix X as the starting point for subsequent iterations;

[0135]

[0136] X0=X[:,S0](15);

[0137] Among them, X[:, S0] refers to all sample rows in the original spectral matrix X composed of all regions of interest in all samples and all columns corresponding to wavelengths in the wavelength set S0, that is, X0 is a column corresponding to m wavelengths in the initially selected wavelength set S0 including all sample rows in the original spectral matrix X. X is the original spectral matrix of all samples (assuming the size is n×p). y is the category score of the region of interest (size is n×1). Among them, n is the total number of all regions of interest in all samples. According to this formula, the regression coefficient vector w0 can be obtained;

[0138] Assume that there are m wavelengths in the initially saved wavelength set S0, then find the wavelengths corresponding to the first m values ​​of the regression coefficient absolute values ​​in the regression coefficient vector w0 arranged from large to small to form the wavelength set S0;

[0139] Evaluate the relative importance of each wavelength in the current vector w0 to determine its contribution in the model:

[0140]

[0141] w 0,j is the regression coefficient of the jth wavelength in vector w0, p 0,j is the importance weight of the jth wavelength in iteration 0.

[0142] The number of wavelengths r0 that need to be retained is calculated through the exponential decay function. These wavelengths will gradually decrease with the increase of iterations, so as to gradually eliminate wavelengths with less influence:

[0143] r0=round(m·exp(-λ·0))(17);

[0144] Where m is the number of wavelengths initially retained, λ is the exponential decay coefficient, which is used to control the decay rate of the number of wavelengths retained as the iteration proceeds, 0 is 0 iterations, exp is the exponential decay function, which is used to calculate the decay rate of the number of wavelengths based on the iteration number 0 and the decay coefficient λ, and round is the rounding function, which converts the result after the decay calculation to an integer to ensure that the number of wavelengths retained is in integer form.

[0145] By weight p 0,j Arrange in descending order, retain the first r0 wavelengths, and eliminate the rest;

[0146] S k =top-r0(p 0,j ), k=1(18);

[0147] Among them, S k (k=0) is the set of wavelengths retained after 0 iterations, which contains the indices of the most important r0 wavelengths, top-r0(p 0,j ) refers to the 0,j Select r0 most important wavelengths.

[0148] Start iteration:

[0149] X k =X[:,S k ],k≥2(19);

[0150]

[0151] Construct the spectral submatrix X k ,X[:,S k ] refers to selecting all sample rows and S in the original spectral matrix X composed of all regions of interest in all samples k All columns corresponding to wavelengths in the wavelengths collection.

[0152] Evaluate each wavelength in the current vector w k , to determine its contribution in the model:

[0153]

[0154] w k,j is the regression coefficient vector w k The regression coefficient of the jth wavelength in k,j is the importance weight of the jth wavelength in the kth iteration.

[0155] The number of wavelengths r that need to be retained in the current iteration k is calculated using the exponential decay function. k The number of these wavelengths is gradually reduced with each iteration, in order to phase out less influential wavelengths:

[0156] r k =round(m·exp(-λ·k))(22);

[0157] Among them, m is the initial number of retained wavelengths, λ is the exponential decay coefficient, which is used to control the decay rate of the number of retained wavelengths as the iteration proceeds, k is the current number of iterations, exp is the exponential decay function, which is used to calculate the decay rate of the number of wavelengths based on the number of iterations k and the decay coefficient λ, and round is the rounding function, which converts the result after the attenuation calculation into an integer to ensure that the number of retained wavelengths is in integer form.

[0158] The vector w k The wavelength in the k,j Sort in descending order, keep the first r k wavelengths, and the rest are eliminated:

[0159] S k+1 =top-r k (p k,j )(twenty three);

[0160] Among them, S k+1 is the set of wavelengths retained after the current iteration k operation, including the most important r k The index of wavelengths, top-r k (p k,j ) refers to the weight p k,j Sort in descending order, keep the first r k wavelength.

[0161] Iterate in sequence according to the operation method in the start iteration until the preset number of iterations G is reached.

[0162] In all iterations k = 1, 2, 3, ... G, choose the cross validation error RMSE CV The smallest set of wavelengths:

[0163]

[0164] Where S optimal is the optimal wavelength set finally selected, k * is the number of iterations that minimizes the cross-validation error, It refers to the root mean square error of cross validation when the number of iterations is k.

[0165] Step h: The micro-spectral data after CARS feature screening and image texture features are fused as input to establish a simplified Transformer multi-task classification model, which includes white meat classification tasks and woody meat classification tasks. The specific structure and process are as follows: Figure 4As shown. The model is mainly composed of an input layer, a Transformer encoder module, a task branch network and an output layer. The input layer is used to receive spectral data and texture feature data. At this stage, the input data is flattened and projected through an embedding layer; the Transformer encoder module is stacked in multiple layers, and each layer mainly includes two modules: a self-attention mechanism (Self-attention) and a feedforward neural network (Feedforward network). The present invention adopts a multi-head attention mechanism. Unlike the traditional single attention head, the Transformer calculates multiple independent attention heads in parallel. Each head captures different features or relationships, and finally splices the outputs of all heads. Assuming there are h attention heads, the calculation method of multi-head attention is:

[0166] MultuHead(Q,K,V)=Concat(head1,...,head h )W O (26);

[0167] Where Q, K, and V are query, key, and value matrices, respectively. The self-attention mechanism calculates the weighted results of different attention heads in parallel to obtain the weighted representation of each band. i All are calculated through the above self-attention mechanism, and finally through a linear transformation W O to aggregate the output of these heads.

[0168] Each encoder layer also includes a feedforward neural network for further processing the feature representation of each position. This network includes two linear transformations and an activation function (ReLU). The output of the feedforward network will be processed by layer normalization to ensure the stability of training; the model designs two classification tasks: white meat (0, 1, 2, 3) and woody meat (0, 1, 2, 3). For each task, a different classification head is used for prediction. Each task uses an independent fully connected layer for classification, and the output is the score of the four categories (softmax probability distribution). Assume that the output of the white meat classification head is y white , the output of the wood meat classification head is y wooden , then the cross entropy loss l of the loss function of each task is:

[0169]

[0170] where y (i) true and (i) pred are the actual label and predicted probability values ​​respectively.

[0171] Since this is a multi-task learning model, the loss function is the weighted sum of the losses of each task:

[0172] l total =λ1l white +λ2l wooden (28);

[0173] Among them, λ1 and λ2 are weight coefficients used to balance the training of the two tasks. white represents the loss of the white meat classification task, l wooden Represents the wood meat classification task loss.

[0174] This study selected 0.0001 as the initial learning rate, dynamically adjusted through the learning rate scheduler, and set the batch size to 32 to ensure the stability of training. The Adam optimizer is used. Adam has the characteristics of adaptive learning rate and can automatically adjust the parameter update step size during training. The parameters of Adam are set to: α = 0.001, β1 = 0.9, β2 = 0.999, ∈ = 10 -8 A 6-layer encoder is selected, each layer contains 8 attention heads, and the hidden layer dimension (Hidden size) is set to 512 to ensure that the model can learn sufficiently complex feature representations.

[0175] Step i: Use the cross-validation method to evaluate the performance of the model and conduct a comprehensive evaluation using multiple metrics such as accuracy, precision, recall, and F1 value.

[0176] Accuracy is the simplest and most intuitive evaluation metric. It measures the proportion of correct predictions made by the model and is calculated as:

[0177]

[0178] Where TP stands for true positives (the number of samples correctly predicted as positive by the model), TN stands for true negatives (the number of samples correctly predicted as negative by the model), FP stands for false positives (the number of samples incorrectly predicted as positive by the model), and FN stands for false negatives (the number of samples incorrectly predicted as negative by the model).

[0179] Precision measures the proportion of samples that are actually positive among all samples predicted by the model to be positive. The calculation formula is:

[0180]

[0181] Recall measures the proportion of samples that are actually positive and are correctly predicted as positive by the model. The calculation formula is:

[0182]

[0183] The F1 value is the harmonic mean of precision and recall, and is used to comprehensively consider the balance between precision and recall. When the precision and recall are unbalanced, the F1 value can better reflect the performance of the model than using accuracy alone. The calculation formula is:

[0184]

[0185] Step j: The last step is to perform microscopic visualization of white-grained woody symbiotic chicken breast. After the above steps, the spectral information of the pixels at the characteristic wavelengths in all regions of interest of the sample to be visualized is extracted and input into the trained Transformer model. The model outputs the classification result of each pixel, indicating the category and degree (category score) of the pixel belonging to woody meat or white-grained meat. In order to further enhance the visualization effect, different color mappings are set for each category (woody meat is red, white-grained meat is blue, and the color changes gradually with the change of grade). Finally, all the prediction results are synthesized into a visualization image, and the appropriate color scale, scale and color level are used to adjust the image so that the spatial distribution of woody meat and white-grained meat in the sample is clearly displayed.

[0186] The protection scope of the present invention includes but is not limited to the above embodiments. The protection scope of the present invention shall be based on the claims. Any replacement, deformation, and improvement of the technology that can be easily thought of by technicians in this field shall fall within the protection scope of the present invention.

Claims

1. A method for distinguishing chicken breast with white-grain wood symbiosis defects based on hyperspectral microscopy technology, characterized in that: The following steps are involved: Step 1: Obtain a sufficient number of normal meat, white-grained meat, woody meat and white-grained woody symbiotic chicken breast meat samples, and cut the samples into microscopic slices of uniform size; Step 2: Build a hyperspectral microscopic imaging system to collect and correct the microscopic spectral data of the sample slices to obtain the corrected microscopic hyperspectral image; Step 3: Use image processing algorithms to extract the region of interest from the microscopic hyperspectral image; Step 4: Label the defect category and defect grade score for each region of interest; Step 5: Extract texture features from the microscopic hyperspectral image of each region of interest; Step 6: Select characteristic wavelengths of the spectral data in each region of interest; Step 7: The average spectral data at the characteristic wavelength of the region of interest is fused with the image texture features as the input of the Transformer multi-task learning model, and the defect category and defect grade score of the corresponding region of interest are used as the output of the Transformer multi-task learning model. The Transformer multi-task learning model is established and trained; Step 8: Collect the microscopic hyperspectral image of the chicken breast with white-grain woody symbiotic defects to be tested and extract the spectral information of each pixel at the characteristic wavelength. Input the spectral information of each pixel into the trained Transformer multi-task learning model. The model outputs the defect category and defect grade score of each pixel. The defect category is woody meat or white-grain meat.

2. The method for distinguishing chicken breast with white-grain wood symbiosis defects based on hyperspectral microscopy technology according to claim 1 is characterized in that: The step 1 is specifically as follows: Step 1.1: Determine and select normal meat, white-grained meat, woody meat and white-grained woody chicken breast meat samples by combining visual inspection and palpation; Step 1.2: Cut the sample into microscopic slices of uniform size and check the flatness and integrity of the sample under a microscope to ensure that there is no damage or air bubble.

3. The method for distinguishing chicken breast with white-grain wood symbiosis defects based on hyperspectral microscopy technology according to claim 1 is characterized in that: The step 3 is specifically as follows: The K-means clustering algorithm is used to segment the chicken breast slices into multiple regions of interest on the corrected microscopic hyperspectral image obtained in step 2. The specific method is as follows: Step 3.1, according to the three different categories of chicken breast, set the number of clusters K to 3, and randomly select 3 sample points in the data matrix V as the initial cluster centers: u1,u2,u3∈R k ; Among them, u1, u2, u3 are the coordinates of the three initial cluster centers, R k is a k-dimensional real number space; Step 3.2: For each pixel point, the spectral vector v i , calculate its Euclidean distance to each cluster center: d ij =||v i -u j || 2 ,j∈{1,2,3}; Among them, v i is the spectral vector of the i-th pixel, u j represents the spectral vector of the jth cluster center; Step 3.3: Substitute the spectral vector v of the pixel point i Assign to the category of the nearest cluster center; Step 3.4: Calculate the average spectral vector of each category according to the currently assigned category, and update the cluster center so that each cluster center better represents all the pixels it contains; Step 3.5: If the update amplitude of the cluster center is less than the threshold e, the clustering process is considered to have converged and the iteration is stopped; otherwise, return to step 3.2 and continue the clustering process.

4. The method for distinguishing chicken breast with white-grain wood symbiosis defects based on hyperspectral microscopy technology according to claim 1 is characterized in that: The step 4 is specifically as follows: Step 4.1, taking the reflectance of the spectrum curve at 930nm as the threshold, defining a fat pixel as one with a reflectance greater than 0.35 and a non-fat pixel as one with a reflectance less than or equal to 0.35; The number of fat pixels N in each region of interest extracted z Divide by the total number of pixels in the region of interest N a Get the fat percentage P z ; P z The meat between 0-0.2 is normal meat, with a score of 0; z The meat with mild white grain between 0.2-0.4 is scored as 1; z The meat with moderate white grain between 0.4 and 0.6 has a score of 2. z The score between 0.6 and 1 is severe white meat, with a score of 3; Step 4.2, taking the reflectance of 0.48 of the spectrum curve at a wavelength of 850 nm as a threshold, defining a reflectance greater than 0.48 as a hardened fiber pixel, and a reflectance less than or equal to 0.48 as a non-hardened fiber pixel; The number of hardened fiber pixels N in each region of interest extracted x Divide by the total number of pixels in the region of interest N a The hardened fiber ratio P is obtained x ; P x The meat between 0-0.2 is normal meat, with a score of 0; x The meat with a score between 0.2 and 0.4 is lightly woody, with a score of 1. x The woodiness is between 0.4 and 0.6, which is moderate, with a score of 2. x Between 0.6 and 1 is considered heavily woody and is scored as 3.

5. The method for distinguishing chicken breast with white-grain wood symbiosis defects based on hyperspectral microscopy technology according to claim 1 is characterized in that: The step 5 is specifically as follows: The grayscale difference matrix is ​​used to extract texture information features from the extracted region of interest. The texture information features include average grayscale difference, grayscale difference variance, grayscale contrast, grayscale difference entropy and energy.

6. The method for distinguishing chicken breast with white-grain wood symbiosis defects based on hyperspectral microscopy technology according to claim 1 is characterized in that: The step 6 is specifically as follows: The competitive adaptive reweighted sampling method (CARS) is used to screen the characteristic wavelengths of the extracted region of interest.

7. The method for distinguishing chicken breast with white-grain wood symbiosis defects based on hyperspectral microscopy technology according to claim 1 is characterized in that: The step 7 is specifically as follows: The average spectral data at the characteristic wavelength in the region of interest after CARS feature screening is fused with the image texture features of the region of interest as the input of the Transformer multi-task classification model. The defect category and defect grade score of the region of interest are used as the output of the Transformer multi-task classification model. The Transformer multi-task classification model is established and trained. The Transformer multi-task classification model includes an input layer, a Transformer encoder module, a task branch network and an output layer.

Citation Information

Cited By

  • Fish anti-oxidation state evaluation method and system

    CN120629029A

  • Meat freezing damage degree intelligent discrimination method and system based on multi-modal information

    CN122200632A