Crop disease identification method and device based on semantic cone
By introducing Lorenz space and semantic cone constraints into the visual language model, a semantic structure for crop disease categories is constructed, which solves the problem of insufficient utilization of semantic relationships in agricultural disease identification and achieves efficient and stable disease identification results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ANHUI UNIV
- Filing Date
- 2026-01-29
- Publication Date
- 2026-05-12
AI Technical Summary
Existing methods for identifying crop diseases are difficult to effectively utilize the semantic relationships between disease categories in agricultural scenarios, resulting in poor identification performance. Furthermore, they rely on a large amount of manually labeled data and consume a lot of computing resources.
In the feature mapping stage of the visual language model, Lorenz space constraints and semantic cone consistency constraints are introduced. The improved visual language model is used to perform feature mapping and fine-tuning training on crop disease images and text descriptions to construct the semantic structure of disease categories and improve the stability and reliability of recognition.
Without altering the core structure of the model, semantic cone constraints improve the accuracy and stability of crop disease identification while reducing computational overhead, making it suitable for agricultural environments with limited data and computational resources.
Smart Images

Figure CN122023903A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of crop disease identification methods, and in particular to a crop disease identification method and device based on semantic cones. Background Technology
[0002] Statistics show that agricultural diseases can cause a 20% to 40% reduction in global crop yields annually. With a continuously growing global population, increasing crop yields has become a significant challenge facing all of humanity. Therefore, timely and accurate identification and control of crop diseases are of great practical importance for ensuring food security and improving the level of sustainable agricultural development.
[0003] With the continuous development of agricultural informatization, mainstream research on crop disease identification methods has gradually shifted from traditional image processing methods such as spectral image analysis to deep learning-based models to achieve more efficient identification of crop diseases. However, these supervised learning methods usually rely on a large number of manually labeled images, which is difficult to obtain in the agricultural field. Furthermore, the category labels of existing datasets cannot express the semantic relationships between categories. At the same time, the common new disease categories in real agricultural environments, the distribution shifts in different regions, and the diverse shooting conditions also significantly weaken their generalization ability.
[0004] In recent years, visual language pre-trained models such as CLIP have significantly improved zero-shot and cross-domain recognition capabilities in general vision domains by aligning visual features with natural language semantics through comparative learning between images and text, providing new solutions for agricultural disease identification. Meanwhile, cue learning methods have further enhanced CLIP's performance on specific agricultural tasks by automatically optimizing learnable text cue words, and existing research shows that cue learning methods have good application potential in agricultural scenarios. However, cue word optimization methods based on gradient descent are prone to overfitting. Furthermore, crop diseases have a natural hierarchical structure in biology, but current mainstream cue learning methods typically treat all diseases as concepts at the same level, making it difficult to reflect and utilize this fine-grained hierarchical relationship.
[0005] Therefore, a method is needed that can distinguish between category structure and semantic boundaries to enhance the separability of text representation and the semantic consistency of images. Summary of the Invention
[0006] To address the issues of complex semantic structures and insufficient category differentiation in agricultural scenarios, the primary objective of this invention is to provide a semantic cone-based crop disease identification method. This method achieves hierarchical semantic expression of diseases by introducing Lorenz space constraints during the feature mapping stage without altering the core structure of the visual language model. It also reduces computational overhead and improves the stability and reliability of the model when identifying crop diseases in complex scenarios.
[0007] To achieve the above objectives, the present invention adopts the following technical solution: a method for identifying crop diseases based on semantic cones, the method comprising the following sequential steps:
[0008] (1) Collect crop disease images containing different crop disease types and corresponding disease types, and supplement the crop disease images with text descriptions. The crop disease images and text descriptions constitute the crop disease image dataset.
[0009] (2) Improve the visual language model to obtain the improved model: The visual language model includes an image encoder and a text encoder. A projection layer is added after the image encoder and the text encoder to obtain the improved visual language model. The crop disease image is input into the image encoder to extract the corresponding image features. At the same time, the text description is input into the text encoder to extract the corresponding text features. The image features and text features are respectively input into the projection layer for mapping to obtain the mapped image features. and mapped text features ;
[0010] (3) Fine-tune the projection layer and introduce semantic cone consistency constraints to constrain the hierarchical semantic relationship between the mapped image features and text features, so that the features of the same crop disease category maintain a consistent semantic direction in the semantic space, and obtain the trained model.
[0011] (4) Input the image of the crop disease to be identified into the trained model and output the corresponding crop disease identification result.
[0012] In step (1), the crop disease image dataset includes the PlantVillage dataset, PlantaeK dataset, PlantLeaf dataset, PlantDoc dataset and PlantWild dataset.
[0013] Step (2) specifically refers to: the visual language model adopts a pre-trained CLIP model, and the image features are extracted through the pre-trained CLIP model. and text features :
[0014] ;
[0015] in, Images representing crop diseases. Indicates a text description; For image encoders, For text encoders;
[0016] Image features and text features The inputs are respectively fed into the projection layer to map the image features. Mapped text features Located in a unified feature representation space, the parameters of the image encoder and text encoder remain frozen during the mapping process, and the mapping formula is:
[0017] ;
[0018] in, The magnitude representing the mapped image features. This represents the mapped image feature vector; The modulus representing the mapped text features. This represents the mapped text feature vector.
[0019] Step (3) specifically refers to: constructing the total loss function for fine-tuning as follows: :
[0020]
[0021] in, This represents the contrastive loss used to constrain image features and text features. To constrain the semantic cone loss of the disease category hierarchy, These are the weighting coefficients for the semantic cone loss;
[0022] For a set of B image-text pairs within a sample, let their image features and text features be denoted as follows: Cosine similarity is used to calculate the degree of matching between images and text:
[0023] ;
[0024] in, Representative image Matched text The probability, Represents an exponential mapping. Represents cosine similarity. Each represents a constant between 1 and B. Representing the Text features, This is a temperature parameter used to adjust the confidence distribution of the prediction; Representing the One text feature;
[0025] Corresponding image-to-text contrast loss for:
[0026]
[0027] Accordingly, the matching degree between text and image is calculated as follows:
[0028] ;
[0029] in, Representative text Matched image The probability of; Representing the Image features;
[0030] Obtain the contrast loss in the text-to-image direction. :
[0031]
[0032] Comparative loss for:
[0033] ;
[0034] Mapped image features Mapped text features Mapping to the Lorentz model via exponential mapping In this process, image features in Lorentz space are obtained. and text features :
[0035] Textual features in Lorentz space As the semantic center, a semantic cone is constructed for the corresponding crop disease category, and the aperture angle of the semantic cone is... Defined as:
[0036] ;
[0037] in, and These are all parameters that control the shape of the semantic cone. Used to control the width of the semantic cone. The depth of the semantic cone, the aperture angle The semantic range of the disease category corresponding to the text feature in the semantic space;
[0038] Subsequently, image features in Lorentz space are calculated based on the Lorentz inner product. Textual features within Lorenz space Deviation angle between :
[0039] ;
[0040] in, Represents the Lorentz inner product;
[0041] When the deviation angle Greater than aperture angle At that time, semantic cone loss The statement is as follows:
[0042]
[0043] in, and These represent the image features and text features of the i-th sample in Lorentz space, respectively.
[0044] Semantic cone loss Used to constrain image features to converge into the corresponding text semantic cone;
[0045] Based on the total loss function While keeping the core parameters of the visual language model frozen, the parameters of the projection layer are fine-tuned to obtain the trained model.
[0046] Another object of the present invention is to provide an electronic device comprising:
[0047] Processor; and
[0048] A memory storing computer program instructions that, when executed by the processor, cause the processor to perform the semantic cone-based crop disease identification method as described above.
[0049] The present invention also provides a computer-readable storage medium having stored thereon computer program instructions, which, when executed by a processor, cause the processor to perform the crop disease identification method based on semantic cones as described above.
[0050] As can be seen from the above technical solution, the beneficial effects of the present invention are as follows: First, by introducing semantic cone consistency constraints, the present invention structures the semantic relationships between crop disease categories, enabling the model to consider the semantic correlations between disease categories simultaneously during the identification process, which helps to improve the rationality of disease identification results; Second, without changing the main structure of the visual language model, the present invention introduces Lorenz space constraints in the feature mapping stage to express the semantics of disease levels, with low computational overhead, making it suitable for application environments with limited data or computational resources in agricultural scenarios; Third, the present invention guides image features of the same disease category to cluster within the corresponding semantic range through semantic cone constraints, reducing confusion between features of different disease categories, thereby improving the stability and reliability of the model when identifying crop diseases in complex scenarios. Attached Figure Description
[0051] Figure 1 This is a flowchart of the method of the present invention;
[0052] Figure 2 This is a schematic diagram of the improved model in this invention. Detailed Implementation
[0053] like Figure 1 As shown, a method for identifying crop diseases based on semantic cones includes the following steps in sequence:
[0054] (1) Collect crop disease images containing different crop disease types and corresponding disease types, and supplement the crop disease images with text descriptions. The crop disease images and text descriptions constitute the crop disease image dataset.
[0055] (2) Improve the visual language model to obtain the improved model, such as Figure 2 As shown: The visual language model includes an image encoder and a text encoder. A projection layer is added after the image encoder and text encoder to obtain the improved visual language model. Crop disease images are input into the image encoder to extract corresponding image features; simultaneously, text descriptions are input into the text encoder to extract corresponding text features. The image features and text features are then input into the projection layer for mapping to obtain the mapped image features. and mapped text features ;
[0056] (3) Fine-tune the projection layer and introduce semantic cone consistency constraints to constrain the hierarchical semantic relationship between the mapped image features and text features, so that the features of the same crop disease category maintain a consistent semantic direction in the semantic space, and obtain the trained model.
[0057] (4) Input the image of the crop disease to be identified into the trained model, extract the corresponding image features, calculate the similarity between the image features and the text features of each disease category in the Lorenz space, determine the target crop disease category according to the principle of maximum similarity, and output the recognition result.
[0058] In step (1), the crop disease image dataset includes the PlantVillage dataset, PlantaeK dataset, PlantLeaf dataset, PlantDoc dataset and PlantWild dataset.
[0059] Step (2) specifically refers to: the visual language model adopts a pre-trained CLIP model, and the image features are extracted through the pre-trained CLIP model. and text features :
[0060] ;
[0061] in, Images representing crop diseases. Indicates a text description; For image encoders, For text encoders;
[0062] Image features and text features The inputs are respectively fed into the projection layer to map the image features. Mapped text features Located in a unified feature representation space, the parameters of the image encoder and text encoder remain frozen during the mapping process, and the mapping formula is:
[0063] ;
[0064] in, The magnitude representing the mapped image features. This represents the mapped image feature vector; The modulus representing the mapped text features. This represents the mapped text feature vector.
[0065] Step (3) specifically refers to: constructing the total loss function for fine-tuning as follows: :
[0066]
[0067] in, This represents the contrastive loss used to constrain image features and text features. To constrain the semantic cone loss of the disease category hierarchy, These are the weighting coefficients for the semantic cone loss;
[0068] For a set of B image-text pairs within a sample, let their image features and text features be denoted as follows: Cosine similarity is used to calculate the degree of matching between images and text:
[0069] ;
[0070] in, Representative image Matched text The probability, Represents an exponential mapping. Represents cosine similarity. Each represents a constant between 1 and B. Representing the Text features, This is a temperature parameter used to adjust the confidence distribution of the prediction; Representing the One text feature;
[0071] Corresponding image-to-text contrast loss for:
[0072]
[0073] Accordingly, the matching degree between text and image is calculated as follows:
[0074] ;
[0075] in, Representative text Matched image The probability of; Representing the Image features;
[0076] Obtain the contrast loss in the text-to-image direction. :
[0077]
[0078] Comparative loss for:
[0079] ;
[0080] Mapped image features Mapped text features Mapping to the Lorentz model via exponential mapping In this process, image features in Lorentz space are obtained. and text features :
[0081] Textual features in Lorentz space As the semantic center, a semantic cone is constructed for the corresponding crop disease category, and the aperture angle of the semantic cone is... Defined as:
[0082] ;
[0083] in, and These are all parameters that control the shape of the semantic cone. Used to control the width of the semantic cone. The depth of the semantic cone, the aperture angle The semantic range of the disease category corresponding to the text feature in the semantic space;
[0084] Subsequently, image features in Lorentz space are calculated based on the Lorentz inner product. Textual features within Lorenz space Deviation angle between :
[0085] ;
[0086] in, Represents the Lorentz inner product;
[0087] When the deviation angle Greater than aperture angle At that time, semantic cone loss The statement is as follows:
[0088]
[0089] in, and These represent the image features and text features of the i-th sample in Lorentz space, respectively.
[0090] Semantic cone loss Used to constrain image features to converge into the corresponding text semantic cone;
[0091] Based on the total loss function While keeping the core parameters of the visual language model frozen, the parameters of the projection layer are fine-tuned to obtain the trained model.
[0092] like Figure 2 As shown, this invention inputs crop disease images and corresponding text descriptions into a frozen visual language encoder to extract image features and text features. After mapping through a trainable projection layer, these features are used for joint training of contrastive constraints and semantic constraints, respectively. The model is then optimized under the action of the total loss function, thereby achieving the identification of crop diseases.
[0093] In summary, this invention eliminates the need for overall training of existing pre-trained models and reliance on a large amount of newly added manually labeled data in the process of crop disease identification. Instead, it effectively characterizes the relationships between different crop disease categories by introducing reasonable semantic constraints during the feature processing stage, thereby reducing the cost of model training and deployment while ensuring recognition effectiveness. Furthermore, by guiding image information of the same disease category to converge within the corresponding semantic range, this invention reduces recognition confusion caused by similar appearances between different disease categories. This allows the model to maintain relatively stable recognition performance even under complex lighting conditions, background interference, and cross-scenario applications. Compared to traditional identification methods that rely on single similarity judgment, this invention improves the applicability and practical value of crop disease identification in actual agricultural production.
[0094] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the claimed invention. The scope of protection claimed by the appended claims and their equivalents is defined.
Claims
1. A method for identifying crop diseases based on semantic cones, characterized in that: The method includes the following steps in sequence: (1) Collect crop disease images containing different crop disease types and corresponding disease types, and supplement the crop disease images with text descriptions. The crop disease images and text descriptions constitute the crop disease image dataset. (2) Improve the visual language model to obtain the improved model: The visual language model includes an image encoder and a text encoder. A projection layer is added after the image encoder and the text encoder to obtain the improved visual language model. The crop disease image is input into the image encoder to extract the corresponding image features; at the same time, the text description is input into the text encoder to extract the corresponding text features; the image features and text features are respectively input into the projection layer for mapping to obtain the mapped image features. and mapped text features ; (3) Fine-tune the projection layer and introduce semantic cone consistency constraints to constrain the hierarchical semantic relationship between the mapped image features and text features, so that the features of the same crop disease category maintain a consistent semantic direction in the semantic space, and obtain the trained model. (4) Input the image of the crop disease to be identified into the trained model and output the corresponding crop disease identification result.
2. The crop disease identification method based on semantic cones according to claim 1, characterized in that: In step (1), the crop disease image dataset includes the PlantVillage dataset, PlantaeK dataset, PlantLeaf dataset, PlantDoc dataset and PlantWild dataset.
3. The crop disease identification method based on semantic cones according to claim 1, characterized in that: Step (2) specifically refers to: the visual language model adopts a pre-trained CLIP model, and the image features are extracted through the pre-trained CLIP model. and text features : ; in, Images representing crop diseases. Indicates a text description; For image encoders, For text encoders; Image features and text features The inputs are respectively fed into the projection layer to map the image features. Mapped text features Located in a unified feature representation space, the parameters of the image encoder and text encoder remain frozen during the mapping process, and the mapping formula is: ; in, The magnitude representing the mapped image features. This represents the mapped image feature vector; The modulus representing the mapped text features. This represents the mapped text feature vector.
4. The crop disease identification method based on semantic cones according to claim 1, characterized in that: Step (3) specifically refers to: constructing the total loss function for fine-tuning as follows: : ; in, This represents the contrastive loss used to constrain image features and text features. To constrain the semantic cone loss of the disease category hierarchy, These are the weighting coefficients for the semantic cone loss; For a set of B image-text pairs within a sample, let their image features and text features be denoted as follows: Cosine similarity is used to calculate the degree of matching between images and text: ; in, Representative image Matched text The probability, Represents an exponential mapping. Represents cosine similarity. Each represents a constant between 1 and B. Representing the Text features, This is a temperature parameter used to adjust the confidence distribution of the prediction; Representing the One text feature; Corresponding image-to-text contrast loss for: ; Accordingly, the matching degree between text and image is calculated as follows: ; in, Representative text Matched image The probability of; Representing the Image features; Obtain the contrast loss in the text-to-image direction. : ; Comparative loss for: ; Mapped image features Mapped text features Mapping to the Lorentz model via exponential mapping In this process, image features in Lorentz space are obtained. and text features : Textual features in Lorentz space As the semantic center, a semantic cone is constructed for the corresponding crop disease category, and the aperture angle of the semantic cone is... Defined as: ; in, and These are all parameters that control the shape of the semantic cone. Used to control the width of the semantic cone. The depth of the semantic cone, the aperture angle The semantic range of the disease category corresponding to the text feature in the semantic space; Subsequently, image features in Lorentz space are calculated based on the Lorentz inner product. Textual features within Lorenz space Deviation angle between : ; in, Represents the Lorentz inner product; When the deviation angle Greater than aperture angle At that time, semantic cone loss The statement is as follows: ; in, and These represent the image features and text features of the i-th sample in Lorentz space, respectively. Semantic cone loss Used to constrain image features to converge into the corresponding text semantic cone; Based on the total loss function While keeping the core parameters of the visual language model frozen, the parameters of the projection layer are fine-tuned to obtain the trained model.
5. An electronic device, comprising: processor; as well as A memory storing computer program instructions that, when executed by the processor, cause the processor to perform the crop disease identification method based on semantic cones as described in any one of claims 1-4.
6. A computer-readable storage medium having stored thereon computer program instructions, which, when executed by a processor, cause the processor to perform the crop disease identification method based on semantic cones as described in any one of claims 1-4.