Method for analyzing morphological parameters of coniferous wood tracheid and intercellular space based on computer vision
By optimizing the U-Net network and cSE module, combined with OpenCV for image preprocessing and automatic segmentation, the challenges of image segmentation and feature extraction of wood microstructures are solved, and higher image quality and segmentation accuracy are achieved.
Patent Information
- Application Number
- CN202510542561.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-28
- Publication Date
- 2025-05-30
AI Technical Summary
Existing computer vision technology has image quality problems and blurred boundaries of complex structures when dealing with wood microstructures, resulting in poor image segmentation and feature extraction effects.
A segmentation model based on optimized U-Net network is adopted, combined with cSE module and OpenCV for image preprocessing, including histogram equalization, image sharpening and denoising, and the tracheal area is automatically segmented and quantitatively analyzed.
It improves image quality and segmentation effect, reduces the difference in manual operations, improves the repeatability and segmentation accuracy of the study, especially in the recognition of small structures.
Smart Images

Figure CN120071348A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer vision, and particularly to a method for analyzing the morphological parameters of coniferous tracheids and cell gaps based on computer vision. Background Art
[0002] Wood is of great significance globally. It is not only a major source of renewable energy but also plays a key role in multiple fields such as construction and packaging. In addition, the growth and development of wood contribute to the absorption of carbon dioxide in the atmosphere, thus also playing an important role in mitigating global warming. Therefore, wood is not only an important part of economic activities but also a key factor in environmental protection and sustainable development. Wood is mainly composed of cell walls and cell gaps, and its appearance and texture largely depend on the arrangement and type of cells. Therefore, the study of wood cells is particularly important. However, the traditional methods for measuring wood cells are time-consuming and laborious, and the accuracy is also a problem. The method using computer vision technology can extract anatomical statistical features such as the shape, size, quantity, and distribution of wood cells from microscopic images, effectively improving these problems.
[0003] In 2008, Xu Yu et al. from Northeast Forestry University, based on the method of extracting wood cells based on edge contours, adopted an improved watershed image segmentation algorithm based on mathematical morphology to finely extract the microscopic structure contours of wood cells.
[0004] In 2013, Liu Zihao et al. used the methods of kernel principal component analysis (KPCA) and adaptive boosting (AdaBoost) to process and classify the microscopic structure images of wood cross-sections, so as to identify wood.
[0005] In 2023, Xi Jingyu et al. adopted the U-Net semantic segmentation model and the YOLO object detection algorithm to identify and process the ray part of the wood tangential section and extract its characteristic parameters.
[0006] Combined with the above research results, it is found that there are some problems and defects in the current computer vision in the field of wood microstructure processing, mainly including: 1. The shooting conditions of wood microscopic images, such as lighting and resolution, may affect the image quality, resulting in problems such as blurring and noise in the images, which affect the effect of image processing and feature extraction. 2. The microscopic structure of wood is highly complex, and features such as cell walls, wood rays, and intercellular fissures may highly overlap, resulting in blurred boundaries of different microscopic structures in the image. This makes the tasks of image segmentation and feature extraction extremely challenging, especially in the case of insufficient labeled data, it is difficult to accurately identify each detail.
[0007] In view of these problems and deficiencies, it is necessary to further improve the existing deep learning model and perform data augmentation on it to further enhance the performance of the model in detail extraction. Summary of the Invention
[0008] Based on this, in view of the above technical problems, it is necessary to propose a method for analyzing the morphological parameters of tracheids and cell gaps in softwood based on computer vision.
[0009] The present invention is realized through the following technical solutions: A method for analyzing the morphological parameters of tracheids and cell gaps in softwood based on computer vision includes the following steps: S1: Collect a cross-sectional sample of softwood, and perform slicing, staining, dehydration, and sealing on the cross-sectional sample to obtain a cross-sectional thin slice; S2: Take a microscopic photo of the cross-sectional thin slice to obtain a cross-sectional image; S3: Preprocess the cross-sectional image to obtain a preprocessed image; S4: Label the tracheid region in the preprocessed image, construct a labeled data set, and divide the labeled data set into a training set and a test set according to a preset ratio; S5: Construct a segmentation model based on the optimized U-Net network, train the segmentation model with the training set, test the segmentation model with the test set, and retain the model parameters that meet the preset evaluation criteria; Input the cross-sectional image of the softwood to be analyzed into the trained segmentation model to automatically segment the tracheid region image; S6: Perform quantitative analysis on the tracheid region image to obtain the tracheid parameters and cell gap morphological parameters of softwood.
[0010] Further, in step S3, the preprocessing includes histogram equalization, image sharpening, and image denoising; The formula expression of the histogram equalization is:
[0011] In the formula, V(i) is the pixel value after histogram equalization, round is the rounding function, CDF(i) is the cumulative distribution probability of pixel i, W and H are the width and height of the cross-sectional image respectively, and CDFmin is the minimum value of the cumulative distribution function; The formula expression of the image sharpening is:
[0012] In the formula, S(i, j) is the pixel value of the sharpened image, I(i, j) is the pixel value of the image before sharpening, and K is the sharpening kernel; The formula expression of the image denoising is:
[0013] Wherein, I'(x, y) is the pixel value after filtering at the point (x, y), k is the set neighborhood boundary length, S(x + i, y + j) is the pixel value at the point (x + i, y + j) in the image after sharpening, and G(i, j) is the Gaussian weight at the point (i, j).
[0014] Further, in step S5, the construction and training process of the segmentation model based on the optimized U-Net network includes: Construct a segmentation model based on the basic U-Net network; Add a cSE module to the U-Net network; Use F1-Score and mIoU as the evaluation metrics of the segmentation model, train the segmentation model with the training set, verify the performance of the segmentation model with the test set, and retain the segmentation model parameters with scores higher than the preset evaluation criteria to obtain the trained segmentation model.
[0015] Further, the segmentation model of the basic U-Net network includes: A downsampling module for gradually reducing the resolution of the preprocessed image and extracting the features of the preprocessed image; An upsampling module for gradually restoring the resolution of the preprocessed image and generating the final segmentation result; A bottleneck for connecting the downsampling module and the upsampling module; A skip connection layer for connecting the feature map of the downsampling module to the upsampling module.
[0016] Further, the construction process of the cSE module includes: Channel compression, expressed by the formula: ;
[0017] Wherein, z is the global average pooling result of the input feature map X in the channel dimension, H 1 、W 1 are the height and width of the input feature map X respectively, AvgPool is the global average pooling, and C is the number of channels; Feature recalibration, expressed by the formula:
[0018] Wherein, s is the generated channel attention weight, ω 1 、ω 2 are the weight matrices of the two fully connected layers respectively, and have shapes 、 , r is the compression ratio, ReLU is the activation function, is the activation function; Generate an attention map, and the formula is expressed as:
[0019] In the formula, AttentionMAP is the normalized attention map, and Sigmoid is the normalization function; Feature recalibration to the original image, and the formula is expressed as:
[0020] In the formula, ⊙ is the element-wise multiplication, and Y is the feature map after channel recalibration.
[0021] Furthermore, F1-Score includes precision and recall. Among them, the formula for the precision P is expressed as:
[0022] In the formula, TP is the true positive example, that is, the number of samples correctly predicted as the positive class, and FP is the false positive example, that is, the number of samples wrongly predicted as the positive class; The formula for the recall R is expressed as:
[0023] In the formula, FN is the false negative example, that is, the number of samples wrongly predicted as the negative class; Then the formula for the final F1-Score is expressed as:
[0024] In the formula, F1 is the F1-Score index score.
[0025] Furthermore, the calculation method of the mIoU score includes: Calculate the IoU of each category, and the calculation formula is expressed as:
[0026] In the formula, IoU is the semantic segmentation score of a single category; Take the average of the IoUs of all categories, and the formula is expressed as:
[0027] In the formula, mIoU is the final semantic segmentation score, N is the number of categories in the segmentation task, and a = 1, 2, 3,..., N.
[0028] Furthermore, in step S6, the tracheid parameters include tracheid area, tracheid perimeter, tracheid roundness, tracheid compactness, tracheid aspect ratio, tracheid rectangularity, tracheid curvature, tracheid eccentricity; The calculation formula for the tracheid area is expressed as:
[0029] Wherein, S R is the tracheid area, M is the number of pixel points within the tracheid contour, and p is the actual physical size corresponding to each pixel point; The calculation formula for the tracheid perimeter is expressed as:
[0030] Wherein, C R is the tracheid perimeter, and M C is the number of pixel points of the tracheid contour; The calculation formula for the tracheid roundness is:
[0031] Wherein, Rd is the tracheid roundness, and d is the maximum distance from the tracheid center to the contour; The calculation formula for the tracheid compactness is:
[0032] Wherein, L is the tracheid contour length; The calculation formula for the tracheid aspect ratio AR is:
[0033] Wherein, L R is the tracheid length, and W R is the tracheid width; The calculation formula for the tracheid curvature Ct is expressed as:
[0034] Wherein, is the derivative of the tangent slope, is the tangent slope of the tracheid contour boundary; The calculation formula for the tracheid eccentricity E is expressed as: ; ;
[0035] Wherein, a is the major semi - axis of the tracheid, b is the minor semi - axis of the tracheid, D is the distance formula, P i , P j are the points with the farthest distance in the tracheid contour, D max is the maximum distance formula, P m , P n are the points on the tracheid contour, and P m , P n where the line where they are located is parallel to P i , Pj is perpendicular to the straight line where it is located.
[0036] Furthermore, in step S6, the cell lumen morphological parameters include double wall thickness and fractal dimension; The calculation formula for the double wall thickness is:
[0037] In the formula, D O is the diameter of the outer wall of the tracheid, and D I is the diameter of the inner wall of the tracheid; The calculation formula for the fractal dimension is expressed as:
[0038] In the formula, DC is the fractal dimension of the tracheid.
[0039] Furthermore, the analysis method further includes: S7: Manually measure the tracheid parameters and cell lumen morphological parameters, and determine whether the similarity between the manually measured tracheid parameters and cell lumen morphological parameters and the quantitatively analyzed tracheid parameters and cell lumen morphological parameters is higher than a preset similarity threshold. If so, output the tracheid parameters; S8: Deploy the result image, the tracheid parameters, and the cell lumen morphological parameters to the Gradio visual interaction platform.
[0040] Compared with the prior art, the present invention has the following beneficial effects: A method for analyzing the morphological parameters of tracheids and cell lumens in coniferous wood based on computer vision provided by the present invention adopts an overall automated processing flow, reduces the differences in manual operations, makes the results of each experiment more consistent, avoids the deviations and errors that may be caused by manual operations, and improves the repeatability of research. In the image preprocessing stage, by using OpenCV for detail enhancement, the quality of the image can be improved, providing a clearer input for subsequent segmentation and analysis, and ensuring the accuracy of the segmentation results. Based on the U-Net model, the cSE algorithm is used for optimization. Compared with traditional methods, it can better process complex wood cell structures, improve the segmentation effect, and is particularly outstanding in the recognition of fine structures. In addition, through quantitative analysis and result verification, this embodiment provides a complete analysis solution, providing comprehensive support for wood research. Description of the Drawings
[0041] Figure 1 is the step diagram of the method for analyzing the morphological parameters of tracheids and cell lumens in coniferous wood based on computer vision in Embodiment 1 of the present invention; Figure 2 is the flow chart of the method for analyzing the morphological parameters of tracheids and cell lumens in coniferous wood based on computer vision in Embodiment 1 of the present invention; Figure 3 It is a schematic structural diagram of the segmentation model that optimizes the U-Net network using the cSE algorithm in Embodiment 1 of the present invention; Figure 4 It is a cross-sectional image of softwood to be analyzed in Embodiment 1 of the present invention; Figure 5 It is the effect diagram of deploying tracheid parameters and cell gap morphological parameters to the Gradio visual interaction platform in Embodiment 1 of the present invention. Detailed implementation manners
[0042] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0043] It should be noted that when a component is referred to as being "installed on" another component, it can be directly on the other component or there may also be an intermediate component. When a component is considered to be "set on" another component, it can be directly set on the other component or there may be an intermediate component at the same time. When a component is considered to be "fixed to" another component, it can be directly fixed to the other component or there may be an intermediate component at the same time.
[0044] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which the present invention belongs. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The term "or / and" used herein includes any and all combinations of one or more of the related listed items.
[0045] Embodiment 1: Please refer to Figure 1 and Figure 2 , this embodiment provides a method for analyzing tracheid and cell gap morphological parameters of softwood based on computer vision, including the following steps: S1: Collect cross-sectional samples of softwood, and perform slicing, staining, dehydration, and sealing treatments on the cross-sectional samples of softwood to obtain cross-sectional thin slices.
[0046] In this embodiment, the slicing process includes: using an ultramicrotome to perform cross-cutting on the softwood sample, and the slice thickness is 10 microns. Before cutting, ensure that the softwood sample is fully dried to avoid bending or cracking.
[0047] The dehydration process includes: gradually dehydrating using a gradient alcohol series (such as 70%, 80%, 90%, 100% ethanol or isopropanol). The specific steps are as follows: Immerse the sample in 70% ethanol for about 30 minutes. Immerse the sample in 80% ethanol for about 30 minutes. Immerse the sample in 90% ethanol for about 30 minutes. Immerse the sample in 100% ethanol twice, 30 minutes each time. In other embodiments, the ethanol concentration and immersion time can also be appropriately adjusted according to the size and material of the sample to ensure complete dehydration of the sample.
[0048] The staining process includes: selecting a suitable staining reagent, including hematoxylin-eosin or malachite green, iodine solution, etc. for microscopic observation. Immerse the section in the staining agent for 5 - 30 minutes (depending on the concentration of the staining agent and the type of sample). After immersion, wash with physiological saline or deionized water to remove the excess staining agent.
[0049] The sealing process includes: selecting a sealing medium. In this embodiment, a cover glass and DPX sealing medium are used for the final sealing treatment. Specifically, drop an appropriate amount of the sealing medium on the stained coniferous wood sample, carefully place the cover glass, and avoid generating bubbles. Then, slightly heat in an oven to accelerate curing, and set the heating temperature to 30°C.
[0050] By performing sectioning, staining, dehydration, and sealing treatments on the coniferous wood, the microscopic structure of the coniferous wood can be made clearly visible and suitable for subsequent microscopic observation and analysis.
[0051] S2: Take a microscopic photograph of the cross-section thin slice to obtain a cross-section image. In this embodiment, an upright fluorescence microscope is used to observe and photograph the cross-section thin slice to obtain a cross-section microscopic structure image, that is, a cross-section image.
[0052] S3: Preprocess the cross-section image to obtain a preprocessed image. The preprocessing includes histogram equalization, image sharpening, and image denoising. In this embodiment, the OpenCV-Python platform is used to perform histogram equalization, image sharpening, and image denoising on the observed cross-section image to enhance the details of the picture and thus improve the effect of subsequent analysis. The specific steps include: Histogram equalization: First, adjust the pixel values through the cumulative distribution function (CDF), and the formula is expressed as:
[0053] In the formula, p(j) is the probability density function of the pixel value j.
[0054] The pixel value V(i) after equalization is expressed as:
[0055] Where round is the rounding function, W and H are the width and height of the cross-sectional image respectively, and CDFmin is the minimum value of the cumulative distribution function.
[0056] Histogram equalization can enhance the contrast of the image, make details more obvious, and improve the clarity of the microscopic observation of softwood.
[0057] Image sharpening: Improve the clarity of edges through convolution operations. Image sharpening can be achieved through convolution operations, and the sharpening kernel is as follows:
[0058] The process of applying the kernel can be expressed as:
[0059] Where S(i, j) is the pixel value of the sharpened image, I(i, j) is the pixel value of the image before sharpening, and K is the sharpening kernel.
[0060] Image sharpening can clarify the image contour, make the details of the cross-section of softwood more distinct, and enhance the observation effect.
[0061] Image denoising: Includes mean filtering, median filtering, Gaussian filtering, etc. In this embodiment, Gaussian filtering is used for denoising. The core of Gaussian filtering is to use the Gaussian function to weight the surrounding pixels, and the formula is expressed as:
[0062] Where G(x, y) is the value of the Gaussian function at the point (x, y), σ is the standard deviation of the Gaussian distribution, and x, y are the relative positions of the denoising point in the convolution kernel and the central pixel.
[0063] Use convolution operations for denoising, and the formula is expressed as:
[0064] Where I′(x, y) is the pixel value of the point (x, y) after filtering, k is the set neighborhood boundary length, S(x + i, y + j) is the pixel value of the point (x + i, y + j) in the image after sharpening, and G(i, j) is the Gaussian weight at the point (i, j).
[0065] Reduce the noise in the image through Gaussian denoising, improve the quality of the cross-sectional image of softwood, and make subsequent processing and analysis more effective.
[0066] Using OpenCV-Python to perform histogram equalization, sharpening, and denoising on the cross-sectional image of softwood can significantly improve the quality of the cross-sectional image of softwood, providing a clearer and more contrastive view for subsequent analysis and observation.
[0067] S4: Label the tracheid regions in the preprocessed image, construct a labeled dataset, and divide the labeled dataset into a training set and a test set according to a preset ratio. In this embodiment, the preprocessed image is labeled using the Labelme software, and 70% of the labeled dataset is randomly selected as the training set, and the remaining 30% is used as the test set.
[0068] S5: Construct a segmentation model based on the optimized U-Net network, train the segmentation model using the training set images, test the segmentation model using the test set images, and retain the model parameters that meet the preset evaluation criteria. Input the cross-sectional image of the softwood to be analyzed into the trained segmentation model to automatically segment the tracheid region image.
[0069] The construction and training process of the segmentation model based on the optimized U-Net network includes: First, construct a segmentation model based on the basic U-Net network. The U-Net network is a convolutional neural network commonly used for image segmentation, and its basic structure includes: The downsampling module is used to gradually reduce the image resolution and extract features.
[0070] The bottleneck is used to connect the downsampling module and the upsampling module.
[0071] The upsampling module is used to gradually restore the image resolution and generate the final segmentation result.
[0072] The skip connection layer is used to connect the feature maps of the downsampling module to the upsampling module to facilitate information flow.
[0073] Secondly, add a cSE module to the U-Net network so that the segmentation model can better handle complex wood cell structures, improve the segmentation effect, and perform particularly well in the recognition of fine structures.
[0074] The purpose of the cSE module is to optimize the feature representation by introducing an attention mechanism in the channel dimension, and its construction process includes: Channel compression: Compress the input feature map X through the global average pooling layer to obtain the statistical information of each channel. The formula is expressed as: ;
[0075] where z is the global average pooling result of the input feature map X in the channel dimension, H 1 、W 1 are the height and width of the input feature map X respectively, AvgPool is the global average pooling, and C is the number of channels.
[0076] Feature recalibration: The compressed feature z is transformed through two fully connected layers to generate channel weights, and the formula is expressed as:
[0077] In the formula, s is the generated channel attention weight, ω 1 and ω 2 are the weight matrices of the two fully connected layers respectively, and have shapes and respectively. r is the compression ratio, ReLU is the activation function, is the activation function.
[0078] Generating the attention map: The generated weight s is normalized through the Sigmoid function as:
[0079] In the formula, AttentionMAP is the normalized attention map, and Sigmoid is the normalization function.
[0080] Feature recalibration to the original image: Applying the attention map to the original feature map to obtain a re-weighted feature map, and the formula is expressed as:
[0081] In the formula, ⊙ is the element-wise multiplication, and Y is the feature map after channel recalibration.
[0082] In this embodiment, the segmentation model of the U-Net network optimized by the cSE algorithm has a structure as Figure 3 shown.
[0083] Using F1-Score and mIoU as the evaluation indicators of the segmentation model, training the segmentation model with the training set respectively, and verifying the performance of the segmentation model with the test set, so as to obtain a segmentation model that meets the preset criteria.
[0084] Specifically, F1-Score includes precision and recall. Among them, the formula for precision P is expressed as:
[0085] In the formula, TP is the true positive example, that is, the number of samples correctly predicted as the positive class, and FP is the false positive example, that is, the number of samples wrongly predicted as the positive class.
[0086] The formula for recall R is expressed as:
[0087] In the formula, FN is the false negative example, that is, the number of samples wrongly predicted as the negative class.
[0088] The final F1-Score formula is expressed as:
[0089] Where F1 is the F1-Score index score.
[0090] mIoU is a commonly used evaluation metric in image segmentation tasks. It is obtained by calculating the IoU for each class and taking the average of the IoUs for all classes. IoU measures the overlap between the predicted result and the ground truth annotation, and its calculation formula is as follows:
[0091] Where IoU is the semantic segmentation score for a single class.
[0092] Then the final mIoU score is expressed as:
[0093] Where mIoU is the final semantic segmentation score, N is the number of classes in the segmentation task, and a = 1, 2, 3,..., N.
[0094] In this embodiment, the cross-entropy loss function and the SGD optimizer are used to train the segmentation model. After each training epoch, the F1-Score and mIoU are calculated on the validation set to evaluate the model performance, and the parameters of the segmentation model with scores higher than the preset evaluation criteria are retained to obtain the trained segmentation model.
[0095] In other embodiments, other segmentation models based on deep learning can also be used to replace the U-Net network, such as: DeepLab series (such as DeepLabv3+). The DeepLab series models are an image segmentation method based on dilated convolution, which can improve the segmentation accuracy and are especially suitable for images with fine structures. DeepLabv3+ can have better performance in detail segmentation by introducing features of different scales and depthwise separable convolutions.
[0096] FCN (Fully Convolutional Network), FCN is a classic image segmentation method. Although it is not as fine as U-Net in wood cell segmentation, it is also an effective alternative, especially suitable for relatively simple segmentation tasks.
[0097] Or traditional computer vision methods can be used to replace deep learning segmentation, including: Edge detection and region growing algorithm: Traditional edge detection methods (such as Canny edge detection) can be used to extract the boundaries of cells in the image, and then the region growing algorithm is used to further extract the cell regions. This method does not rely on deep learning but is based on classical image processing algorithms and is suitable for cases where the sample images are relatively clear and have simple structures.
[0098] Watershed algorithm: The watershed algorithm is an image segmentation method based on image gradients, suitable for images with strong local features. It can be combined with mathematical morphology operations to accurately extract the contours of wood cells. Although the watershed algorithm can segment images well, it is not as good as deep learning methods in terms of detail processing and automation.
[0099] Image thresholding: Use global or local thresholding methods to segment microscopic images of wood cells. It is simple and efficient and suitable for low-complexity images. This method is sensitive to noise and the processing effect is not as good as deep learning methods.
[0100] Or adopt feature extraction and classification based on classical image processing, including: Hough transform: It can be used to extract line or circular features in images. When the structure of wood cells is relatively regular, the Hough transform can effectively extract the contours of tracheid regions.
[0101] S6: Quantitatively analyze the relevant parameters of the segmented tracheids. In this embodiment, the OpenCV computer vision library is used to analyze the tracheid parameters and the morphological parameters of cell gaps of tracheids, and quantitative analysis is carried out. The tracheid parameters include area, perimeter, roundness, compactness, aspect ratio, rectangularity, curvature, eccentricity, and the morphological parameters of cell gaps include double wall thickness and fractal dimension.
[0102] Specifically, the tracheid area can be calculated by the number of pixel points in the binary image obtained by segmentation, and the formula is expressed as:
[0103] In the formula, S R is the tracheid area, M is the number of pixel points within the tracheid contour, and p is the actual physical size corresponding to each pixel point.
[0104] The perimeter of the tracheid can be obtained by counting the number of contour pixels, and the formula is expressed as:
[0105] In the formula, C R is the tracheid perimeter, and M C is the number of pixel points of the tracheid contour.
[0106] Roundness is an index used to measure the degree to which the shape of the tracheid approaches a circle. The closer its value is to 1, the closer the shape is to a circle. The calculation formula for the roundness of the tracheid is:
[0107] In the formula, Rd is the roundness of the tracheid, and d is the maximum distance from the center of the tracheid to the contour.
[0108] The calculation formula for the compactness is as follows:
[0109] In the formula, L is the contour length of the tracheid.
[0110] The calculation formula for the aspect ratio AR is as follows:
[0111] In the formula, L R is the tracheid length, and W R is the tracheid width.
[0112] The curvature can represent the rate of change of the boundary and can be estimated by calculating the tangent slope between contour points. The curvature Ct of the tracheid can be expressed as:
[0113] In the formula, is the derivative of the tangent slope, and is the tangent slope of the tracheid contour boundary.
[0114] The eccentricity can be used to describe the degree of deviation of the shape from a circle. The eccentricity E of the tracheid can be expressed as: ; ;
[0115] In the formula, a is the major semi-axis of the tracheid, b is the minor semi-axis of the tracheid, D is the distance formula, P i , P j are the points with the farthest distance in the tracheid contour, D max is the maximum distance formula, P m , P n are the points on the tracheid contour, and P m , P n The straight line where they are located is perpendicular to the straight line where P i , P j are located.
[0116] The double wall thickness, i.e., the inner and outer wall thicknesses of the tracheid, is calculated as follows:
[0117] In the formula, D O is the outer diameter of the tracheid, and D I is the inner diameter of the tracheid.
[0118] The fractal dimension is an index used to describe the complexity of a graph and is used to illustrate the complexity of the tracheid shape. The formula is expressed as:
[0119] Where DC is the fractal dimension of the tracheid.
[0120] S7: Manually measure the tracheid parameters, compare and analyze the manually measured tracheid parameters with the quantitatively analyzed tracheid parameters, and determine whether the similarity between the manually measured tracheid parameters and the model-analyzed tracheid parameters is higher than the preset similarity threshold. If so, output the tracheid parameters. In this embodiment, the ImageJ software is used to manually measure the tracheid parameters, and the measurement results are compared with the relevant parameters of the tracheid analyzed by the OpenCV computer vision library to verify the accuracy and reliability of the analysis results.
[0121] S8: Deploy the result image to the Gradio visual interaction platform to achieve user interactive applications. Using the Gradio visual interaction platform, users can perform image analysis and result viewing through simple operations, which reduces the technical threshold and enables non-professionals to easily use the system for wood cell analysis.
[0122] In this embodiment, the OpenCV computer vision library is used to analyze the relevant parameters of the tracheid, and the result image is deployed to the Gradio visual interaction platform. As Figures 4 - 5 shown, it can be seen that using OpenCV-Python to preprocess the cross-sectional image of softwood significantly improves the quality of the cross-sectional image of softwood. The preprocessed image is clearer and has a stronger contrast. The segmentation model based on the optimized U-Net network has a better segmentation effect when dealing with complex wood cell structures, especially outstanding in the recognition of fine structures. The tracheid contour is more clearly visible and the accuracy is higher. Through the analysis of computer vision and the display through the Gradio visual interaction platform, the tracheid parameters and the morphological parameters of the cell gap can be clearly and orderly observed, and the analysis results are clearer and easier to understand, suitable for a wider range of people.
[0123] A method for analyzing the morphological parameters of softwood tracheids and cell gaps based on computer vision provided in this embodiment adopts an overall automated processing flow, reduces the differences in manual operations, makes the results of each experiment more consistent, avoids the deviations and errors that may be caused by manual operations, and improves the repeatability of the research. In the image preprocessing stage, by using OpenCV for detail enhancement, the quality of the image can be improved, providing a clearer input for subsequent segmentation and analysis, and ensuring the accuracy of the segmentation results. Based on the U-Net model, the cSE algorithm is used for optimization. Compared with traditional methods, it can better process complex wood cell structures, improve the segmentation effect, especially outstanding in the recognition of fine structures. In addition, this embodiment provides a complete analysis solution through quantitative analysis and result verification, providing comprehensive support for wood research.
[0124] The technical features of the above-described embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as within the scope described in this specification.
[0125] The above-described embodiments merely represent several implementation manners of the present invention. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present invention, several modifications and improvements can still be made, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention patent shall be subject to the appended claims.
Claims
1. A method for analyzing the morphological parameters of coniferous wood tracheids and intercellular spaces based on computer vision, characterized in that: The steps include: S1: collecting a cross-section sample of a coniferous material, and slicing, staining, dehydrating and sealing the cross-section sample to obtain a cross-section thin slice; S2: photographing the cross-section thin slice under a microscope to obtain a cross-section image; S3: preprocessing the cross-section image to obtain a preprocessed image; S4: annotating the tracheid region in the preprocessed image, constructing an annotated data set, and dividing the annotated data set into a training set and a test set according to a preset ratio; S5: constructing a segmentation model based on an optimized U-Net network, training the segmentation model using the training set, testing the segmentation model using the test set, and retaining model parameters that meet the preset evaluation criteria; inputting the cross-section image of the coniferous material to be analyzed into the trained segmentation model to automatically segment the tracheid region image; S6: Quantitatively analyze the tracheid region image to obtain conifer tracheid parameters and intercellular space morphological parameters.
2. The method for analyzing the morphological parameters of coniferous wood tracheids and intercellular spaces based on computer vision according to claim 1, characterized in that: In step S3, the preprocessing includes histogram equalization, image sharpening, and image denoising; The histogram equalization formula is expressed as: Where V(i) is the pixel value after histogram equalization, round is the rounding function, CDF(i) is the cumulative distribution probability of pixel i, W and H are the width and height of the cross-section image respectively, and CDFmin is the minimum value of the cumulative distribution function; The image sharpening formula is expressed as: Where S(i, j) is the pixel value of the image after sharpening, I(i, j) is the pixel value of the image before sharpening, and K is the sharpening kernel; The image denoising formula is expressed as: Where I′(x, y) is the pixel value of point (x, y) after filtering, k is the set neighborhood boundary length, S(x+i, y+j) is the pixel value of point (x+i, y+j) in the image after sharpening, and G(i, j) is the Gaussian weight at point (i, j).
3. The method for analyzing the morphological parameters of coniferous wood tracheids and intercellular spaces based on computer vision according to claim 1, characterized in that: In step S5, the construction and training process of the segmentation model based on the optimized U-Net network includes: Build a segmentation model based on the basic U-Net network; Add a cSE module to the U-Net network; F1-Score and mIoU are used as evaluation indicators of the segmentation model, and the training set is used to train the segmentation model. The test set is used to verify the performance of the segmentation model, and the segmentation model parameters with scores higher than the preset evaluation standard are retained to obtain a trained segmentation model.
4. The method for analyzing the morphological parameters of coniferous wood tracheids and intercellular spaces based on computer vision according to claim 3, characterized in that: The segmentation model of the basic U-Net network includes: A downsampling module, used to gradually reduce the resolution of the preprocessed image and extract features of the preprocessed image; An upsampling module, used to gradually restore the resolution of the preprocessed image and generate a final segmentation result; A bottleneck, used to connect the down-sampling module and the up-sampling module; A skip connection layer is used to connect the feature map of the downsampling module to the upsampling module.
5. The method for analyzing the morphological parameters of coniferous wood tracheids and intercellular spaces based on computer vision according to claim 3, characterized in that: The construction process of the cSE module includes: Channel compression, the formula is expressed as: ; Where z is the global average pooling result of the input feature map X in the channel dimension, H1 and W1 are the height and width of the input feature map X, AvgPool is the global average pooling, and C is the number of channels; Feature recalibration, the formula is expressed as: Where s is the generated channel attention weight, ω1 and ω2 are the weight matrices of the two fully connected layers, and have the shapes , , r is the compression ratio, ReLU is the activation function, is the activation function; Generate an attention map, the formula is expressed as: In the formula, AttentionMAP is the normalized attention map, and Sigmoid is the normalization function; The feature is recalibrated to the original image, and the formula is expressed as: Where ⊙ is the element-wise multiplication and Y is the feature map recalibrated by the channel.
6. The method for analyzing the morphological parameters of coniferous wood tracheids and intercellular spaces based on computer vision according to claim 3, characterized in that: F1-Score includes precision and recall, where the formula of the precision P is expressed as: In the formula, TP is the true positive example, that is, the number of samples correctly predicted as positive, and FP is the false positive example, that is, the number of samples incorrectly predicted as positive. The formula of the recall rate R is expressed as: In the formula, FN is the false negative example, that is, the number of samples that are incorrectly predicted as negative; The final F1-Score formula is expressed as: In the formula, F1 is the F1-Score indicator score.
7. The method for analyzing the morphological parameters of coniferous wood tracheids and intercellular spaces based on computer vision according to claim 3, characterized in that: The calculation method of mIoU score includes: Calculate the IoU of each category, the calculation formula is expressed as: Where IoU is the semantic segmentation score of a single category; Taking the average IoU of all categories, the formula is: Where mIoU is the final semantic segmentation score, N is the number of categories in the segmentation task, and a=1,2,3,…,N.
8. The method for analyzing the morphological parameters of coniferous wood tracheids and intercellular spaces based on computer vision according to claim 1, characterized in that: In step S6, the tracheid parameters include tracheid area, tracheid perimeter, tracheid roundness, tracheid compactness, tracheid aspect ratio, tracheid rectangularity, tracheid curvature, and tracheid eccentricity; The calculation formula of the tracheid area is expressed as: In the formula, S R is the tracheid area, M is the number of pixels within the tracheid outline, and p is the actual physical size corresponding to each pixel; The calculation formula of the tracheid perimeter is expressed as: In the formula, C R is the tracheid perimeter, M C is the number of pixels of the tracheid outline; The calculation formula of the tracheid roundness is: Where Rd is the tracheid roundness, and d is the maximum distance from the tracheid center to the contour; The calculation formula of the tracheid compactness is: Where, L is the tracheid outline length; The calculation formula of the tracheid aspect ratio AR is: Where, L R is the tracheid length, W R is the tracheid width; The calculation formula of the tracheid curvature Ct is expressed as: In the formula, is the derivative of the tangent slope, is the slope of the tangent line to the tracheid outline boundary; The calculation formula of the tracheid eccentricity E is expressed as: ; ; In the formula, a is the major semi-axis of the tracheid, b is the minor semi-axis of the tracheid, D is the distance formula, and P i , P j is the farthest point in the tracheid outline, D max is the maximum distance formula, P m , P n is a point on the tracheid contour, and P m , P n The straight line and P i , P j The straight line is perpendicular.
9. The method for analyzing the morphological parameters of coniferous wood tracheids and intercellular spaces based on computer vision according to claim 1, characterized in that: In step S6, the intercellular space morphological parameters include double wall thickness and fractal dimension; The calculation formula of the double wall thickness is: Where D O is the diameter of the outer wall of the tracheid, D I is the diameter of the inner wall of the tracheid; The calculation formula of the fractal dimension is expressed as: Where DC is the fractal dimension of the tracheid.
10. The method for analyzing the morphological parameters of coniferous wood tracheids and intercellular spaces based on computer vision according to claim 1, characterized in that: Also includes: S7: manually measuring tracheid parameters and intercellular space morphological parameters, and determining whether the similarity between the manually measured tracheid parameters and intercellular space morphological parameters and the quantitatively analyzed tracheid parameters and intercellular space morphological parameters is higher than a preset similarity threshold, and if so, outputting the tracheid parameters; S8: Deploy the result image, the tracheid parameters, and the intercellular space morphology parameters to the Gradio visualization interaction platform.
Citation Information
Patent Citations
U-Net + + cell segmentation network system, method, device and terminal
CN114240961A
Oral cavity region segmentation method and system based on head and neck CT (Computed Tomography) image
CN119027408A