A pork grading evaluation method and device based on image recognition

Through the pork grading evaluation method based on image recognition, the pork image feature extraction and quality rating are used to perform pork image features and quality rating assessment using deep convolution network and Transformer model, the problems of complex and high cost of OTPO-colormeter operation are solved, and accurate assessment and efficient operation are achieved in different environments.

CN119229435BActive Publication Date: 2025-03-14SICHUAN ANIMAL SCI ACAD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411758290.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-03
Publication Date
2025-03-14
Estimated Expiration
2044-12-03

AI Technical Summary

Technical Problem

The existing OTPO-colorimeters have problems such as complex operation, high impact on the measurement environment and high cost in pork color assessment, and professionals need to conduct measurements in a specific measurement environment.

Method used

The pork grading evaluation method based on image recognition is adopted, and pork images are obtained through handheld devices, and image feature extraction and quality rating are used to evaluate images using a deep convolutional network and Transformer model, and a comprehensive evaluation is performed in combination with ambient light data.

Benefits of technology

It achieves simple operation without professional operation, and can accurately assess pork quality levels in different environments, reduce costs and improve assessment efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119229435B_ABST
    Figure CN119229435B_ABST
Patent Text Reader

Abstract

The present invention relates to a pork grading and evaluation method based on image recognition and a pork grading and evaluation device, the method comprising: obtaining a pork image taken by a camera module; inputting the pork image into a deep model to determine the meat quality grade of the pork in the pork image; wherein the deep model comprises a deep convolutional network and a Transformer model; the deep convolutional network is used to extract multi-scale features of the pork image; the deep convolutional network is configured to include a plurality of convolutional kernels of different sizes and / or convolutional layers of different step lengths; the Transformer model is used to extract the category of each pixel in a key area of ​​the pork image based on the multi-scale features, and output the meat quality grade of the pork in the pork image based on the category of each pixel in the key area of ​​the pork image. The present application provides a method for collecting images and performing pork grading and evaluation based on a handheld pork grading and evaluation device, and the method has a high grading and evaluation accuracy.
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 recognition, and in particular to a pork grading evaluation method and device based on image recognition. Background Art

[0002] In the modern pig farming industry and pork processing, pork color is one of the important indicators for evaluating pork quality. According to standards such as the Technical Specifications for Determination of Pork Quality (NY / T 821-2019) and the Quality Grading of Lean Pork (GB / T 42069-2022), the color of pork directly affects its market classification and value assessment.

[0003] At present, the evaluation of pork color mainly relies on naked eye observation and colorimetric method, which are simple but highly subjective. With the development of technology, equipment such as OTPO-colorimeter has begun to be used in laboratories or industrial environments to provide more objective evaluation results. Studies have found that instruments such as OTPO-colorimeter mainly evaluate meat color by measuring the spectral characteristics of the reflected light of meat, but this method has certain limitations. In actual operation, these instruments need to be carried out in a specific test environment, such as the lighting conditions and background must be consistent, and the meat sample placement needs to be precise, which increases the complexity of the operation. In addition, the cost of spectral equipment is high and requires professional maintenance, which limits its application in small farms or places far away from central laboratories. In addition, the use of OTPO-colorimeter for meat color evaluation requires a certain amount of setup time and cost. That is, before each test, the instrument needs to be calibrated to ensure the accuracy of the measurement.

[0004] In other words, current instruments such as OTPO-colorimeter have problems such as complex operation, great influence of measurement environment, and high cost. OTPO-colorimeter needs to be measured by professionals in a specific measurement environment. Summary of the invention

[0005] In order to solve the above-mentioned problems in the prior art, the present invention provides a pork grading and evaluation method and device based on image recognition.

[0006] In a first aspect, an embodiment of the present application provides a pork grading and evaluation method based on image recognition, which is applied to a handheld pork grading and evaluation device, comprising: acquiring a pork image taken by a camera module; inputting the pork image into a deep model to determine the meat quality grade of the pork in the pork image; wherein the deep model comprises a deep convolutional network and a Transformer model; the deep convolutional network is used to extract multi-scale features of the pork image; the deep convolutional network is configured to include multiple convolutional kernels of different sizes and / or convolutional layers of different step lengths; the Transformer model is used to extract the category of each pixel in a key area of ​​the pork image based on the multi-scale features, and output the meat quality grade of the pork in the pork image based on the category of each pixel in the key area of ​​the pork image.

