Lean meat percentage determination method and system

By performing geometric correction and semantic segmentation on pork images, combining Mamba network blocks and multi-head attention mechanism, the problem of lean meat rate measurement accuracy under the influence of image deformation is solved, and efficient and accurate lean meat rate measurement and meat quality are achieved. Evaluate.

CN119130964APending Publication Date: 2024-12-13SICHUAN ANIMAL SCI ACAD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411206948.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

The existing lean meat rate measurement method based on image processing technology is difficult to accurately distinguish lean meat from fat when dealing with image deformation caused by non-vertical cutting angles, which makes it difficult to ensure the accuracy and consistency of lean meat rate measurement.

Method used

By performing geometric correction on the image of the meat to be tested, using deep learning-based geometric correction technology combined with self-attention mechanism and higher-order polynomial distortion model, image distortion is automatically recognized and corrected; then a preset semantic segmentation network is used for semantic segmentation. The deep features are extracted using Mamba network blocks and multi-head attention mechanisms to distinguish between lean meat and fat meat areas; the percentage of lean meat pixels is finally calculated to obtain lean meat rate.

Benefits of technology

It improves the accuracy and efficiency of the determination of lean meat rate, reduces artificial operation errors, protects the integrity and hygiene status of meat products, and realizes automated and standardized control of meat quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119130964A_ABST
    Figure CN119130964A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of lean meat percentage measurement, in particular to a lean meat percentage measurement method and system.The lean meat percentage measurement method comprises the steps that geometric correction is conducted on an obtained image of a meat product to be measured, distortion of the image of the meat product to be measured is automatically recognized and corrected, and a first image is obtained; performing semantic segmentation on the first image by adopting a preset semantic segmentation network to obtain a second image with lean meat pixels and fat meat pixels, and accurately distinguishing a lean meat area and a fat meat area in the meat product to be detected; and the lean meat percentage of the meat product to be detected is obtained by calculating the percentage of the total number of the lean meat pixels accounting for the sum of the total number of the lean meat pixels and the total number of the fat meat pixels, so that the accuracy of lean meat percentage detection is improved, the detection efficiency is higher, a physical separation process is not needed, and the integrity and sanitary state of the meat product are protected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a lean meat rate determination method and system. Background Art

[0002] In modern pig farming, a core indicator for assessing pork quality is lean meat percentage. The traditional method of measuring lean meat percentage requires manual separation of lean meat and fat meat after slaughtering pigs, and then weighing the two types of meat separately for weight comparison. This process is not only cumbersome and time-consuming, but also requires physical contact with the meat, which can easily damage the meat and cause hygiene problems. In addition, manual separation and measurement are subjective, and it is difficult to maintain consistency and accuracy, which will reduce the accuracy of the measured lean meat percentage.

[0003] In view of the problems existing in the traditional artificial lean meat rate determination method, the prior art has introduced image processing technology to innovate the lean meat rate determination method, providing a fast, objective and non-invasive lean meat rate determination method. The lean meat rate determination method based on image processing technology can evaluate the lean meat rate in real time without the need for a physical separation process, thereby protecting the integrity and sanitation of the meat. At the same time, the use of image recognition technology can greatly improve the accuracy and efficiency of lean meat rate determination, reduce human operation errors, and realize the automation and standardization of meat quality control. However, the existing lean meat rate determination method based on image processing technology mainly relies on the color and texture differences of meat to distinguish between lean meat and fat meat, which is greatly limited when it wants to achieve higher accuracy, especially when processing images that are deformed due to non-vertical cutting angles. It is difficult to accurately distinguish between lean meat and fat meat, and thus it is impossible to accurately calculate the lean meat rate. Summary of the invention

[0004] In order to solve the above-mentioned problems in the prior art, the present invention provides a lean meat rate determination method and system, and the lean meat rate determination method can improve the accuracy of lean meat rate determination.

[0005] In a first aspect, the present invention provides a method for measuring lean meat rate, the method comprising: Performing geometric correction on the acquired image of the meat to be tested to obtain a first image; The first image is semantically segmented by using a preset semantic segmentation network to obtain a second image, wherein the second image has lean meat pixels and fat meat pixels, and the semantic segmentation network is provided with a Mamba network block and a multi-head attention mechanism; wherein the first image is semantically segmented by using a preset semantic segmentation network to obtain the second image includes: Using the Mamba network block to perform deep feature extraction on the first image to obtain a plurality of first feature vectors; Based on the multi-head attention mechanism, each first eigenvector is weighted to obtain the corresponding second eigenvector; Perform pixel-level classification according to the second feature vector to obtain the second image; The percentage of the total number of lean meat pixels to the sum of the total number of lean meat pixels and the total number of fat meat pixels is calculated to obtain the lean meat rate of the meat to be tested.

