Beef cattle carcass quality rating method based on image analysis combined with machine learning

Through multi-spectral image acquisition and multi-modal deep convolutional neural network, combined with the isolation forest algorithm, the subjectivity and inaccuracy problems of beef cattle carcass quality rating are solved, accurate assessment and detection of carcass quality and abnormalities are achieved, and improved Rating accuracy and efficiency.

CN118537664BActive Publication Date: 2024-10-11山东商都恒昌清真肉类有限公司
View PDF 13 Cites 0 Cited by

Patent Information

Application Number
CN202411008088.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-26
Publication Date
2024-10-11
Estimated Expiration
2044-07-26

AI Technical Summary

Technical Problem

Existing beef cattle carcass quality rating methods are subjective and inaccurate, are difficult to fully capture the internal details and potential abnormalities of the carcass, and cannot meet actual production needs.

Method used

Multispectral image acquisition is used combined with multi-modal deep convolutional neural network and isolation forest algorithm to generate comprehensive feature vectors through multi-dimensional feature extraction and feature fusion for carcass quality rating and anomaly detection, improving the accuracy and efficiency of rating.

Benefits of technology

It achieves accurate assessment and abnormality detection of beef cattle carcass quality, improves the accuracy and efficiency of rating, reduces false positives and false negatives, and enhances sensitivity and identification of abnormal parts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118537664B_ABST
    Figure CN118537664B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of meat product analysis, and in particular to a beef cattle carcass quality rating method based on image analysis combined with machine learning, comprising the following steps: collecting beef cattle carcasses in different bands through a multispectral camera; preprocessing the multispectral images; extracting multidimensional carcass features from the preprocessed multispectral images, fusing the multidimensional carcass features extracted from the images of different bands through a feature fusion network, and generating a comprehensive feature vector; identifying abnormal parts in beef cattle carcasses using an anomaly detection algorithm; manually annotating the extracted image features and the detected abnormal parts; training a multi-task learning model using a supervised learning method, and jointly training quality rating and anomaly detection tasks. The present invention, based on hierarchical feature analysis and weighted anomaly scoring methods, comprehensively judges abnormal parts, and improves the sensitivity and reliability of anomaly detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of meat product analysis, and in particular to a beef cattle carcass quality rating method based on image analysis combined with machine learning. Background Art

[0002] In the beef cattle industry, carcass quality grading is a key link in assessing the economic value of beef cattle. Traditional beef cattle carcass quality grading methods usually rely on experienced graders to perform visual observations and manual operations. This method is somewhat subjective, and the grading results may vary depending on the grader's experience and subjective judgment. In addition, the manual grading process is time-consuming and labor-intensive, and it is difficult to achieve large-scale automation. In order to improve the accuracy and efficiency of grading, automatic grading methods based on image analysis and machine learning have emerged in recent years. However, existing methods still have some shortcomings in data processing, model training, and application scenarios, and cannot fully meet the needs of actual production.

[0003] Traditional image analysis methods usually rely only on single spectral images, such as visible light images, which cannot fully reflect the quality information of beef cattle carcasses. Single spectral images have limitations in capturing surface and internal details of carcasses, resulting in inaccurate grading results. At the same time, most existing automatic grading systems ignore the detection of potential abnormalities in carcasses (such as damage and signs of disease), making it difficult to provide a comprehensive quality assessment.

[0004] In recent years, with the development of deep learning technology, multimodal image analysis and multi-task learning models have been widely used in various fields. Multimodal image analysis can provide richer and more comprehensive carcass information by combining image data from different spectral bands. However, in the quality grading of beef carcasses, how to effectively use multi-band image data for comprehensive feature extraction and analysis is still a technical problem that needs to be solved urgently.

[0005] Based on the above background, a beef cattle carcass quality grading method based on image analysis combined with machine learning was proposed. Summary of the invention

[0006] The present invention provides a beef cattle carcass quality grading method based on image analysis combined with machine learning.

[0007] The beef cattle carcass quality grading method based on image analysis combined with machine learning includes the following steps:

[0008] S100, Image Acquisition: The multispectral camera acquires images of beef carcasses in different wavelengths to generate multispectral images including visible light, near infrared light and thermal infrared light, ensuring that detailed features of the carcass surface and interior are captured;

[0009] S200, image preprocessing: preprocessing the multispectral image, wherein the preprocessing steps include multispectral image calibration, denoising, enhancement and standardization processing to improve image quality and consistency and enable image information of different bands to be fused;

[0010] S300, feature extraction: using a multimodal deep convolutional neural network MM-CNN to extract multidimensional carcass features from the preprocessed multispectral image, the carcass features include carcass shape, texture, color, fat distribution and temperature distribution, and fusing the multidimensional carcass features extracted from images of different bands through a feature fusion network to generate a comprehensive feature vector with higher recognition, so as to comprehensively reflect the quality information of the beef cattle carcass;

[0011] S400, Anomaly Detection: Based on the generated comprehensive feature vector, anomaly detection algorithms are used to identify abnormal parts in beef cattle carcasses, including signs of damage and disease, to improve the accuracy of grading;

[0012] S500, data labeling: manually labeling the extracted image features and the detected abnormal parts, wherein the image features are multi-dimensional carcass features, and establishing a labeling data set containing known quality grades and abnormality information as a basis for model training;

[0013] S600, model training: Based on the labeled data set, a supervised learning method is used to train a multi-task learning model. By jointly training the quality rating and anomaly detection tasks, the model parameters are optimized to evaluate the quality grade of beef carcasses;

