Intelligent recognition method for edible mushroom category and development stage based on machine vision

CN122597897BActive Publication Date: 2026-09-18郴州市农业科学研究所
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611081274.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-07-21
Publication Date
2026-09-18
Estimated Expiration
2046-07-21

AI Technical Summary

Technical Problem

由于缺少菌体部位分割、部位间拓扑关系和识别关注区域之间的联动约束,识别结果难以保持与食用菌真实形态结构一致

Benefits of technology

[0047] 1. By generating foreground regions of edible fungi from images, semantic segmentation of the cap, stipe, gills, and visible edges of the fungi is performed. A fungal morphology topology map is constructed based on contour morphology features, texture direction features, and relative position features of the parts. The recognition process can be transformed from judging the entire image pixels to a structured judgment based on the fungal parts and their connections. The overall visual features provide information about the overall appearance, while the local features of the parts provide fine-grained visual information about the cap, stipe, and gills. The fungal morphology topology map provides the adjacency, connection, and directional continuity relationships between parts. Topological constraint attention limits the above information to features that conform to the morphological structure of edible fungi. Therefore, non-fungal areas such as culture medium, bag folds, and shadow boundaries are no longer used as the main discrimination criteria. Stage-specific structural changes such as cap opening and closing, stipe ratio, and gill exposure can also be expressed separately from category features, reducing feature confusion between category recognition and developmental stage recognition, and ensuring that the recognition results are consistent with the actual structure of the edible fungi parts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122597897B_ABST
    Figure CN122597897B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of image recognition and image semantic understanding, and particularly discloses an intelligent mushroom class and development stage recognition method based on machine vision. The method acquires a mushroom image and generates a mushroom foreground region, performs part semantic segmentation on a cap, a stem, gills and a visible mushroom edge, and obtains a part region and a part confidence map; a mushroom shape topology graph is constructed according to contour morphology, texture direction and part relative position; whole image visual features, part local features and the topology graph are input into a hierarchical recognition network; each part feature is fused through topology constraint attention; and a mushroom class and development stage recognition result is output. The method makes the recognition basis correspond to the part structure and shape dependence of a mushroom, reduces the interference of background texture, local occlusion and stage appearance changes on the recognition result, and improves the consistency of class recognition and development stage recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image recognition and image semantic understanding technology, and specifically discloses a machine vision-based intelligent identification method for edible fungi categories and developmental stages. Background Technology

[0002] Machine vision recognition of edible fungi typically uses acquired images of the fungi as input, and obtains the recognition result through image preprocessing, target region extraction, feature representation, and classification. Conventional methods often employ whole-image classification, uniformly scaling the image containing the fungus, culture medium, bag edges, background, and shadow areas before feeding it into an image classification model. The model then learns classification features from pixel texture, color distribution, and local edges. Some methods extract foreground features before classification, removing some background areas through grayscale segmentation, color thresholding, edge detection, or connected component analysis, and then extracting color histograms, texture descriptors, contour shape parameters, or depth visual features based on the foreground region. For different varieties or maturity stages of edible fungi, existing methods usually rely on sample labeling to train the classifier, enabling the classifier to map the input image to a preset category or growth state label. While this approach is relatively straightforward, its recognition is primarily based on statistical features from the entire image or a rough foreground area, failing to reliably distinguish discriminative morphological parts such as the cap, stipe, gills, and fungal edges.

[0003] In further improved visual recognition schemes, some technologies introduce object detection or semantic segmentation to locate the edible fungus region, reducing the interference of the background on the recognition model. These schemes typically first obtain the region of the edible fungus using detection boxes or segmentation masks, and then perform classification and recognition on that region. Other schemes combine multi-task learning, placing category recognition and maturity recognition in the same model, reducing redundant computation by sharing feature layers. Because changes in the appearance of edible fungi are significantly location-dependent—cap opening and closing, stem elongation, gill exposure, and edge curling all affect image performance—simply detecting the entire fungal body region cannot fully express the spatial relationships between parts. Existing segmentation results are often only used as a basis for cropping or background removal, without further transforming the connection position between the cap and stem, the direction of gill texture, the curvature of the cap edge, and the relative relationships between different parts into structured features that can participate in recognition decisions. This results in classification models still potentially relying on background texture, local brightness, or non-critical surface markings to make judgments.

[0004] The main technical problem with existing technologies is that edible fungi image recognition lacks a structured visual representation mechanism centered on the fungal body parts and their morphological dependencies. This leads to category recognition and developmental stage recognition being easily interfered with by non-fungal background features, local occlusion features, and stage-specific appearance changes within the same image. For the same variety, the cap edge morphology, stipe ratio, visible gill range, and surface texture distribution change with developmental stages; for different varieties, colors and textures at similar developmental stages may be similar. If the model only makes judgments based on overall image features or coarse foreground features, it is easy to mistake morphological changes caused by growth stages for category differences, and also easy to mistake culture medium textures, bag wrinkles, or shadow boundaries for fungal features. Due to the lack of fungal body segmentation, topological relationships between parts, and linkage constraints between regions of interest for recognition, the recognition results are difficult to maintain consistency with the actual morphological structure of edible fungi. Summary of the Invention

[0005] The purpose of this invention is to provide a machine vision-based intelligent identification method for edible fungi categories and developmental stages, which can effectively solve the problems mentioned in the background art.

[0006] To achieve the above objectives, the technical solution adopted by the present invention is as follows:

[0007] A machine vision-based intelligent identification method for edible fungi categories and developmental stages includes: acquiring images of edible fungi and generating foreground regions of the fungi;

[0008] The foreground region of the fungal body is segmented semantically to obtain the location and position confidence maps of the cap, stipe, gills and visible edges of the fungal body;

[0009] Based on the extracted contour morphology features, texture direction features, and relative position features of the parts, a fungal morphology topology graph is constructed with edible fungi parts as nodes and morphological dependencies as edges. The fungal morphology topology graph uses each edible fungi part as a graph node and the morphological dependencies between parts as graph edges. The graph nodes carry part morphology attributes and confidence attributes, and the graph edges carry geometric association attributes and texture association attributes between parts.