[0006] Furthermore, in the present invention, the acquisition of the image of the meat to be tested includes: A multispectral camera is used to photograph the meat to be tested at various preset wavelengths to obtain images of the meat to be tested.

[0007] Furthermore, in the present invention, the acquisition of the image of the meat to be tested includes: A multispectral camera is used to photograph the meat to be tested and a preset calibration reference map at each preset wavelength to obtain an image of the meat to be tested.

[0008] Furthermore, in the present invention, the acquisition of the image of the meat to be tested includes: Using a multispectral camera to photograph the meat product under test at various preset wavelengths to obtain a first original image; Performing a preprocessing operation on the first original image to obtain an image of the meat to be tested, wherein the preprocessing operation includes denoising, white balance adjustment, and color correction; or A multispectral camera is used to photograph the meat to be tested and a preset calibration reference at each preset wavelength to obtain a second original image; The second original image is preprocessed to obtain an image of the meat to be tested.

[0009] Furthermore, in the present invention, geometric correction is performed on the acquired image of the meat to be tested to obtain the first image, which includes: The image of the meat to be tested is geometrically corrected by using a deep learning-based geometric correction technology to obtain a first image.

[0010] Furthermore, in the present invention, a geometric correction technology based on deep learning is used to perform geometric correction on the image of the meat to be tested, and the first image obtained includes: The image of the meat to be tested is geometrically corrected by combining a spatial transformer network enhanced by a self-attention mechanism and a high-order polynomial distortion model to obtain a first image.

[0011] Furthermore, in the present invention, the lean meat rate determination method further comprises: The quality of the meat to be tested is evaluated according to the second image to obtain a meat quality evaluation result.

[0012] Furthermore, in the present invention, the quality of the meat to be tested is evaluated according to the second image, and the meat quality evaluation result is obtained including: extracting key features from the second image using principal component analysis to obtain a third feature vector; Based on the third eigenvector, learning and classification are performed through support vector machine regression to obtain the meat quality evaluation result.

[0013] In a second aspect, the present invention provides a lean meat rate determination system, the system comprising: A geometric correction module, used for performing geometric correction on the acquired image of the meat to be tested to obtain a first image; The image analysis module is used to perform semantic segmentation on the first image using a preset semantic segmentation network to obtain a second image, wherein the second image has lean meat pixels and fat meat pixels, and the semantic segmentation network is provided with a Mamba network block and a multi-head attention mechanism; wherein the first image is semantically segmented using the preset semantic segmentation network to obtain the second image includes: Using the Mamba network block to perform deep feature extraction on the first image to obtain a number of first feature vectors; Based on the multi-head attention mechanism, each first eigenvector is weighted to obtain the corresponding second eigenvector; Perform pixel-level classification according to the second feature vector to obtain a second image; The meat quality assessment module is used to calculate the percentage of the total number of lean meat pixels to the sum of the total number of lean meat pixels and the total number of fat meat pixels, so as to obtain the lean meat rate of the meat to be tested.

[0014] Furthermore, in the present invention, the meat quality assessment module is also used to assess the quality of the meat to be tested according to the second image to obtain a meat quality assessment result; Wherein, evaluating the quality of the meat to be tested according to the second image to obtain the meat quality evaluation result includes: principal component analysis is used to extract key features of the second image to obtain a third feature vector; According to the third eigenvector, learning and classification are performed through support vector machine regression to obtain the meat quality evaluation result.

[0015] The beneficial effects of the present invention are embodied in that, by geometrically correcting the acquired image of the meat to be tested, the distortion of the image of the meat to be tested is automatically identified and corrected to obtain a first image; then, a preset semantic segmentation network is used to semantically segment the first image to obtain a second image with lean meat pixels and fat meat pixels, and the Mamba network block and the multi-head attention mechanism are combined to highlight the key areas and suppress unimportant information when extracting features from the first image, and to consider multiple contextual information at the same time, so that the lean meat area and the fat meat area in the meat to be tested can be distinguished more accurately; and then, by calculating the percentage of the total number of lean meat pixels to the sum of the total number of lean meat pixels and the total number of fat meat pixels, the lean meat rate of the meat to be tested is obtained, the accuracy of the lean meat rate measurement is improved, and the measurement efficiency is high, no physical separation process is required, and the integrity and sanitary state of the meat are protected. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 A schematic diagram of a specific embodiment of a lean meat rate determination method provided by the present invention; Figure 2 A schematic diagram of a process of obtaining an image of a meat product to be tested according to a specific embodiment of a method for measuring lean meat percentage provided by the present invention; Figure 3 A schematic diagram of a process of obtaining an image of a meat product to be tested according to a specific embodiment of a method for measuring lean meat percentage provided by the present invention; Figure 4 A schematic diagram of a semantic segmentation process of a specific embodiment of a lean meat rate determination method provided by the present invention; Figure 5 A schematic diagram of a meat quality evaluation process of a specific embodiment of a lean meat rate determination method provided by the present invention; Figure 6 This is a structural schematic diagram of a specific embodiment of a lean meat percentage determination system provided by the present invention. DETAILED DESCRIPTION

