Methods, apparatus, equipment and storage media for accurate identification and evaluation of bitter gourd peel color.
By combining ImageJ software and LSTM models with the CIE 1976 ΔE formula to optimize the evaluation of bitter gourd skin color, the problem of manual visual inspection being easily affected by light and subjective factors was solved, achieving accurate identification of bitter gourd skin color and improving the scientificity and reliability of germplasm resource identification and breeding.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TROPICAL CORP STRAIN RESOURCE INST CHINESE ACAD OF TROPICAL AGRI SCI
- Filing Date
- 2026-02-05
- Publication Date
- 2026-06-02
AI Technical Summary
In existing technologies, the evaluation of bitter gourd peel color mainly relies on manual visual inspection, which is easily affected by lighting conditions and subjective factors, making it difficult to achieve accurate quantification and lacking systematic quantitative research on color.
ImageJ software was used to extract color features from fruit images. Combined with the LSTM model and the CIE 1976 ΔE formula, the color center coordinates were optimized by the K-means clustering algorithm. A method for accurate identification and evaluation of bitter gourd skin color was constructed. The LSTM model was used to characterize the continuous variation of skin color in the spatial dimension to achieve accurate identification.
An objective and repeatable evaluation system for bitter gourd skin color identification was established, which improved the accuracy of bitter gourd skin color identification and provided technical support for germplasm resource identification and breeding applications.
Smart Images