[0010] The whole image visual features and local features of each part are extracted. The whole image visual features, local features of each part and the bacterial cell morphology topology map are input into the hierarchical recognition network. Through the topological constraint attention mechanism, the node attributes and edge attributes of the bacterial cell morphology topology map are combined to generate part association weights. The local features of each part are weighted and fused under the constraint of morphological relationship, and feature responses that do not meet the preset morphological dependency relationship are suppressed.

[0011] The hierarchical recognition network performs edible fungus category identification and development stage identification based on the fused features, and outputs the edible fungus category identification results and development stage identification results simultaneously; among them, the development stage identification takes the morphological features of the parts corresponding to the cap edge morphology, the length-to-width ratio of the stipe, and the degree of gill exposure as the core identification criteria.

[0012] Preferably, the generation of the bacterial cell foreground region includes: performing brightness smoothing and edge preservation processing on the edible fungus image to obtain candidate bacterial cell connected regions;

[0013] Color continuity features, boundary closure features, and texture density features are extracted within the connected domains of the candidate bacterial cells;

[0014] The color continuity feature, boundary closure feature, and texture density feature are input into the foreground discrimination network to generate a foreground mask;

[0015] Based on the foreground mask, the culture medium, bag folds, shadow boundaries, and non-bacterial background areas are removed, and the retained area is taken as the foreground area of ​​the bacteria.

[0016] Preferably, the semantic segmentation of the part includes: using the foreground region of the fungus as input, predicting the pixel belonging probability of the cap region, stipe region, gill region and visible fungal edge region respectively;

[0017] Establish competitive ownership relationships for overlapping pixels between adjacent regions;

[0018] The pixel attribution probability is consistently corrected based on the connection position between the cap and the stipe, the radial direction of the gill texture, and the continuity of the fungal body edge.

[0019] The corrected pixel attribution probability is converted into the region and the location confidence map.

[0020] Preferably, constructing the fungal morphology topology map includes mapping the cap, stipe, gills, and visible fungal edges as graph nodes;

[0021] Configure node features for each graph node, the node features including part area ratio, outer contour curvature, main texture direction and part position confidence;

[0022] Establish graph edges between graph nodes that have spatial adjacency, containment, connection, or directional continuity relationships;

[0023] Each edge is configured with edge features, including relative distance, connection angle, contour continuity, and texture direction difference.

[0024] Preferably, the foreground discrimination network includes parallel boundary discrimination branches and texture discrimination branches;

[0025] The boundary discrimination branch outputs candidate lines for the outer edge of the bacterial cell based on the boundary closure feature, and the texture discrimination branch outputs candidate regions for the inside of the bacterial cell based on the texture density feature;

[0026] The spatial consistency of the candidate lines at the outer edge of the bacterial cell and the candidate regions inside the bacterial cell is compared.

[0027] Pixels located outside the candidate line of the outer edge of the bacterial cell and whose texture is discontinuous with that of the candidate region inside the bacterial cell are marked with background, and the foreground mask is updated based on the background marking.

[0028] Preferably, the consistency correction includes: determining a candidate connection band between the cap region and the stipe region;

[0029] The pixel assignment probability within the candidate connection band is matched with the tangential direction of the two side contours;

[0030] Multiple main texture direction lines are extracted within the gill region, and the radial consistency of the main texture direction lines relative to the center of the cap region is calculated.

[0031] For pixels that do not meet the connection direction matching relationship or radial consistency relationship, reduce the pixel assignment probability of the corresponding part and reassign it to the part region with spatial relationship matching.

[0032] Preferably, the topological constraint attention includes: generating a part association weight matrix based on the node features and the edge features;

[0033] The spatial attention weights of each part in the overall visual features are obtained by mapping the part association weight matrix with the part position confidence map.

[0034] The local features of the region are weighted and aggregated according to the spatial attention weights;

[0035] When the connection angle, contour continuity, or texture direction difference between adjacent graph nodes does not meet the preset morphological dependency relationship, the attention weight of the corresponding graph node is suppressed, and the fused features are regenerated.

[0036] Preferably, the hierarchical recognition network includes a category recognition branch and a developmental stage recognition branch;

[0037] The category identification branch receives the fused features and the local discriminative features of the cap, stipe, and gills;

[0038] The developmental stage identification branch receives the fusion features as well as the cap edge curling features, the stipe length-to-width ratio features, and the gill exposure ratio features;

[0039] A shared site consistency constraint is set for the category recognition branch and the developmental stage recognition branch, so that the two recognition branches use effective visual features derived from the site region.

[0040] Preferably, the shared part consistency constraint includes: generating a category attention map based on the gradient response of the category identification branch, and generating a stage attention map based on the gradient response of the developmental stage identification branch;

[0041] Calculate the regional overlap relationship between the category attention map, the stage attention map, and the part location confidence map, respectively;

[0042] When the category attention map or the stage attention map deviates from the area of ​​the cap, stipe, gills and visible fungal edge, the feature response corresponding to the deviated area is attenuated, and the attenuated feature is re-input into the corresponding recognition branch.

[0043] Preferably, the output of edible fungi category identification results and developmental stage identification results includes: generating a topological consistency score based on the output confidence of the category identification branch, the output confidence of the developmental stage identification branch, and the regional overlap relationship;

[0044] The topology consistency score is jointly encoded with the node integrity and edge relationship integrity in the bacterial cell morphology topology graph to obtain the decision calibration vector;

[0045] The decision calibration vector is used to calibrate the confidence ranking of candidate categories and candidate developmental stages, and the recognition results that meet the calibration conditions are output.