[0017] 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.

[0018] The lean meat rate determination method based on image processing technology can evaluate the lean meat rate in real time without the need for a physical separation process, thereby protecting the integrity and sanitation of the meat. At the same time, the use of image recognition technology can greatly improve the accuracy and efficiency of lean meat rate determination, reduce human operation errors, and achieve automation and standardization of meat quality control. However, the existing lean meat rate determination method based on image processing technology mainly relies on the color and texture differences of meat to distinguish between lean meat and fat meat, which is greatly limited when it wants to achieve higher accuracy, especially when processing images that are deformed due to non-vertical cutting angles. It is difficult to accurately distinguish between lean meat and fat meat, and thus it is impossible to accurately calculate the lean meat rate. To this end, an embodiment of the present invention proposes a lean meat rate determination method and system, which performs geometric correction on an acquired image of a meat product to be tested, automatically identifies and corrects the distortion of the image of the meat product to be tested, and obtains a first image; then a preset semantic segmentation network is used to perform semantic segmentation on the first image to obtain a second image having lean meat pixels and fat meat pixels, and the Mamba network block and the multi-head attention mechanism are combined to highlight key areas and suppress unimportant information when extracting features from the first image, and to consider multiple contextual information at the same time, so as to more accurately distinguish the lean meat area and the fat meat area in the meat product to be tested; and then the lean meat rate of the meat product to be tested is obtained by calculating the percentage of the total number of lean meat pixels to the sum of the total number of lean meat pixels and the total number of fat meat pixels, thereby improving the accuracy of the lean meat rate determination, and having a high determination efficiency, without the need for a physical separation process, and protecting the integrity and hygienic state of the meat product.

[0019] Reference Figure 1 , a lean meat rate determination method in an embodiment of the present invention comprises: S101, performing geometric correction on the acquired image of the meat to be tested to obtain a first image; S102, using a preset semantic segmentation network to perform semantic segmentation on the first image to obtain a second image; S103, calculating the percentage of the total number of lean meat pixels to the sum of the total number of lean meat pixels and the total number of fat meat pixels, to obtain the lean meat rate of the meat to be tested.

[0020] Among them, for step S101, the meat to be tested can be pork or other meat, which is the meat object for which the embodiment of the present invention intends to measure the lean meat rate. The distortion of the image of the meat to be tested can be caused by the shooting angle and the lens characteristics. It can be understood that the existing lean meat rate measurement method based on image processing technology has a low accuracy in the measured lean meat rate when processing images that are deformed due to non-vertical cutting angles. The reason is that the distorted image will affect the color and texture of the image, making it impossible for the lean meat rate measurement method to accurately distinguish between the lean meat and fat in the meat. Based on this, the embodiment of the present invention first performs geometric correction on the acquired image of the meat to be tested, automatically identifies and corrects the distortion of the image of the meat to be tested, and provides standardized input for subsequent image analysis, so that the lean meat and fat in the meat to be tested can be more accurately distinguished later.

[0021] Specifically, the method for geometrically correcting the acquired image of the meat to be tested in the embodiment of the present invention relies on computer vision and machine learning technology, and can adopt a feature matching-based method, a machine learning-based method, a deep learning-based method, a physical model-based method, a multimodal learning method or an unsupervised learning method to automatically identify the distortion of the image of the meat to be tested and correct the identified distortion.

[0022] More specifically, when the embodiment of the present invention adopts a feature matching-based method to perform geometric correction on the image of the meat to be tested, feature detection and description algorithms such as scale-invariant feature transform (SIFT), speeded up robust features (SURF), and ORB (Oriented FAST and Rotated BRIEF) are first used to detect key points in the image of the meat to be tested, and then these key points are matched to calculate a transformation model, such as a homography matrix. Finally, the image of the meat to be tested is geometrically transformed according to the transformation model to correct the distortion, thereby obtaining a first image.

[0023] When the embodiment of the present invention uses a machine learning-based method to perform geometric correction on the image of the meat to be tested, a machine learning algorithm (support vector machine, random forest, gradient boosting decision tree, etc.) is first used to predict the type of geometric distortion in the image, and then a corresponding geometric transformation model is used to perform geometric correction on the image of the meat to be tested according to the predicted geometric distortion type to obtain a first image.