[0007] Optionally, the method also includes: acquiring ambient light data detected by an ambient light sensor; wherein the ambient light data represents the lighting conditions of the current environment; and inputting the pork image into a depth model to determine the meat quality grade of the pork in the pork image, including: inputting the pork image into the depth model, and determining the meat quality grade of the pork in the pork image in combination with the ambient light data.

[0008] Optionally, the inputting the pork image into the deep model and combining the ambient light data to determine the meat quality grade of the pork in the pork image includes: extracting multi-scale features of the pork image based on the deep convolutional network; inputting the ambient light data and the multi-scale features into the Transformer model to extract the category of each pixel in the key area of ​​the pork image; wherein the deep model is trained using sample pork images marked with ambient light data; and determining the meat quality grade of the pork in the pork image based on the category of each pixel in the key area of ​​the pork image.

[0009] Optionally, the step of inputting the pork image into the depth model and determining the meat quality grade of the pork in the pork image in combination with the ambient light data comprises: determining a target depth model corresponding to the ambient light data based on the ambient light data; wherein a plurality of different depth models are trained in advance according to lighting conditions of different environments; the target depth model is one of the plurality of different depth models; and inputting the pork image into the target depth model to determine the meat quality grade of the pork in the pork image.

[0010] Optionally, the step of inputting the pork image into the depth model and determining the meat quality grade of the pork in the pork image in combination with the ambient light data comprises: preprocessing the pork image based on the ambient light data; wherein the preprocessing comprises at least one of white balance, color enhancement, and contrast adjustment; and inputting the preprocessed pork image into the depth model to determine the meat quality grade of the pork in the pork image.

[0011] Optionally, the step of inputting the pork image into the depth model and determining the meat quality grade of the pork in the pork image in combination with the ambient light data includes: inputting the pork image into the depth model and extracting the category of each pixel in the key area of ​​the pork image; determining the proportion of each category in the key area of ​​the pork image based on the category of each pixel in the key area of ​​the pork image; determining the influence weight of each category based on the ambient light data; calculating the target proportion of each category based on the proportion of each category in the key area of ​​the pork image and the influence weight of each category; and determining the meat quality grade of the pork in the pork image based on the target proportion of each category.

[0012] Optionally, the Transformer model includes multiple Transformer encoders; each Transformer encoder is used to fuse features from a previous Transformer encoder with the multi-scale features, and refine features through a self-attention mechanism and a feedforward network.

[0013] Optionally, the Transformer model also includes a Transformer decoder and an output layer; the output layer is used to obtain a feature matrix from the Transformer decoder and calculate statistical information, and calculate an adaptive threshold of each pixel in the key area of ​​the pork image based on the statistical information; based on the adaptive threshold of each pixel in the key area of ​​the pork image and the feature matrix, determine the category of each pixel in the key area of ​​the pork image.

[0014] Optionally, before inputting the pork image into the depth model, the method further includes: preprocessing the pork image based on image quality adjustment parameters and noise suppression parameters; the image quality adjustment parameters include at least one of white balance parameters, contrast parameters, and color parameters; wherein the image quality adjustment parameters and the noise suppression parameters are determined based on an image captured in a previous preset frame of the pork image, and are redetermined every preset time.

[0015] In a second aspect, the present application also provides a handheld pork grading and evaluation device, comprising: a handheld body; a camera module, arranged at the head of the handheld body; a processor, arranged inside the handheld body and connected to the camera module, the processor being used to execute any one of the pork grading and evaluation methods based on image recognition provided in the first aspect above.

[0016] The beneficial effects of the present invention include:

[0017] First, the present application provides a method for pork grading and evaluation based on image acquisition. Compared with instruments such as OTPO-colorimeter, it is simple to operate and does not require professional personnel to operate. During actual measurement, the user only needs to hold the handheld pork grading and evaluation device to take a picture of the pork to be tested, and the handheld pork grading and evaluation device can output the meat quality grade of the pork to be tested, without the need for the user to calibrate and adjust the equipment.

[0018] Second, the application has been optimized in terms of image prediction. The constructed deep model includes a deep convolutional network with a multi-scale architecture, which then extracts a wide range of features through convolution kernels of different sizes and / or convolution layers of different step lengths, enhancing the model's ability to capture details of meat pieces, and can more effectively identify and classify pork of different sizes and shapes. The constructed deep model also includes a Transformer model, which is used to capture long-distance dependencies in images and improve the accuracy of classification and segmentation. That is, through refined feature processing and image classification and recognition, accurate meat grading can be achieved in various complex backgrounds.