[0046] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0047] 1. By generating foreground regions of edible fungi from images, semantic segmentation of the cap, stipe, gills, and visible edges of the fungi is performed. A fungal morphology topology map is constructed based on contour morphology features, texture direction features, and relative position features of the parts. The recognition process can be transformed from judging the entire image pixels to a structured judgment based on the fungal parts and their connections. The overall visual features provide information about the overall appearance, while the local features of the parts provide fine-grained visual information about the cap, stipe, and gills. The fungal morphology topology map provides the adjacency, connection, and directional continuity relationships between parts. Topological constraint attention limits the above information to features that conform to the morphological structure of edible fungi. Therefore, non-fungal areas such as culture medium, bag folds, and shadow boundaries are no longer used as the main discrimination criteria. Stage-specific structural changes such as cap opening and closing, stipe ratio, and gill exposure can also be expressed separately from category features, reducing feature confusion between category recognition and developmental stage recognition, and ensuring that the recognition results are consistent with the actual structure of the edible fungi parts.

[0048] 2. Building upon the structured recognition described above, the foreground discrimination network generates a foreground mask based on boundary closure, texture density, and color continuity. This reduces the number of non-fungal regions entering the subsequent segmentation and recognition process during the input stage. Competitive attribution relationships and consistency correction in part semantic segmentation incorporate the connection position between the cap and stipe, the radial direction of the gill texture, and the continuity of the fungal edge into pixel attribution decisions, reducing confusion between adjacent parts. Topological constraint attention generates part association weights based on node and edge features, subjecting local features to constraints based on connection angles, contour continuity, and texture direction differences during fusion. The category recognition branch and the developmental stage recognition branch share part consistency constraints, and the feature responses deviating from the fungal part are attenuated through the overlap between the attention map and the part location confidence map. These processes create a continuous image processing chain from segmentation, topology modeling, feature fusion, and decision calibration, reducing the impact of local background texture, part missegmentation, and attention region offset on the final recognition result. Attached Figure Description

[0049] Figure 1 This is a flowchart illustrating the overall processing flow of the machine vision-based intelligent identification method for edible fungi of the present invention.

[0050] Figure 2 This is a flowchart of the bacterial cell foreground region generation and semantic segmentation process of the present invention.

[0051] Figure 3 This is a flowchart of the construction of the bacterial cell morphology topology graph and the fusion of topological constraint attention in this invention;

[0052] Figure 4 This is a flowchart of the hierarchy identification, part consistency constraint and decision calibration of the present invention. Detailed Implementation

[0053] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.

[0054] Please refer to Figure 1This embodiment provides a machine vision-based intelligent identification method for edible fungi categories and developmental stages, including: acquiring edible fungi images and generating foreground regions of the fungi; performing semantic segmentation on the foreground regions of the fungi to obtain the cap, stipe, gills, and visible edges of the fungi, as well as a position confidence map; extracting contour morphology features, texture direction features, and relative position features of the parts based on the parts, and constructing a fungi morphology topology graph with edible fungi parts as nodes and morphological dependencies as edges; the fungi morphology topology graph uses each edible fungi part as a graph node and the morphological dependencies between parts as graph edges, wherein the graph nodes carry part morphological attributes and confidence attributes, and the graph edges carry geometric association attributes and texture association attributes between parts. The system extracts the overall visual features and local features of each part of the image. It then inputs the overall visual features, local features of each part, and the fungal morphology topology map into a hierarchical recognition network. Through a topological constraint attention mechanism, it generates part association weights by combining the node and edge attributes of the fungal morphology topology map. This weighted fusion of local features of each part, constrained by morphological relationships, suppresses feature responses that do not satisfy preset morphological dependencies. Based on the fused features, the hierarchical recognition network performs edible fungus category and developmental stage discrimination, simultaneously outputting the edible fungus category and developmental stage discrimination results. The developmental stage discrimination uses the morphological features corresponding to the cap edge shape, stipe length-to-width ratio, and gill exposure degree as the core discrimination criteria.

[0055] Specifically, based on the extracted contour morphology features, texture direction features, and relative position features of the parts, a fungal morphology topology map is constructed with edible fungal parts as nodes and morphological dependencies as edges. The overall visual features, local features of the parts, and the fungal morphology topology map are input into a hierarchical recognition network. The features of each part are fused through topological constraint attention, and the edible fungus category recognition result and developmental stage recognition result are output. In this embodiment, the edible fungus image can be a single, clustered, or partially overlapping visible light image of edible fungi. After the image is input, it does not directly enter the category determination, but forms a continuous processing chain through foreground extraction, part division, topological constraint, and hierarchical recognition, so that the recognition basis is transformed from the overall image color and texture to the fungal parts and their spatial relationships.

[0056] In this embodiment, when acquiring edible fungus images and generating the fungal foreground region, the input image is subjected to brightness normalization, edge-preserving filtering, and local contrast adjustment to preserve discernible gradient differences between the cap edge, stipe boundary, gill texture, and background folds. Subsequently, color continuity, boundary closure, texture density, and background difference features are extracted using pixel neighborhoods as the computational object. The foreground discrimination network maps these features into a foreground mask and preserves regions whose connectivity satisfies the fungal contour characteristics. Culture medium particles, bag folds, shadow boundaries, and image edge noise are marked as background. The fungal foreground region is only used as the input space for subsequent semantic segmentation and recognition. The working principle of this embodiment is to first limit the source of visual evidence and then perform part-level expression within the limited fungal region, thereby reducing the participation of non-fungal regions in classification from the source.

[0057] The confidence level of a foreground pixel can be calculated using the following formula:

[0058] ;

[0059] in, x represents the pixel position in the image. This indicates the confidence level that a pixel location belongs to the foreground of the bacterial cell. This represents a mapping operation that compresses the data into the range of 0 to 1. Indicates the continuity of color values. Indicates the value of boundary closure. Indicates the texture density value. Indicates the background difference value. , , and All are positive weighting coefficients, when =0.82、 =0.77、 =0.69、 When the weight coefficient is 0.18 and all four weight coefficients have the same value, the first three terms enhance the foreground judgment together, the background difference term deducts the confidence score, and the pixel position is retained as a candidate region for the bacterial cell. When the background wrinkles have strong edges but low color continuity and high background difference, the deduction term prevents the corresponding pixels from entering the foreground region of the bacterial cell, thereby forming an input boundary that matches the semantic segmentation of subsequent parts.