[0014] S700, real-time rating: Deploy the trained multi-task learning model into the production environment, automatically generate quality ratings and anomaly detection results by analyzing multispectral carcass images collected in real time.

[0015] Furthermore, the image acquisition in S100 specifically includes:

[0016] S110, multispectral camera configuration: equipped with a multispectral camera with visible light, near infrared light and thermal infrared light, ensuring that the camera has high resolution and high sensitivity to capture subtle carcass features, and installing different filters on the multispectral camera to capture spectral images in different bands respectively;

[0017] S120, collection angle and position selection: Select multiple angles and positions to take comprehensive photos of the beef carcass to ensure that all parts of the carcass are covered, avoid feature loss due to a single shooting angle, and determine the optimal distance and angle between the multispectral camera and the carcass to ensure image clarity and detail.

[0018] S130, Synchronous Shooting: Through the synchronous controller, the multispectral camera is triggered to shoot in different bands at the same time to ensure that the multispectral image of the carcass is captured at the same time point. The high-frequency continuous shooting mode is adopted to capture the dynamic changes of the carcass at different time points, providing more comprehensive and accurate image data.

[0019] Furthermore, the image preprocessing in S200 specifically includes:

[0020] S210, image calibration: calibrate images of different bands to ensure spatial alignment of images of different bands for subsequent image fusion and analysis. Use a calibration plate to perform image geometric correction to reduce image deviation caused by camera position change or distortion.

[0021] S220, denoising: Use Gaussian filter to denoise the multispectral image. The formula is as follows:

[0022] ,in, is a Gaussian function, is the standard deviation, which is used to control the width of the filter. Through the convolution operation, the noise in the image is reduced and the detailed information of the image is retained;

[0023] S230, Enhancement: Use the histogram equalization method to enhance the image contrast. The formula is as follows:

[0024] ,in, Is grayscale The histogram of Is grayscale The number of pixels, It is the total number of pixels in the image. The cumulative distribution function (CDF) is used to adjust the pixel value distribution and improve the contrast of the image.

[0025] S240, standardization: Standardize the image so that images of different bands have the same scale. The formula is as follows: ,in, is the original image, is the mean of the image, is the standard deviation of the image, It is a standardized image. Through standardization, the grayscale values ​​of images in different bands are ensured to be in the same range, which is convenient for subsequent fusion and processing.

[0026] Furthermore, the multimodal deep convolutional neural network in S300 specifically includes:

[0027] S310, multi-modal convolution layer design: Design multiple parallel convolution channels, each channel processes images from visible light, near-infrared light, and thermal infrared light respectively. Each channel contains multiple convolution layers and pooling layers to preliminarily extract features of images in different bands:

[0028] ;

[0029] in, Represent visible light, near infrared light and thermal infrared light images respectively, represents the convolution operation, represents the extracted feature map;

[0030] S320, feature fusion layer: feature maps from different bands are fused through the feature fusion layer to generate multimodal feature representation, and the fusion is performed using the channel connection and weighted summation method: ,in, represents the feature connection operation, is a weighted matrix, which is used to perform weighted summation of features of different bands;

[0031] S330, shape feature extraction: Process the fused feature map through multiple convolutional layers and pooling layers to extract shape features, and introduce the shape context method to describe the shape features:

[0032] ,in, is the shape context descriptor, and Respectively represent the polar coordinates of the shape points, is the scale parameter;

[0033] S340, Texture and Color Feature Extraction: Extract texture and color features through joint convolutional layers, and use local binary patterns and color histograms for enhanced description:

[0034] ,in, and are the grayscale values ​​of the pixel and the center point respectively, is a sign function;

[0035] ,in, is a color histogram, which indicates the distribution of color features;

[0036] S350, fat distribution feature extraction: using the temperature information in the thermal infrared image, the fat distribution features are extracted through the convolution layer and the fully connected layer, expressed as: ;

[0037] Described by temperature gradient analysis: ,in, is the temperature gradient, indicating the characteristics of fat distribution;

[0038] S360, multi-scale feature fusion: The shape, texture, color, fat distribution and temperature distribution features at different scales are fused through a multi-scale convolutional layer to generate a comprehensive feature vector:

[0039] ,in, are feature maps at different scales, is the corresponding weight.

[0040] Furthermore, the anomaly detection algorithm in S400 is based on the isolation forest model, and the anomaly detection in S400 specifically includes:

[0041] S410, feature stratification analysis:

[0042] Low-level feature extraction and scoring: From comprehensive feature vector Separate low-level features, including shape and texture, and use isolation forest to detect anomalies on low-level features:

[0043] ,in, is a low-level feature, It is an isolation forest model for low-level features;

[0044] High-level feature extraction and scoring: From comprehensive feature vector High-level features, including color, fat distribution, and temperature distribution, are separated from the dataset. Similar to low-level features, anomaly detection is performed on high-level features using isolation forests to calculate anomaly scores. :

[0045] ,in, It is a high-level feature. It is an isolation forest model for high-level features;

[0046] S420, weighted anomaly scoring: weighted combination of low-level and high-level feature anomaly scores to comprehensively determine the abnormal location. Determine appropriate weights through experience or cross-validation and :

[0047] ,in, and are the weights of low-level and high-level features respectively;

[0048] S430, anomaly location: based on the joint anomaly score , determine the location of the abnormal part. The location of the abnormal part is achieved through threshold judgment. Set a threshold , regions above this threshold are marked as abnormal:

[0049] = ;

[0050] Among them, 1 indicates abnormality and 0 indicates normality.

[0051] Furthermore, the abnormality location in S430 further includes:

[0052] Secondary verification: Use the information of multi-band images to conduct secondary verification of the detected abnormal parts, and verify the authenticity of the abnormal parts by comparing the consistency of features in different band images;

[0053] High-precision target positioning: Map the location information of the abnormal feature vector back to the original image to mark the target with high precision. By converting the abnormal location information in the comprehensive feature vector into the pixel coordinates of the original image, the abnormal area can be accurately located:

[0054] ,in, is the position coordinate in the feature vector, is the mapping matrix, are the pixel coordinates in the original image.

[0055] Furthermore, the S400 also includes local feature enhancement: introducing a local feature enhancement module, performing feature enhancement on the local high-risk abnormal area through convolution operation, and using a local response normalization method to improve the recognition of local features, which is expressed as:

[0056] ,in, is the original activation value, is the normalized activation value, and is a hyperparameter.

[0057] Furthermore, the data annotation in S500 specifically includes:

[0058] S510, feature map visualization: visualizing the extracted multi-dimensional carcass image features to generate an image display that is convenient for manual annotation, including converting feature maps of different bands into visual images using pseudo color coding;

[0059] S520, manual labeling tool: Use the Labelbox labeling tool to support the overlay display and local zoom function of multi-band images. The labeling tool supports mouse operation and is used to mark the key features and abnormal parts of the carcass. Different colors or symbols are provided to mark different quality levels and abnormal types.

[0060] S530, Labeling Guidelines and Training: Develop labeling guidelines to clarify the labeling standards for various characteristics and abnormalities, including how to identify and label characteristics of different quality grades, such as meat color, texture, fat distribution, etc., and how to label abnormal parts;

[0061] S540, labeling process: The labeler labels each sample based on the visualized feature map and actual observation. The labeling content includes:

[0062] Carcass quality grade marking (high quality, medium quality, low quality);

[0063] Annotation of abnormalities (areas of injury, signs of disease);

[0064] Use multi-band image information to cross-validate annotation results;

[0065] S550, construction of annotated data set: combining the manual annotation results with the corresponding multi-dimensional carcass image features to establish annotated data set, each data sample includes a multi-band feature map, a quality grade label and an abnormal information label, and the annotated data set is sorted and formatted.

[0066] Furthermore, the model training in S600 specifically includes:

[0067] S610, dividing the labeled data set into a training set, a validation set, and a test set, so that each data set contains a multi-band image, a quality level label, and an abnormal information label;

[0068] S620, design a multi-task learning model. The multi-task learning model includes a shared convolutional neural network (CNN) part and independent task branches. The shared part is used to extract common features, and the task branches are used for quality rating and anomaly detection respectively:

[0069] Shared feature extraction part: ,in, is the input multi-band image, For shared features;

[0070] Quality Rating Branch: ,in, Output for quality rating;

[0071] Anomaly detection branch: ,in, is the anomaly detection output;

[0072] S630, design a joint loss function to perform a weighted summation of the quality rating loss and the anomaly detection loss to optimize the model parameters. The loss function is expressed as: ,in, is the quality rating loss, is the anomaly detection loss, and is the corresponding weight coefficient;

[0073] S640, using the labeled dataset, trains the multi-task learning model through the back propagation algorithm to minimize the joint loss function, expressed as: ,in, are model parameters, is the learning rate, is the gradient of the loss function;

[0074] Furthermore, the threshold The adaptive threshold calculation method based on distribution is obtained. According to the distribution of feature vectors, the threshold is calculated using the quantile method to improve the flexibility and accuracy of anomaly detection:

[0075] ,in, is the quantile function, is the scale parameter of the quantiles.

[0076] Beneficial effects of the present invention:

[0077] The present invention generates multispectral images including visible light, near-infrared light and thermal infrared light through multi-band image acquisition, ensuring the capture of detailed features of the carcass surface and interior. The multimodal deep convolutional neural network (MM-CNN) extracts multi-dimensional carcass features from the preprocessed multispectral images, and generates a comprehensive feature vector through a feature fusion network to comprehensively reflect the quality information of the beef cattle carcass. The isolation forest algorithm is used to perform anomaly detection on low-level features (such as shape and texture) and high-level features (such as color, fat distribution, and temperature distribution), and the abnormal parts in the beef cattle carcass are accurately identified by calculating the average path length of the samples. Based on the hierarchical feature analysis and the weighted anomaly scoring method, the abnormal parts are comprehensively judged, thereby improving the sensitivity and reliability of anomaly detection.

[0078] The present invention uses a supervised learning method to train a multi-task learning model based on a labeled data set, optimizes model parameters by jointly training quality rating and anomaly detection tasks, and achieves accurate evaluation of the quality grade of beef cattle carcasses. The designed multi-task learning model includes a shared convolutional neural network (CNN) part and independent task branches. The training efficiency and generalization ability of the model are improved by shared feature extraction and independent task processing. The trained multi-task learning model is deployed in the production environment, and the quality rating and anomaly detection results are automatically generated by analyzing the multispectral carcass images collected in real time.

[0079] The present invention introduces a local feature enhancement module, and refines and highlights the local area where the abnormality may exist through convolution operation and local response normalization method. Local feature enhancement improves the feature recognition of the local area, making the subsequent abnormality detection more accurate. By locally enhancing the low-level and high-level features respectively, combined with the adaptive threshold calculation method, the threshold of abnormality detection is dynamically adjusted, the sensitivity and accuracy of abnormal parts are improved, and false positives and missed positives are reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0080] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only for the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0081] Figure 1 A schematic diagram of a quality rating method flow chart of an embodiment of the present invention;