[0019] In summary, the present application provides a method for collecting images and performing pork grading evaluation based on a handheld pork grading evaluation device, and this method has a high grading evaluation accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 A schematic diagram of the structure of a handheld pork grading and evaluation device provided by an embodiment of the present invention;

[0021] Figure 2 A module block diagram of a handheld pork grading and evaluation device provided by an embodiment of the present invention;

[0022] Figure 3 A flowchart of a pork grading and evaluation method based on image recognition provided by an embodiment of the present invention;

[0023] Figure 4 A schematic diagram of the structure of another handheld pork grading and evaluation device provided by an embodiment of the present invention;

[0024] Figure 5A module block diagram of another handheld pork grading and evaluation device provided by an embodiment of the present invention;

[0025] Figure 6 This is a schematic structural diagram of another handheld pork grading and evaluation device provided in an embodiment of the present invention.

[0026] Reference numerals:

[0027] 100-handheld pork grading and evaluation equipment; 10-handheld body; 20-camera module; 30-processor; 40-ambient light sensor; 501-display screen; 502-function button; 503-start switch; 504-grip handle; 505-rechargeable battery; 506-image capture switch. DETAILED DESCRIPTION

[0028] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0029] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0030] The inventors found in their research that instruments such as the OTPO-colorimeter mainly evaluate meat color by measuring the spectral characteristics of light reflected from meat, but this method has certain limitations. In actual operation, these instruments need to be operated in a specific test environment, for example, the lighting conditions and background must be consistent, and the meat samples need to be placed accurately, which increases the complexity of the operation. In addition, the cost of spectral equipment is high and requires professional maintenance, which limits its application in small farms or places far away from central laboratories. Moreover, using the OTPO-colorimeter for meat color assessment requires a certain amount of setup time and cost. That is, before each test, the instrument needs to be calibrated to ensure the accuracy of the measurement.

[0031] In other words, current instruments such as OTPO-colorimeter have problems such as complex operation, great influence of measurement environment, and high cost. OTPO-colorimeter needs to be measured by professionals in a specific measurement environment.

[0032] In view of the above problems, the present application proposes the following embodiments to solve the above technical problems.

[0033] An embodiment of the present application provides a pork grading and evaluation method based on image recognition, which is applied to a handheld pork grading and evaluation device.

[0034] See also Figure 1 and Figure 2 Among them, the handheld pork grading and evaluation device 100 includes: a handheld body 10, a camera module 20 and a processor 30.

[0035] Structurally, the camera module 20 is disposed on the head of the handheld body 10. The processor 30 may be disposed inside the handheld body 10.

[0036] In terms of connection relationship, the camera module 20 is electrically connected to the processor 30 .

[0037] Functionally, the camera module 20 is used to photograph pork to obtain pork images. The processor 30 is configured to execute a pork grading and evaluation method based on image recognition provided in an embodiment of the present application.

[0038] The processor 30 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0039] The following is an explanation of a pork grading and evaluation method based on image recognition provided in an embodiment of the present application. Figure 3 The method includes: step 101~step 102.

[0040] Step 101: Acquire a pork image captured by a camera module.

[0041] In actual use, the user can hold the handheld pork grading and evaluation device, and then aim the camera module at the pork to be measured, and then use the camera module to capture a pork image corresponding to the pork to be measured.

[0042] Step 102: Input the pork image into the deep model to determine the meat quality grade of the pork in the pork image.

[0043] Among them, the deep model includes a deep convolutional network and a Transformer model; the deep convolutional network is used to extract multi-scale features of pork images; the deep convolutional network is configured to include multiple convolutional kernels of different sizes and / or convolutional layers of different step lengths.

[0044] It should be noted that in the embodiment of the present application, the deep convolutional network is mainly used to extract the basic features of the pork image. In order to capture image details of different scales, the deep convolutional network is configured to include multiple convolutional kernels of different sizes and / or convolutional layers of different step lengths, that is, a multi-scale architecture is adopted to extract a wider range of features.

[0045] The mathematical representation of this deep convolutional network can be: ;in, The scale is The following feature map, Indicates the step length is The convolution operation, Represents the input pork image.

[0046] Among them, the Transformer model is used to extract the category of each pixel in the key area of ​​the pork image based on multi-scale features, and output the meat quality grade of the pork in the pork image based on the category of each pixel in the key area of ​​the pork image.

[0047] It should be noted that compared with traditional convolutional neural networks, the Transformer model is better at capturing long-distance data dependencies when processing image data, which can improve the accuracy of meat quality judgment.

[0048] The above-mentioned key area can be the area where the pork is located identified from the pork image, or it can be a partial area of ​​the pork identified from the pork image, and this application is not limited to this.

