Quality detection system and method for meat and meat products
By acquiring and analyzing hyperspectral image information and combining it with a quality prediction model, rapid and non-destructive testing of meat and meat products has been achieved. This overcomes the limitations of existing testing methods, ensures product safety and nutritional quality, and improves testing efficiency and accuracy.
Patent Information
- Application Number
- CN202511700614.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-19
- Publication Date
- 2026-02-24
AI Technical Summary
Existing methods for testing meat and meat products are highly subjective, time-consuming, destructive, and difficult to apply online. They are also unable to accurately characterize the overall quality of samples and cannot meet the needs of modern mass production and rapid circulation.
Hyperspectral image information is acquired, and the sample region of interest is extracted through the data processing and analysis unit. The weighted mean spectral response curve is calculated, and the optimal characteristic band is determined by multiple cross-validations. The safety and nutritional quality indicators are judged by the quality prediction model, and abnormal quality is removed through the sample sorting unit.
It enables rapid and non-destructive testing of meat and meat products, ensuring the safety and nutritional quality of end products and enhancing the user experience.
Smart Images

Figure CN121558637A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of meat product testing technology, specifically to a quality testing system and method for meat and meat products. Background Technology
[0002] With economic development and improved living standards, my country's demand for meat and meat products continues to grow. According to the 2024 China Statistical Yearbook, the per capita meat consumption of Chinese residents has reached 72 kg. However, there are significant differences in consumption structure and preferences among different regions. Against this backdrop, customized processing, cross-regional circulation, and large-scale trade of meat raw materials and processed products have gradually become the norm in the industry. However, meat and meat products are susceptible to changes in physical and chemical properties due to factors such as human operation, temperature and humidity changes, and microbial contamination during processing, storage, and transportation, which may lead to a decline in safety, processing, and nutritional quality.
[0003] Currently, most meat processing and distribution companies still rely mainly on random visual inspection, routine physicochemical analysis, machine vision inspection, or point light source spectral measurement to intermittently monitor product quality. However, these methods all have limitations: visual inspection is experience-dependent and highly subjective; physicochemical and microbiological testing is time-consuming, highly destructive, and difficult to apply online; machine vision can only reflect surface color and structural features; point spectral measurement has a limited sampling range, making it difficult to accurately characterize the overall quality of samples. Affected by the testing method, personnel proficiency, changes in ambient light, and differences in sampling location, the stability and detection rate of traditional testing methods are difficult to meet the needs of modern mass production, rapid circulation, and large-scale transactions.
[0004] Against this backdrop, meat and meat products may still experience quality abnormalities in later stages or at the end of the processing chain without being identified in a timely manner, increasing food safety risks and affecting product value. To address these issues, we propose a quality testing system and method for meat and meat products. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention provides a quality testing system and method for meat and meat products, solving the problems mentioned in the background art.
[0006] The above-mentioned technical objective of the present invention is achieved through the following technical solution: This invention provides a quality inspection system for meat and meat products, characterized in that it includes: a data acquisition unit, a data processing and analysis unit, a judgment and early warning unit, and a sample sorting unit; The data acquisition unit is used to acquire hyperspectral image information of the sample to be tested; The data processing and analysis unit is used to extract the region of interest of the sample based on the hyperspectral image, calculate the weighted mean spectral response curve, and preprocess the spectral data, screen the feature bands, and conduct stability evaluation based on multiple cross-validations to determine the optimal set of feature bands for quality prediction. The judgment and early warning unit is used to call the optimal quality prediction model pre-trained and determined by stability verification based on the weighted mean spectral response curve to obtain the safety quality index and nutritional quality index of the sample to be tested, and compare the obtained index with the corresponding preset threshold to determine whether it exceeds the threshold, and issue an abnormal alarm when an abnormality is determined. The sample sorting unit is used to receive abnormal alarms and control the sorting device to reject samples that are determined to be abnormal.
[0007] Preferably, the data processing and analysis unit determines the region of interest and obtains the grayscale range according to the following steps: (1) Adaptively construct an RGB image based on the visible spectrum information of the hyperspectral image of the sample to be tested; (2) Determine the region of interest image based on the RGB image and generate a binary template of the region of interest; (3) Obtain the grayscale image of the region of interest based on the region of interest image and its binary template; (4) Divide the grayscale image into several grayscale intervals and obtain the binary templates of the corresponding intervals.
[0008] Preferably, the data processing and analysis unit is further configured to calculate the weighted mean spectral response curve of the sample to be tested based on the acquired gray-scale binary template, including: (1) Based on the binary template of each corresponding gray range, extract and calculate the mean spectral response curve of the range in each band from the hyperspectral matrix; (2) Determine the weight W(j) of each gray level interval based on the total number of non-zero pixels in the binary template of the region of interest, Stotal, and the number of non-zero pixels in the binary template of each gray level interval, Ssingle(j), where W(j) = Ssingle(j) / Stotal; (3) Based on the weight W(j) and the mean spectral response curve of the corresponding interval, the weighted mean spectral response curve of the sample to be tested is constructed by weighting the wavelength points.
[0009] Preferably, the judgment and early warning unit is used to generate a quality prediction result based on the weighted mean spectral response curve using a pre-trained quality prediction model, including: (1) Input the weighted mean spectral response curve into the first quality prediction model to obtain safety quality indicators. When any safety quality indicator does not meet its preset threshold, the sample to be tested is judged as having safety quality abnormality and the first abnormality alarm is issued. (2) When all safety and quality indicators meet the preset threshold, the weighted average spectral response curve is input into the second quality prediction model to obtain the nutritional quality indicators. When any nutritional quality indicator is lower than its preset threshold, the sample to be tested is judged as having abnormal nutritional quality and a second abnormal alarm is issued. (3) When both the safety quality index and the nutritional quality index are within their respective preset threshold ranges, the sample to be tested is judged to be of normal quality.
[0010] Preferably, the general procedure for sample rejection by the sample sorting unit after determining an anomaly is as follows: The centroid coordinates of the sample to be tested are calculated based on the binary template of the region of interest, and the coordinates of the minimum bounding rectangle are determined. The instantaneous speed V of the conveyor belt provided by the speed encoder, the straight-line distance D between the preset sorting device and the current position of the sample, and the time advance Td of the sorting device are obtained. The estimated arrival time or time window of the sample to be tested to the sorting device is calculated based on distance D, instantaneous velocity V and time lead Td. And within the expected arrival time or time window, send an activation signal and arrival time vector to the corresponding sorting device to trigger a countdown control sorting push rod to complete rejection; Where V is the instantaneous speed provided by the speed encoder (its unit corresponds to the distance D), and Td represents the response lead or delay time of the sorting device.
[0011] Preferably, the sample sorting unit is further used for: When a safety or quality abnormality is determined, the sorting device is called according to the sorting logic and the time window is calculated using parameters D1 and Td1. When a nutritional quality defect is detected, the secondary sorting device is invoked according to the secondary sorting logic, and the time window is calculated using parameters D2 and Td2 to complete the rejection action of primary sorting or secondary sorting respectively.
[0012] Preferably, the training of the quality prediction model includes: (1) Perform spectral preprocessing on the weighted mean spectral response curve. The preprocessing consists of one or more of the following: baseline correction, Savitzky-Golay filtering, centering, normalization, standard normal variable transformation (SNV), multivariate scattering correction (MSC), first-order spectral differentiation or second-order spectral differentiation. After preprocessing, one or more of Mahalanobis distance, principal component analysis or Monte Carlo cross-validation can be used to remove outlier samples. (2) Use one or more band screening and data dimensionality reduction methods to screen the characteristic bands of the preprocessed spectrum, and verify and optimize the candidate band set through an iterative strategy; (3) A quality prediction model is established based on the weighted mean spectral data under the characteristic band. The quality prediction model is a statistical regression model or a machine learning model. In the process of model training or iterative fitting, a robust weight function can be selected to improve the robustness of the fit. (4) In model selection, priority is given to candidate models with higher calibration correlation coefficient Rc and validation correlation coefficient Rv. The optimal model is determined by the following criteria: larger Rc, larger Rv, smaller root mean square residual RMR, smaller Akaike information content criterion AIC, and fewer feature bands. The preferred threshold for Rc and Rv is 0.9 or above. (5) Apply the feature bands corresponding to the optimal quality prediction model to the feature band acquisition or online dimension reduction reconstruction of the hyperspectral image of the sample to be tested. The optimal quality prediction model includes a first quality prediction model for safety quality judgment and a second quality prediction model for nutritional quality judgment.
[0013] Preferably, the quality prediction model is established using partial least squares (PLS) regression model, as an optional implementation method; During the iterative fitting process, one or more of Andrews, Bisquare, Cauchy, Huber, Logistic, or Welsch may be used as robust weight functions; Quality prediction models can also be alternatively implemented using other statistical regression or machine learning methods, such as ridge regression, support vector regression (SVR), random forest (RF), gradient boosting decision tree (GBDT), or artificial neural network (ANN).
[0014] This invention also provides a method for quality testing of meat and meat products, comprising the following steps: S1. Obtain the hyperspectral image of the sample to be tested; S2. Adaptively construct the sample RGB image based on the visible spectrum information of the hyperspectral image and determine the sample region of interest. Generate a grayscale image based on the region of interest and divide the grayscale intensity range into several grayscale intervals to obtain the binary template of the corresponding interval. S3. Based on the binary template of each gray level interval, extract the spectral response of the corresponding interval from the hyperspectral matrix in each band and obtain the mean spectral response curve of each interval. Calculate the weight according to the pixel distribution of each gray level interval and synthesize the mean spectral response curve of each interval according to the weight to obtain the weighted mean spectral response curve. S4. Preprocess the weighted mean spectral response curve and remove outliers, and use an iterative multi-method band screening and dimensionality reduction process to obtain a set of candidate feature bands and verify them through methods such as cross-validation. S5. Establish one or more quality prediction models based on the candidate feature band set, and repeatedly verify them according to the model selection and verification criteria to finally select the optimal feature band set and the optimal prediction model in order to improve the model stability. S6. Input the weighted average spectral response curve into the optimal prediction model under the optimal characteristic band to obtain the safety quality index and nutritional quality index of the sample, and compare the obtained index with the preset threshold to determine whether the sample quality is abnormal. If it is determined to be abnormal, issue an abnormal alarm and record the sorting parameters for rejection.
[0015] The present invention also provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it is used to implement the above-described method for quality detection of meat and meat products.
[0016] In summary, the present invention has the following main beneficial effects: This invention acquires spectral information from hyperspectral images of meat and meat products, performs sample identification processing based on the visible light band, obtains the weighted average spectral response curve of the sample region after dimensionality reduction of the characteristic band, uses a quality prediction model to train and determine quality indicators, and sorts abnormal meat and meat products based on the quality prediction results. This fills the gap in the existing technology for rapid and non-destructive testing of the safety and nutritional quality of meat and meat products, ensures the quality of products sold at the end, and improves the user experience. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating the quality testing method for meat and meat products provided by the present invention.
[0018] Figure 2 This is one of the flowcharts illustrating the construction of the optimal quality prediction model for the quality testing method of meat and meat products provided by this invention.
[0019] Figure 3 This is the second flowchart illustrating the construction of the optimal quality prediction model for the quality testing method for meat and meat products provided by this invention.
[0020] Figure 4 This is a flowchart illustrating the method for sorting abnormal meat and meat products provided by the present invention.
[0021] Figure 5 This is a schematic diagram of the quality testing device for meat and meat products provided by the present invention.
[0022] Figure 6 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, 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 some embodiments of the present invention, but not all embodiments. Based on the described 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.
[0024] The following embodiments are used to illustrate the present invention, but should not be used to limit the scope of protection of the present invention. The conditions in the embodiments can be further adjusted according to specific conditions, and simple improvements to the method of the present invention under the premise of the concept of the present invention are all within the scope of protection claimed by the present invention.
[0025] Figure 1 This is a flowchart illustrating the quality testing method for meat and meat products provided by the present invention. The quality testing method for meat and meat products provided by this invention is applicable to the quality testing of fresh meat, frozen meat, and their finished products. Specifically, it can be applied to the quality testing and evaluation of fresh meat, frozen meat, and their finished products in various packaging forms during production, processing, transportation, storage, and inspection processes. This includes, but is not limited to, using livestock meat, poultry meat, aquatic product raw materials, or any commercially available meat products. Furthermore, it is not limited to packaging materials, packaging forms, or meat and meat product varieties; specifically, it can be any packaged meat and meat products specified by national standards, industry standards, or local standards. This invention does not specifically limit these aspects. The executing entity of this method can be an electronic device or a meat and meat product quality testing device installed in that electronic device. This quality testing device can be implemented through software, hardware, or a combination of both. Figure 1 As shown, the quality testing method for meat and meat products includes steps 101 to 105.
[0026] Step 101: Based on the spectral information of the hyperspectral image of the sample to be tested, obtain the region of interest and grayscale range of the sample to be tested.
[0027] In this step, the spectral information of the hyperspectral image of the sample to be tested refers to the spectral information of meat and meat products in different packaging forms at time points such as before shipment, before the products arrive at the destination and are stored, and before the start of deep processing. This embodiment does not limit the time points.
[0028] The spectral information of the sample to be tested is mainly used to determine the safety and nutritional quality of the sample. Meat and meat products can be commercially available red meat or white meat and their products in packaging forms such as unpackaged, skin packaging, vacuum packaging or modified atmosphere packaging. This embodiment does not limit this.
[0029] Specifically, based on meat and meat products with different packaging forms, spectral information of hyperspectral images of specific meat and meat products at time points such as before shipment, before the products arrive at the destination and are stored, and before the start of deep processing is obtained. The spectral information of the visible light band of the hyperspectral images is extracted into the red, green and blue light bands, which are fused into the RGB image of the sample to be tested and grayscale space conversion is performed. A binary template of the region of interest of the sample to be tested is obtained by using the dynamic thresholding method. The grayscale image of the region of interest of the sample to be tested is further obtained, and the grayscale intensity range of 0-255 is divided into several grayscale intervals. The pixels in the grayscale image of the region of interest of the sample to be tested are assigned to the corresponding grayscale intervals, and a binary template of the grayscale interval corresponding to the region of interest of the sample to be tested is constructed.
[0030] Step 102: Obtain the corresponding weights and iterative dimensionality reduction characteristic bands of the spectrum of the sample to be tested, and obtain the weighted mean spectral response curve of the sample to be tested.
[0031] Specifically, based on the binary template of the region of interest (ROI) of the sample to be tested, the number of non-zero pixels is counted as the total pixel area of the sample to be tested. Further, based on the established grayscale intervals, the number of non-zero pixels in the binary template of the corresponding grayscale interval of the ROI of the sample to be tested is counted as the pixel area of that region. The pixel area of each region is divided by the total pixel area of the sample to be tested to obtain the weight of each corresponding grayscale interval. Further, based on the characteristic wavelength determined by the quality prediction model for quality assessment through iterative dimensionality reduction, the spectral matrix of the dimensionality-reduced hyperspectral image of the sample to be tested is obtained. The binary template of each grayscale interval is multiplied by the dimensionality-reduced spectral matrix to obtain the spectral matrix of that grayscale interval. After averaging, the mean spectral response curve of the sample to be tested in this grayscale interval is obtained. The spectral values on the mean spectral response curve of each grayscale interval are multiplied by the weight of the corresponding grayscale interval, and the spectral response curves are summed to obtain the weighted mean spectral response curve of the sample to be tested.
[0032] Step 103: Import the spectral curve into the first quality prediction model to obtain the safety and quality indicators of the sample to be tested, and determine whether it meets the requirements.
[0033] In this step, the quality prediction model is a safety and nutritional quality prediction model that has been trained and determined in advance based on the spectral information of the sample to be tested. The quality prediction results are used to indicate the sorting of products with abnormal safety and quality. The first quality prediction model is a safety and quality prediction model that has been trained and determined in advance based on the weighted average spectral response curve of the sample to be tested. The weighted average spectral response curve is the spectral information of a high-quality hyperspectral image of the sample to be tested that has been collected in advance.
[0034] In one embodiment, the safety and quality test results are determined based on the weighted average spectral response curve and the first quality prediction model. Specifically, this can be achieved by: importing the weighted average spectral response curve into the first quality prediction model to predict and determine the safety and quality indicators; when the quality evaluation indicators do not meet the preset indicator thresholds, the quality test results are determined to be abnormal and a first abnormal alarm is issued; wherein, the first abnormal alarm is used to indicate that the safety and quality of the sample to be tested exceeds the standard. In this step, the safety and quality evaluation index refers to the evaluation index used to judge whether the safety and quality of the sample to be tested meets the requirements of national, industry, local, or enterprise standards. The safety and quality evaluation index specifically includes one or more of the following indicators: total volatile basic nitrogen, malondialdehyde content, peroxide value, carbonyl content, total bacterial count, veterinary drug residues, and specific food additive content of the sample to be tested, including but not limited to the above indicators. The sampling range is from the surface of the sample to 0.5 cm below the surface, and the surface fat layer and connective tissue are removed. The sampling method is uniform sampling, and the number of samples is 5 to 9. This embodiment does not limit this.
[0035] In one embodiment, the quality prediction results of the sample to be tested are evaluated from the perspective of safety quality. Safety quality corresponds to the indicators of total volatile basic nitrogen, total bacterial count, veterinary drug residues, and content of specific food additives. When the safety quality indicators of the sample to be tested include one or more of the above parameters, the construction of the first quality prediction model must also include the corresponding types of parameters. The present invention does not specify the selection of safety quality indicators, which can be replaced or added or subtracted according to the characterization quality requirements involved in the specific implementation process. The preset indicator threshold needs to be set according to the requirements of national, industry, local, or enterprise standards for different samples to be tested.
[0036] For example, when the sample to be tested is, for instance, fresh or frozen pork hind leg muscle packaged in PE, the preset safety quality threshold values should be determined according to the requirements of GB / T9959.2-2008 "Separated Fresh and Frozen Lean Pork Meat", with a total volatile basic nitrogen of 15 mg / 100g and a total bacterial count of 1×10⁻⁶. 5 CFU / g, tetracycline is 0.1 mg / kg, oxytetracycline is 0.1 mg / kg, chloramphenicol is not detectable. When the sample to be tested is, for example, braised meat products, the preset safety quality index thresholds should be determined according to the requirements for specific food additives in GB2760-2024 "National Food Safety Standard for the Use of Food Additives", sodium nitrite is 0.15 g / kg, sodium nitrate is 0.5 g / kg, and natamycin is 0.3 g / kg.
[0037] Step 104: Import the spectral curve into the second quality prediction model to obtain the nutritional quality indicators of the sample to be tested and determine whether it meets the requirements.
[0038] In this step, the quality prediction model is a safety and nutritional quality prediction model that has been trained and determined in advance based on the spectral information of the sample to be tested. The quality prediction results are used to indicate the sorting of products with abnormal nutritional quality. The second quality prediction model is a nutritional quality prediction model that has been trained and determined in advance based on the weighted mean spectral response curve of the sample to be tested. The weighted mean spectral response curve is the spectral information of a high-quality hyperspectral image of the sample to be tested that has been collected in advance.
[0039] In one embodiment, the safety and quality test results are determined based on the weighted average spectral response curve and the second quality prediction model. Specifically, this can be achieved as follows: the weighted average spectral response curve is imported into the second quality prediction model to predict and determine the nutritional quality indicators; when the nutritional quality evaluation indicators do not meet the preset indicator thresholds, the quality test results are determined to be nutritionally abnormal and a second abnormality alarm is issued; wherein, the second abnormality alarm is used to indicate that the nutritional composition is lower than the required content or labeled content of the product; when both the safety and nutritional quality indicators meet the preset indicators, the quality test results of the sample to be tested are determined to be normal.
[0040] In this step, the nutritional quality evaluation index refers to the evaluation index used to judge whether the nutritional quality of the sample to be tested meets the requirements of national, industry, local, enterprise, or nutrition labeling standards. The nutritional quality evaluation index specifically includes one or more of the following indicators: protein content, fat content, moisture content, mineral element content, and vitamin content of the sample to be tested, including but not limited to the above indicators. The sampling range and sampling method are the same as in step 103, and this embodiment does not limit them.
[0041] In one embodiment, the quality prediction results of the sample to be tested are evaluated from the perspective of nutritional quality. Nutritional quality corresponds to indicators such as protein content, fat content, moisture content, mineral element content, and vitamin content. When the quality indicators of the sample to be tested include one or more of the above parameters, the construction of the second quality prediction model must also include the corresponding types of parameters. The present invention does not specify the selection of nutritional quality indicators, which can be replaced or added according to the characterization quality requirements involved in the specific implementation process.
[0042] For example, when the sample to be tested is, for instance, dried beef products, the preset threshold values for its nutritional quality indicators should be determined according to the values indicated on the nutrition label submitted by the company: protein content of 44.6g / 100g, fat content of 3.8g / 100g, carbohydrate content of 4.8g / 100g, and sodium (calculated as sodium chloride) of 806mg / 100g.
[0043] In one embodiment, the sample to be tested may be, for example, one of the following: packaged or unpackaged pork, mutton, beef, chicken, duck, or commercially available fresh or frozen livestock and poultry meat and their processed products. Meanwhile, the sampling site can be any segmented part or sampling area defined according to national standards, industry standards, or local standards. This embodiment does not limit this. In order to improve the accuracy of the test, the sample used to train the quality detection model must be the same as the sample to be tested, using the same packaging form, the same packaging material, the same type of meat, and the same processing method, and at the same sampling site.
[0044] Step 105: Issue a quality anomaly alarm and remove the abnormal samples.
[0045] In this step, after determining that the quality detection result of the first quality prediction model is a safety and quality anomaly and issuing the first anomaly alarm, it can be achieved by sorting and rejecting the sample to be tested based on the safety and quality evaluation index.
[0046] Specifically, after determining that the quality inspection result is abnormal and issuing the first abnormality alarm, the samples to be tested with safety and quality abnormalities are identified and sorted once.
[0047] Once the quality test result of the second quality prediction model is determined to be nutritionally abnormal and a second abnormality alarm is issued, it can be achieved by performing secondary sorting of the samples to be tested based on nutritional quality evaluation indicators.
[0048] Specifically, after determining that the quality monitoring results are abnormal in nutritional quality and issuing a second abnormality alarm, the samples to be tested with abnormal nutritional quality are identified and sorted a second time.
[0049] In this embodiment, based on the calculation of the safety and nutritional quality indicators of the sample to be tested using the first and second quality prediction models, a first or second abnormal alarm is triggered. If it is the first abnormal alarm, the distance from the abnormal sample to the primary sorting device is determined; if it is the second abnormal alarm, the distance from the abnormal sample to the secondary sorting device is determined. By dividing the distance determined according to the corresponding alarm type by the current transmission speed, the time interval for the abnormal sample to reach the primary or secondary sorting device can be obtained. According to the alarm type, an activation signal is sent to the corresponding sorting device, along with a vector of the time interval for the abnormal sample to reach the sorting device. After the sorting device is activated, a countdown begins. After the countdown reaches zero, the push cylinder ejects the push rod, pushing the abnormal sample into the corresponding abnormal item chute. After sorting is completed, the push cylinder resets, and the sorting device waits for the next activation signal.
[0050] The following is combined Figures 2-3 The present invention describes the construction of the optimal quality prediction model for the quality testing method for meat and meat products provided by the present invention. Figure 2This is one of the flowcharts illustrating the construction of the optimal quality prediction model for the quality testing method of meat and meat products provided by this invention. The construction of the optimal quality prediction model for the quality prediction method of meat and meat products provided by this invention can be applied to predicting and evaluating the safety and nutritional quality indicators of samples to be tested, such as... Figure 2 As shown, the construction of the optimal quality prediction model for the quality testing method of meat and meat products includes steps 201 to 210.
[0051] Step 201: Obtain the hyperspectral image of the sample to be tested.
[0052] In this step, hyperspectral image information of the sample to be tested is acquired at a preset height and a preset angle. It should be noted that the preset height setting depends on the size of the sample to be tested and the field of view of the hyperspectral image acquisition device at the selected height. The entire sample to be tested must be presented within the field of view of the hyperspectral image acquisition device. The preset angle setting is mainly for the acquisition of hyperspectral information of specific areas or specific feature parts of the sample to be tested. For example, spectral information at 90° can be acquired at a height of 10m as the hyperspectral image information of the sample to be tested. The hyperspectral image information at this angle can be used as the hyperspectral image information directly above the sample to be tested. For another example, hyperspectral image information at 45° or 60° can be acquired at a height of 15 or 20cm as the hyperspectral image information of the sample to be tested. This embodiment does not make specific limitations on the methods.
[0053] In this step, the present invention does not specify the requirements for the acquisition method and parameter settings of the hyperspectral image of the sample to be tested. These requirements can be modified according to the number of detection indicators and the computational complexity. Furthermore, the acquisition of the hyperspectral image of the sample to be tested can adopt the initial settings of the hyperspectral image acquisition device. For example, the hyperspectral image data acquired by the USB3.0 CMOS hyperspectral image acquisition device has a width of 1000 pixels, a height of 1020 pixels, a wavelength range of 400-1000nm, a spectral sampling interval of 2nm, and the size of the resulting hyperspectral image is 1000×1020×301, with a data type of int16.
[0054] The hyperspectral image information of the sample to be tested can be acquired by using a hyperspectral image acquisition device that employs line scanning or area scanning methods. This embodiment does not impose any specific limitations on this method.
[0055] Specifically, it acquires the hyperspectral image information of any sample to be tested from the data stream of the hyperspectral image acquisition device at a preset height and angle.
[0056] For example, the sample to be tested can be placed on a conveyor belt, and a ring-shaped halogen tungsten lamp with a heat dissipation device can be used as the light source. The hyperspectral image to be tested can be acquired by a hyperspectral image acquisition device at a preset angle and preset height. In the actual acquisition process, the spatial resolution or spectral resolution can be reduced by downsampling. By scaling the height and width of the hyperspectral image or increasing the sampling interval of the spectral bands, the volume of the hyperspectral image data can be reduced, thereby reducing the space occupied by the high-dimensional matrix in memory during online detection. To reduce computational complexity and speed up function operations, this embodiment does not impose specific limitations on these aspects. The methods for reducing hyperspectral image data size are not specifically defined. For example, if the original hyperspectral image data (HSID) is 1000×1020×301 pixels and has a size of 585.59 Mb, scaling its spatial resolution by 0.5 reduces the image frame size to 500×510×301 pixels, resulting in a dimensionality reduction of 146.40 Mb. This image matrix can be used as the image frame to be detected. Alternatively, increasing the spectral band sampling interval to 3 nm reduces the image frame size to 1000×1020×201 pixels, with a memory footprint of 391.43 Mb.
[0057] Step 202: Fuse the spectral images of the red, green and blue bands to obtain the RGB image of the sample to be tested.
[0058] Specifically, after obtaining the hyperspectral image of the sample to be tested, spectral images of red, green, and blue light wavelengths are acquired from the 400-780nm visible light band. Based on each color region, spectral images can be extracted, for example, from the wavelength with the largest mean value, or the wavelength with the most maximum values at the same point, or from the wavelengths specified by the CIE International Association of Illumination: 700nm for red light, 546nm for green light, and 436nm for blue light. The data type of the spectral images at the three wavelengths is converted to uint8 and normalized to obtain grayscale images of the red, green, and blue components. The grayscale images of the three color components are concatenated to obtain a 1000×1020×3 RGB image of the sample to be tested.
[0059] Step 203: Construct a binary template of the region of interest of the sample to be detected and obtain the binary template of each grayscale interval.
[0060] Specifically, the obtained RGB image of the sample to be tested is converted to a grayscale image to obtain the grayscale image of the sample to be tested. The region of interest of the sample to be tested is segmented from the background using a fixed threshold or a dynamic threshold method, and a label matrix is constructed. This invention does not impose specific limitations on the segmentation of the foreground and background of the sample to be tested. Based on the connectivity of the connected objects in the label matrix, the number of connected objects is counted, and the number of pixels in the binary template of each connected object is accumulated sequentially and sorted in descending order. The label of the connected object with the largest number of pixels is obtained as the binary template of the region of interest of the sample to be tested. The binary template of the region of interest of the sample to be tested is multiplied by the grayscale image of the sample to be tested to obtain the grayscale image of the region of interest of the sample to be tested. Based on the pixel grayscale values of the obtained grayscale image of the region of interest of the sample to be tested, the grayscale range is divided according to the grayscale range setting. The pixel values falling within the corresponding grayscale range are set to True, and the binary templates of each grayscale range of the sample to be tested are obtained.
[0061] It should be noted that the grayscale intervals can be set according to the grayscale image or for any color component in the region of interest of an RGB image, dividing the grayscale intensity range of 0-255 into several grayscale intervals; or according to the normalized pixel value range between the maximum and minimum values of non-zero pixels in any color component of the grayscale image or RGB image region of interest, for example, dividing the grayscale intensity range into 5 grayscale intervals, namely [1 51], [52 102], [103 153], [154 204], [205 255], and according to the order of the grayscale intervals, setting the pixel values of each non-zero pixel value in the grayscale image of the sample to be detected that fall into the 5 grayscale intervals to True, thereby constructing a binary template of each grayscale interval in the region of interest of the sample to be detected, denoted as Mk(i), i∈m, m represents the number of grayscale interval divisions; or by statistically analyzing the maximum grayscale value p in several grayscale images. Max With minimum gray value p Min Obtain the grayscale intensity range p Range The pixel values from the several grayscale images used are converted to p(j) / p Range , j∈n, where n represents the number of pixels in the corresponding grayscale interval. These are divided into 5 grayscale intervals according to a uniform distribution pattern: [0, p...]. Range / 5), [p Range / 5 p Range *2 / 5), [p Range *2 / 5 p Range *3 / 5), [p Range *3 / 5p Range *4 / 5), [p Range *4 / 5 1], and construct the binary templates of each grayscale interval in the region of interest of the sample to be detected in this order; or use a Gaussian distribution mode for division, which is not limited in this embodiment.
[0062] Step 204: Calculate the weights of pixel distribution in each grayscale interval of the grayscale image of the region of interest of the sample to be detected.
[0063] Specifically, the number of non-zero pixels in the binary template of the region of interest of the sample to be detected is counted and denoted as Sttotal. Then, the number of non-zero pixels in the binary template of each gray-level interval in the region of interest of the sample to be detected is calculated sequentially, which is Ssingle(j), j∈m, where m represents the number of gray-level interval divisions. The weight W(j) of the pixel distribution of each gray-level interval in the gray-level image of the region of interest of the sample to be detected is W(j) = Ssingle(j) / Stotal, j∈m, where m represents the number of gray-level interval divisions.
[0064] Step 205: Extract the mean spectral response of the hyperspectral image at each wavelength and the corresponding binary template for each gray-level range.
[0065] Specifically, the binary templates Mk(i), i∈m, representing the number of gray-level intervals in the region of interest of the sample to be detected described in step 203, are sequentially multiplied with the spectral images at each wavelength in the hyperspectral image. This yields a set of spectral response values at the same location in the spectral image at each wavelength, i.e., HSID(Mk(i), 1: s : j) or HSID(Mk(i), 400 : s : j), where i∈m, m represents the number of gray-level intervals, s is the spectral sampling interval, and j∈n, where n can represent the total number of bands or the maximum wavelength. The mean of this set is calculated along the spectral direction to obtain the mean spectral response HSD(i, 1 : s : j) or HSD(i, 400: s : j) of each gray-level interval at each band or wavelength. A continuous curve is formed by the mean spectral response values at each band or wavelength to obtain the mean spectral response curve of the corresponding gray-level interval.
[0066] Step 206: Obtain the weighted mean spectral response curve of the corresponding interval based on the weight of the pixel distribution in each grayscale interval.
[0067] Specifically, the weights W(i) of the pixel distribution in each gray-level interval described in step 204, i∈m, where m represents the number of gray-level interval divisions, are multiplied by the mean spectral response curves HSD(i, 1 : s : j) or HSD(i, 400 : s : j) of the corresponding gray-level interval described in step 205, where s is the spectral sampling interval, j∈n, and n can represent the total number of bands or the maximum wavelength. This yields the weighted mean spectral response curves wtHSD(i, 1 : s : j) or wtHSD(i, 400 : s : j) of each gray-level interval in the region of interest of the sample to be detected. The weighted mean spectral response curves of each interval are then summed to obtain the weighted mean spectral response curve sampleWtHSD(i, 1 : s : j) or sampleWtHSD(i, 400 : s : j) of the sample to be detected.
[0068] Step 207: Select characteristic bands from the weighted mean spectral response curve.
[0069] In this step, the obtained weighted mean spectral response curves of the samples to be tested undergo spectral preprocessing. One or more methods, such as baseline correction, SG filtering, centering, normalization, standard normal variable transformation, multivariate scattering correction, and spectral derivatives (first and second order), are used to reduce noise, filter, correct, and improve the spectral data quality of the weighted mean spectral response curves. One or more methods, such as Mahalanobis distance, principal component analysis, Laida criterion, Monte Carlo cross-validation sampling, and ODXY, are used to remove outliers from the set of weighted mean spectral response curves of the samples to be tested. The weighted mean spectral response curves after preprocessing and outlier removal are then analyzed. The spectral response curve is used to screen characteristic bands in order to eliminate redundant information, highlight key variables, and improve analysis efficiency. Various methods, such as interval variable iterative space shrinkage, competitive adaptive weighted sampling, iterative information-preserving variable method, random frog jumping method, continuous projection algorithm, stability competitive adaptive reweighted sampling method, Monte Carlo non-information variable screening method, gradient boosting decision tree algorithm, and random forest method, are used to obtain a weighted mean spectral response curve with high correlation of characteristic information, reduced data dimensionality, and pure effective response bands. This invention does not impose specific limitations on the processing, acquisition, and parameter adjustment methods for the effective spectral information of the sample to be tested.
[0070] Step 208: The weighted average spectral curves corresponding to the selected characteristic bands are matched one-to-one with the quality physicochemical indicators to construct a quality prediction model for the sample to be tested.
[0071] In this step, for the construction of the first quality prediction model, the one-to-one correspondence between safety and quality evaluation indicators and the quality of the sample to be tested is first determined, which is represented as the safety and quality of the sample to be tested. This operation is performed for all samples to be tested. If the sample to be tested is raw meat, the volatile basic total nitrogen dataset, malondialdehyde dataset, total bacterial count dataset, tetracycline dataset, oxytetracycline dataset, and chloramphenicol dataset are obtained for the region of interest of the sample to be tested. If the sample to be tested is processed meat, the volatile basic total nitrogen dataset, malondialdehyde dataset, total bacterial count dataset, sodium nitrite dataset, sodium nitrate dataset, and natamycin dataset are obtained for the region of interest of the sample to be tested. Then, the volatile basic total nitrogen dataset, malondialdehyde dataset, total bacterial count dataset, tetracycline dataset, oxytetracycline dataset, and chloramphenicol dataset or the volatile basic total nitrogen dataset, malondialdehyde dataset, total bacterial count dataset, sodium nitrite dataset, sodium nitrate dataset, and natamycin dataset of the above samples are respectively compared with the samples to be tested with different packaging forms, different packaging materials, different meat types, and different cut parts. After correlating the weighted mean spectral response curves of the regions of interest, a linear regression prediction model with several n factors is established, where n ≤ M and n ∈ N+, and M is the number of selected characteristic bands. The candidate prediction models with the highest corrected correlation coefficient Rc and validation correlation coefficient Rv are selected. The partial least squares method is used to construct the n-factor linear regression prediction model, using the volatile basic nitrogen, malondialdehyde, total bacterial count, tetracycline, oxytetracycline, and chloramphenicol or volatile basic nitrogen and malondialdehyde corresponding to the regions of interest of the sample to be tested. Safety and quality indicators such as total bacterial count, sodium nitrite, sodium nitrate, and natamycin are used as dependent variables Ym, and the weighted mean spectral response curve of the sample to be tested is used as the independent variable matrix T. The relational equations Ym = f(T) + (a + b|f(T)|)e are constructed respectively. In the relational equation, f(T) is the partial least squares function form of the model, expressed as Σk(i)T(i), where k(i) represents the estimated coefficient vector of each observation, and T(i) represents the weighted mean spectral response value under a certain characteristic band, i∈[1]. [n], in the relational equation (a+b|f(T)|)e is the error variance model, where a is the intercept of the error variance model, b is the slope of the error variance model, e is a variable matrix with mean 0 and variance 1, Ym represents the observed value of each quality index, m∈[1 6]. The corresponding prediction equation is fitted by the iterative method. For the iterative process, different weight functions such as Andrews, Bisquare, Cauchy, Huber, Logistic, and Welsch are used to control the robustness of the fitting. When the estimated value converges to the termination tolerance range based on the estimated coefficient or based on the sum of squared residuals, the iterative process ends. The model with the largest correction correlation coefficient Rc is selected as the optimal prediction model of the safety quality index of the sample to be tested after the current feature band screening. During model verification,The main methods employed are K-fold, HoldOut, and LeaveOne to divide the sample set into calibration and validation sets. After each division, the sample numbers are compared with those from the previous division, and the validation correlation coefficient Rv of the prediction model is calculated. If the sample numbers from the two divisions are consistent, the sample set is re-divided to avoid redundant model training. Hyperspectral images of the samples are acquired to separate regions of interest from the target objects. After feature band screening of the safety and quality changes related to the weighted mean spectral response curve, linear statistical analysis based on partial least squares is performed. Multiple weighting functions are used to control robustness during the iteration process. This effectively fits the prediction equations of the weighted mean spectral response curves and changes in several quality indicators for samples under different packaging forms, packaging materials, meat types, and cuts, improving the robustness and accuracy of the model's prediction performance. This invention only provides guidance on the method for constructing the first model and does not specify the type of model or construction method.
[0072] Step 209: Evaluate the model parameters to obtain the optimal quality prediction model.
[0073] In this step, the parameters of several quality prediction models constructed in step 208 after screening based on different characteristic bands are compared. Based on the condition that the corrected correlation coefficient Rc and the validation correlation coefficient Rv are greater than 0.9, the optimal first quality prediction model for a certain safety quality index is selected, which has the largest corrected correlation coefficient Rc, the largest validation correlation coefficient Rv, the smallest root mean square residual RMR, the smallest Akaike information criterion (AIC), and the fewest characteristic bands. The corresponding characteristic bands are recorded as data parameters when extracting the weighted mean spectral response curve. If the model parameter evaluation does not meet the requirements, steps 207 to 209 are repeated and the parameter settings in the steps are adjusted. This invention only provides a guiding description of the method for evaluating the first prediction model and does not specify which model evaluation index and method to use.
[0074] In one implementation, Figure 3 This is the second schematic diagram of the process for constructing the optimal quality prediction model for the quality testing method of meat and meat products provided by this invention. Figure 3 As shown, an optimal quality prediction model is constructed based on the hyperspectral image information of the sample to be tested, specifically including: Step 20201: Scale-scaling the hyperspectral image matrix of the sample to be tested.
[0075] In this step, the initial data dimensionality reduction is performed by scaling the hyperspectral image matrix of the sample to be tested acquired by the hyperspectral image acquisition device in two-dimensional space.
[0076] Specifically, the hyperspectral image matrix of the sample to be tested is obtained based on the hyperspectral image information of the sample to be tested after initial dimensionality reduction. It should be noted that in actual implementation, the hyperspectral image information of the sample to be tested is obtained at a predicted angle, and the height of the hyperspectral image acquisition device and the preset acquisition angle of the spectral data are set according to the field of view width of the hyperspectral image acquisition device at different object distances. For example, the spectral matrix at 90 degrees can be acquired as the hyperspectral image information to be tested. This embodiment of the invention does not specifically limit this. It is understood that the spectral matrix can be obtained by a hyperspectral image acquisition device (hyperspectral camera or video camera), and the hyperspectral image matrix can be statically acquired or continuously acquired. This embodiment of the invention does not limit this. Furthermore, this embodiment of the invention does not specifically limit the method of acquiring the hyperspectral image information of the sample to be tested obtained at the preset angle. For example, a ring-shaped halogen tungsten lamp with a heat dissipation device can be placed on a conveyor belt and used as a light source, and the image is captured by a hyperspectral camera at the preset angle and height. The hyperspectral image information of the sample to be tested is acquired. The specific data acquisition method or spectral image acquisition method used is not specifically limited in this invention. Furthermore, in the actual acquisition of hyperspectral image information, a downsampling method is used to reduce the sampling rate of the digital signal, filter out some signal noise, and reduce the volume of the data matrix. By scaling the spatial resolution of the spectral matrix, the space occupied by the spectral matrix in memory during online detection can be reduced, computational complexity can be reduced, and function operation speed can be accelerated. This embodiment of the invention does not specifically limit this. The size of the acquired hyperspectral matrix is 1000×1020×601, the spectral acquisition range is 400-1000nm, and the original hyperspectral image size is 1.14Gb. By setting the downsampling rate scale to 0.5, the spectral sampling interval is 2nm, and the size of the hyperspectral image after the first dimensionality reduction is 500×510×301, with a size of 146.40Mb. The data volume is 1 / 8 of the original data. This embodiment does not limit this.
[0077] Step 20202: Obtaining the grayscale image of the sample to be tested.
[0078] Specifically, within the visible light range of 400-780nm, spectral information at the characteristic wavelengths of red light (650nm), green light (550nm), and blue light (470nm) is extracted. The number of bands in the spectral matrix are 126 (red component), 76 (green component), and 36 (blue component). The data type of the three characteristic components is converted from int16 to uint8, and then cascaded and fused in the order of R, G, B to form a 500×510×3 RGB image. Through color space conversion, the grayscale image of the sample to be detected is obtained.
[0079] Step 20203: Obtaining and dividing the binary template of the region of interest and grayscale interval of the sample to be tested.
[0080] Specifically, the region of interest (ROI) of the sample to be detected is segmented from the background using a fixed threshold or dynamic threshold method, and a label matrix is constructed. This invention does not impose specific limitations on the segmentation of the foreground and background of the sample to be detected. Based on the connectivity of connected objects in the label matrix, the number of connected objects is counted, and the pixel count of the binary template of each connected object is accumulated sequentially and sorted in descending order. The label of the connected object with the largest pixel count is obtained as the binary template of the ROI of the sample to be detected. Further, the binary template of the ROI of the sample to be detected is multiplied by the grayscale image of the sample to be detected to obtain the grayscale image of the ROI of the sample to be detected. Further, the grayscale intervals can be set according to the grayscale image or for any color component in the ROI of the RGB image, dividing the grayscale intensity range of 0-255 into several grayscale intervals. The grayscale intensity range is divided into 5 grayscale intervals: [1 51], [52 102], [103 153], [154 204], [205 ...
[255] Furthermore, in accordance with the order of grayscale intervals, the pixel values of each non-zero pixel value in the grayscale image of the sample to be detected that fall into 5 grayscale intervals are set to True, thereby constructing a binary template of each grayscale interval in the region of interest of the sample to be detected, denoted as Mk(i), i∈m, where m represents the number of grayscale interval divisions. This embodiment does not limit this. By accumulating the number of non-zero pixels in the binary template of the region of interest of the sample to be detected, the total pixel area of the region of interest of the sample to be detected is obtained. The number of non-zero pixels in the binary template of each grayscale interval in the region of interest of the sample to be detected is accumulated sequentially to obtain the pixel area of each grayscale interval. The pixel area of each grayscale interval is divided by the total pixel area of the region of interest of the sample to be detected to obtain the weight of the pixel distribution in each grayscale interval of the sample to be detected.
[0081] Step 20204: Obtaining the mean spectrum of different grayscale ranges.
[0082] Specifically, the binary templates of each gray-level interval in the region of interest of the sample to be tested obtained in step 20203 are sequentially multiplied element-wise with the spectral images of each wavelength in the hyperspectral image to obtain the set of spectral response values at the same point in the spectral image of each wavelength under the selected point of the binary template of each gray-level interval. The mean value of this set is calculated along the spectral direction to obtain the mean spectral response value of each gray-level interval under each band or wavelength. The mean spectral response value of each band or wavelength is used to form a continuous curve to obtain the mean spectral response curve of the corresponding gray-level interval.
[0083] Step 20205: Weighted mean spectral response curve of the sample to be tested.
[0084] Specifically, the mean spectral response curve of the gray range corresponding to the sample to be tested obtained in step 20204 is multiplied by the weight of the pixel distribution in each gray range of the sample to be tested obtained in step 20203, and then accumulated according to the wavelength points to obtain the weighted mean spectral response curve of the sample to be tested.
[0085] Step 20206: Multiple iterative screening of characteristic bands.
[0086] Specifically, the weighted mean spectral response curve of the sample to be tested is subjected to spectral preprocessing. One, several or a combination of methods such as baseline correction, SG filtering, centering method, normalization method, standard normal variable transformation, multivariate scattering correction and spectral derivative (first order, second order) are used to reduce noise, filter, correct and improve the quality of spectral data.
[0087] Furthermore, outliers in the set of weighted mean spectral response curves of the samples to be tested are removed by employing one, multiple, or combinations of methods such as Mahalanobis distance, principal component analysis, Laida criterion, Monte Carlo cross-validation sampling, and ODXY.
[0088] Furthermore, the weighted mean spectral response curve after preprocessing and outlier removal is subjected to feature band screening to eliminate redundant information, highlight key variables, and improve analysis efficiency. Various methods, such as interval variable iterative space contraction, competitive adaptive weighted sampling, iterative information-preserving variable method, random frog-jumping method, continuous projection algorithm, stability competitive adaptive reweighted sampling, Monte Carlo non-information variable screening, gradient boosting decision tree algorithm, and random forest method, are used to obtain weighted mean spectral response curves with high feature information relevance, reduced data dimensionality, and pure effective response bands. This embodiment does not impose specific limitations on the processing, acquisition, and parameter adjustment methods for the effective spectral information of the sample to be tested.
[0089] Step 20207: Construct a quality prediction model.
[0090] In this step, for the construction of the first quality prediction model, the one-to-one correspondence between the safety and quality evaluation indicators and the quality of the sample to be tested is first determined, which is represented as the safety and quality of the sample to be tested. This operation is performed for all samples to be tested. Taking frozen pork No. IV raw meat packaged by hand with PVC plastic film as an example, the volatile basic total nitrogen dataset, malondialdehyde dataset, total bacterial count dataset, tetracycline dataset, oxytetracycline dataset, and chloramphenicol dataset of the region of interest of the sample to be tested are obtained. The chemical values in each dataset are obtained by analyzing the above indicators according to the requirements of GB / T9959.2-2008 "Separation of Fresh and Frozen Lean Pork". Then, the weighted mean spectral response of the volatile basic total nitrogen dataset, malondialdehyde dataset, total bacterial count dataset, tetracycline dataset, oxytetracycline dataset, and chloramphenicol dataset of the sample to be tested is compared with the region of interest of the sample to be tested. After the curve set is correlated, a linear regression prediction model of several n-factor variables is established, n≤M and n∈N+, where M is the number of selected characteristic bands, which is obtained by the characteristic wavelength selection method in step 20206. The n value obtained by using different selection methods in combination is different each time. The candidate prediction model with the highest correction correlation coefficient Rc and validation correlation coefficient Rv is selected respectively. The partial least squares method is used to construct the n-factor variable linear regression prediction model. The volatile basic total nitrogen, malondialdehyde, total colony count, tetracycline, oxytetracycline and chloramphenicol safety quality indicators corresponding to the region of interest of the sample to be tested are respectively used as dependent variables Ym. The weighted mean spectral response curve of the sample to be tested is used as the independent variable matrix T. The relationship equation Ym=f(T)+(a+b|f(T)|)e is constructed respectively. Ym represents the observed value of each quality indicator, m∈[1 [6] An iterative method is used to fit the corresponding prediction equation. For the iterative process, Andrews, Bisquare, Cauchy, Huber, Logistic, Welsch and other methods are used to control the robustness of the fitting. After the iteration process ends, the model with the largest correction correlation coefficient Rc is selected as the optimal prediction model for the safety and quality index of the sample to be tested after the current feature band screening. During model validation, K-fold, HoldOut and LeaveOne methods are mainly used to divide the sample set into calibration set and validation set. After each division, the sample number of the calibration set and validation set after the previous sample division needs to be compared with the sample number of the calibration set and validation set after the previous sample division, and the validation correlation coefficient Rv of the prediction model is calculated. This embodiment only provides a guiding description of the method for constructing the first quality prediction model (safety and quality prediction model) and does not specify the model to be used or the construction method.
[0091] Step 20208: Does the prediction model meet the selection criteria? Specifically, the parameters of several quality prediction models constructed after screening based on different characteristic bands in step 20207 are compared. Based on the condition that the corrected correlation coefficient Rc and the validation correlation coefficient Rv are greater than 0.9, the optimal first quality prediction model for a certain safety quality index is selected based on the largest corrected correlation coefficient Rc, the smallest validation correlation coefficient Rv, the smallest root mean square residual RMR, the smallest Akaike information content criterion AIC, and the fewest characteristic bands. If the model parameter evaluation does not meet the requirements, steps 20206 to 20208 are repeated and the parameter settings in the steps are adjusted.
[0092] Step 20209: Optimal quality prediction model.
[0093] Specifically, the independent variable weight coefficients of the optimal quality prediction model for each safety and quality index of frozen pork No. IV raw meat packaged by hand with PVC plastic film are constructed into vectors, and the weight coefficient matrix of the safety and quality prediction model is formed according to the order of the safety indexes, which is then used as a parameter file for calling.
[0094] Step 20210: Selection of the final characteristic band.
[0095] Specifically, the final band characteristic bands of the weighted average spectral curve selected when constructing the optimal quality prediction model for each safety and quality indicator of frozen pork No. IV raw meat packaged in PVC plastic film are constructed as band vectors. According to the order of safety indicators, a safety and quality characteristic wavelength matrix is formed, which serves as the parameter file for safety and quality prediction. In addition, the characteristic wavelengths of each safety indicator are merged and used as the parameter file for dimensionality reduction of the hyperspectral image information of the sample to be tested in the direction of spectral resolution during detection, so as to be called.
[0096] Figure 4 This is a flowchart illustrating the method for sorting abnormal meat and meat products provided by this invention. The quality inspection method for meat and meat products provided by this invention is applicable to various situations involving the quality inspection of meat and meat products. The executing entity of this method can be an electronic device, or a quality inspection and sorting device for meat and meat products installed within that electronic device. This quality inspection and sorting device for meat and meat products can be implemented through software, hardware, or a combination of both, such as... Figure 4 As shown, the process of obtaining target parameters of the sample to be tested based on the hyperspectral image information of the sample to be tested and calculating the corresponding weighted average spectral response curve, determining the quality prediction result based on the weighted average spectral response curve and the optimal quality prediction model, and sorting out abnormal products based on the quality prediction result is further optimized. The abnormal product sorting method for meat and meat products provided by the present invention includes steps 401 to 408.
[0097] Step 401, Hyperspectral image of the sample to be tested Specifically, a hyperspectral image of the sample to be tested is acquired using a hyperspectral camera. The hyperspectral image matrix is downsampled and scaled in the row and column directions. The red, green, and blue characteristic spectral components of bands 126, 76, and 36 are extracted from the hyperspectral image scaling matrix, cascaded and fused into an RGB image, and color space conversion is performed to obtain a grayscale image of the sample to be tested. The data type of each pixel in the grayscale image is converted from int16 to uint8. Based on the values in the loaded quality feature wavelength matrix, the spectral image of the corresponding band or wavelength is extracted from the hyperspectral image scaling matrix and cascaded to reconstruct the spectral image matrix of the sample to be tested, thus achieving the purpose of data dimensionality reduction.
[0098] Step 402: Obtain the region of interest and weighted mean spectral response curve of the sample to be tested.
[0099] Specifically, a fixed threshold or dynamic threshold method is used to segment the region of interest (ROI) of the sample to be detected from the background, and a binary template of the ROI of the sample to be detected is constructed. The binary template of the ROI of the sample to be detected is multiplied by the grayscale image of the sample to be detected to obtain the grayscale image of the ROI of the sample to be detected. According to the pre-set grayscale interval order, the pixel values of each non-zero pixel value in the grayscale image of the sample to be detected that fall into 5 grayscale intervals are set to True, and a binary template of each grayscale interval in the ROI of the sample to be detected is constructed.
[0100] Furthermore, the number of non-zero pixels in the binary template of the region of interest of the detection sample is accumulated and recorded as the total pixel area of the region of interest of the sample to be detected. The number of non-zero pixels in the binary template of each gray-level interval in the region of interest is accumulated and recorded as the pixel area of each gray-level interval in the region of interest. The pixel area of each gray-level interval in the region of interest is divided by the total pixel area of the region of interest to obtain the weight of the pixel distribution in each gray-level interval of the sample to be detected.
[0101] Furthermore, the binary templates of each gray-level interval in the region of interest are sequentially multiplied with the reconstructed spectral image matrix of the sample to be detected, and the mean value is calculated along the direction of the maximum spectral band or wavelength to obtain the mean spectral response curve of the corresponding gray-level interval. The weight of the pixel distribution in each gray-level interval is multiplied with the mean spectral response curve of the corresponding gray-level interval and then added to obtain the weighted mean spectral response curve of the sample to be detected.
[0102] Step 403: Calculate the centroid coordinates of the sample based on the binary template of the region of interest of the sample to be tested.
[0103] Specifically, matrix data is calculated and determined based on the binary template of the region of interest (ROI) of the sample to be tested. The matrix data includes the coordinates of the minimum bounding rectangle and the centroid of the ROI. It should be noted that to calculate the centroid and the coordinates of the minimum bounding rectangle of the ROI, the horizontal and vertical coordinates of all non-zero pixels in the ROI are first obtained based on the binary template of the ROI of the sample to be tested. The horizontal and vertical coordinates are then summed, and the sum of the horizontal and vertical coordinates is divided by the sum of the number of non-zero pixels. The rounded values are then used to obtain the centroid coordinates of the ROI of the sample to be tested.
[0104] Furthermore, the binary template of the region of interest (ROI) of the sample to be detected is converted into a column vector. The column indices of the first and last non-zero pixels in the vector are obtained and divided by the height of the image and then moduloed to obtain the coordinates [c1 r1] and [c2 r2]. The binary template of the ROI is then transposed and converted into a column vector. The column indices of the first and last non-zero pixels in the vector are obtained and divided by the width of the image and then moduloed to obtain the coordinates [r3 c3] and [r4 c4]. The coordinates are then transposed to obtain [c3 r3] and [c4 r4]. Furthermore, the origin coordinates of the minimum bounding rectangle are obtained as [c1 c3] and its diagonal coordinates are [c2 c4]. The coordinate matrix of the minimum bounding rectangle of the sample to be detected is then [c1 c3 c2 - c1 c4 - c3]. This matrix is mainly used to project the position of the sample to be detected onto the display. This embodiment does not impose specific limitations on this.
[0105] Step 404: Obtain the speed sensor value and calculate the time it takes for the sample to be tested to reach the pushing device.
[0106] Specifically, when the centroid coordinates of the region of interest of the sample to be tested are determined, the distance to the specific position represents the distance constants D1 and D2 between the push device of the first sorting and the push device of the second sorting and the centroid of the sample to be tested. The time for the sample to reach the specific position is determined based on the ratio of the distance of the sample to the specific position to the current transmission speed of the sample.
[0107] It should be noted that the current transmission speed of fresh meat products is obtained by accessing a specific register address through a speed encoder, obtaining a hexadecimal code, converting it into a decimal code with the unit cm / s, and obtaining the transmission speed V. Further, the distance matrix of the distance to the specific position is divided by the transmission speed V to obtain the time interval vector T1 = D1 / V - T1d for the sample to be tested to arrive at the accompanying conveyor of the first sorting, and the time interval vector T2 = D2 / V - T2d for the sample to be tested to arrive at the pushing device of the second sorting. It should be noted that T1d and T2d are the time advance of the pushing device when it receives the activation signal, which is not limited in this embodiment.
[0108] Step 405: Whether the safety indicators of the sample to be tested meet the standard requirements.
[0109] Specifically, the weighted average spectral response curve of the sample to be tested is imported into the first quality prediction model to obtain the values of each safety quality index and compare them with the preset safety index thresholds. If all safety quality indicators meet the standard requirements, step 406 is executed; otherwise, step 407 is executed.
[0110] Step 406: Whether the nutritional indicators of the sample to be tested meet the standard requirements.
[0111] Specifically, the weighted average spectral response curve of the sample to be tested is imported into the second quality prediction model to obtain the values of each nutritional quality index and compare them with the preset safety index threshold. If all nutritional quality indexes meet the standard requirements, the sample to be tested is a normal product; otherwise, 407 is executed.
[0112] Step 407, Quality Anomaly Alarm, Send Activation Signal.
[0113] Specifically, based on the quality prediction results of the first quality prediction model and the second quality prediction model for the sample to be tested, a first abnormal alarm or a second abnormal alarm is triggered. Depending on the type of alarm, an activation signal is sent to the corresponding sorting device, and the time when the sample to be tested arrives at the sorting device is sent.
[0114] Step 408: The sorting device removes abnormal samples.
[0115] Specifically, after the sorting device is activated, a countdown begins based on the time it takes for the sample to be tested to arrive at the sorting and pushing device. Once the countdown reaches zero, the push rod pops out and changes the direction of the abnormal sample, guiding it into the designated diversion chute. After sorting is completed, the push rod resets, and the sorting device waits for the next activation signal.
[0116] The quality testing device for meat and meat products provided by the present invention will be described below. The quality testing device for meat and meat products described below can be referred to in correspondence with the quality testing method for meat and meat products described above.
[0117] Figure 5 This is a schematic diagram of the quality testing device for meat and meat products provided by the present invention, with reference to... Figure 5 As shown, the quality monitoring device 500 for fresh meat products includes: a data acquisition unit 501, a data processing and analysis unit 502, a judgment and early warning unit 503, and a sample sorting unit 504; wherein, Data acquisition unit 501 is used to acquire hyperspectral image information of the sample to be tested; The data processing and analysis unit 502 is used for: 1. Obtaining the grayscale image of the sample to be tested based on the spectral information of the hyperspectral image of the sample to be tested, calculating the pixel distribution weight of each grayscale interval, obtaining the mean spectral response curve of each grayscale interval based on the binary template of each grayscale interval, multiplying the pixel distribution weight of each grayscale interval with the mean spectral response curve of the corresponding interval and adding them together to obtain the weighted mean spectral response curve of the sample to be tested; 2. Using one, multiple or several characteristic wavelength screening and combination methods, constructing and screening the optimal quality prediction model based on the principles of maximizing the correction correlation coefficient and verification correlation coefficient, minimizing the root mean square residual (RMR), minimizing the Akaike information content criterion (AIC), and minimizing the number of characteristic bands; 3. Obtaining the required iterative dimensionality reduction characteristic bands based on the corresponding sample to be tested and quality indicators, which are used to extract characteristic band data from the acquired hyperspectral image information when testing the sample.
[0118] The judgment and early warning unit 503 is used to import the weighted average spectral response curve into the optimal first quality prediction model to obtain the safety quality index of the sample to be tested, and judge whether it meets the preset index threshold. If not, a quality abnormality alarm is issued. If yes, the weighted average spectral response curve is imported into the optimal second quality prediction model to obtain the nutritional quality index of the sample to be tested, and judge whether it meets the preset index requirements. If not, a quality abnormality alarm is issued. The optimal first quality prediction model is an optimal safety quality prediction model pre-trained and determined based on the spectral information of the sample to be tested, and the optimal second quality prediction model is an optimal nutritional quality prediction model pre-trained and determined based on the spectral information of the sample to be tested. The quality prediction results are used to indicate the sorting of products with abnormal quality.
[0119] The sample sorting unit 504 is used to send an activation signal and the parameters of the sample to be tested to the sorting device according to the type of alarm, and to sort and reject abnormal samples.
[0120] In one example embodiment, the optimal quality prediction model includes a first quality prediction model which is a safety quality prediction model pre-trained and determined based on the weighted average spectral response curve of the sample to be tested, and a second quality prediction model which is a nutritional quality prediction model pre-trained and determined based on the weighted average spectral response curve of the sample to be tested. In one example embodiment, the judgment and early warning unit 503 is specifically used to: import the weighted average spectral response curve into the optimal first quality prediction model to obtain the safety quality index of the sample to be tested, determine whether it meets the preset index threshold, if not, issue a quality abnormality alarm, if yes, import the weighted average spectral response curve into the optimal second quality prediction model to obtain the nutritional quality index of the sample to be tested, determine whether it meets the preset index requirements, if not, issue a quality abnormality alarm; wherein, the optimal first quality prediction model is an optimal safety quality prediction model pre-trained and determined based on the spectral information of the sample to be tested, the optimal second quality prediction model is an optimal nutritional quality prediction model pre-trained and determined based on the spectral information of the sample to be tested, and the quality prediction results are used to indicate the sorting of products with quality abnormalities.
[0121] In one example embodiment, the device further includes a first sorting module, specifically used for: after determining that the quality prediction result is a safety quality anomaly and issuing a first anomaly alarm, performing a sorting and rejection of the sample to be tested based on safety quality evaluation indicators.
[0122] In one example embodiment, the device further includes a second sorting module, specifically used for: after determining that the quality prediction result is abnormal in nutritional quality and issuing a second abnormality alarm, performing secondary sorting and rejection of the sample to be tested based on nutritional quality evaluation indicators.
[0123] In one example embodiment, the data processing and analysis unit 502 is specifically used for: 1. Obtaining a grayscale image of the sample to be tested based on the spectral information of the hyperspectral image of the sample to be tested, calculating the pixel distribution weights of each grayscale interval, obtaining the mean spectral response curve of each grayscale interval based on the binary template of each grayscale interval, multiplying the pixel distribution weights of each grayscale interval with the mean spectral response curve of the corresponding interval and adding them together to obtain the weighted mean spectral response curve of the sample to be tested; 2. Using one, more, or several characteristic wavelength screening and combination methods, constructing and screening the optimal quality prediction model based on the principles of maximizing the correction correlation coefficient and verification correlation coefficient, minimizing the root mean square residual (RMR), minimizing the Akaike information content criterion (AIC), and minimizing the number of characteristic bands; 3. Obtaining the required iterative dimensionality reduction characteristic bands based on the corresponding sample to be tested and quality indicators, for use in extracting characteristic band data from the acquired hyperspectral image information when testing the sample.
[0124] In one example embodiment, the data acquisition unit 501 is specifically used to: acquire hyperspectral image information of any meat or meat product to be detected by the hyperspectral image acquisition device at a preset angle and height.
[0125] The apparatus of this embodiment can be used to execute the method of any embodiment in the side embodiment of the method for quality testing of meat and meat products. Its specific implementation process and technical effects are similar to those in the side embodiment of the method for quality testing of meat and meat products. For details, please refer to the detailed description in the side embodiment of the method for quality testing of meat and meat products, which will not be repeated here.
[0126] Figure 6 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 6 As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630, a communication bus 640, a hyperspectral imaging device 650, a sorting device 660, and a speed encoder 670. The processor 610, communication interface 620, and memory 630 communicate with each other via the communication bus 640. The hyperspectral imaging device 650, sorting device 660, and speed encoder 670 send data to the communication bus 640 and receive instructions via the communication interface 620. The processor 610 can call logical instructions in the memory 630 to execute a quality testing method for meat and meat products. This method includes: obtaining the region of interest and grayscale range of the sample to be tested based on the spectral information of the hyperspectral image; obtaining the corresponding weights of the spectrum of the sample to be tested and the features of dimensionality reduction. The system obtains the weighted average spectral response curve of the sample to be tested in a specific band. The spectral curve is then imported into a first quality prediction model to obtain the safety and quality indicators of the sample. It is determined whether these indicators meet preset thresholds. If not, a quality anomaly alarm is issued and the abnormal sample is removed. If yes, the spectral curve is imported into a second quality prediction model to obtain the nutritional quality indicators of the sample. It is then determined whether these indicators meet preset requirements. If not, a quality anomaly alarm is issued and the abnormal sample is removed. The quality prediction model is a safety and nutritional quality prediction model pre-trained based on the spectral information of the sample to be tested. The quality prediction results are used to indicate the sorting of products with quality anomalies.
[0127] Furthermore, when the logical instructions in the aforementioned memory 630 can be implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media that can store program code, such as USB flash drives, mobile hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0128] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the quality detection methods for meat and meat products provided by the above methods. The method includes: obtaining the region of interest and grayscale range of the sample to be tested based on the spectral information of the hyperspectral image of the sample to be tested; obtaining the corresponding weights and characteristic bands of the spectrum of the sample to be tested and the selected dimension reduction, and obtaining the weighted mean spectral response curve of the sample to be tested; importing the spectral curve into a first quality prediction model to obtain the safety quality index of the sample to be tested, and determining whether it meets the preset index threshold. If not, a quality abnormality alarm is issued and the abnormal sample is removed. If yes, the spectral curve is imported into a second quality prediction model to obtain the nutritional quality index of the sample to be tested, and determining whether it meets the preset index requirements. If not, a quality abnormality alarm is issued and the abnormal sample is removed. The quality prediction model is a safety and nutritional quality prediction model pre-trained and determined based on the spectral information of the sample to be tested, and the quality prediction result is used to indicate the sorting of products with abnormal quality.
[0129] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the quality detection method for meat and meat products provided by the above methods. The method includes: obtaining the region of interest and grayscale range of the sample to be tested based on the spectral information of the hyperspectral image of the sample to be tested; obtaining the corresponding weights and characteristic bands of the spectrum of the sample to be tested and the selected dimension reduction, and obtaining the weighted mean spectral response curve of the sample to be tested; importing the spectral curve into a first quality prediction model to obtain the safety quality index of the sample to be tested, determining whether it meets the preset index threshold; if not, issuing a quality abnormality alarm and removing the abnormal sample; if yes, importing the spectral curve into a second quality prediction model to obtain the nutritional quality index of the sample to be tested, determining whether it meets the preset index requirements; if not, issuing a quality abnormality alarm and removing the abnormal sample; wherein, the quality prediction model is a safety and nutritional quality prediction model pre-trained and determined based on the spectral information of the sample to be tested, and the quality prediction result is used to indicate the sorting of products with abnormal quality.
[0130] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platform, or of course by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or some parts of the embodiments.
[0131] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that, unless otherwise defined, the technical or scientific terms used in this invention should be understood in the ordinary sense by those skilled in the art to which this invention pertains, and the terms "comprising" or "including" or similar terms used in this invention mean that the element or object preceding the word covers the element or object listed after the word and its equivalents.
[0132] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A quality inspection system for meat and meat products, characterized in that, include: Data acquisition unit, data processing and analysis unit, judgment and early warning unit, and sample sorting unit; The data acquisition unit is used to acquire hyperspectral image information of the sample to be tested; The data processing and analysis unit is used to extract the region of interest of the sample based on the hyperspectral image, calculate the weighted mean spectral response curve, and preprocess the spectral data, screen the feature bands, and conduct stability evaluation based on multiple cross-validations to determine the optimal set of feature bands for quality prediction. The judgment and early warning unit is used to call the optimal quality prediction model pre-trained and determined by stability verification based on the weighted mean spectral response curve to obtain the safety quality index and nutritional quality index of the sample to be tested, and compare the obtained index with the corresponding preset threshold to determine whether it exceeds the threshold, and issue an abnormal alarm when an abnormality is determined. The sample sorting unit is used to receive abnormal alarms and control the sorting device to reject samples that are determined to be abnormal.
2. The quality inspection system for meat and meat products according to claim 1, characterized in that, The data processing and analysis unit determines the region of interest and obtains the grayscale range according to the following steps: (1) Adaptively construct an RGB image based on the visible spectrum information of the hyperspectral image of the sample to be tested; (2) Determine the region of interest image based on the RGB image and generate a binary template for the region of interest; (3) Obtain the grayscale image of the region of interest based on the region of interest image and its binary template; (4) Divide the grayscale image into several grayscale intervals and obtain the binary templates of the corresponding intervals.
3. The quality inspection system for meat and meat products according to claim 2, characterized in that, The data processing and analysis unit is further used to calculate the weighted mean spectral response curve of the sample to be tested based on the acquired gray-scale binary template, including: (1) Based on the binary template of each corresponding gray range, extract and calculate the mean spectral response curve of the range in each band from the hyperspectral matrix; (2) Determine the weight W(j) of each gray level interval based on the total number of non-zero pixels in the binary template of the region of interest, Stotal, and the number of non-zero pixels in the binary template of each gray level interval, Ssingle(j), where W(j) = Ssingle(j) / Stotal; (3) Based on the weight W(j) and the mean spectral response curve of the corresponding interval, the weighted mean spectral response curve of the sample to be tested is constructed by weighting the wavelength points.
4. The quality inspection system for meat and meat products according to claim 1, characterized in that, The judgment and early warning unit is used to generate quality prediction results based on the weighted mean spectral response curve using a pre-trained quality prediction model, including: (1) Input the weighted mean spectral response curve into the first quality prediction model to obtain safety quality indicators. When any safety quality indicator does not meet its preset threshold, the sample to be tested is judged as having safety quality abnormality and the first abnormality alarm is issued. (2) When all safety and quality indicators meet the preset threshold, the weighted average spectral response curve is input into the second quality prediction model to obtain the nutritional quality indicators. When any nutritional quality indicator is lower than its preset threshold, the sample to be tested is judged as having abnormal nutritional quality and a second abnormal alarm is issued. (3) When both the safety quality index and the nutritional quality index are within their respective preset threshold ranges, the sample to be tested is judged to be of normal quality.
5. The quality inspection system for meat and meat products according to claim 4, characterized in that, The general procedure for sample rejection after an anomaly is determined by the sample sorting unit is as follows: The centroid coordinates of the sample to be tested are calculated based on the binary template of the region of interest, and the coordinates of the minimum bounding rectangle are determined. The instantaneous speed V of the conveyor belt provided by the speed encoder, the straight-line distance D between the preset sorting device and the current position of the sample, and the time advance Td of the sorting device are obtained. The estimated arrival time or time window of the sample to be tested to the sorting device is calculated based on distance D, instantaneous velocity V and time lead Td. And within the expected arrival time or time window, send an activation signal and arrival time vector to the corresponding sorting device to trigger a countdown control sorting push rod to complete rejection; Where V is the instantaneous speed provided by the speed encoder (its unit corresponds to the distance D), and Td represents the response lead or delay time of the sorting device.
6. The quality inspection system for meat and meat products according to claim 5, characterized in that, The sample sorting unit is also used for: When a safety or quality abnormality is determined, the sorting device is called according to the sorting logic and the time window is calculated using parameters D1 and Td1. When a nutritional quality defect is detected, the secondary sorting device is invoked according to the secondary sorting logic, and the time window is calculated using parameters D2 and Td2 to complete the rejection action of primary sorting or secondary sorting respectively.
7. The quality inspection system for meat and meat products according to claim 4, characterized in that, The training and determination of the quality prediction model includes: (1) Perform spectral preprocessing on the weighted mean spectral response curve. The preprocessing consists of one or more of the following: baseline correction, Savitzky-Golay filtering, centering, normalization, standard normal variable transformation (SNV), multivariate scattering correction (MSC), first-order spectral differentiation or second-order spectral differentiation. After preprocessing, one or more of Mahalanobis distance, principal component analysis or Monte Carlo cross-validation can be used to remove outlier samples. (2) Use one or more band screening and data dimensionality reduction methods to screen the characteristic bands of the preprocessed spectrum, and verify and optimize the candidate band set through an iterative strategy. (3) A quality prediction model is established based on the weighted mean spectral data under the characteristic band. The quality prediction model is a statistical regression model or a machine learning model. In the process of model training or iterative fitting, a robust weight function can be selected to improve the robustness of the fit. (4) In model selection, priority is given to candidate models with higher calibration correlation coefficient Rc and validation correlation coefficient Rv. The optimal model is determined by the following criteria: larger Rc, larger Rv, smaller root mean square residual RMR, smaller Akaike information content criterion AIC, and fewer feature bands. The preferred threshold for Rc and Rv is 0.9 or above. (5) Apply the feature bands corresponding to the optimal quality prediction model to the feature band acquisition or online dimension reduction reconstruction of the hyperspectral image of the sample to be tested. The optimal quality prediction model includes a first quality prediction model for safety quality judgment and a second quality prediction model for nutritional quality judgment.
8. The quality inspection system for meat and meat products according to claim 7, characterized in that, The quality prediction model preferably uses partial least squares (PLS) to establish a regression model, as an optional implementation method; During the iterative fitting process, one or more of Andrews, Bisquare, Cauchy, Huber, Logistic, or Welsch may be used as robust weight functions; Quality prediction models can also be alternatively implemented using other statistical regression or machine learning methods, such as ridge regression, support vector regression (SVR), random forest (RF), gradient boosting decision tree (GBDT), or artificial neural network (ANN).
9. A method for quality testing of meat and meat products, characterized in that, Includes the following steps: S1. Obtain the hyperspectral image of the sample to be tested; S2. Adaptively construct the sample RGB image based on the visible spectrum information of the hyperspectral image and determine the sample region of interest. Generate a grayscale image based on the region of interest and divide the grayscale intensity range into several grayscale intervals to obtain the binary template of the corresponding interval. S3. Based on the binary template of each gray level interval, extract the spectral response of the corresponding interval from the hyperspectral matrix in each band and obtain the mean spectral response curve of each interval. Calculate the weight according to the pixel distribution of each gray level interval and synthesize the mean spectral response curve of each interval according to the weight to obtain the weighted mean spectral response curve. S4. Preprocess the weighted mean spectral response curve and remove outliers, and use an iterative multi-method band screening and dimensionality reduction process to obtain a set of candidate feature bands and verify them through methods such as cross-validation. S5. Establish one or more quality prediction models based on the candidate feature band set, and repeatedly verify them according to the model selection and verification criteria to finally select the optimal feature band set and the optimal prediction model to improve model stability. S6. Input the weighted average spectral response curve into the optimal prediction model under the optimal characteristic band to obtain the safety quality index and nutritional quality index of the sample, and compare the obtained index with the preset threshold to determine whether the sample quality is abnormal. If it is determined to be abnormal, issue an abnormal alarm and record the sorting parameters for rejection.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed, causes the electronic device to perform the method of claim 9.
Citation Information
Patent Citations
Hyperspectral image detection method for quality indexes of mutton
CN107271375A
Nondestructive testing method for freshness of chicken
CN117953490A
Method and device for monitoring quality of fresh meat and electronic equipment
CN118675166A
Pork quality grade nondestructive evaluation method based on hyperspectral imaging
CN119715403A
Hyperspectral imaging technology-based sparus latus meat quality detection method and system
CN120404617A
Cited By
Meat freshness rapid detection device
CN121954849A