A method for analyzing the color change of Lentinula edodes spawn bags based on image recognition technology

Through image recognition technology based on deep neural networks, automatic color conversion analysis of shiitake mushroom bags is realized, solving the problems of large errors and low efficiency caused by manual observation, and providing efficient and accurate growth status monitoring.

CN117274404BActive Publication Date: 2025-07-04SHANGHAI ACAD OF AGRI SCI +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311231490.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-22
Publication Date
2025-07-04
Estimated Expiration
2043-09-22

AI Technical Summary

Technical Problem

In the prior art, the judgment of the growth status of shiitake mushrooms mainly relies on manual observation, and there are problems such as large subjective errors, low efficiency, and difficulty in real-time monitoring.

Method used

The yolov5 algorithm based on deep neural network is used to segment the image of bacteria bag area, combined with image preprocessing and HSV color space analysis, and established a chromatic area standard for bacteria bag conversion to realize automated and real-time color conversion analysis.

Benefits of technology

It improves the accuracy and efficiency of judging the growth status of mushrooms, reduces artificial errors, realizes real-time monitoring and repeatability verification, and provides scientific data support.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117274404B_ABST
    Figure CN117274404B_ABST
Patent Text Reader

Abstract

The present invention provides a method for analyzing the color change of shiitake mushroom spawn bags based on image recognition technology. The method includes the following steps: (1) Obtain the images of shiitake mushroom spawn bags; (2) Use the yolov5 algorithm based on a deep neural network to achieve image segmentation of the spawn bag area; (3) Image preprocessing: After obtaining the image of the spawn bag area, gamma automatic correction needs to be performed on the image to adjust the overall brightness of the image and minimize the influence of light on the recognition accuracy; (4) Color change analysis of the spawn bag: After obtaining the image of the spawn bag area in step (3), color change analysis is performed on the spawn bag to obtain the color change area, color change area, and average color of the color change to evaluate the growth state of shiitake mushrooms; (5) Establish a standard for the color change area of the spawn bag. According to the method for analyzing the color change of shiitake mushroom spawn bags based on image recognition technology provided by the present invention, real-time color change analysis can be performed on each spawn bag, and a color change standard for shiitake mushroom spawn bags can be established. It can be used to guide the regulation of the production environment of shiitake mushrooms.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of edible mushroom cultivation, and specifically to a method for analyzing the color change of Lentinula edodes mushroom bags based on image recognition technology. Background Art

[0002] With the continuous improvement of people's requirements for food safety and quality, the production and quality control of Lentinula edodes have received increasing attention. At present, the bag cultivation technology is often used in the production process of Lentinula edodes. However, how to accurately and quickly judge the growth state of Lentinula edodes is crucial for improving production efficiency and ensuring the quality of Lentinula edodes.

[0003] Currently, in the cultivation of Lentinula edodes, the growth state of Lentinula edodes is mainly judged by manually observing the color change of the mushroom bags. Although this method is simple and easy to implement, it has many defects. For example, manual observation is easily affected by subjective factors, resulting in inaccurate judgment results; manual observation requires a large amount of time and labor input, which is not conducive to improving production efficiency; for large-scale production, it is difficult to achieve real-time monitoring by manual observation.

[0004] Therefore, a new method for analyzing the color change of mushroom bags is needed to achieve real-time and accurate monitoring of the growth state of Lentinula edodes. Summary of the Invention

[0005] The present invention provides a method for analyzing the color change of Lentinula edodes mushroom bags based on image recognition technology, and the method includes the following steps:

[0006] (1) Obtain the images of Lentinula edodes mushroom bags: Use a camera to take pictures of the front and back of the Lentinula edodes mushroom bags every day and save them as digital images;

[0007] (2) Implement image segmentation of the mushroom bag area by using the yolov5 algorithm based on a deep neural network. The specific steps are as follows:

[0008] a. Prepare the dataset: A batch of labeled mushroom bag images need to be prepared as the training dataset, and they are divided into a training set, a validation set, and a test set;

[0009] b. Model training: Use the yolov5 network structure for training, and continuously adjust the network parameters to enable it to accurately segment the area of the mushroom bag; during the training process, use the cross-entropy loss function and the stochastic gradient descent algorithm for optimization;

[0010] c. Mushroom bag area segmentation: When segmenting a new mushroom bag image, first use the yolov5 model to predict the image to obtain the coordinates and confidence of the mushroom bag area; then, filter out the prediction boxes with high confidence according to the confidence, and extract the image of the mushroom bag area according to the coordinate information;