[0049] In the embodiment of the present application, the meat quality grades of pork can be divided into three categories, namely normal meat (normal), pale soft and juicy meat (PSE) and dark hard and dry meat (DFD).

[0050] Of course, in other embodiments, 1 to 10 levels can be set according to the color of the meat, and this application does not limit this.

[0051] The following is a complete description of the pork grading and evaluation method based on image recognition provided in the embodiments of the present application.

[0052] After holding the handheld pork grading and evaluation device, the user aims the camera module at the pork to be measured, and then uses the camera module to capture the pork image corresponding to the pork to be measured, and then the pork image is transmitted to the processor, which is used to input the pork image into the deep model to predict the meat quality grade. The specific process is to first extract the multi-scale features of the pork image through a deep convolutional network, and then use the Transformer model to process the multi-scale features, extract the categories of each pixel in the key area of ​​the pork image, and then determine and output the meat quality grade of the pork in the pork image based on the categories of each pixel in the key area of ​​the pork image.

[0053] In summary, the pork grading and evaluation method based on image recognition provided in the embodiments of the present application has the following effects:

[0054] First, the embodiment of the present application provides a method for pork grading and evaluation based on image acquisition. Compared with instruments such as OTPO-colorimeter, it is simple to operate and does not require professional personnel to operate. During actual measurement, the user only needs to hold the handheld pork grading and evaluation device to take a picture of the pork to be tested, and the handheld pork grading and evaluation device can output the meat quality grade of the pork to be tested, without the need for the user to calibrate and adjust the equipment.

[0055] Second, the embodiment of the present application is optimized in terms of image prediction. The constructed deep model includes a deep convolutional network with a multi-scale architecture, which further extracts a wide range of features through convolution kernels of different sizes and / or convolution layers of different step lengths, thereby enhancing the model's ability to capture details of meat pieces and more effectively identifying and classifying pork of different sizes and shapes. The constructed deep model also includes a Transformer model, which is used to capture long-distance dependencies in images and improve the accuracy of classification and segmentation. That is, through refined feature processing and image classification and recognition, accurate meat grading can be achieved in various complex backgrounds.

[0056] In summary, the present application provides a method for collecting images and performing pork grading evaluation based on a handheld pork grading evaluation device, and this method has a high grading evaluation accuracy.

[0057] Considering that the color of pork is easily affected by ambient light, for example, under red light, the meat will look more rosy and tender, which will affect the subsequent image-based grading and evaluation results. Therefore, in an embodiment of the present application, a detection of ambient light is provided.

[0058] See also Figure 4 and Figure 5 In one embodiment, the handheld pork grading and evaluation device 100 further includes an ambient light sensor 40 .

[0059] Structurally, the ambient light sensor 40 is also disposed on the head of the handheld body 10 , and may have a vertical relationship with the camera module 20 , that is, the camera module 20 is disposed above the ambient light sensor 40 .

[0060] In terms of connection relationship, the ambient light sensor 40 is electrically connected to the processor 30 .

[0061] Functionally, the ambient light sensor 40 is used to obtain ambient light data and transmit the ambient light data to the processor 30 .

[0062] At this time, the method further includes: acquiring ambient light data detected by the ambient light sensor; wherein the ambient light data represents the lighting conditions of the current environment.

[0063] Correspondingly, the above step 102 inputs the pork image into the depth model to determine the meat quality grade of the pork in the pork image, including: inputting the pork image into the depth model, and determining the meat quality grade of the pork in the pork image in combination with the ambient light data.

[0064] It can be seen that the pork grading and evaluation method based on image recognition provided in the embodiment of the present application also performs a comprehensive evaluation in combination with the lighting conditions of the current environment. By adding ambient light data, it is possible to ensure the accuracy of image recognition and pork color assessment under different lighting conditions.

[0065] In addition, in the embodiment of the present application, the ambient light sensor 40 is structurally disposed below the camera module 20 , which can ensure that the image captured by the camera module 20 and the ambient light data collected by the ambient light sensor 40 remain synchronized.

[0066] The embodiments of the present application provide the following four implementation methods for determining the meat quality grade of pork in a pork image in combination with ambient light data.

[0067] In a first implementation mode, the above steps input the pork image into a deep model, and determine the meat quality grade of the pork in the pork image in combination with the ambient light data, including: extracting multi-scale features of the pork image based on a deep convolutional network; inputting the ambient light data and the multi-scale features into a Transformer model to extract the category of each pixel in a key area of ​​the pork image; wherein the deep model is trained using sample pork images marked with ambient light data; and determining the meat quality grade of the pork in the pork image based on the category of each pixel in the key area of ​​the pork image.