Figure CN122135356A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of fruit skin color identification technology, specifically to a method, apparatus, equipment, and storage medium for accurate identification and evaluation of bitter gourd skin color. Background Technology
[0002] Bitter melon is an important specialty cucurbit vegetable crop, widely cultivated in Asia and tropical and subtropical regions. It possesses high commercial value and nutritional and health potential, attracting widespread attention in the development of functional foods. In bitter melon breeding and production practices, fruit appearance traits are crucial for variety selection and commercial grading. Among these, skin color directly affects fruit marketability and consumer acceptance, making it one of the important phenotypic traits for evaluating bitter melon varieties. Existing research has shown significant differences in appearance traits such as skin color among different bitter melon germplasm resources, providing a material basis for quantitative evaluation of color traits. Therefore, constructing a scientific, objective, and reproducible method for evaluating bitter melon skin color is of great significance for germplasm resource identification and breeding applications.
[0003] Skin color is not merely a sensory trait, but an important phenotypic characteristic with a clear genetic basis. In melons, studies have identified the key regulatory role of the APRR2 gene in the formation of green skin, revealing the genetic regulatory mechanism of skin color. In wax melons, homologous genes have also been found to participate in the formation of black skin in mature fruits, further demonstrating that skin color traits are regulated by specific genes. Research on bitter melon skin color shows significant differences in candidate loci and genes related to pigment accumulation in different materials, revealing a stable genetic basis for bitter melon skin color. Further research has found that McAPRR2 is an important gene regulating skin color during the domestication of bitter melon, providing direct evidence for the genetic analysis of color traits. These studies demonstrate from a genetic perspective that skin color can be used as a stable and reliable phenotypic trait for germplasm identification and classification evaluation.
[0004] Although skin color has a clear genetic basis, its evaluation in practical applications still mainly relies on manual visual inspection and experience, which is easily affected by lighting conditions and subjective factors, making precise quantification difficult. To overcome the limitations of manual evaluation, image analysis-based fruit phenotypic measurement methods have gradually attracted attention. Existing research shows that extracting fruit color features from image information and analyzing them in the CIE Lab color space can effectively improve the objectivity and consistency of color difference identification among different varieties. Due to its good perceptual uniformity, the Lab color space is widely used in color classification and evaluation research, providing a theoretical basis for the quantitative analysis of complex color traits. However, related research has mostly focused on some fruit and vegetable crops, and systematic quantitative research on bitter gourd skin color remains relatively limited. With the development of machine vision and deep learning technologies, image-based intelligent recognition of fruit and vegetable appearance phenotypic characteristics has gradually become an important direction in precision agriculture research. Related reviews indicate that convolutional neural networks have high application potential in fruit and vegetable appearance phenotypic recognition, providing new ideas for automated agricultural phenotypic analysis. In specific applications, models based on network structures such as AlexNet have been successfully used for vegetable image classification and have achieved high recognition accuracy. Studies have shown that traditional CNNs excel at extracting spatial texture features but have limited ability to distinguish phenotypic traits with small, continuous color variations. For the multi-point measurements or sequential features commonly found in agricultural phenotypes, Long Short-Term Memory (LSTM) networks have been applied to crop phenotypic and physiological state recognition, demonstrating advantages in continuous feature modeling. In research on crops such as rice and wheat, LSTM-based models have proven suitable for processing multi-feature or sequential agricultural data. However, for the specific phenotypic trait of bitter gourd skin color, systematic research combining quantitative color features with deep learning models is still lacking. Summary of the Invention
[0005] In view of this, the embodiments of the present invention are committed to providing a method, device, equipment and storage medium for accurate identification and evaluation of bitter gourd skin color, so as to improve the accuracy of bitter gourd skin color identification and provide technical support for bitter gourd germplasm resource identification and breeding application.
[0006] In a first aspect, the present invention provides a method for accurately identifying and evaluating the color of bitter gourd peel, comprising:
[0007] S1: Capture fruit images;
[0008] S2: Use ImageJ software to extract color features from the fruit images and construct the original sequence dataset;
[0009] S3: The tidyverse package is used to clean and organize the original sequence dataset, and multidimensional visualization methods are used to explore the data;
[0010] S4: The color center coordinates are optimized using the K-means clustering algorithm combined with the CIE 1976 ΔE formula;
[0011] S5: Introduce the LSTM model to model the bitter gourd peel color data;
[0012] S6: Analyze the skin color classification results using the LSTM model and output the analysis results.
[0013] Furthermore, S6 includes:
[0014] The 30 measurement points continuously acquired on the peel of a single fruit are regarded as a one-dimensional spatial sequence. Each measurement point contains three feature values, L, a, and b, in the CIE Lab color space, thus forming a 30×3 input matrix.
[0015] The LSTM model recursively learns the color information of adjacent measurement points to depict the continuous variation of skin color in the spatial dimension, thereby achieving accurate identification of color categories.
[0016] In S5, the process of establishing the LSTM model is represented as (1)-(6):
[0017] (1)
[0018] (2)
[0019] (3)
[0020] (4)
[0021] (5)
[0022] (6)
[0023] in, This represents the input feature vector of the t-th fruit peel measurement point. Output the hidden state at the current time step. This is a unit memory state; , and These represent the activation results of the forget gate, input gate, and output gate, respectively. It is the Sigmoid activation function. It is the hyperbolic tangent function; , , , , , , , For the corresponding bias term.
[0024] Furthermore, S4 includes:
[0025] The dataset was partitioned using 8:2 stratified random sampling. The hyperparameters of the model based on color mean features were optimized using 5-fold cross-validation. The performance baseline for color segmentation was constructed using the test set accuracy. The CIE 1976 ΔE formula is as follows: Among them, L1, a1, b1, and L2, 2 and b2 represent the Lab values of the sample color and the standard reference color, respectively. The color difference distance between each sample and the center of its category is quantified, and the color center value of each category is iteratively optimized using a grid search algorithm.
[0026] Furthermore, prior to S1, the method includes selecting 205 bitter gourd germplasm resources as samples. All samples are planted in the same experimental field and a unified cultivation and management scheme is adopted, with a plant spacing of 0.8m×1.2m, drip irrigation and fertilization, integrated pest and disease control, and control of environmental factors, with consistent light, temperature and humidity.
[0027] Secondly, the present invention provides a device for accurately identifying and evaluating the color of bitter gourd peel, comprising:
[0028] Acquisition module: used to acquire fruit images;
[0029] The first construction module is used to extract color features from the fruit images using ImageJ software and to construct the original sequence dataset.
[0030] Processing module: Used to clean and organize the original sequence dataset using the tidyverse package, and to explore the data using multidimensional visualization methods;
[0031] Baseline and Optimization Module: Used to optimize color center coordinates using the K-means clustering algorithm combined with the CIE 1976 ΔE formula;
[0032] The second building block is used to introduce an LSTM model to model the bitter gourd peel color data.
[0033] Analysis module: Used to analyze the skin color classification results using the LSTM model and output the analysis results.
[0034] Thirdly, the present invention provides an electronic device including a memory and a processor, the memory being used to store a computer program, and the processor being used to implement the method described in any of the preceding claims when the computer program is executed.
[0035] Fourthly, the present invention also provides a readable storage medium storing a computer program that, when executed by a processor, implements the method described in any of the preceding claims.
[0036] The present invention can achieve at least the following beneficial effects: by taking bitter gourd fruit images collected under field conditions as the research object, a skin color quantification dataset based on the CIE Lab color space is constructed. The aim is to establish an objective, repeatable and biologically significant accurate identification and evaluation system for bitter gourd skin color, so as to improve the accuracy of bitter gourd skin color identification and provide technical support for bitter gourd germplasm resource identification and breeding application. Attached Figure Description
[0037] Figure 1 The diagram shown is a flowchart illustrating the method for accurately identifying and evaluating the color of bitter gourd peel provided in the embodiments of this specification. Detailed Implementation
[0038] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0039] The following describes the embodiments in conjunction with the appendix to the instruction manual. Figure 1 Specific details:
[0040] This specification provides an embodiment of a method for accurately identifying and evaluating the color of bitter gourd peel, including:
[0041] S1: Acquiring fruit images; In this embodiment of the manual, images are acquired on sunny mornings from 7:00-10:00 and afternoons from 16:00-18:00. During these times, the sun's altitude angle is moderate, and the light intensity is stable and soft, avoiding localized overexposure or shadow distortion of the fruit peel caused by direct sunlight. A light-shielding plate is used to diffuse the light on the fruit during acquisition, reducing the proportion of highlight areas. A SONY α-7RII camera is used uniformly, with fixed parameters of ISO 400, aperture f / 8, shutter speed 1 / 500s, and white balance (daylight mode). The vertical distance between the lens and the fruit is maintained at 50±1cm to ensure consistent optical conditions for all images and reduce systematic errors in the acquisition process.
[0042] S2: ImageJ software is used to extract color features from the fruit images and construct an original sequence dataset. In this embodiment, 30–40 light-avoiding measurement points are selected on each fruit image. These measurement points are evenly distributed across the upper, middle, and lower regions of the fruit peel, avoiding the fruit stalk, lesions, and mechanically damaged areas to reduce interference from non-target areas on color measurement. ImageJ, as an open-source image analysis software, has been proven to be useful for extracting and analyzing phenotypic parameters such as fruit and vegetable color, and has good applicability in fruit and vegetable classification and quality evaluation research. Based on this, the brightness (L*), red-green hue (a*), and yellow-blue hue (b*) parameters of each measurement point in the CIELab color space are extracted. The spatial sequence information of the original measurements is preserved, and two years of data are integrated to construct an original sequence dataset containing 615 samples, each sample being a 30×3 matrix, for deep learning modeling.
[0043] S3: The original sequence dataset was cleaned and organized using the tidyverse package, and a multidimensional visualization method was used for data exploration. In this embodiment, data preprocessing was completed on the R4.2.1 software platform, and the tidyverse package was used for data cleaning and organization. Data with missing values was removed through a sample-by-sample verification mechanism to ensure the integrity of the dataset. A unified variable naming standard was adopted, and brightness, red-green hue, and yellow-blue hue were standardized into three core feature variables: L, a, and b. Manually labeled skin color categories were used as classification labels (7 categories in total), constructing a standardized feature-label system. To analyze the distribution characteristics of different color categories in the Lab space, a multidimensional visualization method was used for data exploration. Two-dimensional scatter plots of L–a, L–b, and a–b were drawn, and a three-dimensional Lab space distribution map was constructed to analyze the cluster density and overlap of each color category, providing a basis for subsequent model selection and parameter optimization.
[0044] S4: The color center coordinates are optimized using K-means clustering combined with the CIE 1976 ΔE formula. In this embodiment, model construction and data analysis are performed using the R4.4.1 and Python 3.8.1 software platforms. A stratified random sampling method is used to divide the dataset into training and test sets in an 8:2 ratio to ensure consistent proportions of color categories across different subsets. Model hyperparameters are optimized using 5-fold cross-validation, and the classification accuracy on the test set is used as the primary evaluation metric to construct a classification performance baseline based on color mean features. Simultaneously, the uniformity of the Lab color space is utilized to initially locate the color centers using K-means clustering. The difference between sample and standard color perception is quantified using the CIE 1976 ΔE formula, and the color center values for each category are iteratively optimized using a grid search algorithm.
[0045] S5: Introducing the LSTM model to model bitter gourd skin color data; In the embodiments of this specification, LSTM is an improved recurrent neural network structure that can effectively alleviate the gradient vanishing problem that traditional RNNs are prone to in long sequence modeling through gating mechanism. It has been widely used in agricultural phenotypic time series and spatial sequence analysis. In this study, 30 measurement points continuously obtained on the skin of a single fruit are regarded as a one-dimensional spatial sequence. Each measurement point contains three feature values L, a, and b in the CIE Lab color space, thus forming a 30×3 input matrix. The LSTM model describes the continuous change law of skin color in the spatial dimension through recursive learning of color information of adjacent measurement points, and realizes accurate discrimination of color category. For the time step, the calculation process of the LSTM unit can be expressed as (1)-(6):
[0046] (1)
[0047] (2)
[0048] (3)
[0049] (4)
[0050] (5)
[0051] (6)
[0052] in, This represents the input feature vector (i.e., Lab value) of the t-th fruit peel measurement point. Output the hidden state at the current time step. This is a unit memory state; , and These represent the activation results of the forget gate, input gate, and output gate, respectively. The Sigmoid activation function is used. It is the hyperbolic tangent function; , , , These are the weight matrices corresponding to the forget gate, input gate, candidate memory unit, and output gate, respectively. , , , This is the corresponding bias term. This gating structure enables LSTM to dynamically retain key measurement point information that contributes to color discrimination during the modeling process, while weakening the influence of noise points or local outliers, thereby improving the model's overall ability to distinguish skin color categories.
[0053] S6: Analyze the results of leather color classification using the LSTM model and output the analysis results.
[0054] S6 specifically includes:
[0055] The 30 measurement points continuously acquired on the peel of a single fruit are regarded as a one-dimensional spatial sequence. Each measurement point contains three feature values, L, a, and b, in the CIE Lab color space, thus forming a 30×3 input matrix.
[0056] The LSTM model recursively learns the color information of adjacent measurement points to depict the continuous variation of skin color in the spatial dimension, thereby achieving accurate identification of color categories.
[0057] Furthermore, prior to S1, it also includes selecting 205 bitter gourd germplasm resources as samples. All samples are planted in the same experimental field, using a unified cultivation and management scheme, with a plant spacing of 0.8m×1.2m, drip irrigation and fertilization, integrated pest and disease control, and control of environmental factors, with consistent light, temperature, and humidity.
[0058] Based on the same idea, this specification provides an embodiment of a device for accurately identifying and evaluating the color of bitter gourd peel, comprising:
[0059] Acquisition module: used to acquire fruit images;
[0060] The first construction module: using ImageJ software to extract color features from the fruit images, and constructing a mean feature dataset and an original sequence dataset;
[0061] Processing module: Used to clean and organize the mean feature dataset and the original sequence dataset using the tidyverse package, and to explore the data using multidimensional visualization methods;
[0062] Baseline and Optimization Module: Used to optimize color center coordinates using the K-means clustering algorithm combined with the CIE 1976 ΔE formula;
[0063] The second building block is used to introduce an LSTM model to model the bitter gourd peel color data.
[0064] Analysis module: Used to analyze the results of leather color classification using the LSTM model and output the analysis results.
[0065] Based on the same idea, this specification provides an electronic device including a memory and a processor. The memory is used to store a computer program, and the processor is used to implement the method described in any of the above-mentioned embodiments when the computer program is executed.
[0066] Based on the same idea, embodiments of this specification provide a readable storage medium storing a computer program that, when executed by a processor, implements the method described in any of the above-mentioned embodiments.
[0067] The basic principles of the present invention have been described above with reference to specific embodiments. However, it should be noted that the advantages, benefits, and effects mentioned in the present invention are merely examples and not limitations, and should not be considered as essential features of each embodiment of the present invention. Furthermore, the specific details disclosed above are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the present invention to the necessity of employing the aforementioned specific details.
[0068] The block diagrams of devices, apparatuses, devices, and systems involved in this invention are merely illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As those skilled in the art will recognize, these devices, apparatuses, devices, and systems can be connected, arranged, and configured in any manner. Words such as “comprising,” “including,” “having,” etc., are open-ended terms meaning “including but not limited to,” and are used interchangeably with them. The terms “or” and “and” as used herein refer to the terms “and / or,” and are used interchangeably with them unless the context clearly indicates otherwise. The term “such as” as used herein refers to the phrase “such as but not limited to,” and is used interchangeably with it.
[0069] It should also be noted that in the apparatus, device, and method of the present invention, the components or steps can be disassembled and / or recombined. These disassemblies and / or recombinations should be considered as equivalent solutions of the present invention.
[0070] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the invention. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein can be applied to other aspects without departing from the scope of the invention. Therefore, the invention is not intended to be limited to the aspects shown herein, but rather to be carried out within the widest scope consistent with the principles and novel features disclosed herein.
[0071] It should be understood that the qualifying terms "first", "second", "third", "fourth", "fifth" and "sixth" used in the description of the embodiments of the present invention are only used to more clearly illustrate the technical solutions and are not intended to limit the scope of protection of the present invention.
[0072] The above description has been given for purposes of illustration and description. Furthermore, this description is not intended to limit the embodiments of the invention to the forms disclosed herein. Although numerous exemplary aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations therein.
Claims
1. A method for accurately identifying and evaluating the color of bitter melon peel, characterized in that, include: S1: Capture fruit images; S2: Use ImageJ software to extract color features from the fruit images and construct the original sequence dataset; S3: The tidyverse package is used to clean and organize the original sequence dataset, and a multidimensional visualization method is used to explore the data; S4: The color center coordinates are optimized using the K-means clustering algorithm combined with the CIE 1976 ΔE formula; S5: Introduce the LSTM model to model the bitter gourd peel color data; S6: Analyze the skin color classification results using the LSTM model and output the analysis results.
2. The method according to claim 1, characterized in that, S6 includes: The 30 measurement points continuously acquired on the peel of a single fruit are regarded as a one-dimensional spatial sequence. Each measurement point contains three feature values L, a, and b in the CIELab color space, thus forming a 30×3 input matrix. The LSTM model recursively learns the color information of adjacent measurement points to depict the continuous variation of skin color in the spatial dimension, thereby achieving accurate identification of color categories.
3. The method according to claim 1, characterized in that, In S5, the process of establishing the LSTM model is represented as (1)-(6): (1) (2) (3) (4) (5) (6) in, This represents the input feature vector of the t-th fruit peel measurement point. Output the hidden state at the current time step. This is a unit memory state; , and These represent the activation results of the forget gate, input gate, and output gate, respectively. It is the Sigmoid activation function. It is the hyperbolic tangent function; , , , , , , , For the corresponding bias term.
4. The method according to claim 1, characterized in that, S4 further includes partitioning the dataset using 8:2 stratified random sampling, optimizing the model hyperparameters based on color mean features through 5-fold cross-validation, and constructing a classification performance baseline using the test set accuracy; the CIE 1976 ΔE formula is as follows: Among them, L1, a1, b1, and L2, 2 and b2 represent the Lab values of the color of the sample to be tested and the standard reference color, respectively. The color difference distance between each sample and the center of its category is quantified, and the color center value of each category is iteratively optimized through a grid search algorithm.
5. The method according to claim 1, characterized in that, Before S1, the method further includes selecting 205 bitter gourd germplasm resources as samples. All samples are planted in the same experimental field and adopt a unified cultivation and management scheme with a plant spacing of 0.8m×1.2m, drip irrigation and fertilization, integrated pest and disease control, and control of environmental factors, with consistent light, temperature and humidity.
6. A device for accurately identifying and evaluating the color of bitter gourd peel, characterized in that, include: Acquisition module: used to acquire fruit images; The first construction module is used to extract color features from the fruit images using ImageJ software and to construct the original sequence dataset. Processing module: Used to clean and organize the original sequence dataset using the tidyverse package, and to explore the data using multidimensional visualization methods; Baseline and Optimization Module: Used to optimize color center coordinates using the K-means clustering algorithm combined with the CIE 1976 ΔE formula; The second building block is used to introduce an LSTM model to model the bitter gourd peel color data. Analysis module: Used to analyze the skin color classification results using the LSTM model and output the analysis results.
7. An electronic device, characterized in that: The system includes a memory and a processor, the memory being used to store a computer program, and the processor being used to implement the method according to any one of claims 1 to 4 when the computer program is executed.
8. A readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the method as described in any one of claims 1 to 4.