A method for evaluating pork marbling grade
Through the collaborative use of YOLO object detection and deep learning model, the pork marble grade is automatically evaluated, which solves the problems of inefficiency and strong subjectivity in traditional evaluation methods, and achieves a more accurate and objective pork quality assessment.
Patent Information
- Application Number
- CN202411660920.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-11-20
AI Technical Summary
The prior art is inefficient, subjective and inconsistent in the evaluation of pork marble grades, and cannot fully capture the complex relationship between muscle texture and fat-thin ratio.
A pork marble grade evaluation method is adopted to automatically identify key areas in pork images through YOLO object detection technology, and use collaborative training of encoder, decoder and discriminator to deeply understand the implicit structural characteristics of pork images and use hidden structures through hidden The dimension division of variables is comprehensively evaluated by taking into account multiple key features such as fat-thin ratio, texture, color and shape.
It realizes a high degree of automation and repetition of the evaluation process, improves the accuracy and objectivity of the evaluation, comprehensively evaluates pork quality, and solves the problems of subjective judgment and inconsistency in traditional methods.
Smart Images

Figure CN119151949B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of image processing, in particular to a method for evaluating the grade of pork marbling. Background Art
[0002] The evaluation of pork quality has always been an important research area in food science and the meat processing industry. Among them, the marbling of pork (i.e. the distribution of intramuscular fat) is considered an important indicator for evaluating the taste and quality of pork. Traditionally, this evaluation relies on visual inspection and subjective judgment by meat inspectors, which is not only time-consuming and labor-intensive, but also has limited accuracy and repeatability of the results.
[0003] With the development of computer vision and machine learning technology, automated image processing technology has been applied to pork quality assessment to improve the accuracy and efficiency of assessment. However, existing automated technologies usually focus on extracting a single feature of pork images, such as color or texture, without integrating multiple factors that affect meat quality, thus limiting the comprehensiveness and accuracy of the assessment results.
[0004] In addition, the algorithms used in existing methods often fail to effectively utilize the potential of deep learning, for example, failing to deeply learn and understand the implicit features of pork images. This results in the evaluation model being unable to fully capture the complex relationship between muscle texture and fat-to-lean ratio, which in turn affects the accuracy of the evaluation.
[0005] Therefore, in response to the above problems, a method for evaluating the marbling grade of pork is urgently needed. Summary of the invention
[0006] In order to solve the above-mentioned problems in the prior art, the present invention provides a method for evaluating the marbling grade of pork, which solves the problems of low efficiency caused by manual comparison of pork quality in the traditional method and the lack of fixed standards for evaluating pork grades.
[0007] To achieve the above objectives, the present invention is implemented through the following technical solutions: a method for evaluating the marbling level of pork, comprising: S1, obtaining an original image, and preprocessing the original image to obtain a pork image to be evaluated; S2, using a pure lean meat image to train an encoder, a decoder, and a discriminator, and outputting the trained encoder parameters and latent space distribution; S3, using the trained encoder to extract features from the pork image to be evaluated, calculating the distance between the pork to be evaluated and the pure lean meat in the latent space, and evaluating the marbling level of the pork based on the distance and similarity.
[0008] Furthermore, the specific process of obtaining the original image and preprocessing the original image to obtain the pork image to be evaluated is as follows: obtaining the original image containing pork and background through an image sensor, detecting the pork area of the original image using a YOLO target detection model, and obtaining a set of detection frames; selecting the detection frame with the highest confidence, and cropping the original image according to the detection frame with the highest confidence to obtain a cropped pork image; and resizing and normalizing the cropped pork image to obtain a pork image to be evaluated of a fixed size.
[0009] Furthermore, the specific steps of using pure lean meat images to train the encoder, decoder and discriminator and outputting the trained encoder parameters and latent space distribution are as follows: using a large number of pure lean meat images as training data to construct encoder, decoder and discriminator models; the encoder extracts features from the input pure lean meat images, outputs the pure lean meat latent variable mean and the pure lean meat latent variable variance, and forms a latent space distribution; through the reparameterization technique, latent variables are sampled from the latent space distribution, the decoder reconstructs the pork image to be evaluated according to the latent variables to obtain a reconstructed image, obtains the pixel value of the pork image to be evaluated and the pixel value of the reconstructed image, records the total number of pixels of the image, and the discriminator discriminates the pure lean meat image and the reconstructed image, and outputs the true rate; the encoder, decoder and discriminator models are trained by minimizing the reconstruction loss, KL divergence loss and adversarial loss to obtain converged latent space distribution and encoding parameters.
[0010] Furthermore, the specific calculation method of the reconstruction loss is: ; In the formula, represents the reconstruction loss, represents the pixel value of the i-th pork image to be evaluated, represents the pixel value of the i-th reconstructed image, Indicates the total number of pixels in the image.
[0011] Furthermore, the specific calculation method of the KL divergence loss is: ; In the formula, represents the KL divergence loss, represents the mean of the pure lean meat latent variable, represents the variance of pure lean meat latent variable, represents the dimension of latent variables.
[0012] Furthermore, the specific process of using the trained encoder to extract features from the pork image to be evaluated is: using the trained encoder to extract the mean of the latent variable to be evaluated and the variance of the latent variable to be evaluated from the pork image to be evaluated; sampling a certain number of latent variables from the latent variable distribution of the pork to be evaluated to form a set of latent variables to be evaluated, and sampling the same number of latent variables from the latent space distribution of pure lean meat to form a reference latent variable set.
[0013] Furthermore, the specific process of calculating the distance between the pork to be evaluated and the pure lean meat in the latent space is: dividing the set of latent variables to be evaluated into a fat-to-lean ratio subspace to be evaluated, a texture subspace to be evaluated, a color subspace to be evaluated, and a shape subspace to be evaluated, and dividing the reference latent variable set into corresponding reference fat-to-lean ratio subspace, reference texture subspace, reference color subspace, and reference shape subspace; calculating the Euclidean distance of each subspace, calculating the total weighted distance, converting the total weighted distance into similarity, and obtaining the total similarity by the sum of all similarities.
[0014] Furthermore, the specific calculation method of the total weighted distance is: ; In the formula, represents the total weighted distance, , represents the Euclidean distance, represents the weight coefficient of Euclidean distance, represents the latent variable subspace to be evaluated, represents the reference latent variable subspace.
[0015] Furthermore, the specific calculation method of the similarity is: ; In the formula, Indicates similarity, represents the total number of pork image samples to be evaluated, represents the total weighted distance, Represents the total weighted distance between the latent variable pairs of the sample to be evaluated and the reference sample.
[0016] Furthermore, the method of evaluating the marbling level of pork according to the distance and similarity is as follows: the total similarity is compared with the set threshold value. Compare and obtain the corresponding marble grade according to the comparison result; ≥ When > ≥ When the is the preset threshold, and i represents the level number.
[0017] The beneficial effects of the present invention are embodied in:
[0018] (1) The present invention uses advanced YOLO target detection technology to automatically identify key areas in pork images, and uses image preprocessing technology to ensure the consistency and accuracy of the evaluation, thereby achieving a high degree of automation and repeatability in the evaluation process, effectively solving the problems of low efficiency and high subjectivity of manual evaluation in the prior art.
[0019] (2) In the present invention, through the coordinated training of the encoder, decoder and discriminator, the system not only learns the surface features of pork images, but also deeply understands their implicit structural characteristics, thereby realizing the accurate reconstruction and evaluation of pork marbling from the latent space distribution, effectively solving the problem that the model in the prior art cannot capture complex meat quality characteristics.
[0020] (3) The present invention, through the dimensional division of latent variables, comprehensively considers multiple key features such as fat-to-lean ratio, texture, color and shape for evaluation, thereby achieving a comprehensive evaluation of pork quality, and effectively solving the deviation problem that may be caused by single feature evaluation in the prior art.
[0021] (4) The present invention calculates the total weighted distance between the pork to be evaluated and the pure lean meat and converts it into similarity. The system can accurately compare the similarity with the preset threshold and automatically grade the marbling level of the pork. This method not only improves the accuracy of the evaluation, but also ensures the objectivity and repeatability of the evaluation results, effectively solving the problem of inconsistent evaluation standards in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 The present invention provides a flow chart of a method for evaluating the marbling grade of pork. DETAILED DESCRIPTION
[0023] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0024] Reference Figure 1 The embodiment of the present invention provides a technical solution: a method for evaluating the marbling level of pork, comprising S1, obtaining an original image, and preprocessing the original image to obtain a pork image to be evaluated; S2, using a pure lean meat image to train an encoder, a decoder, and a discriminator, and outputting the trained encoder parameters and latent space distribution; S3, using the trained encoder to extract features from the pork image to be evaluated, calculating the distance between the pork to be evaluated and the pure lean meat in the latent space, and evaluating the marbling level of the pork according to the distance and similarity.
[0025] Specifically, the original image is obtained and preprocessed to obtain the pork image to be evaluated. The specific process is as follows: First, the original image containing pork and its background is captured by a high-resolution image sensor to ensure the maximum retention of image clarity and details, which is the basis for evaluation accuracy. Subsequently, these original images are analyzed using an optimized YOLO target detection model, which can quickly and accurately identify the pork area in the image and generate a set of detection frames. This step is crucial in automated processing because it directly affects the accuracy of subsequent processing; next, the system automatically selects the detection frame with the highest confidence. This selection is based on the confidence score calculated by the algorithm to ensure that the selected area is indeed pork. Based on this highest confidence detection frame, the system accurately crops the original image, retaining only the key areas of pork and excluding irrelevant background information, thereby reducing the complexity of subsequent processing and improving processing speed; the cropped pork image is then resized and normalized. These steps are to unify the input standards in the image processing process and improve the efficiency of model training and evaluation. Resizing ensures that all images are consistent in dimension, and normalization adjusts the range of image data to adapt it to the needs of the deep learning model, which helps to accelerate the convergence of model training and improve its generalization ability. Through such preprocessing, we obtain fixed-size and standardized pork images to be evaluated, laying the foundation for the subsequent deep learning feature extraction and marbling grade evaluation.
[0026] In this implementation scheme, the accuracy and automation level of pork marbling grade assessment are effectively improved through efficient image processing technology. By using high-resolution image sensors and advanced YOLO target detection models, we are able to accurately capture and identify pork areas in the original image, thereby ensuring that the starting point of the processing has high-quality image input. The detection frame with the highest confidence is selected to crop the image and accurately remove irrelevant background, further improving the accuracy and efficiency of subsequent analysis. Sizing and normalization processing unify all images in size and numerical range, optimize the data input format, and provide standardized data for the training and evaluation of deep learning models, thereby accelerating the learning speed of the model and enhancing the generalization ability of the model. Overall, this step greatly improves the automation and processing efficiency of the evaluation process, making pork quality assessment more scientific, rapid and objective.
[0027] Specifically, pure lean meat images are used to train the encoder, decoder, and discriminator, and the trained encoder parameters and latent space distribution are output. The specific steps are as follows: First, a large number of high-quality pure lean meat images are selected as training data. These images are used to build and train the encoder, decoder, and discriminator models. Using these specialized image datasets ensures that the data basis for model training is sufficiently representative and diverse, providing rich sample features for the learning process.
[0028] In the model building phase, the encoder is designed to perform deep feature extraction on the input pure lean meat images. By encoding the texture, shape, and color distribution of each image, the encoder outputs the position of each image in the latent space, that is, the mean and variance of the latent variables, which form the latent space distribution of the image. This process not only captures the basic visual features of the image, but also captures deeper statistical properties, providing a basis for subsequent image reconstruction and comparison.
[0029] Next, latent variables are sampled from these latent space distributions through the reparameterization technique. This technique allows the model to maintain randomness and continuity during training, making the learning process more stable. The decoder uses these sampled latent variables to reconstruct pork images and generate reconstructed images. This not only tests the model's ability to capture the characteristics of the original data, but also provides feedback on the accuracy of the model's reconstruction.
[0030] In addition, the role of the discriminator is to evaluate the output of the encoder and decoder, compare the similarity between the original pure lean meat image and the reconstructed image, and output the real rate of the image. This step is carried out through adversarial training. The discriminator tries to distinguish between real images and generated images, while the encoder and decoder try to deceive the discriminator. This adversarial process greatly improves the performance of the model.
[0031] Finally, by minimizing the reconstruction loss, KL divergence loss and adversarial loss, this whole training mechanism continuously optimizes the parameters of the encoder, decoder and discriminator. The reconstruction loss ensures the consistency of the generated image with the original image at the pixel level; the KL divergence loss makes the distribution of the latent variables as close as possible to the prior distribution, increasing the generalization ability of the model; the adversarial loss promotes the authenticity of the generated image. Through these steps, the model finally obtains a stable and accurate latent space distribution and optimized encoding parameters, providing strong technical support for the actual evaluation of pork marbling grade. This process not only improves the accuracy of the evaluation, but also significantly improves the processing efficiency, making pork quality evaluation more scientific and objective.
[0032] In this implementation scheme, in the process of using pure lean meat images to train the encoder, decoder and discriminator, an efficient deep learning model is constructed to accurately analyze the texture and structural characteristics of pork, significantly improving the accuracy and reliability of pork marbling grade assessment. The use of a large number of pure lean meat images provides a rich and professional data basis for model training, ensuring that the model can learn the subtle differences in various pork textures. Through the feature extraction and latent space distribution construction of the encoder, as well as the image reconstruction capability of the decoder, we not only optimize the model's ability to recognize and understand pork images, but also enhance the ability to capture pork quality details. The introduction of the discriminator further improves the authenticity of the generated images, allowing the model to further improve its performance in an adversarial learning environment. Throughout the process, by minimizing the reconstruction loss, KL divergence loss and adversarial loss, the model parameters are continuously adjusted and optimized, thereby obtaining an accurate and stable latent space distribution, greatly improving the automation and objectivity of the evaluation work, and effectively solving the subjectivity and inconsistency problems in traditional evaluation methods.
[0033] Specifically, the specific calculation method of reconstruction loss is: ; In the formula, represents the reconstruction loss, which is a key indicator used to measure the similarity between the reconstructed image and the original image. represents the pixel value of the i-th pork image to be evaluated, represents the pixel value of the i-th reconstructed image, Represents the total number of pixels in the image, that is, the resolution of the image, which usually depends on the resizing standard in the image preprocessing stage.
[0034] In this implementation, this step effectively evaluates the performance of the model on the image reconstruction task and ensures that the generated image is visually highly consistent with the original image. The reconstruction loss is calculated by comparing the pixel value differences between the pork image to be evaluated and the reconstructed image, using the sum of squares to emphasize the impact of larger differences, ensuring that the model prioritizes reducing large visual errors during training. This approach not only helps the model learn more precise image details, but also improves the overall image quality. By averaging all pixel errors, the model's evaluation criteria are decoupled from image size and dimensions, making model training more fair and consistent. Ultimately, by minimizing the reconstruction loss, this step significantly improves the accuracy of pork image reconstruction, thereby directly improving the accuracy and reliability of pork marbling grade assessment, effectively solving the subjective judgment and inconsistency problems in traditional methods.
[0035] Specifically, the specific calculation method of KL divergence loss is: ; In the formula, represents the KL divergence loss, which is a key indicator to measure the similarity between the model output distribution and the target distribution. Represents the mean of the pure lean meat latent variable, emphasizing the degree to which the mean deviates from 0. represents the variance of the pure lean meat latent variable. The closer the variance is to 1, the closer the distribution of the latent variable is to the target distribution. represents the dimension of the latent variable, the complexity of the latent space, and the final constant term -1 is used for mathematical calibration to ensure that and , the loss is 0.
[0036] In this implementation scheme, the accuracy and consistency of the model in latent variable representation are significantly improved by accurately calculating the KL divergence loss. The KL divergence loss evaluates the deviation between the latent variable distribution generated by the model and the target distribution (standard normal distribution), ensuring that the mean and variance of the latent variable are close to the ideal state. This formula includes the square of the mean, the variance, and the logarithm of the variance, each of which plays a key role in the adjustment and optimization of the model. Minimizing the KL divergence loss helps avoid overfitting and enhances the generalization ability of the model to new data, while maintaining the stability and reliability of the generated latent variable distribution. This is not only very important for the learning of latent variables, but also ensures the high quality of subsequent reconstructed images and the accuracy of the evaluation process. In this way, the model improves the overall effect and reliability of pork marbling grade evaluation while maintaining consistency between theory and practice. This step is the key to improving model performance in the entire evaluation process, and effectively solves the subjective judgment and inconsistency problems that may occur in traditional methods.
[0037] Specifically, the specific process of using the trained encoder to extract features from the pork image to be evaluated is as follows: First, the trained encoder is used to conduct an in-depth analysis of the pork image to be evaluated, and key latent variables are extracted from it, including the mean and variance of the latent variables. These latent variables reflect the important features of the pork in the image, such as fat-to-lean ratio, texture, etc., and encode the deep information of the image, which is crucial for the subsequent evaluation process.
[0038] Next, a certain number of latent variables are sampled from these extracted latent variable distributions, and these latent variables are organized into a set of latent variables to be evaluated. This step involves random sampling techniques to ensure that samples can be fairly obtained from the entire distribution, thereby effectively representing the overall characteristics of the pork to be evaluated. The same method is also used to sample from the known latent space distribution of pure lean meat to generate a reference latent variable set. The purpose of this is to compare the differences between the pork to be evaluated and the standard pure lean meat in the subsequent steps.
[0039] In this embodiment, the step of extracting features from the pork image to be evaluated using a trained encoder significantly enhances the accuracy and efficiency of the pork marbling grade assessment. By accurately extracting the mean and variance of the latent variables, this process can deeply capture the key features in the pork image, thereby providing a rich data basis for subsequent evaluation. Subsequently, the set of latent variables sampled from these latent variable distributions further ensures the representativeness and comprehensiveness of the data in the evaluation process. Similarly, by comparing with the standard latent space distribution of pure lean meat, this method can not only accurately determine the quality grade of pork, but also enhance the objectivity of the evaluation and avoid interference from human errors and subjective judgments. Overall, the scientificity and operability of pork evaluation have been greatly improved through scientific and technological means, providing strong technical support for quality assurance and standardized evaluation in the meat processing industry.
[0040] Specifically, the specific process of calculating the distance between the pork to be evaluated and the pure lean meat in the latent space is as follows: the set of latent variables to be evaluated is subdivided into four subspaces: the fat-to-lean ratio subspace to be evaluated, the texture subspace to be evaluated, the color subspace to be evaluated, and the shape subspace to be evaluated. This division allows the evaluation to be carried out on different characteristics of pork, and each characteristic can be specifically considered. Correspondingly, the reference set of pure lean meat latent variables is also divided into corresponding fat-to-lean ratio, texture, color, and shape subspaces to ensure the consistency and accuracy of the comparison. Next, the Euclidean distance is calculated for each pair of latent variables in each subspace. The Euclidean distance measures the difference between latent variables by calculating the straight-line distance between two points. This measurement method is simple and intuitive, and is suitable for expressing the difference of latent variables in specific feature dimensions. Then, these distances are weighted and summed according to predetermined weight factors to form a total weighted distance. These weight factors are usually set based on the importance of each feature in the evaluation process, and can be determined by previous experimental data or expert knowledge. The total weighted distance is then converted to similarity, which is achieved through an inverse function so that sample pairs with smaller distances have higher similarity. Finally, all individual similarity values are summed up to form a total similarity. This total similarity is a measure of the overall similarity between the pork sample and the pure lean meat sample, based on which the pork samples can be classified into quality grades.
[0041] In this embodiment, by carefully analyzing the distance between the pork to be evaluated and pure lean meat in the latent space, this step significantly improves the accuracy and scientificity of the pork marbling grade assessment. By dividing the latent variable set into subspaces such as fat-to-lean ratio, texture, color and shape, and calculating the Euclidean distance in these subspaces, this method can comprehensively evaluate the multidimensional characteristics of pork. The application of weight factors further enhances the influence of each feature in the evaluation process, ensuring that the focus of the evaluation corresponds to the key factors of the actual pork quality. By converting these distances into similarities and summarizing them to obtain the total similarity, this method not only provides a quantitative and easy-to-understand quality assessment result, but also ensures the objectivity and consistency of the assessment results. Overall, this step effectively solves the subjective judgment and inconsistency problems in traditional pork quality assessment through precise calculations and scientific methodology, and provides strong technical support for pork processing and quality control.
[0042] Specifically, the specific calculation method of the total weighted distance is: ; In the formula, Represents the total weighted distance, which is the weighted sum of the distances of each feature dimension. The distance of each feature dimension , represents the Euclidean distance between the latent variable to be evaluated and the reference latent variable in the feature subspace, Represents the weight coefficient of the Euclidean distance, which determines the relative importance of each feature dimension in the total distance. It is obtained from the database. The value range of the weight is generally between 0 and 1. represents the latent variable subspace to be evaluated, represents the reference latent variable subspace.
[0043] In this embodiment, the difference between the pork to be evaluated and the reference pure lean meat sample in multiple key feature dimensions is accurately quantified by calculating the total weighted distance. , the influence of each feature is properly evaluated and added to the total distance calculation, ensuring that the importance of each feature dimension is properly reflected. The selection of these weight factors is based on the actual influence of the features on pork quality, so that the total weighted distance can fully reflect the overall similarity or difference between the pork sample and the standard sample. This method of comprehensively considering multiple features significantly improves the accuracy and scientificity of pork quality assessment, making the assessment results more objective and reliable. Through this step, it can effectively guide the improvement of pork quality and the implementation of quality control measures, providing strong technical support for quality assurance in the pork processing industry.
[0044] Specifically, the specific calculation method of similarity is: ; In the formula, represents the similarity between the sample to be evaluated i and the reference sample j. represents the total number of pork image samples to be evaluated, represents the total weighted distance, It represents the total weighted distance between the latent variable pairs of the sample to be evaluated and the reference sample. During the calculation process, the inverse of each distance is calculated separately, and then normalized by taking the inverse distance to ensure that all similarity values add up to 1. This normalization process not only makes the interpretation of similarity more intuitive, but also helps in subsequent data processing and analysis. Normalization ensures that the similarity between different sample sets is fair and is not affected by the sample size.
[0045] In this embodiment, the accuracy and efficiency of evaluating pork quality are significantly enhanced by applying the calculation method for obtaining similarity, ensuring the scientific evaluation of the marbling grade of pork. Specifically, by converting the total weighted distance into similarity and ensuring that the sum of the similarities between all samples is one through normalization, this method accurately reflects the similarity between the sample to be evaluated and the reference sample. The use of weight factors to adjust the influence of different feature dimensions in the total weighted distance further enhances the flexibility and adaptability of the model, making the evaluation results not only accurate but also highly interpretable. This distance-based similarity calculation method provides an effective quantitative tool for the automated evaluation of pork quality, significantly improves the objectivity and repeatability of the evaluation process, and helps the pork processing industry to more accurately control and improve product quality.
[0046] Specifically, based on the distance and similarity, the marbling level of pork is evaluated as follows: the total similarity is compared with the set threshold Compare, threshold It is carefully set based on historical data, expert experience and market standards to distinguish different grades of pork marbling quality. The determination of these thresholds may involve statistical analysis, data mining techniques or subjective judgment of experts to ensure that they can effectively distinguish different quality grades and obtain the corresponding marbling grade according to the comparison results; ≥ When > ≥ When the is the preset threshold, and i represents the level number.
[0047] In this embodiment, the marbling grade of pork is evaluated by comparing the calculated total similarity with the preset threshold, which significantly improves the objectivity and accuracy of pork quality evaluation. This method systematically compares pork samples with a series of carefully set quality standards to ensure the consistency and repeatability of the evaluation process. Each threshold is set based on detailed data analysis and industry knowledge, so that each quality grade has a clear definition standard, thereby reducing the influence of subjective judgment. In addition, the division of grades can more accurately guide the market positioning and pricing strategies of pork, while providing consumers with clear quality information. Overall, this evaluation not only improves the scientific nature of pork quality judgment, but also increases the transparency and trust of the entire industry, and has a positive impact on all aspects of pork production and sales.
[0048] In the description of the embodiments of the present invention, it should be understood that the terms "upper", "lower", "front", "back", "left", "right", "vertical", "horizontal", "center", "top", "bottom", "top", "bottom", "inside", "outside", "inner side", "outer side" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention. Among them, "inside" refers to an internal or enclosed area or space. "Periphery" refers to the area surrounding a specific component or a specific area.
[0049] In the description of the embodiments of the present invention, the terms "first", "second", "third", and "fourth" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first", "second", "third", and "fourth" may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "multiple" means two or more.
[0050] In the description of the embodiments of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "install", "connect", "connect", and "assemble" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a direct connection, or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0051] In the description of the embodiments of the present invention, specific features, structures, materials or characteristics may be combined in a suitable manner in any one or more embodiments or examples.
[0052] In the description of the embodiments of the present invention, it should be understood that "-" and "~" represent the range between two values, and the range includes the endpoints. For example: "AB" represents a range greater than or equal to A and less than or equal to B. "A~B" represents a range greater than or equal to A and less than or equal to B.
[0053] In the description of the embodiments of the present invention, the term "and / or" herein is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " herein generally indicates that the associated objects before and after are in an "or" relationship.
[0054] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for evaluating the marbling level of pork, characterized in that: include: S1, obtaining an original image, and preprocessing the original image to obtain a pork image to be evaluated; S2, uses pure lean meat images to train the encoder, decoder and discriminator, and outputs the trained encoder parameters and latent space distribution; S3, using the trained encoder to extract features from the pork image to be evaluated, calculating the distance between the pork to be evaluated and pure lean meat in the latent space, and evaluating the marbling level of the pork based on the distance and similarity; The specific steps of using pure lean meat images to train the encoder, decoder and discriminator and outputting the trained encoder parameters and latent space distribution are as follows: A large number of pure lean meat images are used as training data to construct encoder, decoder and discriminator models; the encoder extracts features from the input pure lean meat images, outputs the pure lean meat latent variable mean and pure lean meat latent variable variance, and forms a latent space distribution; Through the reparameterization technique, latent variables are sampled from the latent space distribution. The decoder reconstructs the pork image to be evaluated according to the latent variables to obtain a reconstructed image, obtains the pixel values of the pork image to be evaluated and the pixel values of the reconstructed image, records the total number of pixels in the image, and the discriminator distinguishes the pure lean meat image and the reconstructed image, and outputs the true rate. The encoder, decoder, and discriminator models are trained by minimizing the reconstruction loss, KL divergence loss, and adversarial loss to obtain converged latent space distribution and encoding parameters.
2. A method for evaluating pork marbling grade according to claim 1, characterized in that: The specific process of obtaining the original image and preprocessing the original image to obtain the pork image to be evaluated is as follows: The original image containing pork and background is obtained through an image sensor, and the pork area is detected in the original image using the YOLO target detection model to obtain a set of detection frames; Select the detection frame with the highest confidence, and crop the original image according to the detection frame with the highest confidence to obtain a cropped pork image; The cropped pork image is resized and normalized to obtain a pork image of fixed size to be evaluated.
3. A method for evaluating pork marbling level according to claim 1, characterized in that: The specific calculation method of the reconstruction loss is: ; In the formula, represents the reconstruction loss, represents the pixel value of the i-th pork image to be evaluated, represents the pixel value of the i-th reconstructed image, Indicates the total number of pixels in the image.
4. A method for evaluating pork marbling level according to claim 1, characterized in that: The specific calculation method of the KL divergence loss is: ; In the formula, represents the KL divergence loss, represents the mean of the pure lean meat latent variable, represents the variance of pure lean meat latent variable, represents the dimension of latent variables.
5. The method for evaluating pork marbling level according to claim 1, characterized in that: The specific process of using the trained encoder to extract features from the pork image to be evaluated is as follows: Use the trained encoder to extract the mean and variance of the latent variable to be evaluated from the pork image to be evaluated; A certain number of latent variables are sampled from the latent variable distribution of the pork to be evaluated to form a set of latent variables to be evaluated, and the same number of latent variables are sampled from the latent space distribution of pure lean meat to form a reference set of latent variables.
6. A method for evaluating pork marbling level according to claim 5, characterized in that: The specific process of calculating the distance between the pork to be evaluated and the pure lean meat in the latent space is as follows: The latent variable set to be evaluated is divided into a fat-to-thin ratio subspace to be evaluated, a texture subspace to be evaluated, a color subspace to be evaluated, and a shape subspace to be evaluated; and the reference latent variable set is divided into corresponding reference fat-to-thin ratio subspace, reference texture subspace, reference color subspace, and reference shape subspace; Calculate the Euclidean distance of each subspace, calculate the total weighted distance, convert the total weighted distance into similarity, and get the total similarity by summing up all similarities.
7. A method for evaluating pork marbling level according to claim 6, characterized in that: The specific calculation method of the total weighted distance is: ; In the formula, represents the total weighted distance, , represents the Euclidean distance, represents the weight coefficient of Euclidean distance, represents the latent variable subspace to be evaluated, represents the reference latent variable subspace.
8. A method for evaluating pork marbling level according to claim 6, characterized in that: The specific calculation method of the similarity is: ; In the formula, Indicates similarity, represents the total number of pork image samples to be evaluated, represents the total weighted distance, Represents the total weighted distance between the latent variable pairs of the sample to be evaluated and the reference sample.
9. A method for evaluating pork marbling level according to claim 1, characterized in that: The evaluation of the marbling level of pork based on distance and similarity is as follows: The total similarity is compared with the set threshold Perform a comparison, and obtain a corresponding marble grade according to the comparison result; when ≥ When > ≥ When the is the preset threshold, and i represents the level number.
Citation Information
Patent Citations
Marbling-based fresh meat grading method, system and device
CN110458027A
Beef marbling automatic grading system and method based on image data
CN110555384A