[0060] In this embodiment, when performing semantic segmentation on the foreground region of the fungus, the semantic segmentation network takes the image patch constrained by the foreground mask of the fungus as input, extracts shallow edge, local texture and deep morphological features in the shared coding layer, and generates pixel assignment probability maps for the cap, stipe, gills and visible fungal edges in the decoding layer. For the connection region between the cap and stipe, the transition region between the gills and the inner side of the cap, and the boundary region between the fungal edge and the background, a competitive assignment method is adopted so that each pixel can only form a main part label, and the confidence value of each candidate part is retained. The part location confidence map not only indicates whether the pixel belongs to a certain part, but also indicates the credibility of the part in subsequent topology modeling and attention fusion. This embodiment uses parallel processing of pixel-level assignment and confidence retention to enable the fungal image with unclear boundaries to still provide continuous data for structured recognition.

[0061] The pixel assignment correction for a given area can be calculated using the following formula:

[0062] ;

[0063] Where k represents any part of the cap, stipe, gills, or visible edge of the fungus. This represents the corrected probability of part attribution. This represents the initial attribution probability output by the semantic segmentation network for pixel location x. This represents the consistency coefficient formed by the connection location, texture direction, and edge continuity. This represents the set of all candidate parts. This represents a preset, extremely small positive number to prevent the denominator from being zero. When the initial assignment probabilities of the transition region between the cap and the stipe are close, if the local contour direction of the pixel is consistent with the extension direction of the stipe, then the stipe-corresponding... The value is higher than that corresponding to the cap. The revised This assigns the pixel to the stipe region, thereby reducing the cross-assignment of adjacent parts at the connection point.

[0064] In this embodiment, when extracting contour morphology features, texture direction features, and relative position features of the parts based on the said parts, the cap region is used to calculate the outer contour curvature, edge curling trend, and area ratio; the stipe region is used to calculate the aspect ratio, central axis direction, and connection angle with the cap; the gill region is used to calculate the radial texture direction, texture density variation, and visible area ratio; and the visible fungal body edge is used to calculate boundary continuity and foreground contour integrity. Subsequently, the edible fungus parts are mapped as graph nodes, and spatial adjacency, containment, connection, and directional continuity relationships are mapped as graph edges. Nodes carry part morphology information, and graph edges carry geometric and texture dependency information between parts. The fungal body morphology topology graph thus becomes the structured input of the hierarchical recognition network. This embodiment organizes discrete visual features into computable morphological relationships through graph structure, so that category recognition and developmental stage recognition share the same fungal body structural basis.

[0065] The edge weights of a graph can be calculated using the following formula:

[0066] ;

[0067] in, This represents the morphological dependency weight between part node i and part node j. This represents the normalized relative distance between parts. Indicates the angle between the direction of the connection between the parts and the preset anatomical direction. Indicates contour continuity. Normalized values ​​representing differences in texture direction. , , and This represents the positive coefficient for each item. It is used when the cap node and stipe node are adjacent, the connection angle is close to the central axis direction, the outline continuity is high, and the difference in texture direction is within a reasonable range. By generating higher values ​​and retaining the corresponding associations in subsequent attention fusion, when background lines or overlapping edges form false connections, relative distance, angle, and contour continuity will jointly reduce the image edge weights, thereby reducing the number of associations that do not conform to the bacterial cell morphology from entering the recognition network.

[0068] In this embodiment, to facilitate the disclosure of the data correspondence between bacterial cell features and topological features, the feature configuration method shown in Table 1 can be adopted. All data in Table 1 are calculated from the image processing results and enter the subsequent hierarchical recognition network without involving additional hardware structures or manual interpretation rules.

[0069] Table 1. Configuration of Visual and Topological Features of Edible Fungi:

[0070] In this embodiment, when the overall visual features, local features of the parts, and the fungal morphology topology map are input into the hierarchical recognition network, the overall visual features are obtained by convolutional coding or visual feature coding to preserve the overall color, texture, and contour distribution of the fungus. The local features of the parts are extracted and encoded by the cap, stipe, gills, and visible edge regions of the fungus to preserve the fine-grained discrimination information of each part. After the fungal morphology topology map is propagated through graph features, a node relationship representation is formed. The topological constraint attention performs weighted fusion of local features based on node confidence and graph edge weights. Feature responses with unreasonable connection angles, low contour continuity, or texture directions that do not conform to the part relationships are reduced. The hierarchical recognition network forms a category recognition result and a developmental stage recognition result on the same fused feature. This embodiment avoids the overall image classification from directly relying on local background texture through constrained fusion of multi-source features.

[0071] Topological constraint attention can be calculated using the following formula:

[0072] ;

[0073] in, This represents the attention weight corresponding to part node i. This represents the local characteristic response intensity of node i. This represents the confidence level of node i. This represents the set of nodes in the bacterial cell morphology topology graph. denoted as the set of nodes adjacent to site node i, when the confidence of the gill region is high and the radial texture relationship between it and the cap node is clear, the adjacent node propagation term in the molecule increases and the gill-related features participate in the developmental stage judgment. When the confidence of the visible edge region is low or there is no continuous outline with the cap node, the attention weight is reduced by the normalization operation, thereby making the fused features closer to the actual fungal site structure.

[0074] In this embodiment, the edible fungus category identification result is given by the category output layer of the hierarchical identification network, and the developmental stage identification result is given by the developmental stage output layer. The category output layer receives a fusion representation of cap texture, stipe morphology, gill radial relationship, and overall image color distribution. The developmental stage output layer receives a fusion representation of cap opening degree, cap edge curling, stipe elongation ratio, and gill exposure ratio. The two output layers share the fusion features generated by topological constraint attention and retain task-related discriminative components respectively. The working principle is that the same fungal morphology topology map simultaneously constrains the visual evidence sources of category and stage, so that the appearance changes of the same variety at different stages are classified into stage branches, and the differences in parts of different varieties at similar stages are classified into category branches. The advantage of this embodiment is that the identification process has closed-loop support between parts, relationships, and task branches, which can reduce misjudgments caused by background areas and stage morphological changes.

