Beef surface pollution identification method and system based on machine vision
Through the beef surface pollution recognition method based on machine vision, using machine learning and clustering technology, the problem of difficult to distinguish mold from fat textures in traditional methods is solved, and higher recognition accuracy and reliability are achieved.
Patent Information
- Application Number
- CN202510269637.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-07
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2045-03-07
AI Technical Summary
Traditional beef surface mold contamination identification methods are difficult to accurately distinguish surface fat texture and mold, resulting in insufficient identification accuracy and reliability.
Using machine vision-based recognition methods, we use machine learning to identify implicit contaminated pixels, set the adjacent pixel retrieval specifications based on fat distribution data, and perform clustering and pollution treatment screening to obtain accurate pollution recognition results.
By dynamically setting the search range, we can accurately distinguish mold and fat textures, reduce misjudgment, and significantly improve the accuracy, accuracy and reliability of mold contamination recognition on beef surface.
Smart Images

Figure CN120198726A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision, and particularly to a method and system for identifying beef surface contamination based on machine vision. Background Art
[0002] With the increasing attention to food safety issues, the detection of food surface contamination has become an important link in ensuring food quality. Especially for meat products such as beef, its surface may be contaminated by molds and other contaminants, which not only affect the appearance of the food but also may pose a threat to consumers' health.
[0003] Currently, traditional methods for identifying beef surface contamination usually rely on image processing techniques to detect contamination by analyzing features such as the color and texture of the beef surface. However, the recognition accuracy of some contaminations is relatively low. For example, mold contamination usually appears as white or near-white areas, while the fat texture on the beef surface is also mostly white or light-colored lines or grid-like structures. Due to the similar colors of the two, traditional image processing methods often cannot accurately distinguish between mold and fat areas during color recognition, resulting in inaccurate recognition results and even misjudgment. Summary of the Invention
[0004] In view of the technical problem that the traditional method for identifying mold contamination on the beef surface is difficult to accurately distinguish the surface fat texture and mold, resulting in insufficient accuracy and reliability of mold contamination recognition, the present invention provides a method and system for identifying beef surface contamination based on machine vision to solve this problem.
[0005] The technical solution of the present invention to solve the above technical problems is as follows:
[0006] In a first aspect, the present invention provides a method for identifying beef surface contamination based on machine vision, including: collecting a beef image of the surface of a target beef, using machine learning to identify hidden contamination pixel points in the beef image to obtain a distribution of hidden pixel points; setting a neighboring pixel point retrieval specification according to the fat distribution data on the beef surface; performing neighboring pixel point retrieval clustering on a plurality of hidden pixel points in the distribution of hidden pixel points according to the neighboring pixel point retrieval specification to obtain a clustered distribution of hidden pixel points, and performing contamination processing screening to obtain a contamination recognition result.
[0007] Preferably, the method for identifying beef surface contamination based on machine vision further includes: collecting a beef image of the surface of a target beef, where the target beef is the beef to be identified for surface contamination; using machine learning to pre-train a contamination pixel point identifier; inputting the beef image into the contamination pixel point identifier, and identifying and outputting a contamination pixel point recognition result to obtain a plurality of hidden pixel points; constructing a distribution of hidden pixel points according to the plurality of hidden pixel points.
[0008] Preferably, the machine vision-based beef surface contamination recognition method further includes: collecting a sample beef image set according to the historical recognition data of mold contamination on the beef surface; annotating the mold contamination pixel points on the surface of each sample beef image to obtain a sample contamination pixel point recognition result set; constructing a contamination pixel point recognizer including an input layer, a convolutional layer, a pooling layer, a fully connected layer, and an output layer based on a convolutional neural network; using the sample beef image set and the sample contamination pixel point recognition result set to train the contamination pixel point recognizer until the test converges.
[0009] Preferably, the machine vision-based beef surface contamination recognition method further includes: constructing an image coordinate system within the beef image; within the image coordinate system, annotating the coordinates of the multiple implicit pixel points to obtain an implicit pixel point distribution.
[0010] Preferably, the machine vision-based beef surface contamination recognition method further includes: obtaining the maximum fat distribution width on the surface of the same batch of beef, and obtaining the minimum contamination diameter of mold contamination on the beef surface; calculating the mean value of the maximum fat distribution width and the minimum contamination diameter as the distance for adjacent pixel point retrieval to obtain an adjacent pixel point retrieval specification.
[0011] Preferably, the machine vision-based beef surface contamination recognition method further includes: taking the coordinates of multiple implicit pixel points within the implicit pixel point distribution as the center points, and setting multiple adjacent pixel point retrieval ranges with the adjacent pixel point retrieval specification as the radius; retrieving and clustering the pixel points within the multiple adjacent pixel point retrieval ranges to obtain multiple clustered implicit pixel points as a clustered implicit pixel point distribution.
[0012] Preferably, the machine vision-based beef surface contamination recognition method further includes: performing grayscale processing on the pixel values of all pixel points within the clustered implicit pixel point distribution to obtain a clustered grayscale point distribution; performing binary classification according to the grayscale values of all pixel points within the clustered grayscale point distribution to obtain a clustered binary point distribution, where pixel points with grayscale values greater than a preset grayscale threshold are classified as 1, and pixel points with grayscale values less than the preset grayscale threshold are classified as 0; counting the proportion of 1s in each clustered binary point within the clustered binary point distribution to obtain multiple proportions of 1-class pixel points, and screening the clustered implicit pixel points corresponding to the proportion of 1-class pixel points greater than or equal to a preset proportion threshold as the contamination area to obtain a contamination recognition result.
[0013] In a second aspect, the present invention provides a beef surface contamination recognition system based on machine vision, including: an implicit contamination pixel point recognition module, which is used to collect beef images of the surface of the target beef, and use machine learning to recognize the implicit contamination pixel points in the beef images to obtain an implicit pixel point distribution; a neighboring pixel point retrieval specification setting module, which is used to set the neighboring pixel point retrieval specification according to the fat distribution data on the beef surface; a neighboring pixel point retrieval clustering module, which is used to perform neighboring pixel point retrieval clustering on a plurality of implicit pixel points in the implicit pixel point distribution according to the neighboring pixel point retrieval specification, obtain a clustered implicit pixel point distribution, perform contamination processing screening, and obtain a contamination recognition result.
[0014] The beneficial effects of the present invention are as follows: By using machine learning to recognize the implicit contamination pixel points in the beef images, an implicit pixel point distribution is obtained; then, according to the fat distribution data on the beef surface, the neighboring pixel point retrieval specification is set; then, according to the neighboring pixel point retrieval specification, neighboring pixel point retrieval clustering is performed on a plurality of implicit pixel points in the implicit pixel point distribution to obtain a clustered implicit pixel point distribution; finally, contamination processing screening is performed according to the clustered implicit pixel point distribution to obtain a contamination recognition result; that is to say, by setting a dynamic neighboring pixel point retrieval range according to the mold contamination and fat texture characteristics for contamination feature screening, the mold and fat texture on the beef surface can be accurately distinguished, effectively reducing the misjudgment caused by the similarity between the mold and the fat texture, and significantly improving the accuracy, accuracy and reliability of the mold contamination recognition on the beef surface. Description of the Drawings
[0015] Figure 1 It is a schematic flow chart of the method for recognizing beef surface contamination based on machine vision provided by the present invention;
[0016] Figure 2 It is a schematic structural diagram of the beef surface contamination recognition system based on machine vision provided by the present invention.
[0017] In the drawings, the components represented by each reference numeral are described as follows:
[0018] The implicit contamination pixel point recognition module 10, the neighboring pixel point retrieval specification setting module 20, and the neighboring pixel point retrieval clustering module 30. Specific Embodiments
[0019] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts shall fall within the protection scope of the present invention.
[0020] In the description of the present invention, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more of the described features. In the description of the present invention, "a plurality" means two or more unless otherwise specifically defined.
[0021] In the description of the present invention, the term "for example" is used to mean "serving as an example, illustration, or explanation". Any embodiment described as "for example" in the present invention is not necessarily construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to implement and use the present invention. In the following description, details are set forth for purposes of explanation. It should be understood that those of ordinary skill in the art can recognize that the present invention can be implemented without the use of these specific details. In other instances, well-known structures and processes are not described in detail to avoid obscuring the description of the present invention with unnecessary details. Therefore, the present invention is not intended to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed herein.
[0022] Embodiment 1, as Figure 1 shown, the embodiment of the present invention provides a method for identifying beef surface contamination based on machine vision, specifically including the following steps:
[0023] S100: Collect beef images of the surface of the target beef, and use machine learning to identify hidden contaminated pixel points in the beef images to obtain the distribution of hidden pixel points.
[0024] Furthermore, step S100 of the present invention further includes:
[0025] S110: Collect beef images of the surface of the target beef, where the target beef is the beef to be identified for surface contamination.
[0026] Specifically, the surface of the target beef is imaged by an image acquisition device. Here, the target beef is the beef to be identified for surface contamination. To ensure the accuracy of subsequent image processing and analysis, a high-resolution camera or image acquisition device is used to ensure that every detail on the beef surface can be clearly captured, and the surface image of the target beef is obtained as the beef image. By accurately collecting high-quality beef surface images, a solid foundation is provided for subsequent mold contamination identification, making the entire identification process more efficient and accurate.
[0027] S120: Use machine learning to pre-train a contaminated pixel point identifier.
[0028] Furthermore, step S120 of the present invention further includes:
[0029] S121: Collect a set of sample beef images according to the historical recognition data of mold contamination on the beef surface; S122: Label the mold contamination pixel points on the surface of each sample beef image to obtain a set of sample contamination pixel point recognition results; S123: Based on a convolutional neural network, construct a contamination pixel point recognizer including an input layer, a convolutional layer, a pooling layer, a fully connected layer, and an output layer; S124: Use the set of sample beef images and the set of sample contamination pixel point recognition results to train the contamination pixel point recognizer until the test converges.
[0030] Specifically, in order to improve the accuracy and robustness of mold contamination recognition, it is necessary to collect images from multiple batches of beef. These sample beef images will serve as the basic data set for model training and verification. By collecting images of the surfaces of multiple sample beef, the mold contamination characteristics on the beef surface under different conditions can be covered, thereby improving the recognition ability.
[0031] First, according to the historical recognition data of mold contamination on the beef surface, collect the beef surface images under different conditions as sample beef images to obtain a set of sample beef images; then, label the mold contamination pixel points (such as white or light - colored areas) on the surface of each sample beef image. For example, label through image - processing software. Usually, the mold contamination area is white or light - colored. Mark each mold contamination area and label its corresponding pixel points as "contaminated". After the labeling is completed, each sample image will have a corresponding contamination pixel point recognition result. It should be noted that the labeling here is only for white or light - colored areas. Since the fat area may also be white or light - colored, the beef surface fat area in the sample beef image will also be labeled to obtain a set of sample contamination pixel point recognition results.
[0032] Next, a pollution pixel point recognizer is constructed based on a convolutional neural network. A convolutional neural network is a deep learning model specifically designed for processing image data. It is particularly good at automatically extracting features from images and performing tasks such as classification and recognition. It can effectively extract local features in images and gradually build more advanced abstract features, and is widely used in fields such as image classification and object detection. Among them, the pollution pixel point recognizer is used to automatically identify the pollution area in the beef surface image through the convolutional neural network. The pollution pixel point recognizer includes an input layer, a convolutional layer, a pooling layer, a fully connected layer, and an output layer. Among them, the input data of the input layer is the beef image; the convolutional layer is used to extract local features (such as color, texture, etc.) in the image through a convolutional kernel. Through multiple layers of convolution, image features at different levels can be captured; the pooling layer is used for downsampling to reduce the image size while retaining the most important feature information; the fully connected layer is used to integrate the features extracted by the previous convolutional layer and pooling layer in order to make a final classification decision; the output data of the output layer is the pollution pixel point recognition result.
[0033] Then, use the set of sample beef image and the set of recognition results of sample contaminated pixel points as training data, and divide the training data into a sample training set, a sample validation set, and a sample test set according to a predetermined ratio. For example, the proportion of the sample training set is 70%, the proportion of the sample validation set is 20%, and the proportion of the sample test set is 10%. Further, using the sample beef image as the input and the recognition result of the sample contaminated pixel point as the supervision, use the sample training set, the sample validation set, and the sample test set to perform supervised training, validation training, and testing on the contaminated pixel point recognizer. In the training stage, first send the input image data into the convolutional neural network model, extract features through the convolutional layer and the pooling layer, use the fully connected layer to classify the extracted features, and judge whether each pixel is a contaminated area. Then calculate the loss according to the model output and the actual label, adjust the network weights through backpropagation, and use an optimization algorithm (such as Adam, etc.) to minimize the loss. This process will be iterated multiple times, and the network weights will be updated each time until the performance of the network on the training set reaches a predetermined goal or converges. In the validation stage, evaluate the performance of the model through the validation set, check the generalization ability of the model on unseen data, and the validation set is used to adjust hyperparameters (such as learning rate, convolution kernel size, etc.) to avoid overfitting. First, use the weights learned during training and the validation set data for prediction. Then, compare the output of the model with the true labels in the validation set and calculate the loss of the validation set. Then, according to the results of the validation set, adjust some hyperparameters in the training (for example, learning rate, batch size, etc.). In the testing stage, it is mainly used to evaluate the performance of the model on brand-new, unseen data, and confirm the final generalization ability and accuracy of the model. First, use the trained model to predict the test set. Then, compare the prediction results with the true labels of the test set and calculate evaluation metrics such as the accuracy rate, recall rate, and F1 value of the model. When the test accuracy meets the preset accuracy threshold (such as the output accuracy rate is 95%), the test converges, and the trained contaminated pixel point recognizer is obtained.
[0034] By constructing a contaminated pixel point recognizer based on a convolutional neural network, the intelligent level of contaminated pixel point recognition can be improved. The convolutional neural network can automatically learn the features in the beef image, avoid manual intervention in traditional image processing methods, reduce the situation of misjudgment and missed judgment, and thus improve the recognition efficiency and accuracy, providing reliable technical support for the recognition of mold contamination on the beef surface.
[0035] S130: Input the beef image into the contaminated pixel point recognizer, recognize and output the recognition result of the contaminated pixel point, and obtain multiple implicit pixel points.
[0036] Specifically, the beef image is used as input data and input into the trained contaminated pixel point recognizer. After being processed by multiple convolutional layers and pooling layers, the network will determine whether each pixel point belongs to the contaminated area, and the output contaminated pixel point recognition result will mark the possible contaminated area, where these pixel points usually appear as white or light-colored areas, conforming to the characteristics of mold, and the contaminated pixel point recognition result is output. Among them, the contaminated pixel point recognition result includes multiple implicit pixel points, and these implicit pixel points represent the areas where mold contamination may exist in the image.
[0037] S140: Construct an implicit pixel point distribution according to the multiple implicit pixel points.
[0038] Furthermore, step S140 of the present invention further includes:
[0039] S141: Construct an image coordinate system within the beef image; S142: Mark the coordinates of the multiple implicit pixel points within the image coordinate system to obtain an implicit pixel point distribution.
[0040] Specifically, a two-dimensional coordinate system is established within the beef image. Usually, the upper left corner of the image is used as the coordinate origin (0, 0), the width direction (horizontal axis) of the image is the x-axis, and the height direction (vertical axis) of the image is the y-axis. The coordinate unit is generally a pixel to construct the image coordinate system. Then, within the image coordinate system, mark the coordinates of the multiple implicit pixel points, that is, for each implicit pixel point, record its position in the image coordinate system. For example, record the x coordinate and y coordinate of the pixel. Suppose an implicit contaminated pixel point is located in the 100th column (x = 100) and the 150th row (y = 150) of the image, then the coordinates of this pixel point are (100, 150). By marking the coordinates of all implicit pixel points, an implicit pixel point distribution is formed, and this distribution reflects the areas where contamination may occur.
[0041] By constructing the image coordinate system and marking the coordinates of each implicit pixel point, the spatial distribution of the contaminated area within the beef image is obtained. This coordinate information provides a data basis for subsequent clustering and screening of the contaminated area, thereby ensuring the accuracy and operability of the recognition result.
[0042] S200: Set the adjacent pixel point retrieval specification according to the fat distribution data on the beef surface.
[0043] Furthermore, step S200 of the present invention further includes:
[0044] S210: Obtain the maximum fat distribution width on the surface of the same batch of beef and obtain the minimum contamination diameter of the mold contamination on the beef surface; S220: Calculate the mean value of the maximum fat distribution width and the minimum contamination diameter as the distance for adjacent pixel point retrieval to obtain the adjacent pixel point retrieval specification.
[0045] Specifically, first, obtain the maximum fat distribution width on the surface of beef in the same batch. Among them, the fat distribution usually presents white lines or a grid pattern, and the width of these lines represents the distribution range of fat. By analyzing the image of the beef surface in the same batch, detect and calculate the maximum width of the fat distribution (i.e., the maximum width of the fat lines), which can be measured by an image processing algorithm to find the widest part of the fat lines. For example, the width of the widest fat line is 10 pixels. On the other hand, obtain the minimum contamination diameter of mold contamination on the beef surface. Among them, mold contamination generally presents white circular spots, and the diameter of these spots is usually larger than the line width of the fat texture. By analyzing the mold contamination area in the beef image, calculate the minimum diameter of the mold contamination area, which can be calculated by identifying the contour of the white area. For example, the diameter of the smallest mold contamination spot is 20 pixels.
[0046] Next, calculate the mean value of the maximum fat distribution width and the minimum contamination diameter, and use the mean value calculation result as the distance for adjacent pixel point retrieval. For example, assume that the width of the widest fat line is 10 pixels and the diameter of the smallest mold contamination spot is 20 pixels, then the distance for adjacent pixel point retrieval is 15 pixels. This distance will be used as the range for adjacent pixel point retrieval, which not only ensures that the retrieval range can cover the width of the fat texture but also will not be overly expanded beyond the mold contamination area, thereby improving the recognition accuracy of mold contamination.
[0047] The method provided by the embodiment of the present application is applicable to the monitoring of beef surface contamination with a relatively fine marbling fat distribution. The fat width on the surface of this type of beef is basically smaller than the diameter of the mold contamination spots. In this way, it is ensured that the retrieval range can cover and be greater than the width of the fat texture, and will not be overly expanded beyond the mold contamination area, improving the accuracy of contamination recognition.
[0048] Then, set the retrieval range according to the calculated distance for adjacent pixel point retrieval, that is, the adjacent pixel point retrieval specification. Among them, if there is a misjudgment (for example, the fat texture is misidentified as mold contamination), there will definitely be dark pixel points clustered in the beef muscle area within the retrieval range because the lines of the fat texture often show large variations, while mold contamination is uniform white spots; if there is no misjudgment, almost all the pixel points within the retrieval range will be white pixel points of mold contamination. At this time, the area of mold contamination can be accurately identified. Through this method, the fat texture and mold contamination can be effectively distinguished, avoiding misjudgments in traditional image processing methods and improving the recognition accuracy of mold contamination.
[0049] S300: According to the adjacent pixel retrieval specification, perform adjacent pixel retrieval clustering on multiple implicit pixel points within the implicit pixel point distribution, obtain a clustered implicit pixel point distribution, perform pollution processing and screening, and obtain a pollution recognition result.
[0050] Furthermore, step S300 of the present invention further includes:
[0051] S310: Take the coordinates of multiple implicit pixel points within the implicit pixel point distribution as the center points, and use the adjacent pixel retrieval specification as the radius to set and obtain multiple adjacent pixel retrieval ranges; S320: Retrieve and cluster the pixel points within the multiple adjacent pixel retrieval ranges to obtain multiple clustered implicit pixel points as the clustered implicit pixel point distribution.
[0052] Specifically, take the coordinates of multiple implicit pixel points within the implicit pixel point distribution as the center points, and use the adjacent pixel retrieval specification as the radius. That is, for each implicit pixel point, set a circular retrieval range with this point as the center and the adjacent pixel retrieval specification as the radius. All pixel points located within this circular area will be retrieved from the image. For example, assuming the adjacent pixel retrieval specification is 15 pixels, for the implicit pixel point (100, 150), the retrieval range is a circular area with (100, 150) as the center and a radius of 15 pixels. Then, retrieve and cluster the pixel points within the multiple adjacent pixel retrieval ranges, that is, for the adjacent range of each implicit pixel point, retrieve all pixel points located within this range, obtain multiple clustered implicit pixel points, and construct a clustered implicit pixel point distribution based on the multiple clustered implicit pixel points.
[0053] Furthermore, step S300 of the present invention further includes:
[0054] S330: Perform grayscale processing on the pixel values of all pixel points within the clustered implicit pixel point distribution to obtain a clustered grayscale point distribution; S340: Perform binary classification according to the grayscale values of all pixel points within the clustered grayscale point distribution to obtain a clustered binary point distribution, where pixel points with grayscale values greater than a preset grayscale threshold are classified as 1, and pixel points with grayscale values less than the preset grayscale threshold are classified as 0; S350: Statistically calculate the proportion of 1s in each clustered binary point within the clustered binary point distribution to obtain multiple proportions of 1-class pixel points, and screen the clustered implicit pixel points corresponding to the proportions of 1-class pixel points that are greater than or equal to a preset proportion threshold as the pollution area to obtain a pollution recognition result.
[0055] Specifically, first, grayscale processing is performed on the pixel values of all pixel points within the distribution of the clustered implicit pixel points, that is, the color value of each pixel in the image is converted into a grayscale value. The grayscale value is usually represented as a numerical value between 0 and 255, where 0 represents black and 255 represents white. Through grayscale processing, we can more easily analyze the brightness characteristics in the image to help identify the mold contamination area. Then, according to the grayscale values of all pixel points within the distribution of the clustered grayscale points, binary classification is carried out, that is, pixel points with grayscale values greater than the preset grayscale threshold are classified as 1, and pixel points with grayscale values less than the preset grayscale threshold are classified as 0. Among them, if the grayscale value of a pixel is greater than the preset grayscale threshold (such as 150), then this pixel point is classified as 1, indicating that it may be a mold contamination or fat area; if the grayscale value of a pixel is less than the preset grayscale threshold (such as 150), then this pixel point is classified as 0, indicating that it may be a dark area of beef muscle; thus, the distribution of clustered binary points is obtained.
[0056] Then, count the proportion of 1s in each clustered binary point within the distribution of the clustered binary points, that is, calculate the proportion of pixel points with grayscale values greater than 150 (i.e., classified as 1) in each clustered area to the total number of pixel points in that clustered area. For example, assume that there are 100 pixel points in a certain clustered area, and 98 of them have grayscale values greater than 150 (i.e., belong to the mold contamination or fat area), then the proportion of class 1 pixel points in this clustered area is 98%, and multiple proportions of class 1 pixel points are obtained.
[0057] Among them, if an error occurs, the retrieved clustered implicit pixels may include some pixels in the dark areas of the meat (i.e., the areas where the pixel classification is 0), and these areas should not belong to the mold contamination area; if there is no error, it means that all the pixels within the retrieval range of adjacent pixels are areas contaminated by mold, which usually appear as white or light-colored areas; in practical applications, the image acquisition and processing process may be affected by various factors, such as image noise, uneven illumination, uneven object surface, etc. These factors may cause the mold to be similar to the fat texture or other interference areas, thus causing errors. Therefore, by setting a proportion threshold and only selecting the class 1 pixels with a proportion exceeding a certain ratio as the contamination area, some misjudgments can be effectively avoided; obtain the preset proportion threshold (which can be set according to experience or historical data analysis, such as 95%), and then screen the clustered implicit pixels corresponding to the proportion of class 1 pixels greater than or equal to the preset proportion threshold as the contamination area. That is, when the proportion of class 1 pixels in a certain clustered area exceeds 95% of the total pixels, it indicates that most of the pixels in this clustered area are white or light-colored pixels, and it is very likely to be a mold contamination area. Only this clustered area will be considered as an effective mold contamination area, and multiple contamination areas are obtained as the contamination recognition result. If the proportion of class 1 pixels in a certain clustered area does not exceed the preset proportion threshold, it means that there are many dark pixels in this clustered area, such as the pixels formed by beef muscle, which indicates that this clustered area is very likely to be an area where beef fat and muscle are distributed and is not a mold contamination area.
[0058] By screening the clustered implicit pixels corresponding to the class 1 pixels greater than the preset proportion threshold, and based on the distribution characteristics of mold contamination pixels and beef fat pixels, an effective and high-precision discrimination of the contamination area can be carried out, which can effectively reduce the misjudgment caused by the similarity between mold and fat texture and accurately identify the mold contamination area on the beef surface.
[0059] The beef surface contamination recognition method based on machine vision provided by the embodiments of the present invention has at least the following technical effects:
[0060] By using machine learning to identify hidden contaminated pixel points in beef images, the distribution of hidden pixel points is obtained; then, according to the fat distribution data on the beef surface, the retrieval specifications for neighboring pixel points are set; then, according to the retrieval specifications for neighboring pixel points, neighboring pixel point retrieval clustering is performed on multiple hidden pixel points within the distribution of hidden pixel points to obtain a clustered distribution of hidden pixel points; finally, pollution treatment screening is performed based on the clustered distribution of hidden pixel points to obtain a pollution recognition result; that is to say, by setting a dynamic retrieval range for neighboring pixel points according to mold contamination and fat texture characteristics for pollution feature screening, the mold and fat texture on the beef surface can be accurately distinguished, effectively reducing misjudgment caused by the similarity between mold and fat texture, and significantly improving the accuracy, accuracy, and reliability of mold contamination recognition on the beef surface.
[0061] Embodiment 2, as Figure 2 shown, based on the same inventive concept as the method for identifying beef surface contamination based on machine vision provided in Embodiment 1, the embodiment of the present invention also provides a system for identifying beef surface contamination based on machine vision, including: a hidden contaminated pixel point identification module 10, configured to collect a beef image of the surface of a target beef, and use machine learning to identify hidden contaminated pixel points in the beef image to obtain a distribution of hidden pixel points; a neighboring pixel point retrieval specification setting module 20, configured to set a neighboring pixel point retrieval specification according to the fat distribution data on the beef surface; a neighboring pixel point retrieval clustering module 30, configured to perform neighboring pixel point retrieval clustering on multiple hidden pixel points within the distribution of hidden pixel points according to the neighboring pixel point retrieval specification to obtain a clustered distribution of hidden pixel points, and perform pollution treatment screening to obtain a pollution recognition result.
[0062] Further, the system for identifying beef surface contamination based on machine vision is further configured to: collect a beef image of the surface of a target beef, where the target beef is beef to be identified for surface contamination; use machine learning to pre-train a contaminated pixel point identifier; input the beef image into the contaminated pixel point identifier, identify and output a contaminated pixel point recognition result to obtain multiple hidden pixel points; and construct a distribution of hidden pixel points according to the multiple hidden pixel points.
[0063] Further, the system for identifying beef surface contamination based on machine vision is further configured to: collect a set of sample beef images according to the historical recognition data of mold contamination on the beef surface; label the mold contaminated pixel points on the surface of each sample beef image to obtain a set of sample contaminated pixel point recognition results; construct a contaminated pixel point identifier including an input layer, a convolutional layer, a pooling layer, a fully connected layer, and an output layer based on a convolutional neural network; and use the set of sample beef images and the set of sample contaminated pixel point recognition results to train the contaminated pixel point identifier until the test converges.
[0064] Further, the machine vision-based beef surface contamination recognition system is also used for: constructing an image coordinate system within the beef image; within the image coordinate system, marking the coordinates of the multiple implicit pixel points to obtain the implicit pixel point distribution.
[0065] Further, the machine vision-based beef surface contamination recognition system is also used for: obtaining the maximum fat distribution width on the surface of the same batch of beef, and obtaining the minimum contamination diameter of mold contamination on the beef surface; calculating the mean value of the maximum fat distribution width and the minimum contamination diameter as the distance for adjacent pixel point retrieval to obtain the adjacent pixel point retrieval specification.
[0066] Further, the machine vision-based beef surface contamination recognition system is also used for: using the coordinates of multiple implicit pixel points within the implicit pixel point distribution as the center points, and using the adjacent pixel point retrieval specification as the radius to set and obtain multiple adjacent pixel point retrieval ranges; retrieving and clustering the pixel points within the multiple adjacent pixel point retrieval ranges to obtain multiple clustered implicit pixel points as the clustered implicit pixel point distribution.
[0067] Further, the machine vision-based beef surface contamination recognition system is also used for: performing grayscale processing on the pixel values of all pixel points within the clustered implicit pixel point distribution to obtain the clustered grayscale point distribution; performing binary classification based on the grayscale values of all pixel points within the clustered grayscale point distribution to obtain the clustered binary point distribution, where pixel points with grayscale values greater than the preset grayscale threshold are classified as 1, and pixel points with grayscale values less than the preset grayscale threshold are classified as 0; counting the proportion of 1s in each clustered binary point within the clustered binary point distribution to obtain multiple proportions of 1-type pixel points, and screening the clustered implicit pixel points corresponding to the proportion of 1-type pixel points greater than or equal to the preset proportion threshold as the contaminated area to obtain the contamination recognition result.
[0068] Although the preferred embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications once they learn the basic creative concept.
[0069] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the present invention and its equivalent technologies, the present invention also intends to include these modifications and variations.
Claims
1. A method for identifying beef surface contamination based on machine vision, characterized in that: Methods include: Collecting a beef image on the surface of target beef, using machine learning to identify implicit contaminated pixels in the beef image, and obtaining a distribution of implicit pixels; According to the fat distribution data on the beef surface, the neighboring pixel point retrieval specifications are set; According to the neighboring pixel point retrieval specification, neighboring pixel point retrieval clustering is performed on multiple hidden pixel points in the hidden pixel point distribution to obtain clustered hidden pixel point distribution, and pollution processing screening is performed to obtain pollution identification results.
2. The method for identifying beef surface contamination based on machine vision according to claim 1, characterized in that: Collecting a beef image on the surface of target beef, identifying implicitly contaminated pixels in the beef image, and obtaining implicit pixel distribution, including: Collecting a beef image on the surface of target beef, wherein the target beef is beef to be identified for surface contamination; Use machine learning to pre-train the contaminated pixel identifier; Inputting the beef image into the contaminated pixel identifier, identifying and outputting contaminated pixel identification results, and obtaining a plurality of hidden pixels; According to the multiple hidden pixels, a hidden pixel distribution is constructed.
3. The method for identifying beef surface contamination based on machine vision according to claim 2, characterized in that: Use machine learning to pre-train the contaminated pixel identifier, including: Based on the historical identification data of mold contamination on the surface of beef, a collection of sample beef images is collected; Marking the mold contaminated pixels on the surface of each sample beef image to obtain a sample contaminated pixel recognition result set; Based on the convolutional neural network, a polluted pixel identifier is constructed, which includes an input layer, a convolution layer, a pooling layer, a fully connected layer, and an output layer. The polluted pixel identifier is trained using the sample beef image set and the sample polluted pixel recognition result set until the test converges.
4. The method for identifying beef surface contamination based on machine vision according to claim 2, characterized in that: Constructing a distribution of hidden pixels according to the plurality of hidden pixels, including: constructing an image coordinate system within the beef image; In the image coordinate system, the coordinates of the plurality of hidden pixel points are marked to obtain a distribution of hidden pixel points.
5. The method for identifying beef surface contamination based on machine vision according to claim 1, characterized in that: According to the fat distribution data on the beef surface, the neighboring pixel point retrieval specifications are set, including: Obtain the maximum fat distribution width on the surface of the same batch of beef, and obtain the minimum contamination diameter of mold contamination on the surface of beef; The average of the maximum fat distribution width and the minimum pollution diameter is calculated as the distance for neighboring pixel point retrieval to obtain the neighboring pixel point retrieval specification.
6. The method for identifying beef surface contamination based on machine vision according to claim 1, characterized in that: According to the neighboring pixel point retrieval specification, performing neighboring pixel point retrieval clustering on multiple hidden pixel points in the hidden pixel point distribution to obtain a clustered hidden pixel point distribution, including: Taking the coordinates of the multiple hidden pixel points in the hidden pixel point distribution as the center point and the neighboring pixel point search specification as the radius, setting and obtaining multiple neighboring pixel point search ranges; Pixel points within the retrieval range of the plurality of adjacent pixel points are retrieved and clustered to obtain a plurality of cluster hidden pixel points as the cluster hidden pixel point distribution.
7. The method for identifying beef surface contamination based on machine vision according to claim 6, characterized in that: Conduct pollution treatment screening and obtain pollution identification results, including: Grayscale processing is performed on the pixel values of all the pixels in the cluster implicit pixel point distribution to obtain a cluster grayscale point distribution; According to the grayscale values of all pixels in the clustered grayscale point distribution, binary classification is performed to obtain a clustered binary point distribution, wherein pixels with grayscale values greater than a preset grayscale threshold are classified as 1, and pixels with grayscale values less than the preset grayscale threshold are classified as 0; The proportion of 1 in each cluster binary point in the cluster binary point distribution is counted to obtain multiple 1-type pixel proportions, and cluster implicit pixel points corresponding to the 1-type pixel proportion greater than or equal to a preset proportion threshold are screened as pollution areas to obtain pollution identification results.
8. The beef surface contamination identification system based on machine vision is characterized by: The steps for implementing the method for identifying beef surface contamination based on machine vision according to any one of claims 1 to 7 include: A hidden contaminated pixel point recognition module is used to collect a beef image of the target beef surface, and use machine learning to identify hidden contaminated pixels in the beef image to obtain hidden pixel point distribution; A neighboring pixel point retrieval specification setting module is used to set neighboring pixel point retrieval specifications according to fat distribution data on the beef surface; The neighboring pixel point retrieval clustering module is used to perform neighboring pixel point retrieval clustering on multiple hidden pixels in the hidden pixel point distribution according to the neighboring pixel point retrieval specification, obtain clustered hidden pixel point distribution, perform pollution processing screening, and obtain pollution identification results.
Citation Information
Patent Citations
Steel rail surface defect image adaptive segmentation method
CN106251361A
Fiberboard quality evaluation method based on image processing
CN114419025A
Crushing and stirring machine food material detection method and system based on image features
CN118968504A
Tray assembly and tray for battery hving the same
KR102247190B1
Method for determining meat maturity and device using the same
KR102551173B1