[0024] When the embodiment of the present invention adopts a deep learning-based method to geometrically correct the image of the meat to be tested, the parameters required for geometric correction of the image can be learned by training a corresponding deep learning model or network, and then the trained deep learning model or network is used to geometrically correct the image. Exemplarily, the embodiment of the present invention trains a convolutional neural network (CNN) to identify the distorted area in the image and automatically estimates the parameters required to correct the image; or, uses a generator in a generative adversarial network (GAN) to learn the mapping of the image to the undistorted image (i.e., the first image), so as to use the mapping to correct the image of the meat to be tested; or, uses an autoencoder to learn the intrinsic structure of the image of the meat to be tested, and then uses the learned knowledge to geometrically correct the image of the meat to be tested; or, uses an attention mechanism to focus on the areas in the image of the meat to be tested that are most severely affected by the distortion, and corrects these areas.

[0025] When the embodiment of the present invention uses a physical model-based method to perform geometric correction on the image of the meat to be tested, the distortion source (such as the distortion caused by the camera lens) is first identified, and the corresponding physical model is selected according to the distortion source to describe the distortion effect, and the correction parameters are calculated. It should be noted that this method usually requires the calibration of the camera that takes the image of the meat to be tested in advance to obtain the detailed parameters of the camera lens distortion.

[0026] When the embodiment of the present invention uses a multimodal learning method to perform geometric correction on the image of the meat to be tested, multiple types of data, such as images, depth information, etc., are combined to perform geometric correction, thereby improving the accuracy and robustness of the correction.

[0027] When the embodiment of the present invention uses an unsupervised learning method to perform geometric correction on the image of the meat to be tested, an unsupervised learning method such as an autoencoder or a variational autoencoder is used to automatically monitor and correct image distortion. It is understandable that this method is usually used in the case of no labeled data.

[0028] Optionally, in some embodiments, step S101 may include: The image of the meat to be tested is geometrically corrected by using a deep learning-based geometric correction technology to obtain a first image.

[0029] Among them, the geometric correction technology based on deep learning is as mentioned above and will not be elaborated here. It can be understood that compared with other geometric correction methods, the method based on deep learning has obvious advantages in the field of image geometric correction. It has stronger adaptability and end-to-end learning capabilities. Based on this, the embodiment of the present invention adopts a geometric correction technology based on deep learning to perform geometric correction on the image of the meat to be tested. It can adapt to different image contents and geometric distortion conditions, has strong generalization ability, and realizes adaptive geometric correction without manual intervention. It also has better robustness and higher precision, thereby improving the accuracy and efficiency of the geometric correction of the image of the meat to be tested.

[0030] Furthermore, in some embodiments, using a deep learning-based geometric correction technology to perform geometric correction on the image of the meat to be tested to obtain a first image may specifically include: The image of the meat to be tested is geometrically corrected by combining a spatial transformer network enhanced by a self-attention mechanism and a high-order polynomial distortion model to obtain a first image.

[0031] The embodiment of the present invention performs geometric correction on the image distortion of the meat to be tested caused by the shooting angle and the lens characteristics, and takes into account the irregular texture and shape of the meat, combines the spatial transformer network (STN) enhanced by the self-attention mechanism and the high-order polynomial distortion model to perform geometric correction on the image of the meat to be tested, so as to further improve the precision and accuracy of the correction.

[0032] It should be noted that the spatial transformer network is a neural network that can learn spatial transformations and can autonomously rotate, scale, and distort the input image to match the expected spatial distribution. The introduction of the self-attention mechanism (self-attention layer) can enhance the performance of the spatial transformer network, enabling it to more flexibly and accurately capture the relationship between different regions in the image and further optimize the learning process of spatial transformation. The high-order polynomial distortion model is a mathematical model used to describe and correct image distortion. It captures the distortion effect in the image by expressing the image transformation in the form of a high-order polynomial.

[0033] Specifically, the embodiment of the present invention first analyzes the image of the meat to be tested through the self-attention layer, and automatically identifies the type and degree of image distortion by calculating the dependency between the input features, so that the spatial transformation network can focus on the area in the image that most needs correction. Then, the distortion effect of the corresponding area of ​​the image is described by applying a high-order polynomial distortion model. In the embodiment of the present invention, the high-order polynomial distortion model is expressed by the following formula: ; ; in, , are the horizontal and vertical coordinates of the distorted pixels respectively; , are the original (before distortion) horizontal and vertical coordinates of the pixel, respectively; , Respectively represent the horizontal and vertical coordinate values ​​of the pixel transformation before and after the distortion; , is the distortion coefficient, which is used to describe nonlinear distortion.