[0075] In a preferred embodiment, reference Figure 2 The process of generating the foreground region of the fungi includes: performing brightness smoothing and edge preservation processing on the edible fungi image to obtain candidate fungi connected regions; extracting color continuity features, boundary closure features, and texture density features within the candidate fungi connected regions; inputting the color continuity features, boundary closure features, and texture density features into a foreground discrimination network to generate a foreground mask; and removing culture medium, bag folds, shadow boundaries, and non-fungal background areas based on the foreground mask, and retaining the remaining areas as the fungi foreground region. Specifically, the brightness smoothing employs a joint constraint of local neighborhood mean and edge response to minimize local shadows. To avoid being mistaken for bacterial cell boundaries, edge preservation processing retains the structural boundaries formed by the light and dark variations of the cap, stipe, and gills. The candidate bacterial cell connected domain is formed by a set of pixels whose foreground confidence exceeds the retention condition and is connected to the main body contour. Color continuity features are used to distinguish the color break areas between the bacterial surface and the background. Boundary closure features are used to distinguish the natural contour of the bacterial cell from the background polygonal lines. Texture density features are used to distinguish the fine texture of the gills from the texture of the culture medium particles. The advantage of this embodiment is that background removal is based on the joint discrimination of color, boundary, and texture, reducing the foreground loss or background residue caused by single threshold segmentation.

[0076] Furthermore, the foreground discrimination network includes parallel boundary discrimination branches and texture discrimination branches. The boundary discrimination branch outputs candidate lines for the outer edge of the bacterial cell based on the boundary closure feature, and the texture discrimination branch outputs candidate regions inside the bacterial cell based on the texture density feature. The candidate lines for the outer edge of the bacterial cell and the candidate regions inside the bacterial cell are compared for spatial consistency. Pixels located outside the candidate lines for the outer edge of the bacterial cell and whose texture is discontinuous with the candidate regions inside the bacterial cell are marked with background, and the foreground mask is updated based on the background marking. In this embodiment, the boundary discrimination branch gives a high response to continuous arc edges, closed contour segments, and line segments consistent with the outer direction of the stipe. The texture discrimination branch gives a high response to regions inside the bacterial cell with continuous fine lines, uniform color transitions, or radial textures. The spatial consistency comparison requires that the candidate regions inside the bacterial cell are located within a reasonable range enclosed by the candidate lines for the outer edge, and that the texture extension direction does not cross the candidate lines for the outer edge into the background. The updated foreground mask excludes culture medium particles and bacterial bag folds outside the outer edge. The advantage of this embodiment is that boundary evidence and internal texture evidence are mutually verified, avoiding false foregrounds generated when relying solely on edges or textures.

[0077] In this embodiment, connectivity verification can be performed after the foreground mask is updated. Instead of filtering out regions by fixed area values, connectivity verification compares the boundary contact relationship, texture continuity, and color transition relationship between candidate regions and the main fungal body region. When there is a natural transition between the candidate region and the main fungal body region and the candidate region is located at a position where the cap, stipe, or gills may extend, the candidate region is retained. When the candidate region is only connected to the shadow boundary or background polyline and lacks fungal texture continuity, it is marked as background. The foreground mask thus retains the visible areas that still belong to the fungus in the case of partial occlusion, edge defects, or cluster overlap, and excludes irrelevant background areas from subsequent feature extraction. The advantage of this embodiment is that the foreground extraction process does not use simple area or brightness conditions as the only basis, but uses the visual continuity of the fungus as the basis for judgment, which can provide a more stable input boundary for subsequent semantic segmentation of parts.

[0078] In a preferred embodiment, the semantic segmentation of the part includes: using the foreground region of the fungus as input, predicting the pixel assignment probabilities of the cap region, stipe region, gill region, and visible fungus edge region respectively; establishing competitive assignment relationships for overlapping pixels between adjacent parts; performing consistency correction on the pixel assignment probabilities based on the connection position between the cap and stipe, the radial direction of the gill texture, and the continuity of the fungus edge; and converting the corrected pixel assignment probabilities into the part region and the part position confidence map. In this embodiment, the cap region prediction branch mainly receives the arc-shaped outer contour, surface texture, and top color transition features; the stipe region prediction branch mainly receives the longitudinal contour, central axis direction, and geometric features connected to the lower edge of the cap; the gill region prediction branch mainly receives the radial texture and dense linear variation features; and the visible fungus edge region prediction branch receives the outer edge gradient continuity and foreground mask boundary information. The competitive assignment relationship determines the pixel main label through normalized probability and part consistency coefficient. The advantage of this embodiment is that each part region is determined by its own visual features and the relationship with adjacent parts, reducing label confusion at connection points and occlusion points.

[0079] Further, the consistency correction includes: determining a connection candidate band between the cap region and the stipe region; matching the pixel assignment probability within the connection candidate band with the tangential direction of the two side contours; extracting multiple main texture direction lines within the gill region and calculating the radial consistency of the main texture direction lines relative to the center of the cap region; for pixels that do not satisfy the connection direction matching relationship or the radial consistency relationship, reducing the pixel assignment probability of the corresponding part and reassigning it to the part region with spatial relationship matching. In this embodiment, the connection candidate band is formed by the local neighborhood between the lower edge of the cap and the upper end of the stipe, and the contour tangential direction is calculated from the main edge gradient direction. If a pixel is located in the connection candidate band and the two side contours are continuously transitioned, its connection part assignment is retained. If the pixel texture direction is radial and points to the center of the cap region, the consistency coefficient of gill assignment is increased. If the pixel boundary direction is continuous with the outer edge of the fungus and does not have internal texture, it is assigned to the visible fungus edge region. The advantage of this embodiment is that it uses the directional rules of edible fungus morphology to correct the pixel-level segmentation results, making the part position confidence map closer to the real structure of the fungus.