[0082] Figure 2 It is a schematic diagram of the abnormality detection process of S400 according to an embodiment of the present invention. DETAILED DESCRIPTION

[0083] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with specific embodiments.

[0084] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the present invention should be understood by people with ordinary skills in the field to which the present invention belongs. The "first", "second" and similar words used in the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0085] like Figure 1-Figure 2 As shown, the beef cattle carcass quality rating method based on image analysis combined with machine learning includes the following steps:

[0086] S100, Image Acquisition: The multispectral camera acquires images of beef carcasses in different wavelengths to generate multispectral images including visible light, near infrared light and thermal infrared light, ensuring that detailed features of the carcass surface and interior are captured;

[0087] S200, image preprocessing: preprocessing the multispectral image. The preprocessing steps include multispectral image calibration, denoising, enhancement and standardization to improve image quality and consistency and enable the fusion of image information in different bands.

[0088] S300, feature extraction: Use the multimodal deep convolutional neural network MM-CNN to extract multi-dimensional carcass features from the pre-processed multispectral images. The carcass features include the shape, texture, color, fat distribution and temperature distribution of the carcass. The multi-dimensional carcass features extracted from images of different bands are fused through the feature fusion network to generate a comprehensive feature vector with higher recognition, so as to fully reflect the quality information of the beef carcass;

[0089] S400, Anomaly Detection: Based on the generated comprehensive feature vector, anomaly detection algorithms are used to identify abnormal parts in beef cattle carcasses, including signs of damage and disease, to improve the accuracy of grading;

[0090] S500, data annotation: manually annotating the extracted image features and detected abnormal parts. The image features are multi-dimensional carcass features. Annotated data sets containing known quality grades and abnormal information are established as the basis for model training.

[0091] S600, model training: Based on the labeled data set, a supervised learning method is used to train a multi-task learning model. By jointly training the quality rating and anomaly detection tasks, the model parameters are optimized to evaluate the quality grade of beef carcasses;

[0092] S700, real-time rating: Deploy the trained multi-task learning model into the production environment, automatically generate quality ratings and anomaly detection results by analyzing multispectral carcass images collected in real time.

[0093] Image acquisition in S100 specifically includes:

[0094] S110, multispectral camera configuration: equipped with a multispectral camera with visible light, near infrared light and thermal infrared light, ensuring that the camera has high resolution and high sensitivity to capture subtle carcass features, and installing different filters on the multispectral camera to capture spectral images in different bands respectively;

[0095] S120, collection angle and position selection: Select multiple angles and positions to take comprehensive photos of the beef carcass to ensure that all parts of the carcass are covered, avoid feature loss due to a single shooting angle, and determine the optimal distance and angle between the multispectral camera and the carcass to ensure image clarity and detail.

[0096] S130, Synchronous Shooting: Through the synchronous controller, the multispectral camera is triggered to shoot in different bands at the same time to ensure that the multispectral image of the carcass is captured at the same time point. The high-frequency continuous shooting mode is adopted to capture the dynamic changes of the carcass at different time points, providing more comprehensive and accurate image data.

[0097] The image preprocessing in S200 specifically includes:

[0098] S210, Image Calibration: Calibrate images of different bands to ensure spatial alignment of images of each band for subsequent image fusion and analysis. Use a calibration plate to perform image geometric correction to reduce image deviation caused by camera position change or distortion. Specifically:

[0099] When acquiring images, place a calibration plate (chessboard, dot array) of known geometric size and pattern in the scene.

[0100] A multispectral image containing a calibration plate is captured, and the geometric distortion parameters of the camera are determined by detecting the pattern on the calibration plate.

[0101] Use the camera calibration tool (the camera calibration module in OpenCV), input the calibration plate image, and calculate the camera's intrinsic parameters (including focal length, principal point position, and distortion coefficient) and extrinsic parameters (including camera position and attitude).

[0102] Using the calculated calibration parameters, the image is geometrically corrected to eliminate perspective distortion and lens distortion, ensuring the accuracy and consistency of the image;

[0103] S220, denoising: Use Gaussian filter to denoise the multispectral image. The formula is as follows:

[0104] ,in, is a Gaussian function, is the standard deviation, which is used to control the width of the filter. Through the convolution operation, the noise in the image is reduced and the detailed information of the image is retained;

[0105] S230, Enhancement: Use the histogram equalization method to enhance the image contrast. The formula is as follows:

[0106] ,in, Is grayscale The histogram of Is grayscale The number of pixels, It is the total number of pixels in the image. The cumulative distribution function (CDF) is used to adjust the pixel value distribution and improve the contrast of the image.

[0107] S240, standardization: Standardize the image so that images of different bands have the same scale. The formula is as follows: ,in, is the original image, is the mean of the image, is the standard deviation of the image, It is a standardized image. Through standardization, the grayscale values ​​of images in different bands are ensured to be in the same range, which is convenient for subsequent fusion and processing.

[0108] The multimodal deep convolutional neural network in S300 specifically includes:

[0109] S310, multi-modal convolution layer design: Design multiple parallel convolution channels, each channel processes images from visible light, near-infrared light, and thermal infrared light respectively. Each channel contains multiple convolution layers and pooling layers to preliminarily extract features of images in different bands:

[0110] ;

[0111] in, Represent visible light, near infrared light and thermal infrared light images respectively, represents the convolution operation, represents the extracted feature map;

[0112] S320, feature fusion layer: feature maps from different bands are fused through the feature fusion layer to generate multimodal feature representation, and the fusion is performed using the channel connection and weighted summation method: ,in, represents the feature connection operation, is a weighted matrix, which is used to perform weighted summation of features of different bands;