[0034] Finally, the self-attention-enhanced spatial transformation parameters are learned through the spatial transformer network to minimize the Euclidean distance between the rectified image and the ideal state: ; in, is the spatial variation parameter, is the output of the self-attention layer, is the transformation matrix, is the regularization coefficient used to prevent overfitting.

[0035] The embodiment of the present invention combines the spatial transformation network enhanced by the self-attention mechanism and the high-order polynomial distortion model to and distortion coefficient , After the optimization is completed, the final transformation matrix is ​​obtained The image of the meat to be tested is transformed, and a corrected image, i.e., the first image, is output. Thus, the corrected image in the embodiment of the present invention has a more consistent geometric shape, providing more accurate data input for subsequent image analysis, ensuring that the subsequent image analysis stage can more accurately identify and analyze the lean meat and fat meat of the meat to be tested, and improving the overall performance and accuracy of the lean meat rate determination.

[0036] Optionally, in some embodiments, acquiring the image of the meat to be tested may include: A multispectral camera is used to photograph the meat to be tested at various preset wavelengths to obtain images of the meat to be tested.

[0037] The multispectral camera can capture images in multiple wavelength ranges including infrared and ultraviolet. The embodiment of the present invention uses multispectral imaging technology and a high-resolution camera to capture the meat to be tested at each preset wavelength to obtain an image of the meat to be tested.

[0038] Optionally, in some embodiments, acquiring the image of the meat to be tested may include: A multispectral camera is used to photograph the meat to be tested and a preset calibration reference map at each preset wavelength to obtain an image of the meat to be tested.

[0039] Specifically, the embodiment of the present invention can provide assistance for the subsequent geometric correction process of the image of the meat to be tested by placing a calibration reference object in the field of view of the multispectral camera, thereby further improving the precision and accuracy of the geometric correction.

[0040] Furthermore, in some embodiments, the meat to be tested is placed on a dedicated platform, and the calibration reference object is placed at the center of the field of view of the multi-spectral camera.

[0041] Optionally, refer to Figure 2 and Figure 3 In some embodiments, obtaining the image of the meat to be tested may include: S21, using a multispectral camera to photograph the meat to be tested at various preset wavelengths to obtain a first original image; S22, performing a preprocessing operation on the first original image to obtain an image of the meat to be tested.

[0042] or: S31, using a multispectral camera to photograph the meat to be tested and a preset calibration reference at each preset wavelength to obtain a second original image; S32, performing a preprocessing operation on the second original image to obtain an image of the meat to be tested.

[0043] Among them, the preprocessing operations include denoising, white balance adjustment, and color correction.

[0044] Specifically, the specific contents and functions of step S21 and step S31 are the same as those described above and are not described in detail here. As for step S22 and step S32, the embodiment of the present invention first performs denoising and white balance adjustment on the first original image (or the second original image), and then performs color correction to eliminate color deviation caused by light source fluctuations or other environmental factors, and provides accurate input data for subsequent geometric correction and image analysis, thereby improving the accuracy of the measured lean meat rate.

[0045] Optionally, in the above-mentioned embodiments of obtaining images of the meat to be tested, different wavelengths of light can be provided by an LED light source to improve the stability of the uniformity of the light, so that the quality of the captured image is better, thereby improving the accuracy of the lean meat percentage measurement of the meat to be tested as a whole.

[0046] It should be noted that the embodiment of the present invention can accurately calculate the reflectivity from the image of the meat to be tested by the following formula: ; in, Indicates wavelength The reflectivity of the image of the meat to be tested is as follows: Indicates wavelength The image intensity of the image of the meat to be tested is obtained under is the wavelength Dark field correction intensity under is the wavelength White field correction strength under .

[0047] Furthermore, the embodiment of the present invention can adjust the image intensity of the image of the meat product to be tested corresponding to each preset wavelength by the following adjustment formula to improve the illumination uniformity of these images: ; in, represents the adjusted image intensity, is the wavelength The average image intensity of the image of the meat to be tested obtained under Indicates pixel position The LED light intensity at the

[0048] It can be understood that, through the above settings, the image of the meat to be tested obtained by the embodiment of the present invention not only has high resolution, but also includes rich wavelength information, which provides accurate input data for subsequent geometric correction and image analysis.

[0049] For step S102, the second image has lean meat pixels and fat meat pixels, that is, an image that distinguishes the lean meat area from the fat meat area based on the first image. The embodiment of the present invention performs semantic segmentation based on the first image obtained after geometric correction to obtain a second image with lean meat pixels and fat meat pixels, and accurately distinguishes the lean meat area from the fat meat area in the meat to be tested.

[0050] It should be noted that semantic segmentation involves classifying each pixel in an image into different categories. Unlike traditional image classification, semantic segmentation provides a detailed classification label map for each part of the image, such as labeling the lean meat pixels and fat meat pixels in the first image separately.