[0080] In a preferred embodiment, reference Figure 3 The construction of the fungal morphology topology map includes: mapping the cap, stipe, gills, and visible fungal edges as graph nodes; configuring node features for each graph node, including part area ratio, outer contour curvature, main texture direction, and part position confidence; establishing graph edges between graph nodes with spatial adjacency, inclusion, connection, or directional continuity relationships; configuring edge features for each graph edge, including relative distance, connection angle, contour continuity, and texture direction difference. In this embodiment, the cap node records the proportion of the cap area in the foreground area, the outer edge curvature distribution, and the local morphology at the connection with the stipe; the stipe node records the longitudinal main axis, width variation, and connection relationship with the cap; the gill node records the relationship between the radial texture direction and the cap center; and the visible fungal edge node records the continuity of the foreground boundary. The graph edges are not arbitrarily connected, but are established based on whether there is spatial adjacency, anatomical inclusion, contour connection, or directional continuity of texture between parts. The advantage of this embodiment is that it transforms the local features of the parts into a relational graph that can participate in the calculation, avoiding the classification network from only receiving scattered local features.

[0081] In this embodiment, the generation of the fungal morphology topology map also includes node integrity verification and edge relationship integrity verification. Node integrity is jointly given by the area of ​​the part region, the confidence distribution of the part position, and the continuity of the boundary. Edge relationship integrity is jointly given by the connection angle, relative distance, and texture direction difference between adjacent nodes. When the confidence of the cap node is high but it lacks a reasonable connection with the stipe node, the topology map retains the node but reduces the transmission weight of the corresponding edge. When the texture direction of the gill node does not have radial consistency with the center of the cap, the topology map marks the relationship as a low integrity relationship. When occlusion causes a local missing part, the existing nodes still generate local features according to the visible area and establish restricted connections with adjacent nodes. The advantage of this embodiment is that the topology map does not become invalid as a whole due to local missing parts, and it can mark unreliable part relationships for subsequent fusion processing.

[0082] In a preferred embodiment, the topological constraint attention includes: generating a part association weight matrix based on the node features and the edge features; mapping the part association weight matrix to the part position confidence map to obtain the spatial attention weight of each part in the overall visual features; weighting and aggregating the local features of the part according to the spatial attention weight; and suppressing the attention weight of the corresponding graph node and regenerating the fusion feature when the connection angle, contour continuity, or texture direction difference between adjacent graph nodes does not meet the preset morphological dependency relationship. In this embodiment, the rows and columns of the part association weight matrix correspond to the cap, stipe, gill, and visible fungal edge nodes. The matrix elements are calculated by the graph edge weight, node confidence, and the integrity of the relationship between parts. When mapped to the overall visual features, the part position confidence map provides the pixel spatial position, the association weight matrix provides the reliable relationship between parts, and the spatial attention weight is obtained by multiplying and normalizing the two. During weighted aggregation, each local feature enters the fusion vector according to the corresponding spatial attention weight. The advantage of this embodiment is that feature fusion is constrained by the fungal morphology, and image responses that do not conform to the part relationship will not enter the classification judgment with high weight.

[0083] In this embodiment, the fusion feature can be obtained by concatenating local features of the part, visual features of the whole image, and topological propagation features and then performing nonlinear mapping. The nonlinear mapping layer sets a shared scale for features from the cap, stipe, gills, and visible edges of the fungus, so that the responses of different parts can be compared in the same feature space. If the confidence of a certain part region is low, the corresponding local features will not be directly deleted, but their contribution to the fusion feature will be weakened by attention weight. If the edge weight between a certain part and its adjacent parts is high, the corresponding part features can supplement the structural information of the adjacent parts during the propagation process. After the topological propagation features and the visual features of the whole image enter the hierarchical recognition network, the overall appearance can be preserved while limiting the relationship between parts. The advantage of this embodiment is that it uses soft constraints on low-confidence parts instead of simple removal, which can adapt to the common local occlusion and boundary blurring situations in edible fungus images.

[0084] In a preferred embodiment, reference Figure 4 The hierarchical recognition network includes a category recognition branch and a developmental stage recognition branch. The category recognition branch receives the fused features and local discriminative features of the cap, stipe, and gills. The developmental stage recognition branch receives the fused features and features of cap edge curling, stipe aspect ratio, and gill exposure ratio. A shared site consistency constraint is set for the category recognition branch and the developmental stage recognition branch, enabling the two recognition branches to use effective visual features from the site regions. In this embodiment, the category recognition branch uses cap texture differences, stipe morphological differences, and gill direction differences as the main discriminative inputs, while the developmental stage recognition branch uses the cap edge opening / closing state, stipe longitudinal extension state, and gill visibility range as the main discriminative inputs. The fused features provide a common morphological topology background for the two branches. The shared site consistency constraint requires that the areas of interest of both branches fall within the range of the fungal body site defined by the site location confidence map. The advantage of this embodiment is that category change factors and stage change factors in the same image are assigned to different branches for processing, reducing feature competition between the two.

[0085] In this embodiment, the training data for the category recognition branch and the developmental stage recognition branch can be constructed using the category label and developmental stage label of the same edible fungus image. The loss function of the category recognition branch constrains the category output distribution, the loss function of the developmental stage recognition branch constrains the stage output distribution, and the part consistency constraint constrains the gradient response regions of the two branches, so that the category judgment is not concentrated on the texture of the culture medium, the edge of the bag, or the shadow area, and the developmental stage judgment is not concentrated on the background brightness or local blemish areas that are unrelated to the maturity state. During the training process, the part location confidence map provides soft boundaries, allowing the blurred areas of the fungal body edge to participate in the learning with low weight. The advantage of this embodiment is that the training target of the recognition branch is associated with the part semantic segmentation result, which enables the output result to have a traceable visual source.