[0068] That is, in the first embodiment, the input data for the depth model are the ambient light data detected by the ambient light sensor and the pork image captured by the camera module. The meat quality grade of the pork in the pork image is output through the depth model of these two data.

[0069] It should be noted that when training the deep model, sample pork images marked with ambient light data are used for training.

[0070] That is, in this embodiment, considering the amount of input data, only one deep model needs to be trained to combine the pork image and the ambient light data to achieve the measurement accuracy of the meat quality grade of the pork in the pork image.

[0071] A second implementation manner, the above steps input the pork image into the depth model, and determine the meat quality grade of the pork in the pork image in combination with the ambient light data, including: based on the ambient light data, determining the target depth model corresponding to the ambient light data; wherein, multiple different depth models are trained in advance according to the lighting conditions of different environments; the target depth model is one of the multiple different depth models; the pork image is input into the target depth model to determine the meat quality grade of the pork in the pork image.

[0072] In a second implementation, a plurality of different depth models are trained in advance according to the lighting conditions of different environments, so that each depth model obtained through training corresponds to one lighting condition.

[0073] Exemplarily, the illumination conditions are set to four intervals of A, B, C, and D, and each interval corresponds to a depth model. That is, the sample pork images with illumination condition A are used to train the initial model to obtain depth model A, the sample pork images with illumination condition B are used to train the initial model to obtain depth model B, the sample pork images with illumination condition C are used to train the initial model to obtain depth model C, and the sample pork images with illumination condition C are used to train the initial model to obtain depth model C.

[0074] If the currently detected ambient light data corresponds to lighting condition B, the target depth model corresponding to the ambient light data is determined to be depth model B; then, the pork image is input into depth model B to determine the meat quality grade of the pork in the pork image.

[0075] It can be seen that in this embodiment, different trained deep models are adapted for different lighting conditions, thereby ensuring that images acquired under different lighting conditions can be effectively and accurately recognized. In other words, each deep model corresponds to image data under a lighting condition, which can further improve the accuracy of subsequent meat quality grade measurement.

[0076] A third implementation manner, the above steps input the pork image into the depth model, and determine the meat quality grade of the pork in the pork image in combination with the ambient light data, including: preprocessing the pork image based on the ambient light data; wherein the preprocessing includes at least one of white balance, color enhancement, and contrast adjustment; inputting the preprocessed pork image into the depth model to determine the meat quality grade of the pork in the pork image.

[0077] It should be noted that the third implementation method is to process the pork image in this application, specifically, preprocessing the pork image according to the ambient light data. The preprocessing includes at least one of white balance, color enhancement, and contrast adjustment. Then, after the pork image is preprocessed, it is input into the depth model.

[0078] The white balance processing in the above preprocessing means adjusting the white balance of the pork image; the color enhancement in the preprocessing can use a color enhancement function to enhance the color of the pork image; the contrast adjustment in the preprocessing can use a contrast adjustment function to adjust the contrast of the pork image according to the adaptability of the ambient light.

[0079] In the embodiment of the present application, the pork image is preprocessed according to the ambient light data, with the purpose of enabling the pork image input into the depth model to have environmental consistency, so as to ensure that it is at the same environmental level.

[0080] In a fourth implementation mode, the above steps input the pork image into a depth model, and determine the meat quality grade of the pork in the pork image in combination with the ambient light data, including: inputting the pork image into a depth model, extracting the category of each pixel in the key area of ​​the pork image; determining the proportion of each category in the key area of ​​the pork image based on the category of each pixel in the key area of ​​the pork image; determining the influence weight of each category based on the ambient light data; calculating the target proportion of each category based on the proportion of each category in the key area of ​​the pork image and the influence weight of each category; and determining the meat quality grade of the pork in the pork image based on the target proportion of each category.

[0081] A fourth implementation provides a method for updating the proportions of each category in the key area based on the depth model and the ambient light data to determine the meat quality grade of the pork in the final pork image.

[0082] Exemplarily, the pork image is input into the deep model, and the categories (Q, M, N) of each pixel in the key area of ​​the pork image are extracted; based on the categories of each pixel in the key area of ​​the pork image, the proportion of each category in the key area of ​​the pork image is determined, assuming that Q is 20%, M is 10%, and N is 70%. Then, based on the ambient light data, the influence weight of each category is determined. Assuming that the current ambient light data corresponds to red light, which has a greater impact on category N, it can be multiplied by the set influence weight to reduce the proportion of category N. In this way, the target proportion of each category can be re-determined, and the meat quality grade of the pork in the pork image can be determined based on the target proportion of each category.