[0051] Specifically, the embodiment of the present invention can use a deep learning-based method (such as a convolutional neural network, a generative adversarial network, a model based on an attention mechanism, or transfer learning as a semantic segmentation network) to perform semantic segmentation of the first image, which requires a pre-labeled image dataset of similar meat products, in which each image is marked with lean meat and fat meat areas, and the image dataset is used to train the semantic segmentation network. After the semantic segmentation network is trained, the first image can be semantically segmented to output a second image with lean meat pixels and fat meat pixels.

[0052] It should be noted that the second image having lean meat pixels and fat meat pixels in the embodiment of the present invention refers to an image in which the lean meat pixels and the fat meat pixels are marked respectively, or an image that distinguishes the lean meat area and the fat meat area of ​​the meat to be tested.

[0053] Further, in some embodiments, the semantic segmentation network is provided with a Mamba network block and a multi-head attention mechanism.

[0054] The Mamba network block is used to process complex textures and high-dimensional data in the first image. By using multi-scale convolution kernels, the network can capture various features from subtle details to macro structures, ensuring a comprehensive understanding of the image. Each convolution layer of the Mamba network block is connected to a self-attention layer, which enables it to highlight the key areas of the first image and suppress unimportant information while performing feature extraction, making the semantic segmentation more accurate, thereby improving the accuracy of subsequent lean meat percentage calculations.

[0055] The multi-head attention mechanism allows the model to focus on different pieces of information at the same time when processing data, which can more effectively capture the complex relationships in the data. In the embodiment of the present invention, it is used to optimize the feature extraction process of the Mamba network block. By distributing attention to multiple "heads", the Mamba network block can learn different types of representations in parallel, enhance its generalization ability and ability to handle various tasks, that is, it can consider multiple context information at each pixel at the same time, and enhance the spatial perception ability of the semantic segmentation network through parallel processing. Therefore, the accuracy of semantic segmentation can be further improved.

[0056] In this embodiment, reference is made to Figure 4 In step S102, a preset semantic segmentation network is used to perform semantic segmentation on the first image, and the step of obtaining the second image may include: S41, using the Mamba network block to perform deep feature extraction on the first image to obtain a plurality of first feature vectors; S42, weighting each first eigenvector based on a multi-head attention mechanism to obtain a corresponding second eigenvector; S43: Perform pixel-level classification according to the second feature vector to obtain a second image.

[0057] Specifically, according to the foregoing, for step S41, the embodiment of the present invention uses the Mamba network block to deeply extract the key features of the first image, captures details and macro structures through multi-scale convolution kernels, and obtains a plurality of first feature vectors.

[0058] For step S42, each first feature vector is weighted by a multi-head attention mechanism to strengthen the recognition and classification of key area features and improve the accuracy and efficiency of semantic segmentation. The multi-head attention layer (i.e., the introduced multi-head attention mechanism) is calculated by the following formula: ; Among them, the attention of each head is composed of Calculation allows the semantic segmentation network to focus on the most critical parts of the image when performing pixel classification.

[0059] For step S43, in an embodiment of the present invention, the training goal of the semantic segmentation network is to minimize the difference between the predicted segmentation map and the true label. This training goal is achieved by a preset composite loss function, which combines the weighted cross entropy loss and the Dice loss as follows: ; The above composite loss function can effectively handle category imbalance, and can help the semantic segmentation network better learn the boundary between lean meat and fat meat during training, thereby improving the accuracy and robustness of semantic segmentation. By performing semantic segmentation on the first image through the trained semantic segmentation network, that is, performing semantic segmentation according to the second eigenvector, not only the accuracy of semantic segmentation is improved, but also the efficiency and reliability in processing complex pork images are ensured.

[0060] In step S103, based on the second image obtained in the above steps, the lean meat percentage of the meat to be tested is accurately calculated by the following formula: ; in, is the total number of lean meat pixels, i.e., the total number of pixels marked as lean meat in the second image; is the sum of the total number of lean meat pixels and the total number of fat meat pixels, that is, the total number of pixels of all meat areas (including lean meat and fat meat) in the second image. It can be understood that the lean meat rate calculated by the embodiment of the present invention directly reflects the proportion of lean meat in the meat to be tested, and is an important indicator for evaluating the quality of the meat to be tested.

[0061] Optionally, in some embodiments, the lean meat rate determination method may further include: The quality of the meat to be tested is evaluated according to the second image to obtain a meat quality evaluation result.

[0062] Optionally, the meat quality evaluation process may be: calculating the lean meat percentage of the meat to be tested according to the second image, and performing quality evaluation of the meat to be tested based on the lean meat percentage and preset quality evaluation rules to obtain a meat quality evaluation result.

