Method and device for identifying maturity of oyster mushrooms
By performing hue feature analysis and optimization on oyster mushroom images, and generating four-channel image data input to improve the YOLOv13 model, the accuracy problem of oyster mushroom maturity recognition in complex environments was solved, and high-precision maturity detection was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-14
- Publication Date
- 2026-03-20
AI Technical Summary
In existing technologies, the maturity identification methods for oyster mushrooms have low accuracy in complex production environments and are prone to false detection or omission due to insufficient extraction of color features, making it difficult to meet the accuracy and robustness requirements of automated harvesting.
By performing hue feature analysis based on the oyster mushroom image dataset, a list of hue intervals is generated. The hue of the oyster mushroom images to be detected is optimized, and the optimized hue channels are merged with the original color channels to form four-channel image data. This data is then input into the improved YOLOv13 model, where the adaptive hypergraph computation module and stacked attention module are used to enhance the feature representation, thereby improving the robustness and accuracy of the model.
It significantly improves the accuracy and robustness of oyster mushroom maturity recognition, enabling accurate detection of oyster mushroom maturity under different production environments, reducing environmental interference, and enhancing the integrity of the model's feature representation and detection accuracy.
Smart Images

Figure CN121708352A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image recognition technology, and in particular to a method and apparatus for identifying the maturity of oyster mushrooms. Background Technology
[0002] In current computer vision-based agricultural product detection technologies, the YOLO series models are widely used in the field of fruit maturity recognition due to their high detection speed.
[0003] However, many related technologies rely on morphological and textural features for maturity assessment, while the use of color features is typically limited to auxiliary decision-making. For example, while fusing Lab color space and RGB image multi-channel input into YOLOv8's Backbone improves the recognition rate of diseased oyster mushrooms, it fails to address the problem of misjudgment when color features are weak during the maturity transition period. In real-world production environments with crowded oyster mushroom stacks and uneven lighting, these methods are prone to false positives or omissions due to insufficient color feature extraction, making it difficult to meet the accuracy and robustness requirements of automated harvesting.
[0004] It is evident that the oyster mushroom maturity identification methods in related technologies suffer from low accuracy in complex production environments. Summary of the Invention
[0005] This invention provides a method and apparatus for identifying the maturity of oyster mushrooms, which solves the problem that existing methods for identifying the maturity of oyster mushrooms have low accuracy in complex production environments, and achieves accurate detection of the maturity of oyster mushrooms under different production environments.
[0006] This invention provides a method for identifying the maturity of oyster mushrooms, comprising the following steps: Performing hue feature analysis based on a preset oyster mushroom image dataset to obtain a list of oyster mushroom hue intervals, wherein the oyster mushroom image dataset contains images of oyster mushrooms at their complete growth stages under different growing environments; optimizing the hue of the oyster mushroom image to be detected based on the oyster mushroom hue interval list to obtain optimized hue channels of the oyster mushroom image to be detected; merging the optimized hue channels of the oyster mushroom image to be detected with the original color channels of the oyster mushroom image to be detected to obtain four-channel image data; inputting the four-channel image data into an improved YOLOv13 model to obtain the maturity identification result of the oyster mushroom image to be detected output by the improved YOLOv13 model, wherein the input of the improved YOLOv13 model is changed from 3 channels to 4 channels.
[0007] According to the present invention, a method for identifying the maturity of oyster mushrooms includes optimizing the hue of an image of an oyster mushroom to be detected based on a list of oyster mushroom hue intervals to obtain an optimized hue channel for the image. This includes: converting the image of the oyster mushroom to be detected from the RGB color space to the HSV color space to obtain a converted HSV image; performing hue channel separation based on the converted HSV image to obtain initial hue components; and generating a mask based on the list of oyster mushroom hue intervals, setting the pixel values of the initial hue components that do not belong to a preset hue interval to zero to obtain the optimized hue channel.
[0008] According to the present invention, a method for identifying the maturity of oyster mushrooms includes merging the optimized hue channel of the oyster mushroom image to be detected with the original color channel of the oyster mushroom image to be detected to obtain four-channel image data. The method includes: using the optimized hue channel as the fourth channel and splicing it with the red, green and blue channels of the original color channel of the oyster mushroom image to be detected in the channel dimension to obtain four-channel image data.
[0009] According to the present invention, a method for identifying the maturity of oyster mushrooms is provided. The improved YOLOv13 model includes an adaptive hypergraph computation module and a stacked attention module. The step of inputting the four-channel image data into the improved YOLOv13 model to obtain the maturity identification result of the oyster mushroom image to be detected, output by the improved YOLOv13 model, includes: using the adaptive hypergraph computation module to perform correlation modeling on the color features and spatial features in the four-channel image data to obtain an enhanced hypergraph feature representation; inputting the enhanced hypergraph feature representation into the stacked attention module, optimizing the feature weights through a multi-level attention stacking mechanism to obtain target feature information; and inputting the target feature information into the detection head of the improved YOLOv13 model to output the maturity identification result of the oyster mushroom image to be detected.
[0010] According to the present invention, a method for identifying the maturity of oyster mushrooms includes the following steps: First, the adaptive hypergraph computation module performs correlation modeling on the color features and spatial features in the four-channel image data to obtain an enhanced hypergraph feature representation. This includes: mapping the multi-scale feature map pixels in the four-channel image data to hypergraph vertices to obtain a hypergraph vertex set; second, using a color weighting module, performing multi-level convolution and linear projection calculations on the features corresponding to the optimized hue channels in the hypergraph vertex set to generate hue sensitivity parameters; third, using the hue sensitivity parameters, adaptively establishing hyperedge connections between vertices in the hypergraph vertex set and dynamically adjusting the hyperedge weights to obtain connected vertex features; and fourth, aggregating the connected vertex features through a hypergraph message passing mechanism to generate the enhanced hypergraph feature representation.
[0011] According to the present invention, a method for identifying the maturity of oyster mushrooms includes the following steps: inputting the enhanced hypergraph feature representation into the stacked attention module, and optimizing the feature weights through a multi-level attention stacking mechanism to obtain target feature information. The method comprises: allocating attention weights based on the enhanced hypergraph features to obtain basic attention features; performing feature stacking operations on the basic attention features and the enhanced hypergraph features to obtain a cascaded feature representation; refining the cascaded feature representation layer by layer through a multi-level attention stacking mechanism, and integrating the attention outputs of each layer based on a gating fusion mechanism to obtain target feature information.
[0012] This invention also provides a maturity recognition device for oyster mushrooms, comprising the following modules: a hue analysis module, used to perform hue feature analysis based on a preset oyster mushroom image dataset to obtain a list of oyster mushroom hue intervals, wherein the oyster mushroom image dataset contains oyster mushroom images of complete growth stages under different growth environments; a hue optimization module, used to optimize the hue of the oyster mushroom image to be detected based on the oyster mushroom hue interval list to obtain an optimized hue channel of the oyster mushroom image to be detected; a channel merging module, used to merge the optimized hue channel of the oyster mushroom image to be detected with the original color channel of the detected oyster mushroom image to obtain four-channel image data; and a maturity recognition module, used to input the four-channel image data into an improved YOLOv13 model to obtain the maturity recognition result of the oyster mushroom image to be detected output by the improved YOLOv13 model, wherein the input of the improved YOLOv13 model is changed from 3 channels to 4 channels.
[0013] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the maturity identification method for oyster mushrooms as described above.
[0014] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the maturity identification method for oyster mushrooms as described above.
[0015] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the maturity identification method for oyster mushrooms as described above.
[0016] The present invention provides a method and apparatus for identifying the maturity of oyster mushrooms. It performs hue feature analysis based on a pre-set oyster mushroom image dataset to obtain a list of hue intervals for oyster mushrooms, thereby accurately capturing the hue features of oyster mushrooms at different maturity stages and providing a reliable color benchmark for subsequent processing. Next, the hue interval list is used to optimize the hue of the oyster mushroom image to be detected, enhancing the hue information related to maturity and effectively reducing environmental interference. Then, the optimized hue channels are merged with the original color channels to form four-channel image data, enriching the dimensions of the input information and improving the completeness of feature expression. Finally, the four-channel data is input into an improved YOLOv13 model. By expanding the model's input channels, the model can fully utilize the optimized hue features, significantly improving the accuracy and robustness of oyster mushroom maturity identification. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced one by one below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0018] Figure 1 This is a flowchart illustrating the method for identifying the maturity of oyster mushrooms provided by the present invention.
[0019] Figure 2 This is an example of a preprocessed oyster mushroom image provided by the present invention.
[0020] Figure 3 This is a distribution map of the labeled evaluation image dataset provided by this invention.
[0021] Figure 4 This is a bar chart showing the number of pixels in the oyster mushroom image provided by the present invention.
[0022] Figure 5 This is a schematic diagram of the structure of the improved YOLOv13 model provided by the present invention.
[0023] Figure 6 This is a schematic diagram of the architecture of the adaptive hyperedge generation method provided by the present invention.
[0024] Figure 7 This is a graph showing the model loss value provided by this invention.
[0025] Figure 8 These are images of oyster mushroom maturity detection under different scenarios provided by this invention.
[0026] Figure 9 This is a visualization chart of oyster mushroom maturity analysis provided by the present invention.
[0027] Figure 10 This is a schematic diagram of the oyster mushroom maturity identification device provided by the present invention.
[0028] Figure 11 This is a schematic diagram of the physical structure of the electronic device provided by the present invention. Detailed Implementation
[0029] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0030] Oyster mushrooms, a common edible fungus, play an important role in agricultural production and market sales. With the continuous development of computer vision technology, object detection models are being applied more and more widely in the agricultural field. The YOLOv series of object detection models, with their high detection speed and good accuracy, have achieved remarkable results in multiple fields.
[0031] YOLOv3 / v4 / v5 models have been widely used in agricultural product sorting (such as mushrooms and fruits), but most studies focus on shape and texture features, while there are relatively few studies on the separate fusion of color features.
[0032] The key technological approaches to current color feature fusion research include the following: Multimodal input fusion optimization includes a dual-branch network structure, which inputs the RGB image and the HSV-converted image into the two branches of YOLOv7 respectively, and fuses them through the feature pyramid (FPN); Lab space and texture are combined, and the a / b channels (color contrast dimension) of Lab space are used to enhance the feature extraction of the Neck part of YOLOv6.
[0033] Attention mechanism optimizations mainly include: CBAM + color prior. A CBAM module is added after the SPP layer in YOLOv5, and regions with high color saturation (S in HSV) are given priority in weight allocation.
[0034] Data augmentation strategies mainly include generating adversarial examples targeting color changes to improve model robustness.
[0035] The above studies have achieved certain results in maturity and lesion detection, but it is difficult to classify the maturity of oyster mushrooms in the different maturity transition periods. There are still some difficulties to be overcome in the study of oyster mushroom maturity: the model has low detection accuracy, which can easily lead to missed or misjudged maturity; the interference of natural environmental factors is not considered, and the model has weak generalization ability.
[0036] To address the above issues, this invention improves YOLOv13 by incorporating hypergraph theory and color features to mine hyperedge relationships. First, a self-built dataset is constructed using images from different growth stages under varying environments. Second, the hue interval distribution of oyster mushrooms at different growth stages is analyzed based on color features. Finally, based on the hue interval distribution characteristics of oyster mushrooms, YOLOv13 is improved: First, based on the hue intervals of oyster mushrooms, the HSV-H hue layer is optimized by setting values in the non-hue interval list to 0 and using them as the fourth channel of the model input layer, changing the model input from 3 channels to 4 channels. Second, a color weight module (ColorWeight) is designed, and the Adaptive Hyperedge Generation module is improved by introducing fourth channel information to enhance feature hyperedge relationships. Finally, the StockenAttention mechanism is added to improve the neck network structure of the YOLOv13 model, enhancing its robustness and versatility in processing sequential data, improving performance while maintaining lightweight design.
[0037] Figure 1 This is a flowchart illustrating the maturity identification method for oyster mushrooms provided by the present invention, as shown below. Figure 1 As shown, the method includes the following steps.
[0038] Step 101: Perform hue feature analysis based on the preset oyster mushroom image dataset to obtain a list of oyster mushroom hue intervals. The oyster mushroom image dataset contains oyster mushroom images of the complete growth period under different growth environments.
[0039] refer to Figure 2 , Figure 2 This is an example of a preprocessed oyster mushroom image provided by the present invention.
[0040] refer to Figure 3 , Figure 3 This is a distribution map of the labeled evaluation image dataset provided by this invention.
[0041] In this embodiment of the invention, to improve the model's detection performance under different environments, the oyster mushroom image was deformed to varying degrees to simulate changes in distance and angle under production conditions. Considering the application of color, image enhancement methods such as changing brightness, changing saturation, or adding salt-and-pepper noise were not used.
[0042] Meanwhile, the oyster mushroom images were scaled to a uniform 640x640 to adapt the model; the processed images are as follows. Figure 2 As shown. The original dataset overlaid with the augmented dataset contains a total of 4779 images. The dataset was manually annotated using LabelImg annotation software, with annotations in YOLO format txt files, ensuring that each image has at least one mushroom location labeled. The distribution after annotation is shown below. Figure 3 As shown. Finally, this invention divides the oyster mushroom image dataset into a training set, a validation set, and a test set in an 8:1:1 ratio.
[0043] Referring to Table 1, which shows information such as the label names and number of images in the oyster mushroom image dataset:
[0044] The HSV color space represents color as three components: hue, saturation, and value. Hue reflects the basic properties of color, saturation represents the purity of color, and value represents the lightness or darkness of color. Compared to the RGB color space, the HSV color space better aligns with human color perception and has advantages in color feature extraction. Therefore, we convert the oyster mushroom image from the RGB color space to the HSV color space and then extract the features of the hue component.
[0045] The Hue hue distribution statistical method uses color histograms for statistical analysis: a color histogram is a method for statistically analyzing the color distribution in an image. By dividing the color space of an image into several intervals and counting the number of pixels in each interval, a color histogram is obtained. The color histogram provides a visual representation of the hue distribution data in the mushroom image.
[0046] For example, extract all front views of a complete oyster mushroom growth period, and obtain a clean image of the oyster mushroom body through manual processing; merge the extracted bodies into one image, use OpenCV to convert the image to the HSV color space, separate the hue channels, and calculate the number of pixels for each hue by traversing the hue channel layers to generate a bar chart.
[0047] refer to Figure 4 , Figure 4 This is a bar chart showing the number of pixels in the oyster mushroom image provided by the present invention.
[0048] Analysis of the bar charts throughout the entire growth period revealed that the hues of oyster mushrooms collected under greenhouse and semi-automatic production environments were concentrated in the range of [3-38], while those collected under automated mushroom house environments were concentrated in the range of [115, 170]. The results indicate that the hue of oyster mushrooms is influenced by temperature, light, moisture, and carbon dioxide during growth, but the hue range remains concentrated throughout the growth period.
[0049] This invention extracts the hue of the labeled areas in the labeled image to obtain a list of hue intervals for oyster mushrooms: [[3,10],[11,25],[26,40],[110,170]].
[0050] Step 102: Based on the oyster mushroom hue range list, perform hue optimization on the oyster mushroom image to be detected to obtain the optimized hue channel of the oyster mushroom image to be detected.
[0051] In this embodiment of the invention, the image of the oyster mushroom to be detected is converted from the original RGB color space to the HSV color space. The H (Hue) component independently represents the hue information of the color, effectively eliminating interference from changes in brightness (Value) and saturation (Saturation). After the conversion, the hue (H) channel is separated from the HSV image. This channel contains the original hue value of each pixel in the image, and its value range is typically from 0 to 180 (in commonly used libraries such as OpenCV).
[0052] The separated hue channels are optimized using a pre-obtained list of hue intervals for oyster mushrooms. Specifically, the hue interval list is [[3,38],[110,170]], which defines the effective hue range that significantly contributes to the identification of oyster mushroom maturity. The core operation of the optimization is to generate a binary mask: traversing each pixel value in the hue channel, determining whether it falls within any interval of the hue interval list (e.g., within the range of [3,38] or [110,170]). For pixels falling within the effective interval, their position is marked as True or 1 in the mask; for pixels falling outside the effective interval, they are marked as False or 0.
[0053] The original hue channel is multiplied bitwise with the generated mask. After the multiplication, pixels within the valid hue range retain their original hue values, while all pixels outside the hue range are set to zero.
[0054] Through the embodiments of the present invention, hue interference from background, noise or other irrelevant objects is effectively filtered out, so that the energy of the optimized hue channel is concentrated on the color features related to oyster mushrooms.
[0055] Step 103: Merge the optimized hue channel of the oyster mushroom image to be detected with the original color channel of the oyster mushroom image to be detected to obtain four-channel image data.
[0056] In this embodiment of the invention, the optimized hue channel after masking retains the pixel values belonging to the characteristic hue range of oyster mushroom (such as [3,38] and [110,170]), while setting the pixel values of unrelated hue regions to zero, which can effectively reflect the color characteristics of oyster mushroom.
[0057] The optimized hue channels are fused with the original color channels of the image. The original color channels refer to the standard RGB three-channel data of the mushroom image to be detected without any hue optimization. These three channels represent the red (R), green (G), and blue (B) components, respectively, and together constitute the original color information of the image.
[0058] A 3D tensor representing the original RGB image, with dimensions [height, width, 3], is concatenated with a 3D tensor representing the optimized hue channel, with dimensions [height, width, 1], to obtain four-channel image data. The concatenation operation is performed along the channel dimensions (usually the third dimension), ultimately generating a new four-channel tensor with dimensions [height, width, 4]. In this four-channel tensor, the first three channels are the R, G, and B channels, respectively, and the fourth channel is the optimized H (hue) channel.
[0059] Through the embodiments of the present invention, the obtained four-channel image data simultaneously includes the original color information of the oyster mushroom image and the enhanced hue features that are highly correlated with maturity, aiming to enhance the model's ability to perceive key features of oyster mushrooms from the perspective of color space.
[0060] Step 104: Input the four-channel image data into the improved YOLOv13 model to obtain the maturity recognition result of the oyster mushroom image to be detected output by the improved YOLOv13 model.
[0061] In particular, the input of the improved YOLOv13 model has been changed from 3 channels to 4 channels.
[0062] In this embodiment of the invention, the input layer structure of the YOLOv13 model is adaptively improved. Since the input layer of the standard YOLOv13 model is designed to receive 3-channel RGB image data, to accommodate the 4-channel image data generated by this method, the number of channels in the model's input layer needs to be changed from 3 channels to 4 channels.
[0063] For example, adjusting the number and structure of filters in the input convolutional layer enables it to correctly process four-channel input tensors containing R, G, B, and optimized hue channels, ensuring that the network front-end can effectively extract feature information from the four-channel data.
[0064] Four-channel image data was used as direct input to the improved YOLOv13 model. While maintaining the integrity of the original RGB color information, the four-channel image data incorporated optimized mushroom-specific hue features, providing the model with richer color discrimination criteria.
[0065] The improved YOLOv13 model transforms low-level pixel information into high-level semantic features through a series of convolution, pooling, and feature fusion operations. These features are then passed to the detection head for target localization and classification.
[0066] The improved YOLOv13 model outputs the maturity recognition results of the oyster mushroom images to be detected. The maturity recognition results are usually presented in the form of bounding boxes and corresponding category confidence scores, which can accurately identify the location of the oyster mushrooms in the image and their maturity level (such as immature, mature, overripe, etc.).
[0067] Through this embodiment of the invention, hue feature analysis is performed based on a preset oyster mushroom image dataset to obtain a list of oyster mushroom hue intervals, thereby accurately capturing the hue features of oyster mushrooms at different maturity stages and providing a reliable color benchmark for subsequent processing. Next, the hue interval list is used to optimize the hue of the oyster mushroom image to be detected, enhancing the hue information related to maturity and effectively reducing environmental interference. Then, the optimized hue channels are merged with the original color channels to form four-channel image data, enriching the dimensions of the input information and improving the completeness of feature expression. Finally, the four-channel data is input into an improved YOLOv13 model. By expanding the model's input channels, the model can fully utilize the optimized hue features, significantly improving the accuracy and robustness of oyster mushroom maturity recognition.
[0068] According to the present invention, a method for identifying the maturity of oyster mushrooms includes optimizing the hue of an image of an oyster mushroom to be detected based on a list of oyster mushroom hue intervals to obtain an optimized hue channel for the image of the oyster mushroom to be detected, comprising: The image of the oyster mushroom to be detected is converted from the RGB color space to the HSV color space to obtain the converted HSV image; Based on the converted HSV image, hue channel separation is performed to obtain the initial hue components; A mask is generated based on the mushroom hue range list. Pixel values in the initial hue components that do not belong to the preset hue range are set to zero to obtain the optimized hue channel.
[0069] In this embodiment of the invention, the image of the oyster mushroom to be detected is converted from the RGB color space to the HSV color space to obtain the converted HSV image.
[0070] The HSV color space decomposes color information into three independent components: hue, saturation, and value. Among these, the hue component more directly reflects the essential attributes of color, which is beneficial for subsequent targeted hue feature extraction. Conversion operations are typically implemented using pre-defined conversion functions in mature image processing libraries (such as OpenCV) to ensure accuracy and efficiency.
[0071] Based on the converted HSV image, the hue channels are separated to obtain the initial hue components. Specifically, an HSV image is a data structure containing three channels: H, S, and V. Through channel separation operations, the hue channels can be extracted individually. The initial hue components are a two-dimensional matrix, where each element represents the hue value of the corresponding pixel in the image. Their values typically range from 0 to 180, fully recording the hue distribution information of the original image.
[0072] A mask is generated and optimized based on a preset mushroom hue range list. The mushroom hue range list is an effective range obtained by analyzing a large-scale dataset, such as [[3,38], [110,170]]. The mask generation process is as follows: traverse each pixel value in the initial hue component and determine whether it falls within the preset mushroom hue range. For pixels falling within the range, mark the corresponding position in the mask as valid (usually 1 or True); for pixels falling outside the range, mark them as invalid (usually 0 or False). Subsequently, this binary mask is used to process the initial hue component, setting the hue values of all pixels marked as invalid to zero, while retaining the original hue values of pixels within the valid area, thus obtaining the optimized hue channel.
[0073] Through the embodiments of the present invention, the optimized operation effectively filters out background hue and noise interference that are unrelated to the maturity of oyster mushrooms, so that the energy of the optimized channel signal is highly concentrated in the discriminative hue range of oyster mushroom characteristics, thereby significantly improving the signal-to-noise ratio and effectiveness of color features in the subsequent identification process.
[0074] According to the maturity identification method of oyster mushrooms provided by the present invention, the optimized hue channel of the oyster mushroom image to be detected is merged with the original color channel of the oyster mushroom image to be detected to obtain four-channel image data, including: The optimized hue channel is used as the fourth channel and is stitched together with the red, green, and blue channels in the original color channels of the mushroom image to be detected in the channel dimension to obtain four-channel image data.
[0075] In this embodiment of the invention, the optimized hue channel is a two-dimensional matrix data, in which only pixel values falling within the characteristic hue range of oyster mushroom (such as [[3,38],[110,170]]) are retained, while pixel values outside the characteristic range are set to zero, making this channel a data layer that enhances the color characteristics of oyster mushroom.
[0076] The original color channels of the oyster mushroom image to be detected, namely the standard red channel (Red), green channel (Green), and blue channel (Blue), together constitute the original color information of the image, maintaining the true color representation of the oyster mushroom image to be detected.
[0077] The optimized hue channel is treated as a fourth data channel and concatenated with the original red, green, and blue channels in a specific order. At the data processing level, this is typically achieved through tensor concatenation. Assuming the original RGB image data is a three-dimensional tensor with shape [height, width, 3], and the optimized hue channel is a three-dimensional tensor with shape [height, width, 1], concatenating along the channel dimensions (usually the third dimension) will generate a new four-channel tensor with shape [height, width, 4].
[0078] In this four-channel tensor, the channel order is clearly defined: the first channel is the red channel (R), the second channel is the green channel (G), the third channel is the blue channel (B), and the fourth channel is the optimized hue channel (H). This arrangement ensures the standardization and consistency of the data structure, facilitating unified feature extraction during subsequent model processing.
[0079] Through the embodiments of the present invention, four-channel image data are fused with the original color information of the oyster mushroom to be detected and the refined hue features that are highly correlated with maturity, forming an information-enhanced model input.
[0080] According to the maturity identification method of oyster mushroom provided by the present invention, the improved YOLOv13 model includes: an adaptive hypergraph calculation module and a stacked attention module; The four-channel image data is input into the improved YOLOv13 model to obtain the maturity recognition results of the oyster mushroom image to be detected, including: The adaptive hypergraph computation module is used to model the correlation between color features and spatial features in four-channel image data to obtain an enhanced hypergraph feature representation. The enhanced hypergraph feature representation is input into the stacked attention module, and the feature weights are optimized through a multi-level attention stacking mechanism to obtain the target feature information; The target feature information is input into the detection head of the improved YOLOv13 model, and the maturity recognition result of the oyster mushroom image to be detected is output.
[0081] Research on the color characteristics of oyster mushrooms revealed that, regardless of whether they are gray or brown, the hue of each oyster mushroom variety is relatively concentrated during its growth process. Therefore, this invention integrates the hue distribution relationship into the YOLOv13n hypergraph relationship to improve the relevance of the graph relationship.
[0082] This invention uses YOLOv13n as the baseline model and optimizes and improves it in the following three aspects to achieve higher detection performance and lower computational cost.
[0083] First, since the hyperedge relationship of the HyperACE mechanism originates from the statistics of the feature map, the HSV-H hue layer of oyster mushroom is optimized based on the hue interval distribution. The values in the non-hue interval list are set to 0 and used as the fourth channel of the model input layer, changing the model input from 3 channels to 4 channels. Second, the Adaptive Hyperedge Generation module is improved by adding a color weight module to enhance the adaptive correlation of hue. Finally, the StockenAttention module is introduced to enhance the robustness and diversity of the model when processing sequence data, further optimizing the extraction of oyster mushroom color features.
[0084] refer to Figure 5 , Figure 5 This is a schematic diagram of the structure of the improved YOLOv13 model provided by the present invention.
[0085] The improved YOLOv13 model adopts a modular design, with the data flow passing from left to right through the input layer, backbone network, neck network, and head. The input layer contains two data sources: the original image and the optimized hue channel, which corresponds to the four-channel image data in the method of this invention.
[0086] The backbone network is the core of feature extraction and mainly consists of components such as standard convolution (Conv), depthwise separable convolutional modules (DS-C3k2), and FullPADTunnel. Figure 5 The paper demonstrates the process of feature maps gradually shrinking in size and increasing in number of channels within the backbone network, and labels the output feature maps at different levels, from H2 to H5.
[0087] The neck network is responsible for multi-scale feature fusion. Its structure includes operations such as upsampling, downsampling, concatenation, and the StockenAttention module. This part effectively fuses multi-scale feature information from layers H3, H4, and H5 of the backbone network through top-down and bottom-up paths to enhance the model's ability to perceive targets of different sizes.
[0088] Finally, the fused target feature information is fed into the Detect head section, which outputs the final oyster mushroom target localization and maturity classification results.
[0089] In the input of the improved YOLOv13 model, firstly, the original RGB image is converted to the HSV color space, the H (hue) channel is extracted, and the hue not in the hue interval list ([[3,38],[110,170]]) is set to zero as the fourth input channel; secondly, the fourth channel is merged with the original RGB channel into a 4-channel tensor (R,G,B,H) to achieve channel merging; finally, the input layer structure of YOLOv13 is adjusted, changing the default 3 channels (RGB) to 4 channels (RGB-H).
[0090] This invention uses an optimized H-channel enhancement model that is sensitive to hue and insensitive to changes in illumination (brightness / saturation) of oyster mushrooms, thereby enhancing the model's ability to capture color information of oyster mushrooms.
[0091] Through the embodiments of the present invention, the improved YOLOv13 model models the color and spatial features of four-channel image data through the adaptive hypergraph computation module to obtain an enhanced hypergraph feature representation. Then, the feature weights are optimized through the multi-level attention stacking mechanism of the stacked attention module to obtain target feature information. Finally, the detection head outputs the maturity recognition result, which effectively improves the accuracy of oyster mushroom maturity recognition.
[0092] According to the maturity identification method of oyster mushroom provided by the present invention, an adaptive hypergraph computing module is used to perform correlation modeling on the color features and spatial features in four-channel image data to obtain an enhanced hypergraph feature representation, including: The pixels of the multi-scale feature map in the four-channel image data are mapped to hypergraph vertices to obtain the hypergraph vertex set; The color weighting module performs multi-level convolution and linear projection calculations on the features corresponding to the optimized hue channels in the hypergraph vertex set to generate hue sensitivity parameters. Using the hue sensitivity parameter, hyperedge connections between vertices are adaptively established in the hypergraph vertex set, and the hyperedge weights are dynamically adjusted to obtain the vertex features that establish the connections. The features of the connected vertices are aggregated through the hypergraph message passing mechanism to generate an enhanced hypergraph feature representation.
[0093] In this embodiment of the invention, the core idea of the HyperACE (Hypergraph-based Adaptive Correlation Enhancement) module is to treat pixels in multi-scale feature maps as hypergraph vertices, connect multiple related vertices through learned hyperedges, and perform efficient message passing on this basis to enhance feature representation.
[0094] Based on the analysis of the color change characteristics of oyster mushrooms during their growth period, this invention strengthens color relationships by introducing a color weight module in Adaptive Hyperedge Generation.
[0095] refer to Figure 6 , Figure 6 This is a schematic diagram of the architecture of the adaptive hyperedge generation method provided by the present invention.
[0096] like Figure 6 As shown, the input data is a feature map of dimension H×W×C, which is simultaneously fed into two parallel processing paths: high-order and low-order. In the high-order path, the input feature map undergoes flattening, max pooling, and average pooling operations to extract global features. Simultaneously, a set of global prototype vectors is generated through projection, and combined with dynamic offsets, a high-order hyperedge representation is finally generated. In the low-order path, the input feature map is processed sequentially through multiple C3AH and HyperACE modules to extract and fuse multi-scale local features. The outputs of the two paths are fused through a concatenation operation to finally generate a set of adaptive hyperedges.
[0097] The ColorWeight module is a network built based on the hue change characteristics of oyster mushrooms during their growth period. It enhances the capture of key information by repeatedly stacking and convolving the optimized HSV-H hue layer. It mainly consists of convolutional layers, linear combination layers of features, and information statistics layers. Its core idea is to gradually refine and focus the most important feature information through multiple convolutional cascades, and then enhance the network's hue sensitivity in learning features through linear combination and information statistics.
[0098] The specific process is as follows: Based on the hue range list, the hues of the non-mushroom hue ranges in the Hue layer of the image are set to zero and normalized before being used as the input layer (batch, 640, 640). Through three convolutions, the Hue feature layer is obtained. The mean and maximum values of each feature layer are calculated and concatenated with the original statistical mean and maximum values before being used for projection calculation (based on linear transformation in Linear space). Simultaneously, after the feature layer undergoes projection calculation, it is added to the preceding input features before another projection calculation. Example code is as follows: Input Xhue optimization and normalization: Calculate the mask: Merged=[[3, 38], [110, 170]] mask = torch.zeros_like(Xhue, dtype=torch.bool) For lower, upper in merged: mask |= (hue>= lower)&(hue<= upper) Xhue = Xhue * mask Normalization: Xhue = Xhue / 180 First convolution: The number of channels is expanded from 1 to 32, and the feature size is reduced from 640 x 640 to 320 x 320, reducing the space by a factor of 2.
[0099] conv1 = nn.Conv2d(1, 32, kernel_size=3, stride=2, padding=1) Xhue = conv1(Xhue) Second convolution: The number of channels is expanded from 32 to 64, and the feature size is reduced from 320 x 320 to 80 x 80, reducing the space by a factor of 4.
[0100] conv2 = nn.Conv2d(32, 64, kernel_size=4, stride=4, padding=0) Xhue = conv2(Xhue) The third convolution: the number of channels remains unchanged at 64, but the feature size is reduced from 320 x 320 to 80 x 80, reducing the space by a factor of 2.
[0101] conv3 = nn.Conv2d(64, 64, kernel_size=2, stride=2, padding=0) Xhue = conv3(Xhue) The Linear method learns a linear combination of input features using the weight matrix W and the bias b, thereby extracting or compressing information.
[0102] linear = nn.Linear(64, 64) pre_color_head_proj=linear(Xhue) The obtained pre_color_head_proj is added to the input of the original structure, and then the projection of the original structure is input for calculation.
[0103] Based on the final Xhue statistics, the maximum and mean values are concatenated with the maximum and mean values of the original input, and then linearly combined to extract or compress information.
[0104] The ColorWeight module adds a Projection module to automatically learn and fine-tune color relationships.
[0105] In this embodiment of the invention, four-channel image data is input to the improved YOLOv13 model. The feature vector at each spatial location in the multi-scale feature maps (e.g., feature maps of different levels such as H3, H4, and H5) extracted from the backbone network is regarded as an independent vertex. These vertices together constitute a hypergraph vertex set, where each vertex contains not only spatial location information but also a comprehensive feature representation learned from the original RGB channels and the optimized hue channels.
[0106] The color weighting module performs multi-level convolution and linear projection calculations on the features corresponding to the optimized hue channels in the hypergraph vertex set. For example, the optimized Hue layer is normalized, and then features are extracted sequentially through three convolutional layers. The kernel size and stride settings achieve a gradual reduction in feature map size and an expansion of the number of channels. Subsequently, linear projection calculations are performed on the convolution outputs, mapping them to a dimensional space that matches the original features. Simultaneously, statistical measures such as the mean and maximum values of the feature layers are concatenated with the original input statistics and used in the projection calculation, ultimately generating a hue sensitivity parameter reflecting the importance of the oyster mushroom's color features.
[0107] Based on the learned hue sensitivity parameters, vertices with correlation in color features are adaptively selected to form hyperedges. Each hyperedge can connect multiple vertices, and the connection is established considering not only the spatial proximity between vertices but also, more importantly, their similarity in optimizing hue channel features. The weights of the hyperedges are dynamically adjusted according to the correlation strength of color features between vertices, so that vertices with similar color features receive stronger connection weights.
[0108] The enhanced hypergraph feature representation is generated by aggregating the features of connected vertices through a hypergraph message passing mechanism. In this step, each vertex aggregates the feature information of all adjacent vertices in its hyperedge, with the aggregation weight determined by the hyperedge weight. This message passing mechanism allows vertices with similar color features to interact more fully, thereby enhancing the model's ability to perceive the color features of oyster mushrooms. After multiple rounds of message passing, each vertex contains both local and global contextual information, and the final hypergraph feature representation retains spatial structure information while strengthening the association of color features related to maturity.
[0109] According to the maturity identification method of oyster mushroom provided by the present invention, the enhanced hypergraph feature representation is input into a stacked attention module, and the feature weights are optimized through a multi-level attention stacking mechanism to obtain target feature information, including: Attention weights are assigned based on the enhanced hypergraph features to obtain the basic attention features; A feature stacking operation is performed on the basic attention features and the enhanced hypergraph features to obtain a cascaded feature representation; The cascaded feature representation is refined layer by layer through a multi-layer attention stacking mechanism, and the attention outputs of each layer are integrated based on a gating fusion mechanism to obtain the target feature information.
[0110] Stacked attention is an improved attention mechanism that enhances a model's ability to capture key information through multi-layered attention stacking. Its core idea is to progressively refine and focus on the most important features through the cascading of multiple attention layers. It mainly consists of a base attention layer, an information stacking mechanism, and gating or weight adjustment. The first attention layer performs preliminary information filtering on the input sequence; then, the initial attention output is combined with the original input as the input for the next attention layer, achieving attention stacking; then, each layer focuses on important information that the previous layer may have missed or not fully addressed, refining it layer by layer; finally, the attention results from each layer are integrated through weighted or gating mechanisms to achieve fusion. The mathematical expression is as follows: Attni = Attention(Qi, Ki, Vi); Hi = Gate(Attn i, H{i-1}); Where i represents the attention layer of the i-th layer.
[0111] The application of StockenAttention enables the model to capture local and global dependencies and features at different levels of abstraction simultaneously when outputting, achieving multi-granularity information capture, and achieving resistance to information loss through a stacking mechanism.
[0112] This invention uses the StockenAttention network structure to improve the neck network structure of the YOLOv13 model, which can further optimize the oyster mushroom maturity analysis model while improving performance and ensuring lightweight design.
[0113] In this embodiment of the invention, the enhanced hypergraph features are used as the input sequence, and the correlation between the query vector, key vector, and value vector is calculated through a basic attention layer. This basic attention layer adopts a standard scaled dot product attention mechanism, generates an attention weight distribution through a Softmax function, and performs a weighted summation of the value vectors to obtain the initially filtered basic attention features.
[0114] The output of the basic attention layer (basic attention features) is concatenated or added to the original hypergraph feature input to form a cascaded feature representation. This stacking mechanism preserves the integrity of the original features while incorporating the focusing information after attention weight allocation, providing a richer input basis for subsequent refinement processing.
[0115] The cascaded feature representations are used as input to the next attention mechanism, and attention computation and feature stacking operations are repeatedly performed. Each attention layer focuses on important information that the previous layer may have missed or not paid enough attention to, and the features are progressively refined through a cascaded processing flow. Multi-level attention stacking typically contains 2-4 attention layers, each of which extracts and enhances feature information from different granularities to form multi-scale feature representations.
[0116] For the output features generated during the multi-layer attention stacking process, the fusion weights of each feature are calculated using a gating function (such as the sigmoid function), and then weighted summation or concatenation operations are performed. The gating mechanism can adaptively adjust the contribution of features at different levels, effectively integrate local and global dependencies, and finally output target feature information that contains both detailed information and global context.
[0117] Through the embodiments of the present invention, attention weights are first assigned based on the enhanced hypergraph features to obtain basic attention features, which are then stacked with the hypergraph features to form a cascaded feature representation. Finally, a multi-level attention stacking mechanism is used to refine the features layer by layer and a gating fusion mechanism is combined to integrate the outputs of each layer to obtain the target feature information. This can more accurately capture the key features in oyster mushroom images, effectively improve the extraction and expression capabilities of oyster mushroom maturity-related features, and thus improve the accuracy and reliability of maturity recognition.
[0118] The following describes the maturity identification method for oyster mushrooms provided by this invention, and the model training and evaluation indicators in practical applications.
[0119] refer to Figure 7 , Figure 7 This is a graph showing the model loss value provided by this invention.
[0120] The hardware configuration of the model training platform of this invention is: Intel(R) Xeon(R) Platinum 8474C CPU, NVIDIA GeForce RTX 3090Ti GPU, 24GB of video memory. The software configuration is: CentOS 7 operating system, PyTorch 2.6.0 deep learning framework, CUDA version 12.4, and Python 3.11 programming language. During training, balancing training efficiency and hardware video memory size, the batch size is set to 16; when the number of training epochs is 400, the batch size is adjusted accordingly. Figure 7 As can be seen from the loss curve, the model's loss gradually tends to converge. Therefore, the training number of the experiment in this invention is set to 600.
[0121] The training parameter settings can be found in Table 2: Training parameter settings Parameter Value Batch size 16 Number of iterations (Epochs) 600 Learning rate 0.01 Momentum 0.937 Weight decay times 0.0005 This invention uses precision (P), recall (R), and mean average precision (mAP) to evaluate the model's detection accuracy, with a threshold of 0.5 for mAP. The model is evaluated using the number of model parameters, the number of computational operations per second (FLOPs), and the computational scale. Model size is selected as the deployability metric. Frames per second (FPS) is used to evaluate the model's real-time performance.
[0122] In this embodiment of the invention, to ensure the rationality of each module, the training effects of each module were compared by not selecting, selecting, and combining selection. The experiment included no network modification, adding the StokenAttention module, adding an HSV-H layer and the ColorWeight module without adding the StokenAttention module, and adding an HSV-H layer and both the ColorWeight and StokenAttention modules. The effects were compared on a test set of 877 images.
[0123] Table 3 lists the experimental comparison results: Models Precision (P / %) Recall Rate (Recall R / %) Mean average precision mAP@0.5 / % Parameters / M Computational cost: Floatpoint operations (FLOPs / G) Model weight size (Modelsize / MB) Yolov13n 86.95 87.54 86.6 2.46 3.15 5.23 StokenAttention-Yolov13 87.11 88.47 87.1 2.72 3.15 5.74 Color-Yolov13 87.95 89.75 88.5 2.46 3.16 5.23 Color-StokenAttention-Yolov13 89.92 90.91 89.5 2.72 3.16 5.74 As shown in Table 3, adding StokenAttention to the model's Neck improved the model's precision by 0.18 percentage points, recall by 1.06 percentage points, and mean precision by 0.5 percentage points. Adding ColorWeight improved the model's precision by 1.15 percentage points, recall by 2.54 percentage points, and mean precision by 2.19 percentage points. Adding both StokenAttention and ColorWeight improved the model's precision and recall by 3.41 and 3.90 percentage points, respectively, and the mean precision by 3.34 percentage points. In comparison, ColorWeight performed better than StokenAttention. Adding both ColorWeight and StokenAttention together resulted in a 10.56 percentage point increase in the number of model parameters and a 9.75 percentage point increase in model weights, but only a 0.32 percentage point increase in computation, which is negligible for performance in deployment environments.
[0124] To evaluate the performance of the improved model and its performance differences with other models in the task of detecting the maturity of oyster mushrooms, this invention selected several mainstream target detection models with similar parameter values: YOLOv12n, YOLOv11n, YOLOv10n, YOLOv9t, and YOLOv8n for comparative experiments. The results are shown in Table 4.
[0125] Models Accuracy P / % Recall rate R / % F1-Score Average accuracy mAP@0.5 / % Parameters / M Computational cost FLOPs / G Model weight size (MB) Frame rate (FPS) / (frames per second) YOLOv8n 84.75 88.76 81.04 88.9 3.01 4.1 6.03 18.9 YOLOv9t 92.74 96.11 88.49 94.0 20.16 38.78 39 10.17 YOLOv10n 87.14 89.10 82.37 88.4 2.71 4.20 5.59 14.04 YOLOv11n 86.41 89.63 81.53 89.1 2.59 3.22 5.28 13.39 YOLOv12n 83.95 88.54 79.14 85.6 2.52 2.99 5.27 10.15 Color-StokenAttention-Yolov13 89.92 90.91 88.7 89.5 2.72 3.16 5.73 20.92 As shown in Table 4, for the oyster mushroom maturity analysis dataset constructed in this invention, the average accuracy of the Color-StokenAttention-Yolov13 model is 89.92%, which is 7.11, 4.06, 3.19, -3.04, and 6.1 percentage points higher than the mainstream object detection models YOLOv12n, YOLOv11n, YOLOv10n, YOLOv9, and YOLOv8n, respectively. Regarding model weight size, the improved model has a weight size of 5.73 MB, which is lower than YOLOv9t and YOLOv8n. The model achieved accuracy and recall rates of 85.3 and 4.98 percentage points, respectively, exceeding those of YOLOv12n, YOLOv11n, and YOLOv10n by 8.72, 8.52, and 2.5 percentage points. In terms of detection speed, the Color-StokenAttention-Yolov13 model achieved an average detection rate of 20.92 frames per second, representing improvements of 10.77, 7.53, 6.88, 10.75, and 2.02 frames per second compared to YOLOv12n, YOLOv11n, YOLOv10n, YOLOv9, and YOLOv8n, respectively. Furthermore, experimental results showed that the Color-StokenAttention-Yolov13 model also significantly improved accuracy and recall compared to the other six models, exceeding the baseline YOLOv13n by 3.41 and 3.90 percentage points, respectively. Meanwhile, the model's parameter count and computational cost are lower than those of YOLOv11n, YOLOv10n, YOLOv9t, and YOLOv8n, and similar to those of YOLOv12 and YOLOv11. In summary, the oyster mushroom maturity analysis model proposed in this invention improves accuracy, recall, mean precision, and frame rate, while reducing the number of parameters, computational cost, and model weights. The model's technical indicators are superior, and it has the potential to be deployed on low-computing-power edge devices to meet the need for rapid and accurate detection of oyster mushroom maturity.
[0126] refer to Figure 8 , Figure 8 These are images of oyster mushroom maturity detection under different scenarios provided by this invention.
[0127] Table 4 shows that the frame rates of the YOLOv9t and YOLOv12n models are low and do not meet the speed requirements for recognition. This invention uses the YOLOv8n, YOLOv10n, YOLOv11n, and the improved YOLOv13 algorithm for visual comparison. An evaluation image is randomly selected from three scenarios: complex background occlusion, dim and blurry conditions, and small target conditions, for display. The detection results are shown. Figure 8As shown in the experiment, the comparison reveals that in complex scenes with significant interference, YOLOv8n, YOLOv10n, and YOLOv11n all exhibit false negatives, while Color-StokenAttention-Yolov13 accurately identifies the mushrooms. In dim and blurry scenes, Color-StokenAttention-Yolov13 accurately detects the maturity of oyster mushrooms and achieves a high score, while the other models show multiple detections and some false positives. In small-target oyster mushroom maturity recognition, the scores are generally low, but Color-StokenAttention-Yolov13 can identify more oyster mushroom targets and provide maturity recognition scores. This indicates that the improved algorithm can mitigate the impact of complex background occlusion, dim and blurry environments, and small-target environments on evaluation and recognition. The model provides solid technical support for the accurate detection of oyster mushroom maturity in three production environments: oyster mushroom greenhouses, semi-automated mushroom houses, and automated mushroom houses.
[0128] refer to Figure 9 , Figure 9 This is a visualization chart of oyster mushroom maturity analysis provided by the present invention.
[0129] To verify the actual performance of the improved YOLOv13n model in a production environment, the system was deployed on CentOS 7 using a web API microservice architecture and an NVIDIA 3090Ti GPU computing environment. The model achieved an average image detection speed of 13 frames per second. The deployment results are as follows: Figure 9 As shown, it achieves higher detection speed and better detection results, has better deployment prospects, and can meet the requirements of remote real-time detection.
[0130] This invention addresses the problems of low detection accuracy, weak generalization ability, and easy missed or false positives caused by the crowded, blurry, occluded, and difficult maturity classification of oyster mushrooms during the actual production environment. Based on the YOLOv13n model, a Color-StokenAttention-Yolov13 network model is proposed, which maintains essentially the same parameter quantity, model computational cost, weight file, and detection speed while achieving higher average accuracy. The main conclusions are as follows: Under the same experimental conditions, the improved Color-StokenAttention-Yolov13 model, compared with models such as YOLOv13n, YOLOv12n, YOLOv11n, YOLOv10n, YOLOv9t, and YOLOv8n, achieved superior experimental results on image datasets collected in oyster mushroom greenhouses, self-built semi-automated mushroom houses, and automated mushroom houses. Compared with the original YOLOv13n baseline model, the number of parameters and the model weights increased by 10.56 percentage points and 9.75 percentage points, respectively, while the computational cost only increased by 0.32 percentage points. The precision, recall, and mean precision improved by 3.41, 3.90, and 3.34 percentage points, respectively. The improved model can provide methodological support for the accurate detection of oyster mushroom maturity in greenhouses, self-built semi-automated mushroom houses, and automated mushroom house production environments. To verify the detection performance of Color-StokenAttention-Yolov13, this invention conducted a visual comparative analysis using five sets of comparative experiments. The results show that Color-StokenAttention-Yolov13 outperforms YOLOv8n, YOLOv10n, YOLOv11n, and YOLOv13n in different environments, demonstrating a greater advantage in the oyster mushroom maturity detection task.
[0131] This invention addresses the problems of low detection accuracy, weak generalization ability, and easy missed or false positives in oyster mushroom detection models caused by the overcrowding, blurring, occlusion, and difficulty in classifying the maturity of oyster mushrooms during the interactive period in actual production environments. Based on the growth pattern of color changes during the oyster mushroom's growth period, this invention proposes a YOLOv13 model design that integrates global color features with image features to enhance color features and improve model accuracy and generalization ability. First, we collected images of different growth stages under various environments to build a dataset. Second, based on color feature analysis, we found that the hue intervals of oyster mushrooms are relatively concentrated, and obtained a list of hue intervals of oyster mushrooms under different environments: [[3,38],[110,170]]. Third, based on the distribution of hue intervals of oyster mushrooms, we improved YOLOv13: First, we optimized the HSV-H hue layer of oyster mushrooms, setting the values in the non-hue interval list to 0 and using them as the fourth channel of the model input layer, changing the model input from 3 channels to 4 channels. Second, we designed a color weight module (ColorWeight) and improved the Adaptive Hyperedge Generation module, introducing the fourth channel information to enhance the feature hyperedge relationship. Finally, we added the StockenAttention attention mechanism to improve the neck network structure of the YOLOv13 model, enhancing the robustness and diversity of the model when processing sequence data, and improving performance while ensuring lightweight design. The experimental results show that compared to the original YOLOv13n baseline model, the improved model has increased parameters, size, and computational cost by 10.5%, 9.56%, and 0.317%, respectively, but improved precision, recall, and mean average precision (mAP) by 3.4, 3.8, and 3.3 percentage points, respectively. Deploying the improved model on Windows 2012 with an NVIDIA 3090Ti GPU, the model achieved a detection speed of 12.58 frames per second, meeting the requirements for real-time detection. Real-world testing results show that the improved model reduces false negatives and is more suitable for accurately identifying the maturity of oyster mushrooms in automated mushroom house environments, providing support for intelligent oyster mushroom harvesting.
[0132] The maturity identification device for oyster mushrooms provided by the present invention will be described below. The maturity identification device for oyster mushrooms described below can be referred to in correspondence with the maturity identification method for oyster mushrooms described above.
[0133] refer to Figure 10 , Figure 10 This is a schematic diagram of the oyster mushroom maturity identification device provided by the present invention.
[0134] The hue analysis module 1001 is used to perform hue feature analysis based on a preset oyster mushroom image dataset to obtain a list of oyster mushroom hue intervals. The oyster mushroom image dataset contains oyster mushroom images of the complete growth period under different growth environments. The hue optimization module 1002 is used to optimize the hue of the oyster mushroom image to be detected based on the oyster mushroom hue range list, so as to obtain the optimized hue channel of the oyster mushroom image to be detected. The channel merging module 1003 is used to merge the optimized hue channel of the oyster mushroom image to be detected with the original color channel of the oyster mushroom image to be detected, so as to obtain four-channel image data. The maturity recognition module 1004 is used to input four-channel image data into the improved YOLOv13 model to obtain the maturity recognition result of the oyster mushroom image to be detected output by the improved YOLOv13 model. The input of the improved YOLOv13 model is changed from 3 channels to 4 channels.
[0135] Specifically, the oyster mushroom maturity identification device provided by the present invention can realize all the method steps implemented in the above-mentioned oyster mushroom maturity identification method embodiment, and can achieve the same technical effect. Here, the parts that are the same as those in the method embodiment and the beneficial effects will not be described in detail.
[0136] Figure 11 This is a schematic diagram of the physical structure of the electronic device provided by the present invention, such as... Figure 11 As shown, the electronic device may include: a processor 1110, a communications interface 1120, a memory 1130, and a communications bus 1140, wherein the processor 1110, the communications interface 1120, and the memory 1130 communicate with each other through the communications bus 1140. The processor 1110 can call logic instructions in the memory 1130 to execute a method for identifying the maturity of oyster mushrooms. This method includes: performing hue feature analysis based on a preset oyster mushroom image dataset to obtain a list of oyster mushroom hue intervals, wherein the oyster mushroom image dataset contains images of oyster mushrooms at their complete growth stages under different growth environments; optimizing the hue of the oyster mushroom image to be detected based on the list of oyster mushroom hue intervals to obtain optimized hue channels of the oyster mushroom image to be detected; merging the optimized hue channels of the oyster mushroom image to be detected with the original color channels of the oyster mushroom image to be detected to obtain four-channel image data; and inputting the four-channel image data into an improved YOLOv13 model to obtain the maturity identification result of the oyster mushroom image to be detected output by the improved YOLOv13 model, wherein the input of the improved YOLOv13 model is changed from 3 channels to 4 channels.
[0137] Furthermore, the logical instructions in the aforementioned memory 1130 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0138] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the oyster mushroom maturity recognition method provided by the above methods. The method includes: performing hue feature analysis based on a preset oyster mushroom image dataset to obtain an oyster mushroom hue interval list, wherein the oyster mushroom image dataset contains oyster mushroom images of complete growth stages under different growth environments; optimizing the hue of the oyster mushroom image to be detected based on the oyster mushroom hue interval list to obtain an optimized hue channel of the oyster mushroom image to be detected; merging the optimized hue channel of the oyster mushroom image to be detected with the original color channel of the oyster mushroom image to be detected to obtain four-channel image data; inputting the four-channel image data into an improved YOLOv13 model to obtain the maturity recognition result of the oyster mushroom image to be detected output by the improved YOLOv13 model, wherein the input of the improved YOLOv13 model is changed from 3 channels to 4 channels.
[0139] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the maturity recognition method for oyster mushrooms provided by the above methods. The method includes: performing hue feature analysis based on a preset oyster mushroom image dataset to obtain a list of oyster mushroom hue intervals, wherein the oyster mushroom image dataset contains oyster mushroom images of complete growth stages under different growth environments; optimizing the hue of the oyster mushroom image to be detected based on the oyster mushroom hue interval list to obtain an optimized hue channel of the oyster mushroom image to be detected; merging the optimized hue channel of the oyster mushroom image to be detected with the original color channel of the oyster mushroom image to be detected to obtain four-channel image data; inputting the four-channel image data into an improved YOLOv13 model to obtain the maturity recognition result of the oyster mushroom image to be detected output by the improved YOLOv13 model, wherein the input of the improved YOLOv13 model is changed from 3 channels to 4 channels.
[0140] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0141] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or some parts of embodiments.
[0142] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for identifying the maturity of oyster mushrooms, characterized in that, include: Based on a pre-set oyster mushroom image dataset, hue feature analysis is performed to obtain a list of oyster mushroom hue ranges. The oyster mushroom image dataset contains oyster mushroom images of the complete growth period under different growth environments. Based on the oyster mushroom hue range list, the hue of the oyster mushroom image to be detected is optimized to obtain the optimized hue channel of the oyster mushroom image to be detected; The optimized hue channel of the oyster mushroom image to be detected is merged with the original color channel of the oyster mushroom image to be detected to obtain four-channel image data. The four-channel image data is input into the improved YOLOv13 model to obtain the maturity recognition result of the oyster mushroom image to be detected, which is output by the improved YOLOv13 model. The input of the improved YOLOv13 model is changed from 3 channels to 4 channels.
2. The method for identifying the maturity of oyster mushrooms according to claim 1, characterized in that, The step of optimizing the hue of the oyster mushroom image to be detected based on the oyster mushroom hue range list to obtain the optimized hue channel of the oyster mushroom image to be detected includes: The image of the oyster mushroom to be detected is converted from the RGB color space to the HSV color space to obtain the converted HSV image; Based on the converted HSV image, hue channel separation is performed to obtain the initial hue components; A mask is generated based on the mushroom hue range list. Pixel values in the initial hue components that do not belong to the preset hue range are set to zero to obtain an optimized hue channel.
3. The method for identifying the maturity of oyster mushrooms according to claim 1, characterized in that, The optimized hue channel of the oyster mushroom image to be detected is merged with the original color channel of the oyster mushroom image to be detected to obtain four-channel image data, including: The optimized hue channel is used as the fourth channel and is stitched together with the red, green, and blue channels in the original color channels of the mushroom image to be detected in the channel dimension to obtain four-channel image data.
4. The method for identifying the maturity of oyster mushrooms according to claim 1, characterized in that, The improved YOLOv13 model includes: an adaptive hypergraph computation module and a stacked attention module; The step of inputting the four-channel image data into the improved YOLOv13 model to obtain the maturity recognition result of the oyster mushroom image to be detected output by the improved YOLOv13 model includes: The adaptive hypergraph computation module is used to model the correlation between color features and spatial features in the four-channel image data to obtain an enhanced hypergraph feature representation. The enhanced hypergraph feature representation is input into the stacked attention module, and the feature weights are optimized through a multi-level attention stacking mechanism to obtain the target feature information. The target feature information is input into the detection head of the improved YOLOv13 model, and the maturity recognition result of the oyster mushroom image to be detected is output.
5. The method for identifying the maturity of oyster mushrooms according to claim 4, characterized in that, The adaptive hypergraph computation module performs correlation modeling on the color features and spatial features in the four-channel image data to obtain an enhanced hypergraph feature representation, including: The multi-scale feature map pixels in the four-channel image data are mapped to hypergraph vertices to obtain a hypergraph vertex set. The color weighting module performs multi-level convolution and linear projection calculations on the features corresponding to the optimized hue channels in the hypergraph vertex set to generate hue sensitivity parameters. Using the hue sensitivity parameter, hyperedge connections between vertices are adaptively established in the hypergraph vertex set, and the hyperedge weights are dynamically adjusted to obtain the vertex features that establish the connections. The vertex features of the established connections are aggregated using the hypergraph message passing mechanism to generate an enhanced hypergraph feature representation.
6. The method for identifying the maturity of oyster mushrooms according to claim 4, characterized in that, The enhanced hypergraph feature representation is input into the stacked attention module, and feature weights are optimized through a multi-level attention stacking mechanism to obtain target feature information, including: Based on the enhanced hypergraph features, attention weights are assigned to obtain basic attention features; The basic attention features and the enhanced hypergraph features are stacked to obtain a cascaded feature representation. The cascaded feature representation is refined layer by layer through a multi-level attention stacking mechanism, and the attention outputs of each layer are integrated based on a gating fusion mechanism to obtain the target feature information.
7. A device for identifying the maturity of oyster mushrooms, characterized in that, include: The hue analysis module is used to perform hue feature analysis based on a preset oyster mushroom image dataset to obtain a list of oyster mushroom hue intervals. The oyster mushroom image dataset contains oyster mushroom images of the complete growth period under different growth environments. The hue optimization module is used to optimize the hue of the oyster mushroom image to be detected based on the oyster mushroom hue range list, so as to obtain the optimized hue channel of the oyster mushroom image to be detected. The channel merging module is used to merge the optimized hue channel of the oyster mushroom image to be detected with the original color channel of the oyster mushroom image to be detected, so as to obtain four-channel image data. The maturity recognition module is used to input the four-channel image data into the improved YOLOv13 model to obtain the maturity recognition result of the oyster mushroom image to be detected output by the improved YOLOv13 model, wherein the input of the improved YOLOv13 model is changed from 3 channels to 4 channels.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the method for identifying the maturity of oyster mushrooms as described in any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the method for identifying the maturity of oyster mushrooms as described in any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the method for identifying the maturity of oyster mushrooms as described in any one of claims 1 to 6.