[0011] (3) Image preprocessing: After obtaining the image of the mushroom bag area, it is necessary to perform gamma automatic correction on the image to adjust the overall brightness of the image and minimize the influence of light on the recognition accuracy. The specific steps are as follows:

[0012] a. Convert the image from the RGB color gamut to grayscale.

[0013] b. Calculate the mean of the grayscale of the image, mean = 1 / N·sum

[0014] where N is the number of pixels and sum is the sum of the pixel values of the grayscale image.

[0015] c. Calculate the gamma value: gamma = log10(0.5) / log10(mean / 255)

[0016] where 0.5 is the average gamma value of the target image and mean is the pixel mean of the grayscale image.

[0017] d. Establish a gamma mapping table: gamma_table = 255*(x / 255)^gamma, where x ranges from 0 to 255

[0018] where x is each pixel value in the RGB channels of the original image.

[0019] e. Perform look-up table replacement to replace the pixel points of the original image with the corresponding values in the gamma mapping table.

[0020] (4) Mushroom bag color change analysis: After obtaining the image of the mushroom bag area in step (3), perform color change analysis on the mushroom bag to obtain the color change area, color change area, and average color of the color change to evaluate the growth state of the shiitake mushroom. The specific steps are as follows:

[0021] a. Convert RGB to HSV: Convert the mushroom bag image from the RGB color space to the HSV color space for subsequent processing.

[0022] b. Set the HSV threshold: According to the color contrast between the color change area and the non-color change area, set an appropriate HSV threshold to extract the color change area.

[0023] c. Calculate the area of the color change area: For the extracted color change area, its area can be calculated to obtain the total color change area.

[0024] d. Calculate the average grayscale value and average HSV value of the color change area: By calculating the average grayscale value and average HSV value of the color change area, the average color of the color change area can be obtained.

[0025] e. Calculate the area of the color change area: For the extracted color change area, its area can be calculated to obtain the total color change area.

[0026] f. Calculate the average grayscale value and average HSV value of the color change area: By calculating the average grayscale value and average HSV value of the color change area, the average color of the color change area can be obtained.

[0027] (5) Establish the standard for the color conversion area of the mushroom bags: According to step (4), the quantitative index of the color conversion area of each mushroom bag in each growth period can be obtained, and the standard curve of the color conversion area of the mushroom bags is established.

[0028] Among them, to obtain the image of the Lentinula edodes mushroom bags: First, it is necessary to take the image of the mushroom bags using devices such as digital cameras or mobile phones under sufficient light, and transfer the image to a computer for processing.

[0029] Image segmentation of the mushroom bag area: There may be non-mushroom bag areas in the mushroom bag image, so it is necessary to extract the mushroom bag area for analysis. The mushroom bag target detection model trained by a deep neural network can effectively extract the mushroom bags from the image.

[0030] Image preprocessing: Since there may be problems such as noise, shadows, and color deviation in the image, some preprocessing operations are required, such as denoising, smoothing, white balance, etc. Among them, white balance can eliminate the influence of the light source color on the image color, making the overall image present a natural color balance.

[0031] Color conversion analysis of the mushroom bags: For the mushroom bag area, first, it needs to be converted to the HSV color space, and then the color features of this area are calculated, such as average gray scale, average hue, saturation, brightness, etc. Different color features can be selected for analysis according to different needs. For example, the growth state of the fungus can be judged according to the average hue, because the color of the fungus will change with different growth states.

[0032] Result display: Finally, the analysis results need to be displayed. The analysis results can be presented in the form of charts, reports, etc., and statistical analysis is carried out to facilitate users' judgment and decision-making.

[0033] Generally speaking, for the Lentinula edodes mushroom bag color conversion analysis method based on image recognition technology provided by the present invention, image preprocessing can eliminate problems such as noise and color deviation in the image, region extraction can select the region of interest for analysis, color analysis can calculate the color features of the region, and result display can display the analysis results in an intuitive way to facilitate users' judgment and decision-making. The whole process requires the comprehensive application of knowledge and technologies in multiple fields such as image processing, computer vision, and data analysis.

[0034] According to the above Lentinula edodes mushroom bag color conversion analysis method based on image recognition technology provided by the present invention, real-time color conversion analysis of each mushroom bag can be realized: According to the established Lentinula edodes mushroom bag color conversion standard, compare the color conversion area and growth period of each mushroom bag to judge whether the color conversion area meets the standard. And it is used to guide the regulation of the Lentinula edodes production environment.