[0063] Optionally, refer to Figure 5In other embodiments, evaluating the quality of the meat to be tested according to the second image to obtain the meat quality evaluation result may include: S51, extracting key features of the second image using principal component analysis (PCA) to obtain a third feature vector; S52. Based on the third eigenvector, support vector machine regression (SVR) is used to perform learning and classification to obtain a meat quality evaluation result.

[0064] Specifically, the embodiment of the present invention combines PCA and SVR to efficiently analyze meat characteristics and perform quality assessment. The module performs dimensionality reduction processing on image features to reduce data complexity, uses the SVR model to predict the quality grade of meat, and outputs the lean meat rate and quality grade of each piece of meat, providing a scientific basis for meat processing and market pricing.

[0065] For step S51, the embodiment of the present invention uses PCA to extract key features from the second image and performs dimensionality reduction processing on the second image, thereby reducing the complexity of the data and highlighting the most critical features, providing a clearer and more discriminative input for subsequent machine learning (SVR learning and classification), and improving the accuracy of meat quality evaluation results. Specifically, the embodiment of the present invention first extracts features from the second image to obtain a feature data set , and then use PCA to analyze the feature data set The eigenvector in is processed by dimensionality reduction to obtain the third eigenvector. (i.e., the third eigenvector) is composed of the original feature data set With the principal component matrix from PCA Multiplying together gives: ; Among them, the feature dataset Contains the color, texture and other features extracted from the second image, the principal component matrix It is a matrix of important eigenvectors, which is used to simplify the model and speed up the training process.

[0066] For step S52, specifically, the embodiment of the present invention uses SVR to learn and classify the third eigenvector obtained after PCA processing to predict the quality grade of the meat to be tested. The training of the SVR model takes into account the characteristics of the meat to be tested, such as lean meat rate, color and texture, and determines the weight of the SVR model through the following optimization formula: and bias , while considering the slack variables , : ; in, is a regularization parameter used to balance the error term and model complexity to prevent model overfitting.

[0067] In summary, the embodiment of the present invention adopts the lean meat rate determination method of the above steps S101-S103, and obtains a first image by geometrically correcting the acquired image of the meat to be tested, automatically identifying and correcting the distortion of the image of the meat to be tested; then a preset semantic segmentation network is used to semantically segment the first image to obtain a second image with lean meat pixels and fat meat pixels, and the Mamba network block and the multi-head attention mechanism are combined to highlight the key areas and suppress unimportant information when extracting features from the first image, and consider multiple contextual information at the same time, so as to more accurately distinguish the lean meat area and the fat meat area in the meat to be tested; and then the lean meat rate of the meat to be tested is obtained by calculating the percentage of the total number of lean meat pixels to the sum of the total number of lean meat pixels and the total number of fat meat pixels, thereby improving the accuracy of the lean meat rate determination, and having a high determination efficiency, without the need for a physical separation process, and protecting the integrity and hygienic state of the meat.

[0068] Next, a lean meat percentage determination system according to an embodiment of the present invention will be described with reference to the accompanying drawings.

[0069] Figure 6 It is a structural schematic diagram of a lean meat percentage determination system 600 according to an embodiment of the present invention.

[0070] The lean meat rate determination system 600 specifically includes: The geometric correction module 610 is used to perform geometric correction on the acquired image of the meat to be tested to obtain a first image. The image analysis module 620 is used to perform semantic segmentation on the first image using a preset semantic segmentation network to obtain a second image, wherein the second image has lean meat pixels and fat meat pixels, and the semantic segmentation network is provided with a Mamba network block and a multi-head attention mechanism; wherein the first image is semantically segmented using the preset semantic segmentation network to obtain the second image includes: Using the Mamba network block to perform deep feature extraction on the first image to obtain a number of first feature vectors; Based on the multi-head attention mechanism, each first eigenvector is weighted to obtain the corresponding second eigenvector; Pixel-level classification is performed according to the second feature vector to obtain a second image.

[0071] The meat quality assessment module 630 is used to calculate the percentage of the total number of lean meat pixels to the sum of the total number of lean meat pixels and the total number of fat meat pixels to obtain the lean meat rate of the meat to be tested.

[0072] Furthermore, in some embodiments, the meat quality assessment module 630 is further configured to assess the quality of the meat to be tested according to the second image to obtain a meat quality assessment result; Wherein, evaluating the quality of the meat to be tested according to the second image to obtain the meat quality evaluation result includes: principal component analysis is used to extract key features of the second image to obtain a third feature vector; According to the third eigenvector, learning and classification are performed through support vector machine regression to obtain the meat quality evaluation result.

[0073] It can be seen that the contents of the above method embodiments are all applicable to the present system embodiments, the functions specifically implemented by the present system embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0074] 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.