[0086] In a preferred embodiment, the shared site consistency constraint includes: generating a category attention map based on the gradient response of the category identification branch, and generating a stage attention map based on the gradient response of the developmental stage identification branch; calculating the regional overlap relationship between the category attention map, the stage attention map, and the site location confidence map; when the category attention map or the stage attention map deviates from the site region of the cap, stipe, gills, and visible fungal edge, the feature response corresponding to the deviated region is attenuated, and the attenuated feature is re-input into the corresponding identification branch. In this embodiment, the gradient response is calculated by the inverse sensitivity of the output layer to the fused feature map, the category attention map represents the dependence of the category output on different spatial regions, the stage attention map represents the dependence of the developmental stage output on different spatial regions, and the regional overlap relationship is obtained by the product of the attention map and the site location confidence map in spatial position and the normalized ratio. When the attention map mainly falls in non-fungal regions, the feature response of the deviated region is multiplied by an attenuation coefficient less than 1 and re-participates in the branch calculation. The advantage of this embodiment is that the model judgment process is constrained by visible site evidence, reducing the identification error caused by the deviation of high response regions from the fungal structure.

[0087] The overlap of regions can be calculated using the following formula:

[0088] ;

[0089] in, This represents a preset, extremely small positive number, used to prevent the denominator from being zero. Represents the set of spatial locations in an image. This indicates the overlap between the areas of interest and the parts of interest. This represents the response value of the category attention map or stage attention map at pixel position x. This represents the cell location reliability synthesized from the cell location reliability maps of the cap, stipe, gills, and visible cell edges. When the focus of the response is concentrated in the cap, stipe, or gill region, the numerator and denominator are close. Higher values ​​result in the branch output being retained, especially when the focus is on the bag folds or shaded boundaries. The value is relatively low. The feature decays and triggers the attenuation of off-site features, thereby aligning the identification output with the evidence of the location.

[0090] In a preferred embodiment, the output of edible fungus category identification results and developmental stage identification results includes: generating a topological consistency score based on the output confidence of the category identification branch, the output confidence of the developmental stage identification branch, and the regional overlap relationship; jointly encoding the topological consistency score with the node integrity and edge relationship integrity in the fungal morphology topology map to obtain a decision calibration vector; calibrating the confidence ranking of candidate categories and candidate developmental stages using the decision calibration vector, and outputting identification results whose ranking meets the calibration conditions. In this embodiment, the category identification branch provides the confidence sequence of each candidate category, the developmental stage identification branch provides the confidence sequence of each candidate stage, the regional overlap relationship provides information on whether the location of the evidence of interest is reliable, the node integrity provides information on whether the cap, stipe, gills, and visible edges are sufficiently visible, and the edge relationship integrity provides information on whether the topological relationship between parts conforms to the structure of edible fungi. The jointly encoded decision calibration vector rearranges the candidate results without changing the front-end image features. The advantage of this embodiment is that the output stage simultaneously refers to the classification confidence, stage confidence, and structural integrity, reducing high-confidence misjudgments in cases of insufficient local evidence.

[0091] Candidate result calibration can be calculated using the following formula:

[0092] ;

[0093] in, This represents the joint calibration score composed of candidate category p and candidate developmental stage q. This represents the confidence level of the category recognition branch in the output of candidate category p. This represents the confidence level of the developmental stage identification branch for the output of the candidate developmental stage q. This represents the structural integrity value, which is a combination of node integrity and edge relation integrity. , , and This represents the non-negative calibration coefficient, which is used when the candidate class has high confidence but the region of interest deviates from the bacterial cell and has low structural integrity. and The joint calibration score is reduced by working together. When both the candidate category and the candidate stage have high confidence and the part relationship is complete, the joint calibration score maintains a high ranking, thereby outputting a recognition result that is consistent with the image part evidence and topological relationship.

[0094] In this embodiment, the decision calibration vector can be formed by concatenating category confidence, stage confidence, region overlap, node integrity, and edge integrity. After normalization, it is applied to the ranking process of candidate categories and candidate developmental stages. If two candidate categories are similar in color and texture, the decision calibration vector prioritizes comparing topologically related data such as cap outer contour curvature, stipe connection angle, and gill radial texture. If two candidate developmental stages are similar in overall color, the decision calibration vector prioritizes comparing stage-related data such as cap edge curling, stipe aspect ratio, and gill exposure ratio. The output result can include category identifier, developmental stage identifier, part location confidence, and topological consistency score. The advantage of this embodiment is that the recognition result is formed by image features, part structure, and decision calibration, which can support the stable determination of edible fungi category and developmental stage.

[0095] In the above embodiments, foreground extraction provides the bacterial cell input boundary for part semantic segmentation, part semantic segmentation provides the node and confidence basis for morphological topology modeling, morphological topology graph provides node features and edge features for topological constraint attention, topological constraint attention provides fusion features constrained by part relationships for category recognition branch and developmental stage recognition branch, and part consistency constraint and decision calibration vector verify the evidence location and structural integrity of the output results. The entire processing chain revolves around the bacterial cell parts and their morphological dependencies, which can avoid directly using background texture, local brightness and non-critical spots for judgment in whole image classification. The advantage of this set of embodiments is that there are input-output reference relationships and data constraint relationships between each processing link, so that the category features, stage features and background interference in edible fungus images are distinguished and processed at different computing levels.

Claims