[0083] Here, the category with the largest proportion is adopted as the meat quality grade of the pork in the pork image.

[0084] Optionally, the Transformer model includes multiple Transformer encoders; each Transformer encoder is used to fuse features from a previous Transformer encoder with multi-scale features, and refine features through a self-attention mechanism and a feedforward network.

[0085] Among them, the mathematical representation of the Transformer encoder can be:

[0086] ;

[0087] ;

[0088] In the above formula, Indicates The output of the layer encoder, which is processed by the multi-head self-attention mechanism and fused with the input features, and then processed by the layer normalization layer; MHA stands for multi-head attention mechanism, LayerNorm stands for layer normalization; FeedForward stands for feedforward network, and Respectively represent Layer and The feature output of the layer.

[0089] Optionally, the Transformer model also includes a Transformer decoder and an output layer; the output layer is used to obtain a feature matrix from the Transformer decoder and calculate statistical information, and calculate an adaptive threshold of each pixel in the key area of ​​the pork image based on the statistical information; based on the adaptive threshold and feature matrix of each pixel in the key area of ​​the pork image, determine the category of each pixel in the key area of ​​the pork image.

[0090] It should be noted that before pixel-level classification, an adaptive threshold adjustment is introduced to optimize the classification results. This step dynamically adjusts the classification threshold based on the statistical information of the image to adapt to different image conditions and feature distributions.

[0091] The mathematical representation of the adaptive threshold can be:

[0092] ;

[0093] in, The pixel position is The adaptive threshold of (which is dynamically adjusted), is the activation function of sigmoid, and are the parameters of learning, and Stats represents the The local mean or variance of the statistics computed on , which represents the logical score for each class label.

[0094] The mathematical representation of the final classification output can be:

[0095] ;

[0096] ;

[0097] in, It is the classification probability map after applying the softmax function; The pixel position is The logical fraction of Represents the final classification output, which means that the pixel is The pixel classification result is a binary image, whose value is based on and The comparison result determines.

[0098] It should be noted that the embodiment of the present application introduces an adaptive threshold algorithm based on image content, which adjusts the classification threshold by calculating the statistical information of the image in real time, thereby enabling the system to maintain high accuracy in a changing environment and reduce errors caused by environmental changes.

[0099] The mathematical representation of the category proportions provided in the embodiments of the present application is described below, including:

[0100] ;

[0101] in, Indicates category The proportion of The pixel position is The category of the pixel point is , Indicates a critical area.

[0102] Optionally, before inputting the pork image into the depth model, the method also includes: preprocessing the pork image based on image quality adjustment parameters and noise suppression parameters; the image quality adjustment parameters include at least one of white balance parameters, contrast parameters, and color parameters; wherein the image quality adjustment parameters and noise suppression parameters are determined based on an image captured in a previous preset frame of the pork image, and are redetermined every preset time.

[0103] Here, in order to adapt to the needs of subsequent image processing algorithms, the captured pork images can first undergo real-time preprocessing, including automatic white balance, color enhancement, and contrast adjustment to optimize the quality of the output image.

[0104] In addition, an adaptive image preprocessing algorithm is provided here, which can be combined with the parameters of the preprocessing of the image captured by the previous preset frame for unified adjustment. The previous preset frame can be 5, 7, 9, etc. In addition, the preprocessing parameters are re-determined every preset time, and based on this, adaptive adjustments are made for the subsequent multiple frames of images. In this way, the efficiency of preprocessing can be improved.

[0105] In addition, in other embodiments, the above-mentioned preprocessing may also include noise suppression, which can reduce the noise introduced into the environment, thereby improving the image clarity and processing accuracy.

[0106] The present application provides a handheld pork grading and evaluation device 100 for detailed description below. Figure 6 The handheld pork grading and evaluation device 100 may further include: a display screen 501 , a function button 502 , a start switch 503 , a grip handle 504 , a rechargeable battery 505 , and an image capture switch 506 .

[0107] Structurally, the display screen 501 and the function buttons 502 are arranged at the rear of the handheld pork grading and evaluation device 100, the start switch 503 is arranged on the side wall of the handheld body 10, the gripping handle 504 is connected to the rear of the handheld body 10, and the rechargeable battery 505 is arranged on the gripping handle 504. The image capture switch 506 is arranged at the connection between the handheld body 10 and the gripping handle 504.

