Agricultural product tracing method based on deep learning
Through deep learning technology, combining the texture characteristics and chromaticity values of pork surface images, the problem of differentiation of pork color and texture is solved, and the accurate identification of pork source and freshness is achieved, the accuracy and efficiency of the traceability system are improved, and the Food safety.
Patent Information
- Application Number
- CN202411164447.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2024-12-20
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art has failed to effectively distinguish the source and freshness of pork based on the color and texture of pork, and cannot accurately trace the source and freshness of pork.
Using a deep learning-based method, by obtaining pork surface images, pre-processing and segmenting, the chromaticity values of lean meat and fat meat are determined, and the marble characteristics are combined to determine the source and freshness of pork, and dynamically adjust the chromaticity values of pixels. Calculation formula to accurately identify the source and freshness of pork.
It significantly improves the accuracy of pork source identification and the scientific nature of freshness assessment, optimizes the accuracy and efficiency of the traceability system, and enhances food safety guarantees.
Smart Images

Figure CN119168655A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of product traceability, and in particular to a method for tracing agricultural products based on deep learning. Background Art
[0002] Agricultural product traceability stems from the growing concern of modern society about food safety and quality. With the advancement of globalization and the complexity of the food supply chain, consumers have higher and higher requirements for the transparency of the entire process of agricultural products from production source to table. In order to protect public health, enhance consumer trust, promote sustainable agricultural development, and effectively respond to food safety incidents, the agricultural product traceability system came into being. The agricultural product traceability system uses modern information technology means, such as blockchain, Internet of Things, big data, etc., to record information on various links such as production, processing, circulation, and sales of agricultural products, so as to achieve full traceability of agricultural products, ensure the quality and safety of agricultural products, and provide consumers with reliable product sources and quality assurance.
[0003] Chinese patent announcement number CN117709986B discloses a method and system for reliable traceability of agricultural product production dates based on deep learning. The method includes: obtaining agricultural product images, identifying the agricultural product images through a pre-trained agricultural product recognition model, and obtaining the type and weight of the agricultural product; obtaining the corresponding basic information and transaction information of the agricultural product through the agricultural product traceability blockchain, and the basic information includes: origin, first production date, batch number, production quantity, manufacturer, and average weight of the same batch; predicting the second production date of the agricultural product based on the type and weight of the agricultural product and basic information; comparing the first production date and the second production date to obtain the difference in production dates. If the difference in production dates does not exceed the judgment threshold, it is determined that the basic information of the agricultural product is reliable. The system includes: an image module, an information module, a prediction module, and a comparison module. Realize reliable traceability of agricultural products. It can be seen that the invention has the following problems:
[0004] The issue of distinguishing the source and freshness of pork based on the color and texture of the pork itself is not considered. Summary of the invention
[0005] To this end, the present invention provides a method for tracing agricultural products based on deep learning, so as to overcome the problem in the prior art that the source and freshness of pork cannot be distinguished based on the color and texture of the pork itself.
[0006] To achieve the above object, the present invention provides a method for tracing agricultural products based on deep learning, comprising:
[0007] Acquire a pork surface image and a production label of pork, wherein the production label includes a standard pork source and a start slaughter time, and the pork source includes a domestic pig and a free-range pig;
[0008] Preprocessing the pork surface image to obtain a surface texture image;
[0009] Determining whether marble patterns appear in the surface texture image based on a deep learning model and segmenting the surface texture image into a lean meat texture image and a fat meat surface image;
[0010] Determining corresponding lean meat chromaticity values and fat meat chromaticity values according to the lean meat texture image and the fat meat surface image respectively;
[0011] Determine the predicted pork source based on the determination result of the presence of marbling and whether the lean meat chromaticity value and the fat meat chromaticity value meet a preset condition;
[0012] Determining the predicted freshness of the pork according to the average value of the red channel proportion of each pixel point in the lean meat texture image;
[0013] Determining standard freshness based on the start slaughtering time and the current time;
[0014] The predicted pork source is compared with the standard pork source and the predicted freshness is compared with the standard freshness, and a deep learning model is trained based on the comparison results.
[0015] Further, preprocessing the pork surface image to obtain a surface texture image includes:
[0016] Image filtering to remove noise from pork surface images;
[0017] Image enhancement, used to enhance texture information in images;
[0018] Image segmentation is used to separate the pork part and other parts of the pork surface image, wherein the other parts include the background image and the pig skin image.
[0019] Further, the corresponding lean meat chromaticity value and fat meat chromaticity value are determined according to the lean meat texture image and the fat meat surface image, respectively, including:
[0020] respectively determining the number of pixels of the lean meat texture image and the number of pixels of the fat meat surface image;
[0021] Determine the chromaticity value of each pixel of the lean meat texture image according to a single pixel chromaticity value calculation formula, and determine the lean meat chromaticity value according to an average value of the chromaticity value of each pixel of the lean meat texture image;
[0022] The chromaticity value of each pixel of the fat surface image is determined according to a single pixel chromaticity value calculation formula, and the fat chromaticity value is determined according to an average value of the chromaticity value of each pixel of the fat surface image.
[0023] Furthermore, the calculation formula for the chromaticity value of a single pixel is:
[0024] Li=l1×Ri+l2×Gi+l3×Bi,
[0025] Among them, Li is the chromaticity value of the i-th pixel, Ri is the value of the red channel in the RGB channel of the i-th pixel, G is the value of the green channel in the RGB channel of the i-th pixel, B is the value of the blue channel in the RGB channel of the i-th pixel, l1 is the red coefficient, l2 is the green coefficient, and l3 is the blue coefficient.
[0026] Furthermore, the values of the red coefficient, the green coefficient and the blue coefficient are determined according to the surface texture image to which the single pixel belongs, wherein:
[0027] If a single pixel belongs to the lean meat texture image, the red coefficient > green coefficient ≥ blue coefficient;
[0028] If a single pixel belongs to the fat surface image, the green coefficient ≥ blue coefficient > red coefficient.
[0029] Further, the predicted pork source is determined based on the determination result of the presence of marbling and whether the lean meat chromaticity value and the fat meat chromaticity value meet preset conditions, including:
[0030] If the preset conditions are met, the predicted pork source is determined to be free-range pigs;
[0031] If the preset conditions are not met, the predicted pork source is determined to be domestic pigs;
[0032] Among them, the preset condition is that the lean meat chromaticity value is greater than or equal to a first preset value and the fat meat chromaticity value is greater than or equal to a second preset value.
[0033] Furthermore, if the predicted source of pork is determined to be free-range pigs, the predicted freshness of the pork is determined according to the average value of the red channel proportion of each pixel in the lean meat texture image, wherein:
[0034] The predicted freshness is positively correlated with the average value of the red channel proportion of each pixel.
[0035] Furthermore, the average value of the red channel proportion of each pixel is calculated according to the following formula:
[0036]
[0037] Among them, Y is the average value of the red channel proportion of each pixel, n is the number of pixels in the lean meat texture image, ri is the red channel proportion of the i-th pixel, Ri is the red channel value of the i-th pixel, Gi is the green channel value of the i-th pixel, and Bi is the blue channel value of the i-th pixel.
[0038] Further, the slaughtering time is determined according to the start time of slaughtering and the current time, and the standard freshness is determined according to the slaughtering time;
[0039] Among them, the standard freshness is negatively correlated with the slaughtering time.
[0040] Further, comparing the predicted pork source with the standard pork source and the predicted freshness with the standard freshness, and determining to train a deep learning model based on the comparison results, including:
[0041] If the comparison result meets the preset comparison result, it is determined that the deep learning model will not be trained;
[0042] If the comparison result does not meet the preset comparison result, it is determined to train the deep learning model;
[0043] Among them, the preset comparison result is that the predicted pork source is the same as the standard pork source and the difference percentage between the predicted freshness and the standard freshness is less than a preset percentage.
[0044] Compared with the prior art, the beneficial effect of the present invention is that the agricultural product traceability method based on deep learning provided by the present invention shows significant effects in improving traceability accuracy, enhancing food safety, optimizing supply chain management, enhancing consumer trust, supporting continuous model optimization, and promoting agricultural modernization development.
[0045] Furthermore, the present invention can significantly improve the accuracy of identifying the source of pork (such as domestic pigs and free-range pigs) by combining the texture features of the pork surface image with the production label information, especially using a deep learning model to accurately identify the marbling of pork and the colorimetric values of lean meat and fat. This method is more accurate and efficient than traditional manual detection or simple instrument detection.
[0046] Furthermore, the present invention adopts a single pixel chromaticity value calculation formula and dynamically adjusts the values of red, green and blue coefficients according to the image to which the pixel belongs (lean meat texture or fat meat surface), thereby ensuring the pertinence and accuracy of the chromaticity value calculation and improving the scientificity and accuracy of the chromaticity value evaluation.
[0047] Furthermore, the present invention achieves high efficiency and accuracy in model training by comparing the predicted pork source with the standard pork source and the predicted freshness with the standard freshness, and intelligently deciding whether to train and how to train the deep learning model based on the comparison results: when the prediction results highly meet the preset standards (i.e., the predicted pork source is accurate and the predicted freshness is slightly different from the standard freshness), unnecessary model training is avoided and computing resources are saved; and when the prediction results deviate from the preset standards, the system can accurately identify the problem, whether it is the misjudgment of the pork source or the deviation of the freshness assessment, the relevant judgment operators of the deep learning model can be retrained in a targeted manner, thereby effectively improving the accuracy and robustness of the model in evaluating pork quality. In particular, by dynamically adjusting the judgment operators of key parameters such as marbling, lean meat color, and fat meat color, and updating the preset values, the model's adaptability to complex and variable pork quality is further enhanced, providing a more solid guarantee for food safety and consumer health. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 This is a step diagram of a method for tracing agricultural products based on deep learning according to an embodiment of the present invention;
[0049] Figure 2 A diagram showing the steps of determining the chromaticity value of lean meat and the chromaticity value of fat meat according to an embodiment of the present invention;
[0050] Figure 3 This is a schematic diagram of a marble pattern sample according to an embodiment of the invention. DETAILED DESCRIPTION
[0051] In order to make the objects and advantages of the present invention more clearly understood, the present invention is further described below in conjunction with embodiments; it should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0052] The preferred embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.
[0053] It should be noted that, in the description of the present invention, terms such as "up", "down", "left", "right", "inside" and "outside" indicating directions or positional relationships are based on the directions or positional relationships shown in the drawings. This is merely for the convenience of description and does not indicate or imply that the device or element must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it cannot be understood as a limitation on the present invention.
[0054] In addition, it should be noted that in the description of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0055] See also Figure 1 As shown, it is a step diagram of an agricultural product traceability method based on deep learning according to an embodiment of the present invention. An embodiment of the present invention provides an agricultural product traceability method based on deep learning, comprising:
[0056] Step S1, obtaining a pork surface image and a production label of pork, wherein the production label includes a standard pork source and a start time of slaughtering, and the pork source includes domestic pigs and free range pigs;
[0057] Step S2, preprocessing the pork surface image to obtain a surface texture image;
[0058] Step S3, determining whether marble patterns appear in the surface texture image based on a deep learning model and segmenting the surface texture image into a lean meat texture image and a fat meat surface image;
[0059] Step S4, determining the corresponding lean meat chromaticity value and fat meat chromaticity value according to the lean meat texture image and the fat meat surface image respectively;
[0060] Step S5, determining the predicted pork source based on the result of the determination of the presence of marbling and whether the lean meat chromaticity value and the fat meat chromaticity value meet preset conditions; it is understandable that free range pigs have a delicate texture, and the intramuscular fat forms obvious marble patterns, which enhances the visual effect and taste of the meat; the meat texture of domestic pigs may be relatively rough and lacks the delicate feeling of free range pigs.
[0061] Step S6, determining the predicted freshness of the pork according to the result of the determination of the predicted pork source combined with the average value of the red channel proportion of each pixel in the lean meat texture image;
[0062] Step S7, determining the standard freshness according to the start time of slaughtering and the current time;
[0063] Step S8, comparing the predicted pork source with the standard pork source and the predicted freshness with the standard freshness, and determining to train a deep learning model based on the comparison results.
[0064] It can be understood that the agricultural product traceability method based on deep learning provided by the present invention has shown significant effects in improving traceability accuracy, enhancing food safety, optimizing supply chain management, enhancing consumer trust, supporting continuous model optimization, and promoting agricultural modernization development: (1) By combining the texture features of pork surface images with production label information, especially using deep learning models to accurately identify the marbling of pork and the color values of lean meat and fat, the accuracy of identifying the source of pork (such as domestic pigs and free-range pigs) can be significantly improved. This method is more accurate and efficient than traditional manual detection or simple instrument detection; (2) Through automated and intelligent traceability methods, enterprises can more accurately grasp the production of pork products. (3) By comparing the predicted results with standard data, the deep learning model can be continuously trained and optimized to improve its recognition ability and accuracy. This feedback mechanism ensures the continuous improvement and adaptability of the traceability system. (4) This method can not only help consumers understand the true source of pork, but also provide a scientific basis for food safety regulatory authorities to effectively combat counterfeit and shoddy products and ensure the quality and safety of pork products on the market. (5) This method is an important manifestation of agricultural modernization, which promotes the deep integration of agricultural information technology and intelligent technology, and provides strong support for the realization of precision and intelligent agricultural production.
[0065] Specifically, in step S2, the pork surface image is preprocessed to obtain a surface texture image, including:
[0066] Image filtering is used to remove noise from pork surface images to improve image quality; in implementation, so as to better extract the texture features of pork;
[0067] Image enhancement is used to enhance the texture information in the image; in implementation, a frequency domain method is used to convert the image to the frequency domain (such as using Fourier transform) and then operate on the frequency components, specifically using high-pass filtering for image enhancement to enhance the high-frequency components of the image, i.e., texture information;
[0068] Image segmentation is used to separate the pork part and other parts of the pork surface image, wherein the other parts include the background image and the pig skin image; in implementation, methods such as threshold segmentation, edge detection, and region growing can be used.
[0069] See also Figure 2 As shown, it is a step diagram of determining the chromaticity value of lean meat and the chromaticity value of fat meat according to an embodiment of the present invention. Specifically, in step S4, the corresponding chromaticity value of lean meat and the chromaticity value of fat meat are determined according to the lean meat texture image and the fat meat surface image, respectively, including:
[0070] Step S41, respectively determining the number of pixels of the lean meat texture image and the number of pixels of the fat meat surface image;
[0071] Step S42, determining the chromaticity value of each pixel of the lean meat texture image according to a single pixel chromaticity value calculation formula, and determining the lean meat chromaticity value according to an average value of the chromaticity value of each pixel of the lean meat texture image;
[0072] Step S43, determining the chromaticity value of each pixel of the fat surface image according to a single pixel chromaticity value calculation formula, and determining the fat chromaticity value according to an average value of the chromaticity value of each pixel of the fat surface image.
[0073] Specifically, the calculation formula for the chromaticity value of a single pixel is:
[0074] Li=l1×Ri+l2×Gi+l3×Bi,
[0075] Among them, Li is the chromaticity value of the i-th pixel, Ri is the value of the red channel in the RGB channel of the i-th pixel, G is the value of the green channel in the RGB channel of the i-th pixel, B is the value of the blue channel in the RGB channel of the i-th pixel, l1 is the red coefficient, l2 is the green coefficient, and l3 is the blue coefficient.
[0076] In implementation, the R, G, and B channels are all based on the RGB color model, R is the value of the red channel in the RGB model, G is the value of the green channel in the RGB model, and B is the value of the blue channel in the RGB model.
[0077] It can be understood that the chromaticity value calculation formula for a single pixel is adopted, and the values of the red, green and blue coefficients are dynamically adjusted according to the image to which the pixel belongs (lean meat texture or fat meat surface), thereby ensuring the pertinence and accuracy of the chromaticity value calculation.
[0078] Specifically, the values of the red coefficient, the green coefficient, and the blue coefficient are determined according to the surface texture image to which the single pixel belongs, where:
[0079] If a single pixel belongs to a lean meat texture image, the red coefficient>green coefficient≥blue coefficient; it is understandable that the color of lean meat is usually dark red or pink, and its red tone is more significant than that of fat meat; in particular, for lean meat texture images, emphasizing the contribution of the red channel (the red coefficient is the largest) is consistent with the visual characteristics of lean meat being reddish in color;
[0080] If a single pixel belongs to the fat surface image, the green coefficient ≥ blue coefficient > red coefficient; it is understandable that the color of fat tends to be light pink or off-white, and the ratio of these colors in RGB tends to be lower red (R) value, moderate green (G) value and higher blue (B) value, but the blue value will not be too high to maintain the warmth of the color; in particular, for the fat surface image, the emphasis is on the contribution of the green and blue channels (green coefficient ≥ blue coefficient and both are greater than the red coefficient) to reflect the paler color of the fat or a certain degree of transparency.
[0081] In practice, this approach improves the scientificity and accuracy of colorimetric value assessment.
[0082] Specifically, in step S5, the predicted pork source is determined based on the determination result of the presence of marbling and whether the lean meat chromaticity value and the fat meat chromaticity value meet the preset conditions, including:
[0083] If the preset conditions are met, the predicted pork source is determined to be free-range pigs;
[0084] If the preset conditions are not met, the predicted pork source is determined to be domestic pigs;
[0085] Among them, the preset condition is that the lean meat chromaticity value is greater than or equal to a first preset value and the fat meat chromaticity value is greater than or equal to a second preset value.
[0086] It is understandable that the color of pork from wild pigs is darker, with the lean part being dark red or bright red, and the fat part being white and shiny; the color of pork from ordinary pork is relatively lighter, with the lean part being mostly light pink, and the fat part also being lighter. Therefore, under the preset conditions, the dual determination of the color values of lean meat and fat can more accurately determine the source of pork.
[0087] It can be understood that the method of predicting the source of pork by combining the determination result of marbling and whether the chromaticity value of lean meat and the chromaticity value of fat meet the preset conditions makes full use of the color information in the appearance characteristics of pork, and also combines the dual determination criteria of the chromaticity values of lean meat and fat meat, effectively improving the accuracy and reliability of pork source determination; according to the characteristics of free-range pigs that have darker color, dark red or bright red lean meat, white and shiny fat, and domestic pigs that have relatively lighter color, light pink lean meat, and lighter fat color, reasonable first preset values and second preset values are set as chromaticity value determination thresholds. The combined application of this dual chromaticity value determination and marbling characteristics can more comprehensively capture the quality characteristics of pork, reduce the misjudgment rate, and provide a more scientific and accurate basis for traceability management of the pork market and consumer selection.
[0088] See also Figure 3As shown, it is a schematic diagram of a marble pattern sample according to an embodiment of the present invention. It can be understood that the marble pattern of pork is a discrete pattern. Relevant image samples of the marble pattern can be collected in advance, which will not be described in detail here.
[0089] In implementation, both the first preset value and the second preset value are determined based on the results of historical analysis, wherein the average chromaticity value of free range pigs and the average historical chromaticity value of domestic pigs are determined respectively based on a large amount of historical information, and the average of the average chromaticity value of free range pig lean meat and the average historical chromaticity value of domestic pig lean meat is taken as the first preset value, and the average of the average chromaticity value of free range pig fat meat and the average historical chromaticity value of domestic pig fat meat is taken as the second preset value.
[0090] Specifically, in step S6, if the predicted pork source is determined to be free-range pigs, the predicted freshness of the pork is determined based on the average value of the red channel proportion of each pixel in the lean meat texture image, where:
[0091] The predicted freshness is positively correlated with the average value of the red channel proportion of each pixel.
[0092] It is understandable that the color of fresh pork tends to be bright red due to its high hemoglobin content and the lack of significant oxidation, which may be manifested in the RGB system as a relatively high R (red) component and relatively low G (green) and B (blue) components; as the freshness of the pork decreases, the color gradually darkens and abnormal colors such as gray-brown or green may appear, which may cause the R component to decrease, while the G or B component changes depending on the specific color change (for example, gray-brown may mean that both G and B components have increased, while green may mean that the G component has increased significantly); therefore, the freshness of the pork can be determined based on the proportion of the R component, and the fresher the pork, the greater the proportion of the red channel.
[0093] In implementation, specific values of the R, G, and B components are determined according to the first preset value to determine the preset proportion Y0 of the R component, and then the proportion change y=|Y-Y0|÷Y0 is calculated.
[0094] In implementation, the deep learning model determines the predicted slaughter time based on the proportion change y to determine the predicted freshness based on the established mapping relationship table between slaughter time and freshness.
[0095] Specifically, the average value of the red channel proportion of each pixel is calculated according to the following formula:
[0096]
[0097] Among them, Y is the average value of the red channel proportion of each pixel, n is the number of pixels in the lean meat texture image, ri is the red channel proportion of the i-th pixel, Ri is the red channel value of the i-th pixel, Gi is the green channel value of the i-th pixel, and Bi is the blue channel value of the i-th pixel.
[0098] Specifically, in step S7, the slaughtering time is determined according to the start slaughtering time and the current time, and the standard freshness is determined according to the slaughtering time;
[0099] Among them, the standard freshness is negatively correlated with the slaughtering time.
[0100] In practice, slaughtering time = current time - start time of slaughtering. The longer the slaughtering time is, the worse the standard freshness is, and the pork is less fresh.
[0101] In implementation, the deep learning model determines the standard freshness based on the slaughter time and the established mapping relationship table between slaughter time and freshness.
[0102] Specifically, in step S8, the predicted pork source is compared with the standard pork source and the predicted freshness is compared with the standard freshness, and a deep learning model is trained based on the comparison results, including:
[0103] If the comparison result meets the preset comparison result, it is determined that the deep learning model will not be trained;
[0104] If the comparison result does not meet the preset comparison result, it is determined to train the deep learning model;
[0105] Among them, the preset comparison result is that the predicted pork source is the same as the standard pork source (first preset result) and the difference percentage between the predicted freshness and the standard freshness is less than a preset percentage (second preset result).
[0106] In implementation, the difference percentage between the predicted freshness and the standard freshness = | predicted slaughter time - slaughter time | ÷ slaughter time × 100%; usually, the preset percentage is ≤10%, preferably, the preset percentage = 5%.
[0107] In implementation, when determining to train a deep learning model, how to train the deep learning model is determined according to whether the first preset result or the second preset result is not satisfied, wherein:
[0108] If the first preset result is not satisfied, it is because the determination of whether there is marble or the determination of the chromaticity value of lean meat and the chromaticity value of fat meat is wrong, and the marble determination operator of the deep learning model needs to be retrained, and the first preset value and the second preset value need to be updated (redetermined);
[0109] If the second preset result is not met, it means that the deep learning model makes an error in the judgment result of predicting the slaughtering time according to the proportion change y, and it is necessary to retrain the judgment operator of predicting the slaughtering time of the deep learning model.
[0110] It is understandable that by comparing the predicted pork source with the standard pork source and the predicted freshness with the standard freshness, and intelligently deciding whether to train and how to train the deep learning model based on the comparison results, the efficiency and accuracy of model training are achieved: when the prediction results are highly consistent with the preset standards (that is, the predicted pork source is accurate and the predicted freshness is slightly different from the standard freshness), unnecessary model training is avoided and computing resources are saved; and when the prediction results deviate from the preset standards, the system can accurately identify the problem, whether it is the misjudgment of the pork source or the deviation of the freshness assessment, the relevant judgment operators of the deep learning model can be retrained in a targeted manner, thereby effectively improving the accuracy and robustness of the model in assessing pork quality. In particular, by dynamically adjusting the judgment operators of key parameters such as marbling, lean meat color, and fat meat color, and updating the preset values, the model's adaptability to complex and changeable pork quality is further enhanced, providing a more solid guarantee for food safety and consumer health.
[0111] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.
[0112] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for tracing agricultural products based on deep learning, characterized in that: include: Acquire a pork surface image and a production label of pork, wherein the production label includes a standard pork source and a start slaughter time, and the pork source includes a domestic pig and a free-range pig; Preprocessing the pork surface image to obtain a surface texture image; Determining whether marble patterns appear in the surface texture image based on a deep learning model and segmenting the surface texture image into a lean meat texture image and a fat meat surface image; Determining corresponding lean meat chromaticity values and fat meat chromaticity values according to the lean meat texture image and the fat meat surface image respectively; Determine the predicted pork source based on the determination result of the presence of marbling and whether the lean meat chromaticity value and the fat meat chromaticity value meet a preset condition; Determining the predicted freshness of the pork according to the average value of the red channel proportion of each pixel point in the lean meat texture image; Determining standard freshness based on the start slaughtering time and the current time; The predicted pork source is compared with the standard pork source and the predicted freshness is compared with the standard freshness, and a deep learning model is trained based on the comparison results.
2. The agricultural product traceability method based on deep learning according to claim 1 is characterized in that: Preprocessing the pork surface image to obtain a surface texture image includes: Image filtering to remove noise from pork surface images; Image enhancement, used to enhance texture information in images; Image segmentation is used to separate the pork part and other parts of the pork surface image, wherein the other parts include the background image and the pig skin image.
3. The agricultural product traceability method based on deep learning according to claim 1 is characterized in that: Determining the corresponding lean meat chromaticity value and fat meat chromaticity value according to the lean meat texture image and the fat meat surface image respectively includes: respectively determining the number of pixels of the lean meat texture image and the number of pixels of the fat meat surface image; Determine the chromaticity value of each pixel of the lean meat texture image according to a single pixel chromaticity value calculation formula, and determine the lean meat chromaticity value according to an average value of the chromaticity value of each pixel of the lean meat texture image; The chromaticity value of each pixel of the fat surface image is determined according to a single pixel chromaticity value calculation formula, and the fat chromaticity value is determined according to an average value of the chromaticity value of each pixel of the fat surface image.
4. The agricultural product traceability method based on deep learning according to claim 3 is characterized in that: The calculation formula for the chromaticity value of a single pixel is: Li=l1×Ri+l2×Gi+l3×Bi, Among them, Li is the chromaticity value of the i-th pixel, Ri is the value of the red channel in the RGB channel of the i-th pixel, G is the value of the green channel in the RGB channel of the i-th pixel, B is the value of the blue channel in the RGB channel of the i-th pixel, l1 is the red coefficient, l2 is the green coefficient, and l3 is the blue coefficient.
5. The agricultural product traceability method based on deep learning according to claim 4 is characterized in that: The values of the red coefficient, the green coefficient and the blue coefficient are determined according to the surface texture image to which the single pixel belongs, wherein: If a single pixel belongs to the lean meat texture image, the red coefficient > green coefficient ≥ blue coefficient; If a single pixel belongs to the fat surface image, the green coefficient ≥ blue coefficient > red coefficient.
6. The agricultural product traceability method based on deep learning according to claim 5 is characterized in that: The method of predicting the pork source is based on the determination result of the presence of marbling and whether the lean meat chromaticity value and the fat meat chromaticity value meet preset conditions, including: If the preset conditions are met, the predicted pork source is determined to be free-range pigs; If the preset conditions are not met, the predicted pork source is determined to be domestic pigs; Among them, the preset condition is that the lean meat chromaticity value is greater than or equal to a first preset value and the fat meat chromaticity value is greater than or equal to a second preset value.
7. The agricultural product traceability method based on deep learning according to claim 6 is characterized in that: If the predicted pork source is determined to be free-range pigs, the predicted freshness of the pork is determined according to the average value of the red channel proportion of each pixel point in the lean meat texture image, wherein: The predicted freshness is positively correlated with the average value of the red channel proportion of each pixel.
8. The agricultural product traceability method based on deep learning according to claim 7 is characterized in that: The average value of the red channel proportion of each pixel is calculated according to the following formula: Among them, Y is the average value of the red channel proportion of each pixel, n is the number of pixels in the lean meat texture image, ri is the red channel proportion of the i-th pixel, Ri is the red channel value of the i-th pixel, Gi is the green channel value of the i-th pixel, and Bi is the blue channel value of the i-th pixel.
9. The agricultural product traceability method based on deep learning according to claim 1, characterized in that: Determine the slaughtering time according to the start slaughtering time and the current time, and determine the standard freshness according to the slaughtering time; Among them, the standard freshness is negatively correlated with the slaughtering time.
10. The agricultural product traceability method based on deep learning according to claim 1, characterized in that: Comparing the predicted pork source with the standard pork source and the predicted freshness with the standard freshness, and determining to train a deep learning model based on the comparison results, including: If the comparison result meets the preset comparison result, it is determined that the deep learning model will not be trained; If the comparison result does not meet the preset comparison result, it is determined to train the deep learning model; Among them, the preset comparison result is that the predicted pork source is the same as the standard pork source and the difference percentage between the predicted freshness and the standard freshness is less than a preset percentage.
Citation Information
Patent Citations
Method for detecting pork freshness based on color and smell data fusion
CN109490306A
Meat identification method and device, computer equipment and storage medium
CN117372748A
Pork quality grading method
CN117456524A
Nondestructive testing method and system for comprehensive quality of fresh pork
CN118261492A
Tray assembly and tray for battery hving the same
KR102247190B1
Cited By
Pork traceability management method and system based on big data
CN120912229A