[0113] S330, shape feature extraction: Process the fused feature map through multiple convolutional layers and pooling layers to extract shape features, and introduce the shape context method to describe the shape features:

[0114] ,in, is the shape context descriptor, and Respectively represent the polar coordinates of the shape points, is the scale parameter;

[0115] S340, Texture and Color Feature Extraction: Extract texture and color features through joint convolutional layers, and use local binary patterns and color histograms for enhanced description:

[0116] ,in, and are the grayscale values ​​of the pixel and the center point respectively, is a sign function;

[0117] ,in, is a color histogram, which indicates the distribution of color features;

[0118] S350, fat distribution feature extraction: using the temperature information in the thermal infrared image, the fat distribution features are extracted through the convolution layer and the fully connected layer, expressed as: ;

[0119] Described by temperature gradient analysis: ,in, is the temperature gradient, indicating the characteristics of fat distribution;

[0120] S360, multi-scale feature fusion: The shape, texture, color, fat distribution and temperature distribution features at different scales are fused through a multi-scale convolutional layer to generate a comprehensive feature vector:

[0121] ,in, are feature maps at different scales, is the corresponding weight.

[0122] The anomaly detection algorithm in S400 is based on the isolation forest model. The anomaly detection in S400 specifically includes:

[0123] S410, feature stratification analysis:

[0124] Low-level feature extraction and scoring: From comprehensive feature vector Separate low-level features, including shape and texture, and use isolation forest to detect anomalies on low-level features:

[0125] ,in, is a low-level feature, It is an isolation forest model for low-level features;

[0126] Specific;

[0127] Train the Isolation Forest model:

[0128]

[0129] in, is the number of trees, is the expected proportion of abnormal samples;

[0130] Fit the model: ;

[0131] Calculate anomaly scores: Isolation Forest constructs multiple random trees and calculates the average path length of samples for each tree. The shorter the path length, the more likely the sample is an anomaly.

[0132] The specific formula for the anomaly score is: ,in, It is a sample The anomaly score, It is a sample The average path length across all trees in the forest, is an adjustment for the number of samples, is the dataset size, It is a sample Path length in a single tree;

[0133] Adjustment for average path length The specific formula is:

[0134] ,in, It is The harmonic number of the items; then the low-level features Anomaly detection calculations;

[0135] High-level feature extraction and scoring: From comprehensive feature vector High-level features, including color, fat distribution, and temperature distribution, are separated from the dataset. Similar to low-level features, anomaly detection is performed on high-level features using isolation forests to calculate anomaly scores. :

[0136] ,in, It is a high-level feature. It is an isolation forest model for high-level features;

[0137] S420, weighted anomaly scoring: weighted combination of low-level and high-level feature anomaly scores to comprehensively determine the abnormal location. Determine appropriate weights through experience or cross-validation and :

[0138] ,in, and are the weights of low-level and high-level features respectively;

[0139] S430, anomaly location: based on the joint anomaly score , determine the location of the abnormal part. The location of the abnormal part is achieved through threshold judgment. Set a threshold , regions above this threshold are marked as abnormal:

[0140] = ;

[0141] Among them, 1 indicates abnormality and 0 indicates normality.

[0142] The abnormality location in S430 also includes:

[0143] Secondary verification: Use the information of multi-band images to perform secondary verification on the detected abnormal parts. By comparing the consistency of features in images of different bands, the authenticity of the abnormal parts can be verified. For example, whether the detected abnormal parts have abnormal temperature distribution in the thermal infrared image.

[0144] = ,in, Indicates the feature value of the corresponding position in the thermal infrared image;

[0145] High-precision target positioning: Map the location information of the abnormal feature vector back to the original image to mark the target with high precision. By converting the abnormal location information in the comprehensive feature vector into the pixel coordinates of the original image, the abnormal area can be accurately located:

[0146] ,in, is the position coordinate in the feature vector, is the mapping matrix, are the pixel coordinates in the original image.

[0147] Feature extraction extracts multi-dimensional carcass features from the pre-processed multispectral image, but these features may contain a lot of global information, and local abnormal features may be submerged. Local feature enhancement is further processed on this basis to highlight and amplify potential abnormal areas, making these areas more obvious in subsequent detections. The feature map after local feature enhancement is input into the anomaly detection algorithm, which improves the sensitivity and recognition of the detection algorithm to abnormal areas. By enhancing local features, the anomaly score can be calculated more accurately, the abnormal parts can be located, and false positives and false negatives can be reduced. The local feature enhancement module ensures that potential abnormal areas are fully identified and highlighted in the comprehensive feature vector, thereby improving the effectiveness and accuracy of the entire anomaly detection process. Therefore;

[0148] S400 also includes local feature enhancement: a local feature enhancement module is introduced to enhance the features of local high-risk abnormal areas through convolution operations, and the local response normalization method is used to improve the recognition of local features, which is expressed as:

[0149] ,in, is the original activation value, is the normalized activation value, and is a hyperparameter.

[0150] The data annotation in S500 specifically includes:

[0151] S510, feature map visualization: visualizing the extracted multi-dimensional carcass image features to generate an image display that is convenient for manual annotation, including converting feature maps of different bands into visual images using pseudo color coding;

[0152] S520, manual labeling tool: Use the Labelbox labeling tool, which supports image data in multiple formats, can easily upload multi-band images, and allows users to perform detailed labeling work. It supports the overlay display and local magnification of multi-band images. The labeling tool supports mouse operation and is used to mark various key features and abnormal parts of the carcass. Different colors or symbols are provided to mark different quality levels and abnormal types (such as damage, signs of disease, etc.);