[0108] In terms of connection, the display screen 501 , the function button 502 , the start switch 503 , the rechargeable battery 505 , and the image capture switch 506 are all electrically connected to the processor 30 .

[0109] In terms of function, the display screen 501 is used to display the image processing results and provide a user interaction interface. The user can directly operate on the display screen, select different function options, and view the meat color evaluation results.

[0110] Function button 502 can be used to quickly perform common operations such as switching modes, confirming selections, etc., providing users with additional operational convenience.

[0111] The start switch 503 is used to control the power of the device, that is, to turn it on and off, and is separated from the function button 502 to ensure that the user can quickly and intuitively control the power status of the device.

[0112] The grip handle 504 is convenient for users to hold and operate.

[0113] The rechargeable battery 505 is powered by a power source or a built-in battery to ensure continuous operation of the device without being limited by an external power source.

[0114] The image capture switch 506 provides a convenient way to capture images. The user can control the camera module 20 to take a single shot through the image capture switch 506 .

[0115] Optionally, in other embodiments, the handheld pork grading and evaluation device 100 may further include a storage module. It is used to store information such as original image data, processing results, and user settings. Built-in storage allows data to be accessed without a network, and also facilitates the tracing and analysis of historical data.

[0116] Optionally, in other embodiments, the handheld pork grading and evaluation device 100 may also include a communication interface, such as a Wi-Fi, Bluetooth or USB interface, for data transmission and connection with other devices, such as transmitting data to a central database or receiving remote control instructions.

[0117] Those skilled in the art will understand that Figure 6 The handheld pork grading and evaluation device 100 is merely an example and does not constitute a limitation on the handheld pork grading and evaluation device 100 , and may include more or fewer components than shown in the figure, or a combination of certain components, or different components.

[0118] Next, other functions of the handheld pork grading and evaluation device 100 are described, including:

[0119] 1. Image upload function: This function allows users to upload pork images to be analyzed by simply dragging and dropping or browsing files. The system supports single or batch upload. During the upload process, the interface will display a progress bar to feedback the upload progress.

[0120] 2. Real-time analysis and result display: After the image is uploaded and processed in the background, the interface will immediately display the results of meat quality grading. The analysis results include semantic segmentation masks on the image, where different meat types are distinguished by different colors. In addition, the specific information of each type will be displayed in the form of charts or lists to provide users with detailed data support.

[0121] 3. Parameter adjustment controls: Users can adjust image processing parameters according to actual needs, such as adaptive thresholds and other algorithm-specific settings. These controls are usually presented in the form of sliders, drop-down menus, or input boxes. Any adjustments made by the user will be reflected in the image processing results in real time, supporting instant preview.

[0122] 4. History Record Management: The system provides a dedicated interface for accessing and managing historical analysis records. Users can view thumbnails, dates, parameters used, and other information for each analysis, and can reload historical images and results for detailed viewing or further analysis.

[0123] 5. Help and User Support: The interface includes an easily accessible help section that contains operating guides, frequently asked questions (FAQs), and details on how to contact technical support. This section is designed to help users use the system more efficiently and provide necessary technical support.

[0124] In summary, the pork grading evaluation method and device based on image recognition provided by the embodiments of the present application have the following advantages:

[0125] High-precision color assessment: Using the Transformer-based semantic segmentation algorithm, the system can accurately distinguish different colors and textures in pork, providing a more detailed and accurate color rating than traditional methods. This high-precision analysis helps to improve the standards of meat quality control.

[0126] Strong adaptability: The system's adaptive learning function can dynamically adjust algorithm parameters according to different lighting conditions and meat characteristics, ensuring the accuracy and consistency of evaluation results, and maintaining high performance even in the case of light changes or background interference.

[0127] Convenience and efficiency of operation: The fully automatic image capture and analysis process greatly simplifies the operation steps, making the entire process from image capture to result output only take a few seconds, greatly improving the evaluation efficiency and suitable for high-speed production environments.

[0128] Significant economic benefits: Compared with traditional meat color assessment instruments, this system has lower costs, simpler maintenance, and is easy to deploy on a large scale, which can save enterprises a lot of manpower and material resources.

[0129] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.

[0130] An embodiment of the present application provides a computer program product. When the computer program product runs on a mobile terminal, the mobile terminal can implement the steps in the above-mentioned method embodiments when executing the computer program product.

[0131] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the camera / electronic device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), electrical carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a disk or an optical disk.

