A method for quantifying color phenotype of broccoli florets based on high-frequency texture segmentation
Patent Information
- Application Number
- CN202611243742.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-17
- Publication Date
- 2026-10-27
AI Technical Summary
[0005]本发明的目的是提供一种基于高频纹理分割的青花菜花球颜色表型量化方法,以解决青花菜花球区域难以精确分割、颜色特征易受非花球区域干扰以及花球颜色表型难以客观量化的问题
1)通过Sobel高频纹理图增强花球边界和颗粒纹理信息,提高复杂背景下花球区域分割精度;
Smart Images

Figure CN122990265A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computer vision and digital image processing technology, and in particular to a method for quantifying the color phenotype of broccoli florets based on high-frequency texture segmentation. Background Technology
[0002] The color of broccoli florets is an important phenotypic indicator in appearance quality evaluation, commercial grading, and breeding selection. Traditional color evaluation mainly relies on manual observation or experience-based grading, which is easily affected by the evaluator's subjective judgment, lighting conditions, and sample size, making it difficult to meet the needs of batch, automated, and objective evaluation.
[0003] Existing image-based color evaluation methods typically require first obtaining the floret region and then extracting color features. However, in in-situ field images, broccoli florets have irregular boundaries, dense surface textures, and are easily affected by leaves, stems, soil, shadows, field markers, and background areas. If color features are extracted directly from the entire image or a coarse area, non-floret pixels will be included in the statistical process, leading to unstable color evaluation.
[0004] Furthermore, existing methods primarily focus on head detection, maturity identification, size estimation, or single color indicators, lacking an integrated and continuous quantitative process for assessing the overall color phenotypic differences and internal color uniformity after automatic head segmentation. Therefore, a method is needed that can automatically segment broccoli heads, extract color features, and output overall color scores and color uniformity scores after inputting an RGB image of a broccoli head. Summary of the Invention
[0005] The purpose of this invention is to provide a method for quantifying the color phenotype of broccoli florets based on high-frequency texture segmentation, in order to solve the problems of difficulty in accurately segmenting the broccoli floret region, the susceptibility of color features to interference from non-floret regions, and the difficulty in objectively quantifying the color phenotype of the florets.
[0006] To achieve the above objectives, this invention provides a method for quantifying the color phenotype of cauliflower florets based on high-frequency texture segmentation, comprising the following steps: S1. Obtain the RGB image of the broccoli florets to be tested, and perform size normalization and pixel value normalization processing on the RGB image to obtain a standardized RGB image. S2. Generate a corresponding Sobel high-frequency texture map based on the standardized RGB image to characterize the cauliflower head boundary and surface particle texture information; S3. Input the standardized RGB image and Sobel high-frequency texture map into the broccoli floret segmentation model. The high-frequency feature encoding module generates multi-scale high-frequency reference features and combines texture-boundary guided multi-scale feature enhancement with dilation rates of 1, 2 and 4 to obtain the broccoli floret prediction mask. S4. Based on the prediction mask, extract the effective area of the broccoli florets, exclude leaves, stems, soil, field markers and other non-floret background areas, and reduce the interference of background shadows on color analysis; S5. Extract HSV and Lab color space features within the effective area of the flower ball; S6. Calculate the overall color phenotype score (BCPS) of broccoli florets based on the color space characteristics. S7, Lab in the effective area of the flower ball Cluster analysis is performed in the chromaticity plane to determine the primary color reference; the color distance between the effective pixels and the primary color reference is calculated, and color distribution-related features are extracted based on the color distance; the candidate features, including the color distribution-related features, are standardized, dimensionality-reduced and fused, and directionally corrected, and mapped to a preset scoring interval to obtain the broccoli floret color uniformity score BCUS. S8 outputs the broccoli floret prediction mask, BCPS score, and BCUS score.
[0007] Preferably, in S2, the Sobel high-frequency texture map is generated as follows: the standardized RGB image is converted to grayscale; the horizontal and vertical gradient maps are extracted using the horizontal and vertical Sobel operators respectively; the gradient magnitude map is calculated; and the gradient magnitude map is normalized to obtain the Sobel high-frequency texture map; the gradient magnitude map calculation formula is as follows: ; ; ; in, and These represent the horizontal gradient plot and the vertical gradient plot, respectively. This represents a gradient magnitude plot. Gradient magnitude plot The 99th percentile, This represents the corresponding 99th percentile threshold. This represents the normalized Sobel high-frequency texture map. This means limiting the calculation result to the range of 0 to 1. This represents a very small constant used to prevent the denominator from being zero.
[0008] Preferably, in S3, the broccoli floret segmentation model is a high-frequency texture-boundary guided multi-scale segmentation network HF-TBMSNet. The high-frequency texture-boundary guided multi-scale segmentation network includes an RGB image input branch, a Sobel high-frequency texture map input branch, a high-frequency feature encoding module, a semantic segmentation backbone module, a texture-boundary guided multi-scale feature enhancement module, a multi-task prediction module, and a background misclassification suppression training strategy.
[0009] Preferably, the RGB image input branch is used to receive a normalized RGB image; the Sobel high-frequency texture map input branch is used to receive a Sobel high-frequency texture map corresponding to the normalized RGB image, and input the Sobel high-frequency texture map into the high-frequency feature encoding module; The high-frequency feature encoding module is used to extract multi-scale features from the Sobel high-frequency texture map and generate high-frequency reference features at different scales. Specifically, the Sobel high-frequency texture map is processed by convolution to generate shallow high-frequency features, and multi-scale high-frequency reference features are formed by downsampling at each level. The semantic segmentation backbone module adopts an encoder-decoder structure, including four encoding stages, a bottleneck layer, and four decoding stages connected in sequence; The texture-boundary guided multi-scale feature enhancement module includes at least dilated convolution branches with dilation rates of 1, 2, and 4, and combines the high-frequency reference features to generate gate weights for weighted fusion of the multi-scale high-frequency reference features. The multi-task prediction module includes a main segmentation prediction branch, a distance transformation prediction branch, and a boundary prediction branch; wherein, the distance transformation prediction branch and the boundary prediction branch are used for auxiliary supervision during the training phase, and the main segmentation prediction branch is used to output the flower ball probability map. The background misclassification suppression training strategy reduces the probability of non-flower ball background regions being misclassified as flower ball regions by introducing a high-confidence positive penalty term into the main segmentation loss; the expression for the main segmentation loss is: ; ; in, Indicates the primary segmentation loss. This represents the weighted binary cross-entropy loss. This indicates Dice's loss. Indicates that a difficult background inhibits loss. This represents the total number of pixels involved in the calculation. Represents pixels The true label, Represents pixels The probability of being predicted as a flower ball region; the difficult background suppression loss is used to penalize high-confidence positive predictions of vacations within the background region.
[0010] Preferably, in S3, the prediction mask is obtained by thresholding the flower ball probability map output by the segmentation model: ; In the formula, Indicates pixel position, Represents pixels The predicted probability of belonging to the flower ball region. Indicates the segmentation threshold. Indicates the flower ball area. Indicates the background area.
[0011] Preferably, in S4, the effective region of the broccoli florets is extracted as follows: Extract the set of valid pixels: ; In the formula, This represents the set of valid pixels determined by the flower ball prediction mask. Indicates the pixel position in the image. Represents pixels It has been identified as the valid area for the flower ball.
[0012] Preferably, in S5, the color space features are all calculated within the effective area of the flower ball corresponding to the prediction mask; wherein, the features in the HSV color space H Components are converted into sine and cosine components: ; ; In the formula, This represents the hue components in the HSV color space, expressed in angles. and These represent the sine and cosine transformation values of the hue components, respectively. S and V These represent the saturation component and the brightness component, respectively. Lab color space includes , and , respectively, represent the luminance component, red-green component, and yellow-blue component in the Lab color space.
[0013] Preferably, in S6, the input feature vector of BCPS is calculated as follows: ; In the formula, Indicates the sample number. Indicates the first The BCPS input feature vector of each sample and They represent the first Sine and cosine transform values of each sample hue component and They represent the first The saturation and brightness components of each sample , and For the first Lab color features of each sample; The input feature vector is standardized, and the first two principal components are extracted using principal component analysis. These components are then weighted and fused according to their explained variance to obtain the overall color phenotype score. Based on Lab... The original score is oriented to correct the direction, so that the BCPS value increases and the color of the cauliflower head changes from yellowish-green to bluish-green. The oriented score is then mapped to the 0-100 range to obtain the BCPS score.
[0014] Preferably, in S7, calculating BCUS includes the following steps: S71, in Lab Cluster analysis is performed on the effective pixels of the flower ball in the chromaticity plane. The cluster with the largest number of pixels is defined as the main color cluster, and the main color reference of the sample is determined by the cluster center. S72. Calculate the color distance between the effective pixels of the flower ball and the main color reference; extract the average color distance based on the color distance. Standard deviation 90th percentile The color cast recognition threshold is determined based on the median and median absolute deviation of the color distance. ; In the formula, This indicates the threshold for identifying color cast pixels. This represents the set of color distances between all pixels within the effective area of the flower ball. This represents the median of the color distance set. This represents the median absolute deviation of the color from the set. This represents the threshold adjustment coefficient determined during the modeling phase; pixels with a color distance greater than the threshold are identified as color-biased pixels, and the proportion of color-biased pixels is calculated. and the proportion of the largest color-biased connected component ; S73. Divide the local grid around the circumscribed rectangle of the effective area of the flower ball, filter the effective grid, and calculate the mean and variance of the grid colors. and average color entropy ; S74, Calculation and Component standard deviation , Distance between cluster centers and the pixel ratio of the main color cluster Construct candidate feature vectors: ; S75. Using the original scores after BCPS direction correction as control variables, perform residual processing on each candidate feature; S75. Standardize and perform principal component analysis on the feature matrix composed of residual terms, retain the first two principal components and weight them according to the proportion of explained variance, and after direction correction and linear residualization, map them to the 0-100 range to obtain the BCUS score, where the higher the BCUS value, the more uniform the flower ball color.
[0015] Preferably, the method includes a training phase and a deployment phase; the training phase completes the training of the HF-TBMSNet segmentation model, and determines and saves the color feature standardization parameters, principal component parameters, orientation correction parameters, and fractional mapping boundary parameters required for BCPS and BCUS; in the deployment phase, after inputting the RGB image of the broccoli florets to be tested, the parameters fixed in the training phase are directly reused, and the floret prediction mask, BCPS score, and BCUS score are automatically output.
[0016] Therefore, the present invention employs the above-mentioned method for quantifying the color phenotype of cauliflower florets based on high-frequency texture segmentation, which has the following beneficial effects: 1) Enhance the flower ball boundary and grain texture information by using Sobel high-frequency texture maps to improve the segmentation accuracy of flower ball regions in complex backgrounds; 2) A flower head prediction mask is obtained through a high-frequency texture-boundary guided multi-scale segmentation network, and color features are extracted only within the prediction mask to reduce the interference of leaf, stem, soil, shadow and background pixels on color analysis; 3) The overall color phenotypic differences in the flower head, from yellowish-green to bluish-green, were continuously quantified using BCPS; 4) BCUS is used to continuously quantify the uniformity of color distribution within the flower head area, reflecting local color deviation, mottled appearance, and color heterogeneity. 5) Automatically outputs flower head segmentation results, BCPS scores, and BCUS scores after inputting images, suitable for phenotypic evaluation, quality analysis, breeding screening, and post-harvest grading.
[0017] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0018] Figure 1This is a schematic diagram of the overall process of the high-frequency texture segmentation method for quantifying the color phenotype of cauliflower florets according to the present invention. Figure 2 This is a schematic diagram of the high-frequency texture-guided cauliflower floret segmentation model structure of the present invention; Figure 3 These are typical broccoli floret samples with different color phenotype scoring levels, as shown in the embodiments of the present invention. Figure 3 (a) shows typical samples at different BCPS rating levels. Figure 3 (b) is a typical sample under different BCUS score levels; Figure 4 This is a correlation analysis diagram of BCPS score and Lab color characteristics of broccoli florets in an embodiment of the present invention, wherein, Figure 4 (a) BCPS score and Lab Correlation analysis plot of components, Figure 4 (b) BCPS score and Lab Correlation analysis diagram of components. Detailed Implementation
[0019] The technical solutions of the present invention will be further described below with reference to the accompanying drawings and embodiments. Unless otherwise defined, the technical or scientific terms used in this invention should be understood in their ordinary sense by those skilled in the art. The described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0020] Example 1 This embodiment provides a method for quantifying the color phenotype of cauliflower florets based on high-frequency texture segmentation. The overall process is as follows: Figure 1 As shown. This method takes the RGB image of the broccoli floret as input, automatically generates a floret prediction mask, and calculates the Overall Color Phenotypic Score (BCPS) and Color Uniformity Score (BCUS) within the effective area of the floret. Finally, it outputs the floret prediction mask, BCPS score, and BCUS score. The specific steps are as follows: S1. Acquisition and standardization of RGB images of broccoli florets.
[0021] RGB images of broccoli florets were acquired in situ in the field using a non-destructive method, and the influence of natural light variations was reduced by utilizing a shaded imaging box and a stable light source. This embodiment used a Canon EOS 700D camera, acquiring a total of 828 images with a resolution of 5184×3456 pixels.
[0022] The visible area of the flower head was annotated at the pixel level using LabelMe software to obtain a binary artificial mask. Both the RGB image and the artificial mask were uniformly adjusted to 512×512 pixels. The RGB image underwent bilinear interpolation with pixel values normalized to 0-1, while the artificial mask used nearest-neighbor interpolation, resulting in a standardized RGB image. The 828 images were divided into training, validation, and test sets in an 8:1:1 ratio, containing 663, 82, and 83 images respectively. During deployment, only the RGB image to be tested was input; no artificial mask was required.
[0023] S2. High-frequency texture map generation based on Sobel operator.
[0024] Convert a standardized RGB image to a grayscale image. The gradient response was calculated using both horizontal and vertical Sobel operators: ; ; Calculate the gradient magnitude based on the gradient response in both directions: ; Normalize the gradient magnitude to obtain a single-channel high-frequency texture map. : ; ; In the formula, This represents a grayscale image obtained by converting a standardized RGB image. and These represent the Sobel convolution kernels in the horizontal and vertical directions, respectively. This represents a two-dimensional convolution operation. and These represent the gradient responses in the horizontal and vertical directions, respectively. This represents a gradient magnitude plot. This represents the 99th percentile threshold of the gradient magnitude plot. This represents the normalized single-channel high-frequency texture map. This means limiting the calculation result to the range of 0 to 1. This represents a very small constant used to prevent the denominator from being zero.
[0025] S3, High-frequency texture-guided cauliflower floret segmentation.
[0026] The standardized RGB image and the corresponding Sobel high-frequency texture map are jointly input into the High-Frequency Texture-Boundary Guided Multi-Scale Segmentation Network (HF-TBMSNet). The segmentation network is as follows: Figure 2As shown, it includes an RGB image input branch, a Sobel high-frequency texture map input branch, a high-frequency feature encoding module, a semantic segmentation backbone module, a texture-boundary guided multi-scale feature enhancement module, a multi-task prediction module, and a background misclassification suppression training strategy.
[0027] The RGB image input branch is used to receive the normalized RGB image; the Sobel high-frequency texture map input branch is used to receive the Sobel high-frequency texture map corresponding to the normalized RGB image and input the Sobel high-frequency texture map into the high-frequency feature encoding module.
[0028] In the high-frequency feature encoding module, the Sobel high-frequency texture map is convolved to generate shallow high-frequency features, and then downsampled stepwise to form multi-scale high-frequency reference features. These shallow high-frequency features are fused with the normalized RGB image along the channel dimension and input into the semantic segmentation backbone module. The multi-scale high-frequency reference features are used to guide feature enhancement at the corresponding scale in the backbone network. The semantic segmentation backbone module consists of four encoding stages, a bottleneck layer, and four decoding stages. The number of channels in the encoding stages are 16, 32, 64, and 128, respectively, and the number of channels in the bottleneck layer is 256.
[0029] The texture-boundary guided multi-scale feature enhancement module uses the backbone semantic feature X and the corresponding high-frequency reference features at different scales. As input. The backbone semantic features are then subjected to 3×3 dilated convolutions with dilation rates of 1, 2, and 4 to obtain multi-scale branch features: ; The input semantic features are concatenated with the proportionally scaled high-frequency reference features via channels: ; In this embodiment, λ =0.50. Fusion features G Each branch gating weight is generated by independent 1×1 convolution and sigmoid activation: ; Each branch feature is multiplied element-wise with its corresponding gating weight: ; The three weighted branch features are concatenated along the channel dimension and then subjected to 1×1 convolution and ReLU activation to obtain the enhanced features: ; In the formula, This represents the backbone semantic features of the input texture-boundary guided multi-scale feature enhancement module. High-frequency reference features are represented to correspond to the spatial scale of the main semantic features. This represents the dilation rate of dilated convolution. Indicates the expansion rate Features of dilated convolution branches before gated weighting, This represents the fused feature formed by concatenating the main semantic features and the scaled high-frequency reference features. The scaling factor represents the high-frequency reference feature. Indicates the expansion rate The gating weights corresponding to the branches, This indicates the branch characteristics after gating and weighting. express Activation function Indicates the expansion rate 3×3 dilated convolution operation, This represents a 1×1 convolution operation. This indicates feature concatenation along the channel dimension. This represents element-wise multiplication. This represents the output features of the texture-boundary guided multi-scale feature enhancement module.
[0030] The multi-task prediction module includes a main segmentation prediction branch, a distance transform prediction branch, and a boundary prediction branch. The model generates the main segmentation probability map, distance transform prediction map, and boundary prediction map based on the decoding stage features output from the semantic segmentation backbone module. The distance transform prediction branch and boundary prediction branch are only used for auxiliary supervision during the training phase. During the deployment phase, the main segmentation prediction branch outputs the flower ball probability map, which is then thresholded to generate a flower ball prediction mask. ; In the formula, Indicates pixel position, Represents pixels in the principal segmentation probability map Predicted probability of belonging to the broccoli floret region As the segmentation threshold, this embodiment takes... . Represents pixels The corresponding predicted mask value, Indicates the flower ball area. Indicates the background area.
[0031] S4. Extraction of the effective area of the flower ball prediction mask.
[0032] Extract the effective pixel set based on the flower ball prediction mask: ; In the formula, This represents the set of valid pixels determined by the flower ball prediction mask. Indicates the pixel position in the image. Represents pixels The area has been designated as the flower ball area.
[0033] Color features are calculated only within the set of valid pixels, thereby excluding leaves, stems, soil, field markers, and other non-flower head background areas, and reducing the interference of background shadows on color analysis. This embodiment does not perform secondary screening of the prediction mask based on a color threshold, nor does it implement morphological corrections to avoid altering the original color distribution of the flower head area.
[0034] S5. Extraction of color space features of the effective area of the flower ball.
[0035] The RGB image was converted to HSV and CIELab color spaces, and color features were extracted within the effective area of the flower head. (HSV hue...) H When expressed in angles, convert them into sine and cosine components: ; ; In the formula, This represents the hue components of the HSV color space expressed in angles. and These represent the sine and cosine transformation values of the hue components, respectively. The transformation converts the periodic hue components into continuous two-dimensional features.
[0036] Simultaneously extract the saturation from the HSV color space. S Brightness V and in the Lab color space , and The components are determined, and the corresponding sample-level statistics within the effective area of the flower ball are calculated.
[0037] S6. Calculation of Overall Color Phenotypic Score (BCPS).
[0038] For the i For each sample, construct the BCPS input feature vector: ; In the formula, i Indicates the sample number. Indicates the first i The BCPS input feature vector of the i-th sample, where each component of the vector represents the i-th sample. i The hue sine, hue cosine, saturation, lightness, and Lab color component statistics were calculated for each sample within the effective area of the flower head. These features were then standardized. ; In the formula, Indicates the sample number. Indicates the color feature number. Indicates the first The first sample Original color features, This represents the corresponding standardized eigenvalue. and They represent the first and second samples in the modeling sample, respectively. The mean and standard deviation of the color feature. This represents a minimal constant used to prevent the denominator from being zero. Principal component analysis is performed on the standardized characteristic matrix, retaining the first two principal components, and then weighted and fused according to the proportion of explained variance: ; In the formula, and They represent the first i The scores of each sample on the first and second principal components. and represents the proportion of variance explained by the first principal component and the second principal component, respectively. This represents the original score of the overall color phenotype before orientation correction. According to With Lab Relevant directions determine the direction correction coefficient This causes the BCPS value to increase accordingly. The color of the flower head decreases, meaning it changes from a yellowish-green to a bluish-green: ; Map the direction-corrected scores to the 0-100 range: ; In the formula, and The scoring mapping boundary is determined and solidified during the modeling phase.
[0039] S7, Color Uniformity Rating BCUS Calculation.
[0040] Lab in the effective area of the flower ball K-means clustering is performed in the chroma plane; in this embodiment, the number of clusters is 2. The cluster with the largest percentage of pixels is defined as the primary color cluster, and its cluster center is used as the primary color cluster. Used as a primary color reference. Calculate the color distance between the effective pixels and the primary color reference: ; In the formula, Represents pixels within the effective area of the flower ball. Color distance from the primary color reference and Representing pixels Lab chromaticity components, and These represent the Lab chromaticity components at the center of the principal color cluster, with subscripts indicating their respective values. Indicates the center of the primary color cluster. The mean color distance is extracted based on the color distance. Standard deviation and 90th percentile The color cast recognition threshold is determined based on the median and median absolute deviation of the color distance. ; In the formula, This indicates the threshold for identifying color cast pixels. This represents the set of color distances between all pixels within the effective area of the flower ball. This represents the median of the color distance set. This represents the median absolute deviation of the color from the set. This represents the threshold adjustment coefficient determined during the modeling phase. Pixels with a color distance greater than the threshold are identified as color-biased pixels, and the proportion of color-biased pixels is calculated. and the proportion of the largest color-biased connected component .
[0041] The area bounded by the effective region of the flower ball is divided into 8×8 local grids. Only the effective grids with a flower ball pixel coverage of not less than 0.50 are retained, and the mean and variance of the grid colors are calculated. and average color entropy Simultaneous calculation and Component standard deviation , The distance between two cluster centers and the pixel ratio of the main color cluster Construct candidate feature vectors: ; To reduce the linear coupling between uniformity features and the overall color phenotype, the original scores after BCPS direction correction were used. To control for variables, residuals are applied to each candidate feature: ; The feature matrix composed of residual terms is standardized and subjected to principal component analysis. The first two principal components are retained and weighted according to the explained variance. Then, orientation correction is performed so that a higher score indicates a more uniform color distribution. Subsequently, the orientation-corrected color uniformity pre-score is compared again with... Perform linear residual transformation and use the resulting residual as the original score for color uniformity. Then Mapped to the range of 0 to 100: ; In the formula, and The BCUS mapping boundary is defined and solidified for the modeling phase.
[0042] S8. Output the results.
[0043] After completing the above processing, the following are output: broccoli head prediction mask, BCPS overall color phenotypic score, and BCUS color uniformity score. An increase in the BCPS score indicates a change in the overall head color from yellowish-green to bluish-green; an increase in the BCUS score indicates a more uniform color distribution within the head area.
[0044] Model training, parameter fixing, and deployment: This embodiment uses the TensorFlow / Keras framework to train the HF-TBMSNet segmentation model, employing the Adam optimizer with an initial learning rate of 1×10⁻⁶. -4 The batch size is 1, and the maximum number of training epochs is 100. No color enhancement operations such as brightness, saturation, contrast, or hue perturbation are used during training. The F1 score of the validation set master split is used as the optimal model selection metric; if the validation set loss does not improve for 8 consecutive epochs, the learning rate is adjusted to 0.5, with a minimum learning rate of 1×10⁻⁶. -7 Training is stopped early when the F1 score of the main split on the validation set fails to improve for 20 consecutive rounds.
[0045] The distance transformation supervision map is generated by manually annotated masks. Specifically, it calculates the Euclidean distance from each pixel within the flower ball region to the nearest background pixel and normalizes the resulting distance values to the range of 0 to 1; the distance value for the background region is set to 0. The boundary supervision map is obtained by performing one morphological dilation and one morphological erosion on the manually annotated mask using 3×3 structuring elements, and then subtracting the dilation and erosion results.
[0046] The total loss of the model is: ; The primary segmentation loss is: ; ; In the formula, This represents the total loss of the model. Indicates the primary segmentation loss. Indicates the distance transformation auxiliary loss. Indicates the boundary auxiliary loss. This represents the weighted binary cross-entropy loss. This indicates Dice's loss. Indicates that a difficult background inhibits loss; This represents the total number of pixels involved in the calculation. Represents pixels The true label, Represents pixels The probability of being predicted as a flower ball region. A difficult background suppression loss is used to penalize high-confidence positive predictions within the background region. The weighted binary cross-entropy loss assigns a weight of 3.0 to the flower ball foreground pixels; the distance transform auxiliary loss uses mean squared error loss; the boundary auxiliary loss is a combination of binary cross-entropy loss and Dice loss.
[0047] During the training phase, the feature standardization parameters, residual parameters, principal component loadings, explained variance weights, orientation correction coefficients, and scoring mapping boundaries required for BCPS and BCUS are simultaneously determined and saved. During the deployment phase, after inputting a new RGB image of a broccoli floret to be tested, the aforementioned fixed parameters are directly reused, eliminating the need for manual annotation, retraining of the segmentation model, or refitting of the scoring model.
[0048] Implementation effect verification: This embodiment uses 83 test set images to evaluate the segmentation performance of broccoli florets and selects U-Net as the baseline model for comparison. The segmentation performance of U-Net and the HF-TBMSNet model of this invention is shown in Table 1.
[0049] Table 1 Comparison of segmentation performance between U-Net and HF-TBMSNet
[0050] As shown in Table 1, HF-TBMSNet achieves Precision, F1, IoU, and Accuracy of 0.9874, 0.9889, 0.9781, and 0.9930, respectively, all higher than the U-Net baseline model; Recall is 0.9906, maintaining a high level. Compared with the U-Net baseline model, HF-TBMSNet improves F1 and IoU by 0.0058 and 0.0112, respectively, indicating that the high-frequency texture guidance and multi-scale feature enhancement method adopted in this invention can improve the consistency between the predicted flower head region and the manually labeled region, and reduce the interference of complex backgrounds on the flower head segmentation results.
[0051] Based on the flower head prediction mask generated by HF-TBMSNet, color phenotype quantization was performed on 828 broccoli flower head images to obtain the overall color phenotype score BCPS and color uniformity score BCUS. The descriptive statistical results are shown in Table 2.
[0052] Table 2 Descriptive statistics of BCPS and BCUS
[0053] Table 2 shows that the mean, standard deviation, and coefficient of variation of BCPS were 62.01, 18.69, and 30.14%, respectively, while those of BCUS were 67.58, 14.22, and 21.04%, respectively. The higher coefficient of variation of BCPS compared to BCUS indicates a greater inter-sample difference in overall color phenotype among the samples in this embodiment. BCUS also exhibits a certain range of variation among samples, reflecting differences in color uniformity within different floret regions. The Pearson correlation coefficient between BCPS and BCUS was 0.341, and the Spearman correlation coefficient was 0.358, indicating a low correlation between the two. They can describe the broccoli floret color phenotype from two aspects: overall color difference and color uniformity within regions, respectively.
[0054] Typical broccoli florets at different BCPS and BCUS scoring levels, such as Figure 3 As shown. By Figure 3 As shown in Figure (a), with the increase of BCPS score, the overall color of the cauliflower head generally shows a trend of changing from yellowish-green to bluish-green; from... Figure 3 As shown in Figure (b), samples with low BCUS scores exhibit noticeable localized color casts, mottled areas, or abnormal colors. However, as the BCUS score increases, the overall color distribution within the flower head region tends to become more uniform. These results indicate that BCPS can characterize the overall color phenotypic differences of the flower head, while BCUS can characterize the uniformity of color distribution within the flower head.
[0055] To further verify the ability of the BCPS score to characterize the overall color change direction of broccoli florets, this embodiment analyzes the correlation between the BCPS score and the CIELab color features within the effective area of the floret head. The results are as follows: Figure 4 As shown. BCPS score and Lab The components showed a significant negative correlation, with a Pearson correlation coefficient of -0.964 and a Spearman correlation coefficient of -0.983; BCPS scores and Lab... The components showed a significant positive correlation, with a Pearson correlation coefficient of 0.853 and a Spearman correlation coefficient of 0.868; both correlation tests were significant. In the CIELab color space, A negative value indicates the green direction. A positive value indicates the yellow direction. As the BCPS score increases, The values gradually approached 0 from small negative values, indicating that the green component weakened; at the same time, The significant decrease in the value indicates a weakening of the yellow component and a shift towards the blue direction along the yellow-blue axis. Therefore, the BCPS score can characterize the trend of the overall color of the broccoli head changing from a yellowish-green to a bluish-green.
[0056] The above verification results demonstrate that the present invention can accurately segment the cauliflower head region and output two color phenotypic scores, BCPS and BCUS, based on the predicted cauliflower head region. BCPS characterizes the trend of the overall cauliflower head color changing from yellowish-green to bluish-green, while BCUS characterizes the uniformity of color distribution within the cauliflower head region, thus achieving automated processing of cauliflower head segmentation and color phenotypic quantification.
[0057] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the technical solutions of the present invention, and these modifications or equivalent substitutions cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.
Claims
1. A method for quantifying the color phenotype of cauliflower florets based on high-frequency texture segmentation, characterized in that, Includes the following steps: S1. Obtain the RGB image of the broccoli florets to be tested, and perform size normalization and pixel value normalization processing on the RGB image to obtain a standardized RGB image. S2. Generate a corresponding Sobel high-frequency texture map based on the standardized RGB image to characterize the cauliflower head boundary and surface particle texture information; S3. Input the standardized RGB image and Sobel high-frequency texture map into the broccoli floret segmentation model. The high-frequency feature encoding module generates multi-scale high-frequency reference features and combines texture-boundary guided multi-scale feature enhancement with dilation rates of 1, 2 and 4 to obtain the broccoli floret prediction mask. S4. Based on the prediction mask, extract the effective area of the broccoli florets, exclude leaves, stems, soil, field markers and other non-floret background areas, and reduce the interference of background shadows on color analysis; S5. Extract HSV and Lab color space features within the effective area of the flower ball; S6. Calculate the overall color phenotype score (BCPS) of broccoli florets based on the color space characteristics. S7, Lab in the effective area of the flower ball Cluster analysis is performed in the chromaticity plane to determine the primary color reference; the color distance between the effective pixels and the primary color reference is calculated, and color distribution-related features are extracted based on the color distance; Candidate features, including the color distribution-related features, are standardized, dimensionally reduced and fused, and oriented and corrected, and mapped to a preset scoring range to obtain the color uniformity score (BCUS) of broccoli florets. S8 outputs the broccoli floret prediction mask, BCPS score, and BCUS score.
2. The method for quantifying the color phenotype of cauliflower florets based on high-frequency texture segmentation according to claim 1, characterized in that, In S2, the Sobel high-frequency texture map is generated as follows: the standardized RGB image is converted to grayscale; the horizontal and vertical gradient maps are extracted using the horizontal and vertical Sobel operators, respectively; the gradient magnitude map is calculated; and the gradient magnitude map is normalized to obtain the Sobel high-frequency texture map. The gradient magnitude map calculation formula is as follows: ; ; ; in, and These represent the horizontal gradient plot and the vertical gradient plot, respectively. Represents the gradient magnitude plot. Gradient magnitude plot The 99th percentile, This represents the corresponding 99th percentile threshold. This represents the normalized Sobel high-frequency texture map. This means limiting the calculation result to the range of 0 to 1. This represents a very small constant used to prevent the denominator from being zero.
3. The method for quantifying the color phenotype of cauliflower florets based on high-frequency texture segmentation according to claim 1, characterized in that, In S3, the broccoli floret segmentation model is a high-frequency texture-boundary guided multi-scale segmentation network HF-TBMSNet. The high-frequency texture-boundary guided multi-scale segmentation network includes an RGB image input branch, a Sobel high-frequency texture map input branch, a high-frequency feature encoding module, a semantic segmentation backbone module, a texture-boundary guided multi-scale feature enhancement module, a multi-task prediction module, and a background misclassification suppression training strategy.
4. The method for quantifying the color phenotype of cauliflower heads based on high-frequency texture segmentation according to claim 3, characterized in that, The RGB image input branch is used to receive a normalized RGB image; the Sobel high-frequency texture map input branch is used to receive a Sobel high-frequency texture map corresponding to the normalized RGB image, and input the Sobel high-frequency texture map into the high-frequency feature encoding module; The high-frequency feature encoding module is used to extract multi-scale features from the Sobel high-frequency texture map and generate high-frequency reference features at different scales. Specifically, the Sobel high-frequency texture map is processed by convolution to generate shallow high-frequency features, and multi-scale high-frequency reference features are formed by downsampling at each level. The semantic segmentation backbone module adopts an encoder-decoder structure, including four encoding stages, a bottleneck layer, and four decoding stages connected in sequence; The texture-boundary guided multi-scale feature enhancement module includes at least dilated convolution branches with dilation rates of 1, 2, and 4, and combines the high-frequency reference features to generate gate weights for weighted fusion of the multi-scale high-frequency reference features. The multi-task prediction module includes a main segmentation prediction branch, a distance transformation prediction branch, and a boundary prediction branch; wherein, the distance transformation prediction branch and the boundary prediction branch are used for auxiliary supervision during the training phase, and the main segmentation prediction branch is used to output the flower ball probability map. The background misclassification suppression training strategy reduces the probability of non-flower ball background regions being misclassified as flower ball regions by introducing a high-confidence positive penalty term into the main segmentation loss; the expression for the main segmentation loss is: ; ; in, Indicates the primary segmentation loss. This represents the weighted binary cross-entropy loss. This indicates Dice's loss. Indicates that a difficult background inhibits loss. This represents the total number of pixels involved in the calculation. Represents pixels The true label, Represents pixels The probability of being predicted as a flower ball region; the difficult background suppression loss is used to penalize high-confidence positive predictions of vacations within the background region.
5. The method for quantifying the color phenotype of cauliflower florets based on high-frequency texture segmentation according to claim 4, characterized in that, In S3, the prediction mask is obtained by thresholding the flower ball probability map output by the segmentation model: ; In the formula, Indicates pixel position, Represents pixels The predicted probability of belonging to the flower ball region. Indicates the segmentation threshold. Indicates the flower ball area. Indicates the background area.
6. The method for quantifying the color phenotype of cauliflower florets based on high-frequency texture segmentation according to claim 5, characterized in that, In S4, the specific steps for extracting the effective area of the broccoli florets are as follows: Extract the set of valid pixels: ; In the formula, This represents the set of valid pixels determined by the flower ball prediction mask. Indicates the pixel position in the image. Represents pixels It has been identified as the valid area for the flower ball.
7. The method for quantifying the color phenotype of cauliflower florets based on high-frequency texture segmentation according to claim 6, characterized in that, In S5, all color space features are calculated within the effective area of the flower ball corresponding to the prediction mask; among them, the HSV color space features are calculated within the effective area of the flower ball. H Components are converted into sine and cosine components: ; ; In the formula, This represents the hue components in the HSV color space, expressed in angles. and These represent the sine and cosine transformation values of the hue components, respectively. S and V These represent the saturation component and the brightness component, respectively. Lab color space includes , and , respectively, represent the luminance component, red-green component, and yellow-blue component in the Lab color space.
8. The method for quantifying the color phenotype of cauliflower florets based on high-frequency texture segmentation according to claim 7, characterized in that, In S6, the input feature vector of BCPS is calculated as follows: ; In the formula, Indicates the sample number. Indicates the first The BCPS input feature vector of each sample and They represent the first The sine and cosine transform values of each sample hue component and They represent the first The saturation and brightness components of each sample , and For the first Lab color features of each sample; The input feature vector is standardized, and the first two principal components are extracted using principal component analysis. These components are then weighted and fused according to their explained variance to obtain the overall color phenotype score. Based on Lab... The original score is oriented to correct the direction, so that the BCPS value increases and the color of the broccoli florets changes from yellowish-green to bluish-green. The oriented score is then mapped to the 0-100 range to obtain the BCPS score.
9. The method for quantifying the color phenotype of cauliflower heads based on high-frequency texture segmentation according to claim 7, characterized in that, In S7, calculating BCUS includes the following steps: S71, in Lab Cluster analysis is performed on the effective pixels of the flower ball in the chromaticity plane. The cluster with the largest number of pixels is defined as the main color cluster, and the main color reference of the sample is determined by the cluster center. S72. Calculate the color distance between the effective pixels of the flower ball and the main color reference; extract the average color distance based on the color distance. Standard deviation 90th percentile The color cast recognition threshold is determined based on the median and median absolute deviation of the color distance. ; In the formula, This indicates the threshold for identifying color cast pixels. This represents the set of color distances between all pixels within the effective area of the flower ball. This represents the median of the color distance set. This represents the median absolute deviation of the color from the set. This represents the threshold adjustment coefficient determined during the modeling phase; pixels with a color distance greater than the threshold are identified as color-biased pixels, and the proportion of color-biased pixels is calculated. and the proportion of the largest color-biased connected component ; S73. Divide the local grid around the circumscribed rectangle of the effective area of the flower ball, filter the effective grid, and calculate the mean and variance of the grid colors. and average color entropy ; S74, Calculation and Component standard deviation , Distance between cluster centers and the pixel ratio of the main color cluster Construct candidate feature vectors: ; S75. Using the original scores after BCPS direction correction as control variables, perform residual processing on each candidate feature; S75. Standardize and perform principal component analysis on the feature matrix composed of residual terms, retain the first two principal components and weight them according to the proportion of explained variance, and after direction correction and linear residualization, map them to the 0-100 range to obtain the BCUS score, where the higher the BCUS value, the more uniform the flower head color.
10. The method for quantifying the color phenotype of cauliflower florets based on high-frequency texture segmentation according to claim 9, characterized in that, The method includes a training phase and a deployment phase. In the training phase, the HF-TBMSNet segmentation model is trained, and the normalized parameters of color features required for BCPS and BCUS, principal component parameters, orientation correction parameters, and fractional mapping boundary parameters are determined and saved. In the deployment phase, after inputting the RGB image of the broccoli florets to be tested, the parameters fixed in the training phase are directly reused, and the floret prediction mask, BCPS score, and BCUS score are automatically output.