[0153] S530, Labeling Guidelines and Training: Develop labeling guidelines to clarify the labeling standards for various characteristics and abnormalities, including how to identify and label characteristics of different quality grades, such as meat color, texture, fat distribution, etc., and how to label abnormal parts;

[0154] S540, labeling process: The labeler labels each sample based on the visualized feature map and actual observation. The labeling content includes:

[0155] Carcass quality grade marking (high quality, medium quality, low quality);

[0156] Annotation of abnormalities (areas of injury, signs of disease);

[0157] Use multi-band image information to cross-validate annotation results to ensure accuracy and consistency of annotations;

[0158] S550, construction of annotated dataset: Combine the manual annotation results with the corresponding multi-dimensional carcass image features to establish annotated dataset. Each data sample includes a multi-band feature map, quality grade label and abnormal information label. The annotated dataset is sorted and formatted to ensure its structure for model training.

[0159] Model training in S600 specifically includes:

[0160] S610, dividing the labeled data set into a training set, a validation set, and a test set, so that each data set contains multi-band images, quality level labels, and abnormal information labels, and standardizing the data to ensure that the data input into the model are on the same scale to improve training efficiency;

[0161] S620, design a multi-task learning model. The multi-task learning model includes a shared convolutional neural network (CNN) part and independent task branches. The shared part is used to extract common features, and the task branches are used for quality rating and anomaly detection respectively:

[0162] Shared feature extraction part: ,in, is the input multi-band image, For shared features;

[0163] Quality Rating Branch: ,in, Output for quality rating;

[0164] Anomaly detection branch: ,in, is the anomaly detection output;

[0165] S630, design a joint loss function to perform a weighted summation of the quality rating loss and the anomaly detection loss to optimize the model parameters. The loss function is expressed as: ,in, is the quality rating loss, is the anomaly detection loss, and is the corresponding weight coefficient;

[0166] S640, using the labeled dataset, trains the multi-task learning model through the back propagation algorithm to minimize the joint loss function, expressed as: ,in, are model parameters, is the learning rate, is the gradient of the loss function;

[0167] Evaluate the performance of the trained model on the validation set, and further optimize the model performance by monitoring the accuracy and loss of quality rating and anomaly detection, adjusting the model structure and hyperparameters, and using the early stopping method to prevent overfitting, and stop training according to the validation set loss value. Evaluate the performance of the final model on the test set, calculate the accuracy and recall rate indicators of quality rating and anomaly detection, and ensure the effectiveness of the model in practical applications. Deploy the trained multi-task learning model to the production environment, process the multi-band images collected in real time, generate quality rating and anomaly detection results, and provide reliable beef carcass quality assessment.

[0168] The shared convolutional neural network (CNN) part uses a standard convolutional neural network architecture, which is as follows:

[0169] Input layer: multi-band image As input, the shape is (H, W, C), where H is the height, W is the width, and C is the number of channels.

[0170] First convolutional layer: Use a convolution kernel size of 3x3, a step size of 1, and a ReLU activation function:

[0171] ;

[0172] First pooling layer: Use a 2x2 max pooling layer with a stride of 2:

[0173] ;

[0174] Second convolutional layer: Use a convolution kernel size of 3x3, a step size of 1, and a ReLU activation function:

[0175] ;

[0176] Second pooling layer: Use a 2x2 max pooling layer with a stride of 2:

[0177] ;

[0178] The third convolutional layer: Use a convolution kernel size of 3x3, a step size of 1, and a ReLU activation function:

[0179] ;

[0180] Third pooling layer: Use a 2x2 max pooling layer with a stride of 2:

[0181] ;

[0182] Fully connected layer: Flatten the pooling layer output and pass it through the fully connected layer, ReLU activation function:

[0183] .

[0184] The S800's real-time rating includes:

[0185] Export the trained multi-task learning model to a format suitable for production environments (such as TensorFlowSavedModel, ONNX), and deploy the model to edge computing devices or cloud servers to ensure that computing resources can meet the needs of real-time analysis. Use multispectral cameras installed in the production environment to collect multi-band image data of beef carcasses in real time. Ensure that the camera's shooting frequency and image quality meet the input requirements of the model.

[0186] Preprocess the multispectral images collected in real time, including image calibration, denoising, enhancement and standardization, to ensure that the data input to the model is consistent with that during training, and format the preprocessed image data into the input format of the model in preparation for feature extraction and analysis.

[0187] The preprocessed multispectral images are input into the deployed multi-task learning model to extract the comprehensive feature vector and analyze it through the quality rating branch and anomaly detection branch of the model: the quality rating branch outputs the quality grade of the carcass, and the anomaly detection branch outputs the anomaly detection result of the carcass.

[0188] Threshold The adaptive threshold calculation method based on distribution is obtained. According to the distribution of feature vectors, the threshold is calculated using the quantile method to improve the flexibility and accuracy of anomaly detection:

[0189] ,in, is the quantile function, is the scale parameter of the quantiles.

[0190] 1. Quantile function Determination of:

[0191] Quantile function It is determined by analyzing the distribution of eigenvectors. First, the comprehensive eigenvectors of normal carcass samples are collected and the distribution of these eigenvectors is calculated.

[0192] Using the quantile method, we can get the values ​​of the eigenvector at different quantiles. For example, we can calculate the 95th percentile, that is, The feature vector scores of normal samples are lower than this value.

[0193] 2. Quantile ratio parameter Determination of:

[0194] Quantile ratio parameter Determine through experiments and cross-validation, select an initial value (for example, 0.95 means 95%), and then adjust it on the validation set to find the most suitable threshold.