[0132] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0133] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0134] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0135] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A pork grading and evaluation method based on image recognition, characterized in that: Applicable to handheld pork grading and evaluation equipment, including: Acquire the pork image captured by the camera module; Inputting the pork image into a depth model to determine the meat quality grade of the pork in the pork image; The deep model includes a deep convolutional network and a Transformer model; the deep convolutional network is used to extract multi-scale features of the pork image; the deep convolutional network is configured to include a plurality of convolutional kernels of different sizes and / or convolutional layers of different step lengths; The Transformer model is used to extract the category of each pixel in the key area of ​​the pork image based on the multi-scale features, and output the meat quality grade of the pork in the pork image based on the category of each pixel in the key area of ​​the pork image; The method further comprises: acquiring ambient light data detected by an ambient light sensor; wherein the ambient light data represents the lighting conditions of the current environment; Inputting the pork image into the depth model to determine the meat quality grade of the pork in the pork image comprises: inputting the pork image into the depth model and determining the meat quality grade of the pork in the pork image in combination with the ambient light data; The method of inputting the pork image into the depth model and determining the meat quality grade of the pork in the pork image in combination with the ambient light data includes: inputting the pork image into the depth model and extracting the category of each pixel in the key area of ​​the pork image; determining the proportion of each category in the key area of ​​the pork image based on the category of each pixel in the key area of ​​the pork image; determining the influence weight of each category based on the ambient light data; calculating the target proportion of each category based on the proportion of each category in the key area of ​​the pork image and the influence weight of each category; and determining the meat quality grade of the pork in the pork image based on the target proportion of each category.

2. The pork grading and evaluation method based on image recognition according to claim 1, characterized in that: The step of inputting the pork image into the depth model and determining the meat quality grade of the pork in the pork image in combination with the ambient light data comprises: Extracting multi-scale features of the pork image based on the deep convolutional network; The ambient light data and the multi-scale features are input into the Transformer model to extract the category of each pixel in the key area of ​​the pork image; wherein the deep model is trained using sample pork images marked with ambient light data; The meat quality grade of the pork in the pork image is determined based on the category of each pixel in the key area in the pork image.

3. The pork grading and evaluation method based on image recognition according to claim 1, characterized in that: The step of inputting the pork image into the depth model and determining the meat quality grade of the pork in the pork image in combination with the ambient light data comprises: Based on the ambient light data, determining a target depth model corresponding to the ambient light data; wherein a plurality of different depth models are trained in advance according to lighting conditions of different environments; and the target depth model is one of the plurality of different depth models; The pork image is input into the target depth model to determine the meat quality grade of the pork in the pork image.

4. The pork grading and evaluation method based on image recognition according to claim 1, characterized in that: The step of inputting the pork image into the depth model and determining the meat quality grade of the pork in the pork image in combination with the ambient light data comprises: Preprocessing the pork image based on the ambient light data; wherein the preprocessing includes at least one of white balance, color enhancement, and contrast adjustment; The preprocessed pork image is input into the depth model to determine the meat quality grade of the pork in the pork image.

5. The pork grading and evaluation method based on image recognition according to claim 1, characterized in that: The Transformer model includes multiple Transformer encoders; each Transformer encoder is used to fuse the features from the previous Transformer encoder with the multi-scale features, and refine the features through a self-attention mechanism and a feedforward network.

6. The pork grading and evaluation method based on image recognition according to claim 5, characterized in that: The Transformer model also includes a Transformer decoder and an output layer; the output layer is used to obtain a feature matrix from the Transformer decoder and calculate statistical information, and calculate an adaptive threshold value of each pixel in the key area of ​​the pork image based on the statistical information; Based on the adaptive threshold of each pixel in the key area of ​​the pork image and the feature matrix, the category of each pixel in the key area of ​​the pork image is determined.

7. The pork grading and evaluation method based on image recognition according to claim 1, characterized in that: Before inputting the pork image into the depth model, the method further includes: Preprocessing the pork image based on image quality adjustment parameters and noise suppression parameters; the image quality adjustment parameters include at least one of white balance parameters, contrast parameters, and color parameters; The image quality adjustment parameters and the noise suppression parameters are determined based on an image captured in a preset frame before the pork image, and are re-determined every preset time.

8. A handheld pork grading and evaluation device, characterized in that: include: Handheld subject; A camera module, arranged on the head of the handheld body; A processor is arranged inside the handheld body and connected to the camera module, and the processor is used to execute the pork grading evaluation method based on image recognition as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Method and system for analyzing quantity of living livestock based on recorded image

    CN118552879A

  • Live pig body condition management method and system based on computer vision scoring

    CN118968564A