[0035] A method for analyzing the color transformation of Lentinula edodes mushroom bags based on image recognition technology proposed by the present invention aims to photograph Lentinula edodes mushroom bags at different growth stages through devices such as cameras. Through steps such as preprocessing, segmentation, and feature extraction, it quantitatively analyzes the color transformation of Lentinula edodes mushroom bags at different stages, and establishes corresponding color transformation standards for adjusting the parameters in the Lentinula edodes cultivation process, so as to improve the accuracy, stability, and repeatability of Lentinula edodes cultivation. Compared with traditional manual observation and empirical judgment, this method uses image recognition technology for automated analysis, with higher efficiency and accuracy.

[0036] The method for analyzing the color transformation of Lentinula edodes mushroom bags based on image recognition technology provided by the present invention has the following innovative points:

[0037] Automated analysis: Compared with traditional manual observation and empirical judgment, this method uses a deep neural network model to automatically segment the mushroom bag image, reducing the need for manual operation. According to actual operations, this automated analysis can shorten the analysis time to a few seconds, greatly improving the efficiency compared to the several minutes or longer time of manual operation.

[0038] High accuracy and stability: By using image recognition technology for color transformation area analysis, the influence of human error is reduced. In actual operations, the accuracy rate of this method can reach more than 90%, accurately extracting the color transformation area.

[0039] Repeatability verification: Since this method is based on image recognition technology for automated analysis and is not affected by human subjective factors, it can evaluate the consistency and repeatability of the color transformation of mushroom bags in different batches and by different operators. Through actual operation verification, the results of this method have small differences among different operators and have good repeatability.

[0040] Data statistics and analysis: This method can perform data statistics and analysis on the color transformation of mushroom bags. By collecting a large amount of sample data, a curve of the color transformation rate changing with time can be drawn to help users better understand the growth law and development trend of Lentinula edodes. At the same time, by analyzing indicators such as the area, average gray value, and average HSV value of the color transformation area, detailed information on the growth state of the mushroom bags can be mastered.

[0041] In summary, the method for analyzing the color transformation of Lentinula edodes mushroom bags based on image recognition technology can improve the management level and yield stability of Lentinula edodes cultivation and provide a scientific basis for decision-making through the advantages and beneficial effects of automated analysis, high accuracy and stability, reliable color transformation analysis, repeatability verification, and data statistics and analysis. Actual operations and data verification show that this method has significant advantages in improving accuracy, stability, and efficiency. Brief Description of the Drawings

[0042] Figure 1Use the annotation tool to annotate the collected pictures for the mycelium bag area

[0043] Figure 2 The effect after data generalization is that 1 picture can be generalized into 6 pictures

[0044] Figure 3 Visualization of the changes in precision and recall during the training process of YOLOV5s

[0045] Figure 4 It is a comparison chart for the extraction results of the mycelium bag area. Figure a is the original picture of the mycelium bag, and the gray area in Figure b is the mycelium bag area extracted by the algorithm

[0046] Figure 5 The calculated gamma mapping table

[0047] Figure 6 Comparison charts before and after gamma mapping processing

[0048] Figure 7 Based on the picture of the identified mycelium bag area, color conversion analysis is carried out, and the non-color conversion area map and color conversion area map are obtained

[0049] Figure 8 They are respectively the results after binarization processing of the non-color conversion area and the color conversion area

[0050] Figure 9 Standard curve for the analysis of the percentage of color conversion area in the entire cultivation cycle of Lentinula edodes Huxiang F2 established in Example 1 Specific implementation mode

[0051] The following examples are only illustrative of the present invention and do not limit the present invention

[0052] Lentinula edodes strain: Huxiang F2 (from the Institute of Edible Fungi, Shanghai Academy of Agricultural Sciences)

[0053] The environmental parameters for the cultivation of Huxiang F2 are: 25 degrees Celsius, 70% humidity, 2000 ppm carbon dioxide, and the entire growth period is 85 days

[0054] Mycelium bag formula: 79% sawdust, 20% wheat bran, 1% gypsum (by weight percentage); add water to prepare a culture material with a water content of 65%. The mycelium bag size is 18*35 cm, and the filling amount per bag is 1200 g

[0055] Model training:

[0056] a. Use the Hikvision industrial camera MV-CA013-20GC for image capture