[0195] Through different Conduct tests to evaluate their impact on anomaly detection and select the one that optimizes anomaly detection accuracy and recall. value.

[0196] The specific steps are as follows:

[0197] Collect and analyze normal sample feature distribution: ,in, is the comprehensive feature vector of normal samples, and quantile represents the function for calculating quantiles.

[0198] Experimental and cross-validation determination : , by testing different value, select the one with the highest precision and recall .

[0199] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present invention is limited to these examples. Under the concept of the present invention, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the present invention as described above, which are not provided in detail for the sake of simplicity.

Claims

1. A beef cattle carcass quality rating method based on image analysis combined with machine learning, It is characterized in that The following steps are involved: S100, Image Acquisition: The multispectral camera acquires images of beef carcasses in different wavelengths to generate multispectral images including visible light, near infrared light and thermal infrared light, ensuring that detailed features of the carcass surface and interior are captured; S200, image preprocessing: preprocessing the multispectral image, wherein the preprocessing steps include multispectral image calibration, denoising, enhancement and standardization processing, so that image information of different bands can be fused; S300, feature extraction: extracting multi-dimensional carcass features from the pre-processed multispectral image using a multimodal deep convolutional neural network MM-CNN, wherein the carcass features include the shape, texture, color, fat distribution, and temperature distribution of the carcass. The multi-dimensional carcass features extracted from images of different bands are fused through a feature fusion network to generate a comprehensive feature vector to comprehensively reflect the quality information of the beef cattle carcass; S400, abnormality detection: Based on the generated comprehensive feature vector, an abnormality detection algorithm is used to identify abnormal parts of the beef cattle carcass, including signs of damage and disease. The abnormality detection algorithm is based on the isolation forest model. The abnormality detection specifically includes: S410, feature stratification analysis: Low-level feature extraction and scoring: From the comprehensive feature vector F combined Separate low-level features, including shape and texture, and use isolation forest to detect anomalies on low-level features: Score low =IF low (F low ), where F low is a low-level feature, IF low It is an isolation forest model for low-level features; High-level feature extraction and scoring: From the comprehensive feature vector F combined Separate high-level features from the dataset, including color, fat distribution, and temperature distribution, use Isolation Forest to detect anomalies on the high-level features, and calculate the anomaly score high : Score high =IF high (F high ), where F high is a high-level feature, IF high It is an isolation forest model for high-level features; S420, weighted anomaly scoring: weighted combination of the anomaly scores of low-level and high-level features to comprehensively determine the abnormal location; Score combined =w l Score low +W h Score high , where w l and w h are the weights of low-level and high-level features respectively; S430, anomaly location: based on the joint anomaly score Score combined , determine the location of the abnormal part. The location of the abnormal part is achieved through threshold judgment. A threshold Threshold is set. Areas above the threshold are marked as abnormal: Among them, 1 indicates abnormality and 0 indicates normality; The abnormality positioning also includes: Secondary verification: Use the information of multi-band images to conduct secondary verification of the detected abnormal parts, and verify the authenticity of the abnormal parts by comparing the consistency of features in different band images; High-precision target positioning: Map the location information of the abnormal feature vector back to the original image to mark the target with high precision. By converting the abnormal location information in the comprehensive feature vector into the pixel coordinates of the original image, the abnormal area can be accurately located: (x′, y′) = Map(x, y, H), where (x, y) is the position coordinate in the feature vector, H is the mapping matrix, and (x′, y′) is the pixel coordinate in the original image; S500, data labeling: manually labeling the extracted image features and the detected abnormal parts, wherein the image features are multi-dimensional carcass features, and establishing a labeling data set containing known quality grades and abnormality information as a basis for model training; S600, model training: Based on the labeled data set, a supervised learning method is used to train a multi-task learning model. By jointly training the quality rating and anomaly detection tasks, the model parameters are optimized to evaluate the quality grade of beef carcasses; S700, real-time rating: Deploy the trained multi-task learning model into the production environment, automatically generate quality ratings and anomaly detection results by analyzing multispectral carcass images collected in real time.

2. The beef cattle carcass quality grading method based on image analysis combined with machine learning according to claim 1, It is characterized in that The image acquisition in S100 specifically includes: S110, multispectral camera configuration: equipped with multispectral cameras for visible light, near infrared light and thermal infrared light, with different filters installed on the multispectral camera to capture spectral images in different bands respectively; S120, collection angle and position selection: select multiple angles and positions to take comprehensive photos of the beef carcass to ensure that all parts of the carcass are covered; S130, Synchronous Shooting: Through the synchronous controller, the multispectral camera is triggered to shoot in different bands at the same time to ensure that the multispectral image of the carcass is captured at the same time point. The high-frequency continuous shooting mode is adopted to capture the dynamic changes of the carcass at different time points.

3. The method for grading beef carcass quality based on image analysis combined with machine learning according to claim 1, It is characterized in that The image preprocessing in S200 specifically includes: S210, image calibration: calibrate images of different bands to ensure spatial alignment of images of different bands for subsequent image fusion and analysis, and use a calibration plate to perform image geometric correction; S220, denoising: denoising the multispectral image using a Gaussian filter; S230, enhancement: enhancing the image contrast using a histogram equalization method; S240, standardization processing: performing standardization processing on the image so that images of different bands have the same scale.

