A classification method and device based on phenotypic parameters of King Oyster Mushroom
By using semantic segmentation and shape classification models combined with the K-means clustering algorithm, the accuracy and speed problems of phenotypic parameter detection in King Oyster Mushroom breeding were solved, and efficient and accurate classification of King Oyster Mushroom was achieved.
Patent Information
- Application Number
- CN202410584403.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-11
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2044-05-11
AI Technical Summary
In the existing technology of King Oyster Mushroom breeding, the detection of phenotypic parameters has the problems of low accuracy and slow speed, especially the inaccurate identification of the cap, gills, stipe and other parts of the King Oyster Mushroom, resulting in large measurement errors.
The semantic segmentation model based on the improved U-net network structure of VGG16 and the AlexNet model were used to segment and classify the King Oyster Mushroom images. The K-means clustering algorithm and color threshold algorithm were combined, and the phenotypic parameters of King Oyster Mushroom were obtained through a multi-view imaging device and a weight sensor.
The accuracy and speed of detecting phenotypic parameters of King Oyster Mushroom were improved, measurement errors were reduced, and more efficient classification and grading were achieved.
Smart Images

Figure CN118522005B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of edible fungus breeding, and in particular relates to a classification method and device based on phenotypic parameters of Pleurotus eryngii. Background Art
[0002] King oyster mushrooms, also known as Pleurotus eryngii, Pleurotus eryngii, snow mushroom, and chicken leg mushroom, belong to the genus Pleurotus of the family Pleurotus. They are a fruiting plant that grows singly or in clusters. Rich in protein, they are a staple vegetable on Chinese tables and are a favorite. Some factories also process them into ready-to-eat products. In the breeding process, manual phenotyping is often used to assess the quality of cultivated king oyster mushrooms. However, manual sorting often results in significant measurement errors, and the data measured by different workers can also be inconsistent. To address this issue, using machine vision to measure the length of king oyster mushrooms can establish standardized size standards and reduce measurement errors.
[0003] During the King Oyster Mushroom breeding process, it is necessary to accurately detect the phenotype of the King Oyster Mushroom. Existing detection methods mostly use color thresholds to distinguish between the cap, gills, and stipe; or adopt manual measurement and sorting methods. Chinese invention patent application with publication number CN114419002A discloses a King Oyster Mushroom quality detection system and method based on image analysis. The method includes the following steps: collecting an image of the cap of the King Oyster Mushroom to be analyzed, obtaining the damage degree of the cap of the King Oyster Mushroom to be analyzed, and if the damage degree of the cap of the King Oyster Mushroom to be analyzed is greater than the damage threshold, then outputting information that the quality inspection of the King Oyster Mushroom to be analyzed is unqualified; if the damage degree of the cap of the King Oyster Mushroom to be analyzed is less than or equal to the damage threshold, then the King Oyster Mushroom to be analyzed is a preferred King Oyster Mushroom, collecting an image of the stipe of the preferred King Oyster Mushroom, and outputting quality inspection result information of the preferred King Oyster Mushroom based on the stipe image.
[0004] This scheme does not take into account the phenotypic parameters of various parts of King Oyster Mushroom. Insufficient phenotypic data leads to low accuracy. In addition, the scheme is computationally complex, resulting in a low grading speed. Summary of the Invention
[0005] The present invention provides a classification method and device based on King Oyster Mushroom phenotypic parameters, aiming to solve the problem of insufficient speed and accuracy when classifying King Oyster Mushroom phenotypic parameters.
[0006] To solve the above technical problems, the classification method proposed in the present invention includes the following steps:
[0007] S1: Collect phenotypic images of King Oyster Mushroom, annotate the phenotypic images with semantic information of the cap, gills, and stipe, and annotate the shapes of the King Oyster Mushroom fruiting bodies in the phenotypic images to obtain a King Oyster Mushroom dataset;
[0008] S2: The King Oyster Mushroom dataset is input into the semantic segmentation model and the shape classification model for training respectively. The semantic segmentation model is a U-net network structure improved based on VGG16, and the shape classification model is an AlexNet model. The model training is performed using a five-fold cross-validation method.
[0009] S3: Use the trained semantic segmentation model to segment the King Oyster Mushroom image to form a semantic mask, and use the trained shape classification model to classify the shape of the King Oyster Mushroom fruiting body;
[0010] S4: Use the color threshold algorithm to obtain different semantic parts of the King Oyster Mushroom, use the minimum circumscribed rectangle method to obtain the bounding boxes of different parts of the King Oyster Mushroom, and calculate the length and width information of different parts of the King Oyster Mushroom;
[0011] S5: Select images with cap semantics, use the K-means clustering algorithm to extract the main color of the cap, use the color clustering algorithm and color extraction algorithm to obtain the quantized color value of the cap image, and then perform cap color grading based on different color thresholds.
[0012] Preferably, in step S1, the annotation of semantic information is specifically as follows:
[0013] Use the labelme tool to perform semantic annotation, with the annotation categories including cap, gills, stipe, and background. The obtained img images and mask images are divided into the data set and validation set;
[0014] The steps for classifying the shape data of the fruiting body are as follows:
[0015] Create three shape information annotation folders and place the corresponding shape images in the corresponding folders. The annotation information specifically includes bowling ball shape, funnel shape and straight shape.
[0016] Preferably, in the semantic segmentation model, the U-net network adopts a fully convolutional network with a U-shaped structure, including a downsampling path as an encoder and an upsampling path as a decoder, and the VGG16 network is set on the upsampling path of the U-net network.
[0017] Preferably, the input image size of the semantic segmentation model is 572×572 pixels.
[0018] Preferably, the step S3 is specifically as follows:
[0019] Obtain an image of the King Oyster Mushroom to be classified, use a semantic segmentation model to predict the image of the King Oyster Mushroom to be classified and generate a semantic mask, wherein the color areas in the semantic mask correspond to respective semantic information; use a shape classification model to predict the fruiting bodies in the image of the King Oyster Mushroom to be classified and output corresponding shape labels.
[0020] Preferably, the step S4 is specifically as follows:
[0021] The semantic mask image generated by the semantic segmentation model is used to obtain the phenotypic data of different parts of the King Oyster Mushroom through the color threshold HSV algorithm, and the outline of the King Oyster Mushroom in different parts is obtained through OSTU.
[0022] Use OpenCV's cv2.minAreaRect() function to obtain the minimum bounding rectangle information and get the length and width pixel sizes;
[0023] In order to obtain the actual size of the King Oyster Mushroom, it is necessary to use a reference object of known size in advance to obtain the ratio between pixels and millimeters, and finally obtain the actual phenotypic size length of the King Oyster Mushroom.
[0024] Preferably, the K-means clustering algorithm is specifically:
[0025] S51: Randomly select K from the input data set as the initial cluster centroids;
[0026] S52: For the remaining sample points in the data set, calculate the distance between each sample point and the cluster centroid, and assign the sample point to the cluster with the closest distance, thereby forming an initial cluster assignment;
[0027] S53: For each cluster, calculate the average value of all sample points in the cluster to obtain the new cluster centroid;
[0028] S54: Check whether the cluster assignment of each sample point has changed. If a sample point has changed its cluster assignment, repeat step S52 to reallocate the sample point to the nearest cluster. If no sample point has changed its cluster assignment, the algorithm converges and stops iterating.
[0029] S55: Repeat steps S52 and S53 until the cluster allocation no longer changes or a predetermined number of iterations is reached.
[0030] Correspondingly, the present invention also proposes a classification device based on the phenotypic parameters of King Oyster Mushroom, the device comprising a container, a weight sensor being provided at the bottom of the container, the King Oyster Mushroom sample to be tested being placed on the weight sensor, at least two imaging devices being provided inside the container for photographing the King Oyster Mushroom sample to be tested at different perspectives, a temperature and humidity sensor and a control unit being provided inside the container, the temperature and humidity sensor being used to collect temperature and humidity data inside the container, the control unit being used to execute the above-mentioned classification method.
[0031] Preferably, the container is a dark box, and a light source for illuminating the Pleurotus eryngii sample to be tested is provided inside the dark box.
[0032] Preferably, a power source for providing power to the device is also provided in the container.
[0033] Compared with the prior art, the present invention has the following technical effects:
[0034] 1. The classification method proposed in the present invention adopts a semantic segmentation model to identify the three difficult-to-distinguish parts of the cap, gills, and stipe, and realizes the size measurement of multiple phenotypic information. The algorithm does not require filtering, binarization, edge cutting, etc. on the input image. Traditional segmentation algorithms are sensitive to the range of segmentation thresholds and cannot be applied to other scenarios. Compared with the existing technology, the present invention can better distinguish multiple phenotypic data, is more robust, and greatly improves the accuracy of phenotypic data.
[0035] 2. The classification device proposed in the present invention obtains the overall surface information of the King Oyster Mushroom sample through imaging devices with multiple different perspectives. By setting up a dark box and using artificial light for imaging, the interference of different light intensities on the color of the fungus can be eliminated, making the classification method proposed in the present invention more robust.
[0036] 3. The classification device proposed in the present invention is made more portable by centrally arranging a weight sensor, a temperature and humidity sensor, multiple imaging devices, a light source and a control unit in a container. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 is a flow chart of the classification method of the present invention;
[0038] Figure 2 1 is a U-net network structure diagram of an embodiment of the present invention;
[0039] Figure 3 2 is a diagram of a VGG network structure according to an embodiment of the present invention;
[0040] Figure 4 This is an example of the appearance and phenotypic data of King Oyster Mushroom according to an embodiment of the present invention;
[0041] Figure 5 This is an example of phenotypic data of the color and maximum diameter of the Pleurotus eryngii cap according to an embodiment of the present invention;
[0042] Figure 6 is a flow chart of the K-means clustering algorithm according to an embodiment of the present invention;
[0043] Figure 7 Schematic diagram of a classification device according to an embodiment of the present invention.
[0044] Figure numerals: 1. weight sensor; 11. King oyster mushroom; 2. light source; 3. power supply; 4. first imaging device; 5. second imaging device; 6. temperature and humidity sensor; 7. control unit. DETAILED DESCRIPTION
[0045] In order to make the objectives, technical solutions and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in combination with specific embodiments of the present application and with reference to the accompanying drawings.
[0046] Example 1
[0047] like Figure 1 As shown, a classification method based on phenotypic parameters of King Oyster Mushroom comprises the following steps:
[0048] S1: Collect phenotypic images of King Oyster Mushroom, annotate the phenotypic images with semantic information of the cap, gills, and stipe, and annotate the shapes of the King Oyster Mushroom fruiting bodies in the phenotypic images to obtain a King Oyster Mushroom dataset.
[0049] In this step, the annotation of semantic information is as follows:
[0050] Use the labelme tool to perform semantic annotation, and the annotation categories include cap, gills, stipe and background. The obtained img images and mask images are divided into data sets and verification sets.
[0051] The steps for classifying the shape data of the fruiting body are as follows:
[0052] Create three shape information annotation folders and place the corresponding shape images in the corresponding folders. The annotation information specifically includes bowling ball shape, funnel shape and straight shape.
[0053] S2: The King Oyster Mushroom dataset is input into the semantic segmentation model and the shape classification model for training respectively. The semantic segmentation model is a U-net network structure improved based on VGG16, and the shape classification model is an AlexNet model. The model training is performed using a five-fold cross-validation method.
[0054] like Figure 2 As shown in the semantic segmentation model, the U-net network adopts a U-shaped fully convolutional network, including a downsampling path as an encoder and an upsampling path as a decoder, as shown in Figure 2 As shown in the figure, the encoder consists of several convolutional blocks, each followed by maximum pooling, which reduces the spatial resolution of the image while increasing the number of channels to extract higher-level features. Each convolutional block consists of two convolutional layers (3x3 convolution kernels), an activation function (ReLU), and a 2x2 maximum pooling layer. These convolutional blocks are used to capture features in the image. The input image size of the semantic segmentation model is 572×572 pixels.
[0055] The decoder then upsamples each maximum pooling operation in the encoder, using transposed convolution (or deconvolution) to restore the image resolution. It also connects the output of the previous encoder layer to the input of the current decoder to pass the underlying detail information to the upper layer, helping the network to better restore the details. Each deconvolution block contains two convolutional layers and a ReLU activation function. These deconvolution blocks are used to gradually restore the details of the segmented image. At the end of the decoder, there is also a 1x1 convolution kernel to adjust the number of channels to the number of output channels.
[0056] The VGG16 network is set on the upsampling path of the U-net network. The network structure of VGG16 is as follows Figure 3 As shown in FIG, the network includes an input layer, five convolutional blocks, and a fully connected layer arranged in sequence. The input layer input image is an RGB image of size 224x224x3. The five convolution blocks are the first convolution block: two convolution layers, each containing 64 convolution kernels (3x3 size), using ReLU activation function, a 2x2 maximum pooling layer with a stride of 2; the second convolution block: two convolution layers, each containing 128 convolution kernels (3x3 size), using ReLU activation function, a 2x2 maximum pooling layer with a stride of 2; the third convolution block: three convolution layers, each containing 256 convolution kernels (3x3 size), using ReLU activation function, a 2x2 maximum pooling layer with a stride of 2; the fourth convolution block: three convolution layers, each containing 512 convolution kernels (3x3 size), using ReLU activation function, a 2x2 maximum pooling layer with a stride of 2; the fifth convolution block: three convolution layers, each containing 512 convolution kernels (3x3 size), using ReLU activation function, a 2x2 maximum pooling layer with a stride of 2. The fully connected layer has 4096 neurons, uses the ReLU activation function, and uses Dropout to reduce overfitting. The output layer of the fully connected layer consists of a fully connected layer with 1000 neurons, uses the Softmax activation function, and outputs the probability of each category.
[0057] The AlexNet model consists of eight consecutive convolutional layers with ReLU (Rectified Linear Unit) activation functions, each followed by a max pooling layer, and three fully connected layers. Before each convolutional layer, the input data is conditioned by a 227x227 input image matrix, with the output channels being 96, 256, 384, 384, and 256, respectively. Finally, a fully connected layer consisting of 1,000 units produces the final output. Specifically, the network structure of the AlexNet model is as follows:
[0058] The first convolutional layer (conv1) has 96 kernels of 11x11x3, a stride of 4, no padding, and an output size of 55x55x96.
[0059] The first pooling layer (pool1) uses a 3x3 max pooling with a stride of 2 and an output of 27x27x96.
[0060] The second convolutional layer (conv2) has 256 convolution kernels of 5x5x48, a padding of 2, and an output of 27x27x256.
[0061] The second pooling layer (pool2) uses 3x3 max pooling with a stride of 2 and an output size of 13x13x256.
[0062] The third convolutional layer (conv3) has 384 3x3x256 kernels with a padding of 1 and an output of 13x13x384.
[0063] The fourth convolutional layer (conv4) has 384 3x3x192 convolution kernels with a padding of 1 and an output of 13x13x384.
[0064] The fifth convolutional layer (conv5) has 256 convolution kernels of size 3x3x192, with a padding of 1 and an output of size 13x13x256.
[0065] The third pooling layer (pool5) uses 3x3 maximum pooling with a stride of 2 and an output of 6x6x256.
[0066] The first fully connected layer (fc6), 4096 neurons, connected to the output of pool5;
[0067] The second fully connected layer (fc7), 4096 neurons;
[0068] The third fully connected layer (fc8) has 1000 neurons, corresponding to 1000 classification labels;
[0069] Finally, softmax is used to calculate the category probability.
[0070] Five-fold cross-validation is a model evaluation technique that divides a dataset into five subsets. First, the original dataset is divided into five subsets of equal size, usually called folds, each of which contains samples from the dataset in roughly the same proportion. In five iterations, the model is trained five times, using four of the folds for training each time and the remaining fold for validation. In this way, each fold serves as a validation set while the model is trained on the remaining four folds. In each iteration, the performance of the current model on the validation set is used to evaluate the generalization ability of the model. The performance evaluation indicators usually recorded include accuracy, precision, recall, etc. After completing all five iterations, the results of the five performance evaluations are averaged to obtain the final performance evaluation of the model, which provides an estimate of the average performance of the model on different data partitions and reduces the randomness caused by a single partition.
[0071] The main advantage of five-fold cross-validation is that it provides a more comprehensive assessment of the model's generalization performance and reduces randomness in the model performance evaluation. This is particularly useful for small sample sizes or imbalanced data. Furthermore, by using different training and validation sets, five-fold cross-validation helps capture the model's performance under different data distributions.
[0072] S3: Use the trained semantic segmentation model to segment the King Oyster Mushroom image to form a semantic mask, and use the trained shape classification model to classify the shape of the King Oyster Mushroom fruiting body.
[0073] Specifically, an image of the King Oyster Mushroom to be classified is obtained, and a semantic segmentation model is used to predict the image of the King Oyster Mushroom to be classified to generate a semantic mask, wherein the color areas in the semantic mask correspond to respective semantic information; and a shape classification model is used to predict the fruiting bodies in the image of the King Oyster Mushroom to be classified and output corresponding shape labels.
[0074] S4: Use the color threshold algorithm to obtain the parts of King Oyster Mushroom with different semantics, use the minimum circumscribed rectangle method to obtain the borders of different parts of King Oyster Mushroom, and calculate the length and width size information of different parts of King Oyster Mushroom. The length and width size information of different parts of King Oyster Mushroom is as follows: Figure 4 、 5 As shown, the longest horizontal length is the complete length of the King Oyster Mushroom. It also includes the stipe length, stipe width, gill length and cap thickness of the King Oyster Mushroom.
[0075] Specifically, the semantic mask image generated by the semantic segmentation model prediction is used to obtain the phenotypic data of the King Oyster Mushroom in different parts through the color threshold HSV algorithm, and the contours of the King Oyster Mushroom in different parts are obtained through OSTU; in some embodiments, cv2.cvtColor() is used to convert the image into HSV color space, and then cv2.threshold(), cv2.THRESH_BINARY, and cv2.THRESH_OTSU are used to perform OSTU binarization after defining and applying the color threshold. After obtaining the contour through cv2.findContours(), cv2.drawContours() is used to draw it.
[0076] Use OpenCV's cv2.minAreaRect() function to obtain the minimum bounding rectangle information and get the length and width pixel sizes;
[0077] In order to obtain the actual size of the King Oyster Mushroom, it is necessary to use a reference object of known size in advance to obtain the ratio between pixels and millimeters, and finally obtain the actual phenotypic size length of the King Oyster Mushroom.
[0078] S5: Select an image with cap semantics and use the K-means clustering algorithm to extract the primary colors of the cap. Then, use a color clustering algorithm and a color extraction algorithm to quantize the cap image's color values. Then, use different color thresholds to perform cap color grading. Using the K-means algorithm for color clustering and extraction simplifies image information, extracts cap features, reduces human intervention, and exhibits strong adaptability.
[0079] like Figure 6 As shown, the K-means clustering algorithm is specifically as follows:
[0080] S51: Randomly select K from the input data set as the initial cluster centroids;
[0081] S52: For the remaining sample points in the data set, calculate the distance between each sample point and the cluster centroid, and assign the sample point to the cluster with the closest distance, thereby forming an initial cluster assignment;
[0082] S53: For each cluster, calculate the average value of all sample points in the cluster to obtain the new cluster centroid;
[0083] S54: Check whether the cluster assignment of each sample point has changed. If a sample point has changed its cluster assignment, repeat step S52 to reallocate the sample point to the nearest cluster. If no sample point has changed its cluster assignment, the algorithm converges and stops iterating.
[0084] S55: Repeat steps S52 and S53 until the cluster allocation no longer changes or a predetermined number of iterations is reached.
[0085] The algorithm used in this embodiment does not require filtering, binarization, edge cutting, etc. on the input image, and the traditional segmentation algorithm is sensitive to the range of the segmentation threshold and cannot be applied to other scenarios. Compared with the existing technology, the present invention can better distinguish multi-phenotypic data, is more robust, and greatly improves the accuracy of phenotypic data.
[0086] Example 2
[0087] like Figure 7 As shown, a classification device based on the phenotypic parameters of King Oyster Mushroom is provided. The device includes a container, a weight sensor 1 is provided at the bottom of the container, and a King Oyster Mushroom sample 11 to be tested is placed on the weight sensor 1. At least two imaging devices for shooting the King Oyster Mushroom sample 11 to be tested at different angles are also provided inside the container. A temperature and humidity sensor 6 and a control unit 7 are also provided inside the container. The temperature and humidity sensor 6 is used to collect temperature and humidity data in the container, and the control unit 7 is used to execute the classification method as described in Example 1.
[0088] In a preferred embodiment of the present invention, the imaging devices are respectively a first imaging device 4 with ultra-high-definition pixels arranged on the top of the container, and a second imaging device 5 with ultra-high-definition pixels arranged on the side of the container. Those skilled in the art may also arrange imaging devices at other locations in the container as needed to obtain a more comprehensive image of the King Oyster Mushroom sample 11, such as Figure 7 Imaging devices can also be installed on the right side, front side, and back side of the container. When the King Oyster Mushroom sample 11 is placed horizontally on the weight sensor 1, the imaging device facing the cap can obtain an image of the entire cap, the imaging device facing away from the cap can obtain an image of the gills, and the other side imaging devices and the first imaging device on the top can obtain a side image of the King Oyster Mushroom sample 11.
[0089] In this embodiment, the container is a dark box, within which is located a light source 2 for illuminating the King Oyster Mushroom sample 11 to be tested. Specifically, to ensure good lighting and more stable image acquisition by the imaging device, the light source 2 can be configured as a strip of LED light with adjustable brightness. Multiple strips are positioned on opposing sides of the King Oyster Mushroom sample 11, illuminating the sample 11 from different angles. By using a dark box and artificial light for imaging, interference with bacterial color caused by varying light intensities can be eliminated, making the classification method described in Example 1 more robust.
[0090] In this embodiment, the container is further provided with a power supply 3 for providing power to the device. In other embodiments of the present invention, the power required by the classification device can be provided by an external system.
[0091] The above description is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this field, several variations and improvements can be made without departing from the creative concept of the present invention, which all fall within the scope of protection of the present invention.
Claims
1. A classification method based on phenotypic parameters of Pleurotus eryngii, characterized in that: The following steps are involved: S1: Collect phenotypic images of King Oyster Mushroom, annotate the phenotypic images with semantic information of the cap, gills, and stipe, and annotate the shapes of the King Oyster Mushroom fruiting bodies in the phenotypic images to obtain a King Oyster Mushroom dataset; The semantic information is annotated as follows: labelme is used to perform semantic annotation, with the annotated categories including cap, gills, stipe, and background. The obtained img images and mask images are divided into the data set and validation set. The steps of classifying the shape data of the fruiting body are as follows: establishing three shape information annotation folders, placing corresponding shape pictures in the corresponding folders, and the annotation information specifically includes bowling ball shape, funnel shape and straight shape; S2: The King Oyster Mushroom dataset is input into the semantic segmentation model and the shape classification model for training respectively. The semantic segmentation model is a U-net network structure improved based on VGG16, and the shape classification model is an AlexNet model. The model training is performed using a five-fold cross-validation method. The semantic segmentation model input image size is 572×572 pixels. The U-net network adopts a U-shaped fully convolutional network, including a downsampling path as an encoder and an upsampling path as a decoder. The VGG16 network is set on the upsampling path of the U-net network. S3: Use the trained semantic segmentation model to segment the King Oyster Mushroom image to form a semantic mask, and use the trained shape classification model to classify the shape of the King Oyster Mushroom fruiting body; S4: Use the color threshold algorithm to obtain different semantic parts of the King Oyster Mushroom, use the minimum enclosing rectangle method to obtain the bounding boxes of different parts of the King Oyster Mushroom, and calculate the length and width information of different parts of the King Oyster Mushroom; the specific method is as follows: The semantic mask image generated by the semantic segmentation model is used to obtain the phenotypic data of different parts of the King Oyster Mushroom through the color threshold HSV algorithm, and the outline of the King Oyster Mushroom in different parts is obtained through OSTU. Use OpenCV's cv2.minAreaRect() function to obtain the minimum bounding rectangle information and get the length and width pixel sizes; In order to obtain the actual size of King Oyster Mushroom, it is necessary to use a reference object of known size in advance to obtain the ratio between pixels and millimeters, and finally obtain the actual phenotypic size length of King Oyster Mushroom; S5: Select images with cap semantics, use the K-means clustering algorithm to extract the main color of the cap, use the color clustering algorithm and color extraction algorithm to obtain the quantized color value of the cap image, and then perform cap color grading based on different color thresholds.
2. A classification method based on phenotypic parameters of King Oyster Mushroom according to claim 1, characterized in that: The step S3 is specifically as follows: Obtain an image of the King Oyster Mushroom to be classified, use a semantic segmentation model to predict the image of the King Oyster Mushroom to be classified and generate a semantic mask, wherein the color areas in the semantic mask correspond to respective semantic information; use a shape classification model to predict the fruiting bodies in the image of the King Oyster Mushroom to be classified and output corresponding shape labels.
3. A classification method based on phenotypic parameters of King Oyster Mushroom according to claim 1, characterized in that: The K-means clustering algorithm is specifically: S51: Randomly select K from the input data set as the initial cluster centroids; S52: For the remaining sample points in the data set, calculate the distance between each sample point and the cluster centroid, and assign the sample point to the cluster with the closest distance, thereby forming an initial cluster assignment; S53: For each cluster, calculate the average value of all sample points in the cluster to obtain the new cluster centroid; S54: Check whether the cluster assignment of each sample point has changed. If a sample point has changed its cluster assignment, repeat step S52 to reallocate the sample point to the nearest cluster. If no sample point has changed its cluster assignment, the algorithm converges and stops iterating. S55: Repeat steps S52 and S53 until the cluster allocation no longer changes or a predetermined number of iterations is reached.
4. A classification device based on phenotypic parameters of King Oyster Mushroom, characterized in that: The device comprises a container, a weight sensor (1) is provided at the bottom of the container, a King Oyster Mushroom sample to be tested is placed on the weight sensor (1), at least two imaging devices for photographing the King Oyster Mushroom sample to be tested at different viewing angles are provided inside the container, a temperature and humidity sensor (6) and a control unit (7) are also provided inside the container, the temperature and humidity sensor (6) is used to collect temperature and humidity data in the container, and the control unit (7) is used to execute the classification method according to any one of claims 1 to 3.
5. A classification device based on phenotypic parameters of King Oyster Mushroom according to claim 4, characterized in that: The container is a dark box, and a light source (2) is provided inside the dark box for illuminating the Pleurotus eryngii sample to be tested.
6. A classification device based on phenotypic parameters of King Oyster Mushroom according to claim 4 or 5, characterized in that: A power source (3) for providing power to the device is also provided in the container.
Citation Information
Patent Citations
Pleurotus eryngii quality detection system and method based on image analysis
CN114419002A
Eye fundus image classification method
CN117636449A