[0057] b. Use labelimg for data annotation, such as Figure 1 。

[0058] c. To improve the data generalization ability, data augmentation is performed through the following means: size translation, random rotation, blurring, brightness and darkness changes, and adding noise. For example, Figure 2 , which is the effect after data generalization. One picture can be generalized into six pictures.

[0059] d. Based on the deep learning framework of Pytorch, the YOLOV5s algorithm is used for model training. The accuracy and recall rate should be ensured simultaneously. Figure 3 This is the visualization of the changes in accuracy and recall rate during the training of YOLOV5s.

[0060] Example 1

[0061] (1) Collect 10 groups of photos of normal-growing (60th day) mushroom bags. Under sufficient light, use the Hikvision industrial camera MV-CA013-20GC to take pictures of the front and back of the shiitake mushroom bags and save them as digital images. To ensure data accuracy, try to avoid reflection.

[0062] (2) The yolov5 algorithm based on the deep neural network is used to implement the image segmentation of the mushroom bag area. The specific steps are as follows:

[0063] a. Prepare the dataset: A batch of labeled mushroom bag images ( Figure 4 ) are needed as the training dataset, and it is divided into a training set, a validation set, and a test set;

[0064] b. Model training: Use the yolov5 network structure for training. By continuously adjusting the network parameters, it can accurately segment the area of the mushroom bag; during the training process, the cross-entropy loss function and the stochastic gradient descent algorithm are used for optimization;

[0065] c. Mushroom bag area segmentation: When segmenting a new mushroom bag image, first use the yolov5 model to predict the image to obtain the coordinates and confidence levels of the mushroom bag area; then, filter out the prediction boxes with high confidence levels according to the confidence levels, and extract the image of the mushroom bag area according to the coordinate information; for example, Figure 4 This is the extracted mushroom bag area

[0066] (3) Image preprocessing: After obtaining the mushroom bag area image, it is necessary to perform gamma automatic correction on the image to

[0067] adjust the overall brightness of the image and minimize the impact of light on the recognition accuracy; the specific steps are as follows:

[0068] a. Convert the image from the RGB color gamut to grayscale

[0069] The conversion can be performed using the cvtColor method of opencv

[0070] b. Calculate the mean of the grayscale of the image, mean = 1 / N·sum

[0071] where N is the number of pixels and sum is the total pixel value of the grayscale image;

[0072] It can be directly obtained using the mean method of numpy, and the obtained Figure 4 mean = 130.3

[0073] c. Calculate the gamma value: gamma = log10(0.5) / log10(mean / 255)

[0074] where 0.5 is the average gamma value of the target image and mean is the pixel mean of the grayscale image;

[0075] The obtained Gamma value is 1.03

[0076] d. Establish a gamma mapping table: gamma_table = 255*(x / 255)^gamma, x ranges from 0 to 255

[0077] where x is each pixel value in the RGB channels of the original image;

[0078] The gamma value in the above steps is 1.03, and the gamma mapping table can be obtained, such as Figure 5

[0079] e. Perform look-up table replacement, replace the pixel points of the original image with the corresponding values in the gamma mapping table, and the comparison diagram of the effect after replacement is as Figure 6 .

[0080] (4). Analysis of the color conversion of the mushroom bag: After obtaining the image of the mushroom bag area in step (3), perform color conversion analysis on the mushroom bag to obtain the color conversion area, color conversion area, and average color of the color conversion to evaluate the growth state of the shiitake mushroom; the specific steps are as follows:

[0081] a. Convert RGB to HSV: Convert the mushroom bag image from the RGB color space to the HSV color space for subsequent processing;

[0082] It can be converted using the cvtColor method of opencv

[0083] b. Set the HSV threshold: According to the color comparison between the color conversion area and the non-color conversion area, set an appropriate HSV threshold to extract the color conversion area;

[0084] First, use the split method of opencv to split the original image into three channels: h, s, and v,

[0085] Then use the threshold method of OpenCV to extract the color conversion area, where the threshold of h is set to 60 and the threshold of s is set to 30.

[0086] Then perform an AND operation on the binary image of h and the binary image of s to obtain the overall color conversion area mask image. Here, the bitwise_and method of OpenCV can be used for processing. The overall color conversion area mask image is as Figure 7 shown.

[0087] c. Calculate the area of the color conversion area: For the extracted color conversion area Figure 8 , its area can be calculated to obtain the total color conversion area;