[0075] 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.

[0076] 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.

[0077] 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.

[0078] 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.

[0079] 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.

[0080] 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 measuring lean meat rate, It is characterized in that The method comprises: Performing geometric correction on the acquired image of the meat to be tested to obtain a first image; Using a preset semantic segmentation network to perform semantic segmentation on the first image to obtain a second image, wherein the second image has lean meat pixels and fat meat pixels, and the semantic segmentation network is provided with a Mamba network block and a multi-head attention mechanism; wherein using a preset semantic segmentation network to perform semantic segmentation on the first image to obtain the second image includes: Using the Mamba network block to perform deep feature extraction on the first image to obtain a plurality of first feature vectors; Weighting each of the first feature vectors based on the multi-head attention mechanism to obtain a corresponding second feature vector; Perform pixel-level classification according to the second feature vector to obtain the second image; The percentage of the total number of lean meat pixels to the sum of the total number of lean meat pixels and the total number of fat meat pixels is calculated to obtain the lean meat rate of the meat to be tested.

2. A method for measuring lean meat rate according to claim 1, It is characterized in that The acquisition of the image of the meat to be tested includes: A multispectral camera is used to photograph the meat to be tested at various preset wavelengths to obtain an image of the meat to be tested.

3. A method for measuring lean meat rate according to claim 1, It is characterized in that The acquisition of the image of the meat to be tested includes: A multispectral camera is used to photograph the meat to be tested and a preset calibration reference map at each preset wavelength to obtain an image of the meat to be tested.

4. A method for measuring lean meat rate according to claim 1, It is characterized in that The acquisition of the image of the meat to be tested includes: Using a multispectral camera to photograph the meat to be tested at various preset wavelengths to obtain a first original image; Performing a preprocessing operation on the first original image to obtain the image of the meat to be tested, wherein the preprocessing operation includes denoising, white balance adjustment, and color correction; or Using a multispectral camera to photograph the meat to be tested and a preset calibration reference at each preset wavelength to obtain a second original image; The preprocessing operation is performed on the second original image to obtain the image of the meat to be tested.

5. A method for measuring lean meat rate according to claim 1, It is characterized in that The step of geometrically correcting the acquired image of the meat to be tested to obtain the first image comprises: The image of the meat to be tested is geometrically corrected using a deep learning-based geometric correction technology to obtain the first image.

6. A method for measuring lean meat rate according to claim 5, It is characterized in that The step of using a deep learning-based geometric correction technology to perform geometric correction on the image of the meat to be tested to obtain the first image includes: The image of the meat to be tested is geometrically corrected by combining a spatial transformation network enhanced by a self-attention mechanism and a high-order polynomial distortion model to obtain the first image.

7. A method for measuring lean meat percentage according to any one of claims 1 to 6, It is characterized in that The method further comprises: The quality of the meat to be tested is evaluated according to the second image to obtain a meat quality evaluation result.

8. A method for measuring lean meat rate according to claim 7, It is characterized in that The step of evaluating the quality of the meat to be tested according to the second image to obtain a meat quality evaluation result comprises: extracting key features from the second image using principal component analysis to obtain a third feature vector; The meat quality evaluation result is obtained by learning and classifying through support vector machine regression according to the third eigenvector.

9. A lean meat rate determination system, It is characterized in that The system comprises: A geometric correction module, used for performing geometric correction on the acquired image of the meat to be tested to obtain a first image; An image analysis module is used to perform semantic segmentation on the first image using a preset semantic segmentation network to obtain a second image, wherein the second image has lean meat pixels and fat meat pixels, and the semantic segmentation network is provided with a Mamba network block and a multi-head attention mechanism; wherein the performing semantic segmentation on the first image using the preset semantic segmentation network to obtain the second image comprises: Using the Mamba network block to perform deep feature extraction on the first image to obtain a plurality of first feature vectors; Weighting each of the first feature vectors based on the multi-head attention mechanism to obtain a corresponding second feature vector; Perform pixel-level classification according to the second feature vector to obtain the second image; The meat quality assessment module is used to calculate the percentage of the total number of lean meat pixels to the sum of the total number of lean meat pixels and the total number of fat meat pixels to obtain the lean meat rate of the meat to be tested.

10. A lean meat percentage measuring system according to claim 9, It is characterized in that The meat quality assessment module is further used to assess the quality of the meat to be tested according to the second image to obtain a meat quality assessment result; Wherein, evaluating the quality of the meat to be tested according to the second image to obtain a meat quality evaluation result includes: extracting key features from the second image using principal component analysis to obtain a third feature vector; The meat quality evaluation result is obtained by learning and classifying through support vector machine regression according to the third eigenvector.