4. The method for grading beef cattle carcass quality based on image analysis combined with machine learning according to claim 1, It is characterized in that The multimodal deep convolutional neural network in S300 specifically includes: S310, multi-modal convolution layer design: Design multiple parallel convolution channels, each channel processes images from visible light, near-infrared light, and thermal infrared light respectively. Each channel contains multiple convolution layers and pooling layers to preliminarily extract features of images in different bands: F visible =Conv(I visible ),F nir =Conv(I nir ),F thermal =Conv(I thermal ); Among them, I visible , I nir , I thermal They represent visible light, near infrared light, and thermal infrared light images respectively, Conv represents the convolution operation, and F represents the extracted feature map; S320, feature fusion layer: feature maps from different bands are fused through the feature fusion layer to generate multimodal feature representation, and the fusion is performed using the channel connection and weighted summation method: F fusion =Concat(F visible , F nir , F thermal )×W, where Concat represents the feature concatenation operation and W is a weighted matrix used to perform weighted summation of features of different bands; S330, shape feature extraction: Process the fused feature map through multiple convolutional layers and pooling layers to extract shape features, and introduce the shape context method to describe the shape features: Among them, SC is the shape context descriptor, r and θ represent the polar coordinates of the shape points, and σ is the scale parameter; S340, Texture and Color Feature Extraction: Extract texture and color features through joint convolutional layers, and use local binary patterns and color histograms for enhanced description: Among them, I p and I c are the gray values ​​of the pixel and the center point respectively, s(x) is the sign function; H c =Histogram(I c ), where H c is a color histogram, which indicates the distribution of color features; S350, fat distribution feature extraction: using the temperature information in the thermal infrared image, the fat distribution features are extracted through the convolution layer and the fully connected layer, expressed as: T = Conv(I thermal ); Described by temperature gradient analysis: in, is the temperature gradient, indicating the characteristics of fat distribution; S360, multi-scale feature fusion: The shape, texture, color, fat distribution and temperature distribution features at different scales are fused through a multi-scale convolutional layer to generate a comprehensive feature vector: Among them, F s are feature maps at different scales, W s is the corresponding weight.

5. The method for grading beef carcass quality based on image analysis combined with machine learning according to claim 1, It is characterized in that The S400 also includes local feature enhancement: introducing a local feature enhancement module, performing feature enhancement on the local area through convolution operation, and using a local response normalization method to improve the recognition of local features, which is expressed as: in, is the original activation value, is the normalized activation value, k, α, β and n are hyperparameters.

6. The method for grading beef cattle carcass quality based on image analysis combined with machine learning according to claim 1, It is characterized in that The data annotation in S500 specifically includes: S510, feature map visualization: visualizing the extracted multi-dimensional carcass image features to generate an image display that is convenient for manual annotation, including converting feature maps of different bands into visual images using pseudo color coding; S520, manual labeling tool: Use the Labelbox labeling tool to support the overlay display and local zoom function of multi-band images. The labeling tool supports mouse operation and is used to mark the key features and abnormal parts of the carcass. Different colors or symbols are provided to mark different quality levels and abnormal types. S530, Labeling Guidelines and Training: Develop labeling guidelines to clarify the labeling standards for various features and anomalies, including how to identify and label features of different quality levels, and how to label anomalies; S540, labeling process: The labeler labels each sample based on the visualized feature map and actual observation. The labeling content includes: Carcass quality grade marking; Marking of abnormal parts; Use multi-band image information to cross-validate annotation results; S550, construction of annotated data set: combining the manual annotation results with the corresponding multi-dimensional carcass image features to establish annotated data set, each data sample includes a multi-band feature map, a quality grade label and an abnormal information label, and the annotated data set is sorted and formatted.

7. The method for grading beef cattle carcass quality based on image analysis combined with machine learning according to claim 1, It is characterized in that The model training in S600 specifically includes: S610, dividing the labeled data set into a training set, a validation set, and a test set, so that each data set contains a multi-band image, a quality level label, and an abnormal information label; S620, design a multi-task learning model. The multi-task learning model includes a shared convolutional neural network (CNN) part and independent task branches. The shared part is used to extract common features, and the task branches are used for quality rating and anomaly detection respectively: Shared feature extraction part: F shared =CNN(X), where X is the input multi-band image, F shared For shared features; Quality rating branch: Q output =Dense(F shared ), where Q output Output for quality rating; Anomaly detection branch: A output =Dense(F shared ), where A output is the anomaly detection output; S630, design a joint loss function to perform a weighted summation of the quality rating loss and the anomaly detection loss to optimize the model parameters. The loss function is expressed as: L = αL quality +βL anomaly , where L quality is the quality rating loss, L anomaly is the anomaly detection loss, α and β are the corresponding weight coefficients; S640, using the labeled dataset, trains the multi-task learning model through the back propagation algorithm to minimize the joint loss function, expressed as: Among them, θ is the model parameter, η is the learning rate, is the gradient of the loss function.

8. The method for grading beef carcass quality based on image analysis combined with machine learning according to claim 1, It is characterized in that The threshold Threshold is obtained based on the distribution-based adaptive threshold calculation method. According to the distribution of the feature vector, the threshold is calculated using the quantile method to improve the flexibility and accuracy of anomaly detection: Threshold = Q(γ), where Q is the quantile function and γ is the proportional parameter of the quantile.

Citation Information

Patent Citations

  • Multi-mode and adversarial learning-based multi-task target detection and identification method and device

    CN114821014A

  • Chicken carcass defect hyperspectral image detection method based on deep learning

    CN116563237A

  • KTV face-scanning payment method based on AI face recognition technology

    CN117495384A

  • Medical image processing method and system based on artificial intelligence algorithm

    CN117522817A

  • Deep learning-based beef cattle body nucleus temperature detection method

    CN117766143A