[0088] Use countNonZero to count the areas of the color conversion area and the non-color conversion area.

[0089] In this experiment, it can be obtained that the number of pixel points in the color conversion area is: 66016

[0090] The number of pixel points in the non-color conversion area is: 112408

[0091] d. Calculate the average gray value and the average value of HSV of the color conversion area: By calculating the average gray value and the average value of HSV of the color conversion area, the average color of the color conversion area can be obtained;

[0092] Using the mask image of the color conversion area, the mean in OpenCV can be used to calculate the average gray value of the color conversion area.

[0093] Average gray value of color conversion: 113.

[0094] The results show that: the percentage of color conversion area: 37%; the average gray value of color conversion: 113.

[0095] Referring to the above steps, during the entire growth cycle of Lentinula edodes Huxiang F2, collect the color conversion areas calculated every day completely, and the percentage of color conversion area at different times can be statistically analyzed, and the standard of the color conversion area of Lentinula edodes can be established, Figure 9 which is the standard of the color conversion area of the Lentinula edodes bag established in this embodiment, and it represents the percentage of the color conversion area corresponding to different growth periods of the Lentinula edodes bag.

[0096] When it is monitored that the percentage of its color conversion area deviates from the standard curve by more than 5%, artificial intervention is required for the production environment conditions of Lentinula edodes.

Claims

1. A method for analyzing the color change of Lentinula edodes strain bags based on image recognition technology, characterized in that The method includes the following steps: (1) Obtain the images of shiitake mushroom bags: Use a camera to take pictures of the front and back of shiitake mushroom bags every day and save them as digital images; (2) Implement image segmentation of the mushroom bag area using the yolov5 algorithm based on a deep neural network. The specific steps are as follows: a. Prepare the dataset: A batch of labeled mushroom bag images need to be prepared as the training dataset and divided into a training set, a validation set, and a test set; b. Model training: Use the yolov5 network structure for training. By continuously adjusting the network parameters, it can accurately segment the area of the mushroom bag; During the training process, use the cross-entropy loss function and the stochastic gradient descent algorithm for optimization; c. Mushroom bag area segmentation: When segmenting a new mushroom bag image, first use the yolov5 model to predict the image to obtain the coordinates and confidence levels of the mushroom bag area; Then, filter out the prediction boxes with high confidence levels according to the confidence levels and extract the images of the mushroom bag area according to the coordinate information; (3) Image preprocessing: After obtaining the mushroom bag area image, it is necessary to perform gamma automatic correction on the image to adjust the overall brightness of the image and minimize the impact of light on the recognition accuracy. The specific steps are as follows: a. Convert the image from the RGB color gamut to grayscale b. Calculate the mean of the image grayscale, mean = 1 / N·sum where N is the number of pixels and sum is the total pixel value of the grayscale image; c. Calculate the gamma value: gamma = log10(0.5) / log10(mean / 255) where 0.5 is the average gamma value of the target image and mean is the pixel mean of the grayscale image; d. Establish a gamma mapping table: gamma_table = 255*(x / 255)^gamma, x ranges from 0 to 255 where x is each pixel value in the RGB channels of the original image; e. Perform look-up table replacement and replace the pixel points of the original image with the corresponding values in the gamma mapping table; (4) Mushroom bag color conversion analysis: After obtaining the image of the mushroom bag area in step (3), perform color conversion analysis on the mushroom bag to obtain the color conversion area, color conversion area, and average color of the color conversion to evaluate the growth state of shiitake mushrooms. The specific steps are as follows: a. Convert RGB to HSV: Convert the mushroom bag image from the RGB color space to the HSV color space for subsequent processing; b. Set the HSV threshold: According to the color contrast between the color conversion area and the non-color conversion area, set an appropriate HSV threshold to extract the color conversion area; c. Calculate the area of the color conversion area: For the extracted color conversion area, its area can be calculated to obtain the total color conversion area; d. Calculate the average grayscale value and the average HSV value of the color conversion area: By calculating the average grayscale value and the average HSV value of the color conversion area, the average color of the color conversion area can be obtained; (5) Establish a standard for the color conversion area of the mushroom bag: According to step (4), the quantization index of the color conversion area of each mushroom bag in each growth period can be obtained, and a standard curve for the color conversion area of the mushroom bag is established.

Citation Information

Patent Citations

  • Intelligent steel slag detection method and system based on convolutional neural network

    CN110796046A

  • Edible mushroom environment detection method based on smart agriculture

    CN115601690A