1. A machine vision-based intelligent identification method for edible fungi categories and developmental stages, characterized in that, include: Acquire images of edible fungi and generate foreground regions of the fungi cells; The foreground region of the fungal body is segmented semantically to obtain the location and position confidence maps of the cap, stipe, gills and visible edges of the fungal body; Based on the extracted contour morphology features, texture direction features, and relative position features of the parts, a fungal morphology topology graph is constructed with edible fungi parts as nodes and morphological dependencies as edges. The fungal morphology topology graph uses each edible fungi part as a graph node and the morphological dependencies between parts as graph edges. The graph nodes carry part morphology attributes and confidence attributes, and the graph edges carry geometric association attributes and texture association attributes between parts. The whole image visual features and local features of each part are extracted. The whole image visual features, local features of each part and the bacterial cell morphology topology map are input into the hierarchical recognition network. Through the topological constraint attention mechanism, the node attributes and edge attributes of the bacterial cell morphology topology map are combined to generate part association weights. The local features of each part are weighted and fused under the constraint of morphological relationship, and feature responses that do not meet the preset morphological dependency relationship are suppressed. The hierarchical recognition network performs edible fungus category identification and development stage identification based on the fused features, and simultaneously outputs the edible fungus category identification results and development stage identification results; The developmental stage is determined based on the morphological characteristics of the parts corresponding to the edge morphology of the cap, the length-to-width ratio of the stipe, and the degree of exposure of the gills. The generation of the bacterial cell foreground region includes: performing brightness smoothing and edge preservation processing on the edible fungus image to obtain candidate bacterial cell connected regions; Color continuity features, boundary closure features, and texture density features are extracted within the connected domains of the candidate bacterial cells; The color continuity feature, boundary closure feature, and texture density feature are input into the foreground discrimination network to generate a foreground mask; Based on the foreground mask, the culture medium, bag folds, shadow boundaries and non-bacterial background areas are removed, and the retained area is taken as the foreground area of ​​the bacteria. The hierarchical recognition network includes a category recognition branch and a developmental stage recognition branch; The category identification branch receives the fused features and the local discriminative features of the cap, stipe, and gills; The developmental stage identification branch receives the fusion features as well as the cap edge curling features, the stipe length-to-width ratio features, and the gill exposure ratio features; A shared site consistency constraint is set for the category recognition branch and the developmental stage recognition branch, so that the two recognition branches use effective visual features derived from the site region; The shared site consistency constraint includes: generating a category attention map based on the gradient response of the category-identified branch, and generating a stage attention map based on the gradient response of the developmental stage-identified branch; Calculate the regional overlap relationship between the category attention map, the stage attention map, and the part location confidence map, respectively; When the category attention map or the stage attention map deviates from the area of ​​the cap, stipe, gills and visible fungal edge, the feature response corresponding to the deviated area is attenuated, and the attenuated feature is re-input into the corresponding recognition branch.

2. The intelligent identification method for edible fungi categories and developmental stages based on machine vision according to claim 1, characterized in that, The semantic segmentation of the part includes: using the foreground region of the fungus as input, predicting the pixel belonging probability of the cap region, stipe region, gill region and visible fungal edge region respectively; Establish competitive ownership relationships for overlapping pixels between adjacent regions; The pixel attribution probability is consistently corrected based on the connection position between the cap and the stipe, the radial direction of the gill texture, and the continuity of the fungal body edge. The corrected pixel attribution probability is converted into the region and the location confidence map.

3. The intelligent identification method for edible fungi categories and developmental stages based on machine vision according to claim 2, characterized in that, Constructing the fungal morphology topology graph includes mapping the cap, stipe, gills, and visible fungal edges as graph nodes, respectively. Configure node features for each graph node, the node features including part area ratio, outer contour curvature, main texture direction and part position confidence; Establish graph edges between graph nodes that have spatial adjacency, containment, connection, or directional continuity relationships; Each edge is configured with edge features, including relative distance, connection angle, contour continuity, and texture direction difference.

4. The intelligent identification method for edible fungi categories and developmental stages based on machine vision according to claim 3, characterized in that, The foreground discrimination network includes parallel boundary discrimination branches and texture discrimination branches; The boundary discrimination branch outputs candidate lines for the outer edge of the bacterial cell based on the boundary closure feature, and the texture discrimination branch outputs candidate regions for the inside of the bacterial cell based on the texture density feature; The spatial consistency of the candidate lines at the outer edge of the bacterial cell and the candidate regions inside the bacterial cell is compared. Pixels located outside the candidate line of the outer edge of the bacterial cell and whose texture is discontinuous with that of the candidate region inside the bacterial cell are marked with background, and the foreground mask is updated based on the background marking.

5. The intelligent identification method for edible fungi categories and developmental stages based on machine vision according to claim 4, characterized in that, The consistency correction includes: identifying a candidate connection band between the cap region and the stipe region; The pixel assignment probability within the candidate connection band is matched with the tangential direction of the two side contours; Multiple main texture direction lines are extracted within the gill region, and the radial consistency of the main texture direction lines relative to the center of the cap region is calculated. For pixels that do not meet the connection direction matching relationship or radial consistency relationship, they are reassigned to the spatial relationship matching region.

6. The intelligent identification method for edible fungi categories and developmental stages based on machine vision according to claim 5, characterized in that, The topological constraint attention includes: generating a part association weight matrix based on the node features and the edge features; The spatial attention weights of each part in the overall visual features are obtained by mapping the part association weight matrix with the part position confidence map. The local features of the region are weighted and aggregated according to the spatial attention weights; When the connection angle, contour continuity, or texture direction difference between adjacent graph nodes does not meet the preset morphological dependency relationship, the attention weight of the corresponding graph node is suppressed, and the fused features are regenerated.

7. The intelligent identification method for edible fungi categories and developmental stages based on machine vision according to claim 6, characterized in that, The output results for edible fungi category identification and developmental stage identification include: generating a topological consistency score based on the output confidence of the category identification branch, the output confidence of the developmental stage identification branch, and the regional overlap relationship; The topology consistency score is jointly encoded with the node integrity and edge relationship integrity in the bacterial cell morphology topology graph to obtain the decision calibration vector; The decision calibration vector is used to calibrate the confidence ranking of candidate categories and candidate developmental stages, and the recognition results that meet the calibration conditions are output.

Citation Information

Patent Citations

  • Edible mushroom phenotypic characteristic analysis method and system based on multi-modal data fusion

    CN122115818A

  • Decoration structure parameterization identification design method and system fused with computer vision

    CN122312923A