Agricultural knowledge extraction method and device, storage medium and electronic equipment
Patent Information
- Application Number
- CN202610714542.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-22
- Publication Date
- 2026-10-30
AI Technical Summary
农业文本资源分布零散,缺乏高质量的标注数据集
[0044]借此,本发明农业知识抽取技术,包括:获取多源农业数据,对多源农业数据进行预处理,构建农业知识抽取的训练集;基于通用信息抽取模块为基础架构,选取预训练语言模型作为底层表示模型,并结合农业知识特征设计层次化信息抽取模板,共同构建农业知识抽取模型;通过训练集对农业知识抽取模型进行有监督微调训练;通过农业知识抽取模型从待处理农业数据中抽取输出实体与关系。借此,本发明能够实现农业知识的自动、高效与可扩展抽取,为农业知识图谱构建与智能决策提供了技术支撑。
Smart Images

Figure CN123014106A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of smart agriculture technology, and in particular to an agricultural knowledge extraction method, apparatus, storage medium, and electronic device. Background Technology
[0002] With the rapid development of agricultural informatization and smart agriculture, the agricultural sector has generated a large amount of multi-source heterogeneous data, including scientific research literature, policy documents, crop planting records, pest and disease monitoring reports, and content from agricultural Q&A communities. This data contains rich textual knowledge, such as crop variety characteristics, environmental factors, and disease control strategies. However, this knowledge often exists in unstructured form and is difficult to utilize directly. Therefore, Agricultural Knowledge Extraction (AKE) has become a key foundational technology driving the construction of agricultural knowledge graphs and the development of intelligent decision-making / large-scale agricultural models.
[0003] Current agricultural knowledge extraction aims to solve the following problems:
[0004] I. Scarcity of Annotated Corpora and Fragmentation of Knowledge. Agricultural text resources are scattered and lack high-quality annotated datasets.
[0005] Second, domain adaptation and knowledge transfer are difficult. General NLP (Natural Language Processing) models have limited transfer effectiveness in the agricultural field.
[0006] Third, the issues of the dynamism and timeliness of knowledge. Agricultural knowledge changes frequently due to factors such as seasons, climate, and policies, requiring a continuously updated extraction system.
[0007] There are four existing methods for extracting agricultural knowledge:
[0008] I. Rule-Based and Template-Based Methods. Early research on agricultural knowledge extraction primarily relied on rule templates and manual feature engineering. For example, entities (such as "crop names," "disease names," and "pesticide types") and their relationships were extracted from agricultural literature by defining regular expressions, syntactic templates, or rule systems based on expert knowledge. These methods are simple to implement and highly interpretable, but they lack versatility and scalability, making it difficult to adapt to changes in different domains and text styles. Furthermore, agricultural texts contain a large number of technical terms and implicit semantic relationships, and relying solely on rule matching often results in low recall rates.
[0009] II. Shallow Models Based on Machine Learning. With the development of statistical learning methods, researchers have begun to use traditional machine learning models such as SVM (Support Vector Machine), CRF (Conditional Random Field), and HMM (Hidden Markov Model) for entity recognition and relation extraction. These methods typically rely on manually designed features (such as part-of-speech tagging, context windows, and word vectors), which improves the robustness of extraction to some extent. However, high feature construction costs and weak domain transfer capabilities are their main limitations, and the models struggle to capture complex semantic relationships.
[0010] III. End-to-End Extraction Methods Based on Deep Learning. In recent years, the introduction of deep learning has significantly promoted the development of agricultural knowledge extraction. Models based on BiLSTM-CRF (Bidirectional Long Short-Term Memory), CNN (Convolutional Neural Network), Attention, and Transformer have achieved significant progress in tasks such as agricultural entity recognition, relation extraction, and event extraction. In particular, the application of pre-trained language models such as BERT (Bidirectional Encoder Representations from Transformers), RoBERTa (Robustly Optimized BERT Pretraining Approach), and ERNIE (Enhanced Representation through Knowledge Integration) enables models to better understand the contextual semantics of agricultural texts. For example, pre-trained language models for agriculture, such as AgriBERT (Agricultural BERT, a BERT pre-trained model specifically for the agricultural domain) and AgroBERT (Agriculture-oriented BERT, a BERT pre-trained model for agriculture), have demonstrated superior performance in various agricultural NLP tasks. However, agricultural data suffers from problems such as a lack of labeled data, sparse domain knowledge, and strong terminology ambiguity, which means that deep models still face performance bottlenecks when transferred to specific agricultural scenarios.
[0011] IV. Research Trends Based on Knowledge Graphs and Multimodal Fusion. With the development of smart agriculture systems, agricultural knowledge extraction is gradually evolving towards agricultural knowledge graph construction and multimodal fusion. Researchers are attempting to jointly extract entities and relationships from text, images, and sensor data to achieve knowledge modeling of the relationship between crop phenotypes, environmental factors, and yield. For example, crop image recognition is fused with text information to support the construction of knowledge graphs for pest and disease identification and control. Furthermore, in recent years, some studies have emerged utilizing Large Language Models (LLMs) for knowledge extraction and reasoning, such as using ChatGPT or Agric-LLM for few-sample agricultural knowledge generation and verification, demonstrating powerful general extraction and knowledge completion capabilities. However, these large language models still suffer from problems such as domain-specific knowledge dilution, insufficient interpretability of extraction results, and difficulty in guaranteeing knowledge consistency.
[0012] In conclusion, the existing technology obviously has inconveniences and defects in practical use, so it is necessary to improve it. Summary of the Invention
[0013] To address the aforementioned shortcomings, the present invention aims to provide an agricultural knowledge extraction method, apparatus, storage medium, and electronic device that can achieve automatic, efficient, and scalable extraction of agricultural knowledge, providing technical support for agricultural knowledge graph construction and intelligent decision-making.
[0014] To solve the above-mentioned technical problems, the present invention is implemented as follows:
[0015] In a first aspect, embodiments of the present invention provide an agricultural knowledge extraction method, comprising the following steps:
[0016] The data preprocessing step involves acquiring multi-source agricultural data, preprocessing the multi-source agricultural data, and constructing a training set for agricultural knowledge extraction.
[0017] The model construction steps are based on a general information extraction module as the basic architecture, a pre-trained language model is selected as the underlying representation model, and a hierarchical information extraction template is designed in combination with agricultural knowledge features to jointly construct an agricultural knowledge extraction model.
[0018] The model fine-tuning step involves supervising the agricultural knowledge extraction model using the training set.
[0019] The model reasoning step involves extracting output entities and relationships from the agricultural data to be processed using the agricultural knowledge extraction model.
[0020] According to the agricultural knowledge extraction method of the present invention, the data preprocessing step includes:
[0021] Acquire multi-source agricultural data, including academic papers, agricultural technology manuals, pest and disease control announcements and / or agricultural technology Q&A texts;
[0022] The multi-source agricultural data is preprocessed by data cleaning and labeling to construct the training set for agricultural knowledge extraction.
[0023] The entities include entities in the categories of crops, pests and diseases, pesticides, control measures, and / or climate conditions.
[0024] According to the agricultural knowledge extraction method of the present invention, the hierarchical information extraction template adopts a multi-granularity labeling system and defines multi-level entities and relationships.
[0025] According to the agricultural knowledge extraction method of the present invention, the supervised fine-tuning training of the model fine-tuning step employs an adaptive moment estimation optimizer and a hierarchical learning rate strategy.
[0026] The updated parameters of the adaptive moment estimator optimizer are expressed as follows:
[0027]
[0028] Where θ is a learnable parameter and η is the learning rate. For the total loss function, The gradient of the parameter θ corresponding to the loss function;
[0029] The hierarchical learning rate strategy is expressed as follows:
[0030]
[0031] in, Let be the learning rate of the i-th layer. The base learning rate is L, and the number of layers is L. This is the attenuation coefficient.
[0032] According to the agricultural knowledge extraction method of the present invention, the supervised fine-tuning training of the model fine-tuning step adopts end-to-end optimization using a joint loss function, which is:
[0033]
[0034] Where Lgen is the cross-entropy loss for sequence generation, and Lcls is the relation classification loss. , The hyperparameters for balancing the weights.
[0035] According to the agricultural knowledge extraction method of the present invention, the supervised fine-tuning training of the model fine-tuning step incorporates agricultural professional question-and-answer data.
[0036] According to the agricultural knowledge extraction method of the present invention, the supervised fine-tuning training of the model fine-tuning step adopts a regularization strategy, which includes: random deactivation strategy, gradient pruning strategy and early stopping strategy.
[0037] Secondly, embodiments of the present invention provide an agricultural knowledge extraction device constructed based on any one of the methods described above, the device comprising:
[0038] The data preprocessing module is used to acquire multi-source agricultural data, preprocess the multi-source agricultural data, and construct a training set for agricultural knowledge extraction.
[0039] The model building module is used to construct an agricultural knowledge extraction model based on the general information extraction module as the basic architecture, select a pre-trained language model as the underlying representation model, and design a hierarchical information extraction template in combination with agricultural knowledge features.
[0040] The model fine-tuning module is used to perform supervised fine-tuning training on the agricultural knowledge extraction model using the training set.
[0041] The model reasoning module is used to extract output entities and relationships from the agricultural data to be processed through the agricultural knowledge extraction model.
[0042] Thirdly, embodiments of the present invention provide a storage medium for storing a computer program for performing any of the methods described herein.
[0043] Fourthly, embodiments of the present invention provide an electronic device, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor executes the computer program to implement any of the methods described above.
[0044] Therefore, this invention provides an agricultural knowledge extraction technology, comprising: acquiring multi-source agricultural data; preprocessing the multi-source agricultural data; constructing a training set for agricultural knowledge extraction; based on a general information extraction module as the basic architecture, selecting a pre-trained language model as the underlying representation model, and designing a hierarchical information extraction template in conjunction with agricultural knowledge features to jointly construct an agricultural knowledge extraction model; performing supervised fine-tuning training on the agricultural knowledge extraction model using the training set; and extracting output entities and relationships from the agricultural data to be processed using the agricultural knowledge extraction model. Thus, this invention enables automatic, efficient, and scalable extraction of agricultural knowledge, providing technical support for agricultural knowledge graph construction and intelligent decision-making. Attached Figure Description
[0045] Figure 1 This is a flowchart illustrating the agricultural knowledge extraction method provided in Embodiment 1 of the present invention.
[0046] Figure 2This is a schematic diagram of the agricultural knowledge extraction device provided in Embodiment 2 of the present invention;
[0047] Figure 3 This is a schematic diagram of the structure of the electronic device provided in Embodiment 3 of the present invention. Detailed Implementation
[0048] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0049] It should be noted that references to "an embodiment," "embodiment," "example embodiment," etc., in this specification refer to the described embodiment including specific features, structures, or characteristics, but not every embodiment must include these specific features, structures, or characteristics. Furthermore, such expressions do not refer to the same embodiment. Moreover, when describing specific features, structures, or characteristics in conjunction with embodiments, whether or not explicitly described, it is indicated that incorporating such features, structures, or characteristics into other embodiments is within the knowledge of those skilled in the art.
[0050] Furthermore, certain terms are used in the specification and subsequent claims to refer to specific components or parts. Those skilled in the art will understand that manufacturers may use different names or terms to refer to the same component or part. This specification and subsequent claims do not distinguish components or parts by differences in name, but rather by differences in function. The terms "comprising" and "including" used throughout the specification and subsequent claims are open-ended and should be interpreted as "including but not limited to." Additionally, the term "connection" here includes any direct and indirect electrical connection means. Indirect electrical connection means include connections made through other means.
[0051] The agricultural knowledge extraction method provided by the present invention will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.
[0052] In its research on agricultural knowledge graphs, this invention discovered that the main deficiency in existing technologies stems from the low ability to extract textual knowledge from the agricultural domain during the construction of current agricultural knowledge graphs. Traditional agricultural knowledge extraction methods largely rely on manual rules and general language models, making it difficult to accurately identify domain entities (such as crop varieties, pest and disease names, pesticides, cultivation practices, etc.) and their complex semantic relationships within agricultural texts. This problem results in a low degree of structuring in agricultural knowledge graphs, low knowledge update efficiency, and an inability to meet the demands for high-quality knowledge representation and reasoning in intelligent agriculture applications.
[0053] To address the aforementioned technical shortcomings, this invention, through extensive experimental and model comparison studies, discovered that domain-specific fine-tuning of pre-trained language models based on the PaddleNLP (Baidu PaddlePaddle) framework can effectively improve the model's extraction accuracy and generalization performance on agricultural corpora. First, a multi-source agricultural corpus was collected and constructed, including academic papers, agricultural technical manuals, pest and disease control announcements, and agricultural Q&A texts. After data cleaning and annotation, a high-quality training set was formed. Subsequently, the Universal Information Extraction (UIE) framework of PaddleNLP was selected as the base model, and improvements were made in three aspects specifically for agricultural knowledge extraction tasks: schema design, entity relation information extraction template (Schema) construction, and domain vocabulary expansion. In schema design, a hierarchical relation template was introduced, enabling the model to simultaneously recognize multi-level entities and complex relationships. In information extraction template construction, a multi-granularity labeling system was designed for agricultural terms to improve the fine-grained extraction capability. In the fine-tuning stage, agricultural professional Q&A data was introduced to enhance the model's semantic understanding of domain terms.
[0054] Through the above improvements, this invention constructs an agricultural knowledge extraction model that achieves significant performance enhancements in multiple tasks, including crop diseases, climate factors, and agronomic measures. This model not only overcomes the shortcomings of general models in agricultural semantic recognition but also realizes automatic, efficient, and scalable extraction of agricultural knowledge, providing technical support for agricultural knowledge graph construction and intelligent decision-making.
[0055] Figure 1 This is a flowchart illustrating the agricultural knowledge extraction method provided in Embodiment 1 of the present invention. The method includes the following steps:
[0056] Step S101, data preprocessing step: acquire multi-source agricultural data, preprocess the multi-source agricultural data, and construct a training set for agricultural knowledge extraction.
[0057] Step S102, model construction step: Based on the general information extraction module as the basic architecture, a pre-trained language model is selected as the underlying representation model, and a hierarchical information extraction template is designed in combination with agricultural knowledge features to jointly construct an agricultural knowledge extraction model.
[0058] Step S103, model fine-tuning step, involves supervising the agricultural knowledge extraction model through the training set.
[0059] Step S104, model reasoning step, extracts output entities and relationships from the agricultural data to be processed through the agricultural knowledge extraction model.
[0060] The purpose of this invention is to solve (overcome) the problem of low text knowledge extraction capability in the current agricultural knowledge graph construction process of the prior art, and to propose an agricultural knowledge extraction method and system.
[0061] Key Point 1: Hierarchical Relationship Template; the model can simultaneously identify multi-level entities and complex relationships.
[0062] Key Point 2: In the construction of information extraction templates; design a multi-granularity labeling system for agricultural terminology.
[0063] Key Point 3: During the fine-tuning phase, agricultural professional question-and-answer data is introduced to enhance the model's semantic understanding of domain terminology.
[0064] This invention constructs an agricultural knowledge extraction model, achieving significant performance improvements in multiple tasks, including agricultural knowledge extraction and agricultural knowledge graph construction. This model not only overcomes the shortcomings of general models in agricultural semantic recognition but also enables automatic, efficient, and scalable extraction of agricultural knowledge, providing technical support for agricultural knowledge graph construction and intelligent decision-making.
[0065] Preferably, the data preprocessing step includes:
[0066] Acquire multi-source agricultural data, including academic papers, agricultural technology manuals, pest and disease control announcements, and / or agricultural technology Q&A texts.
[0067] Data cleaning and labeling were performed on multi-source agricultural data to complete preprocessing, and a training set for agricultural knowledge extraction was constructed.
[0068] Entities include those in the categories of crops, pests and diseases, pesticides, control measures, and / or climate conditions.
[0069] Preferably, the hierarchical information extraction template adopts a multi-granularity tagging system and defines multi-level entities and relationships.
[0070] Preferably, the supervised fine-tuning training in the model fine-tuning step employs an adaptive moment estimation optimizer and a hierarchical learning rate strategy.
[0071] Preferably, the adaptive moment estimator optimizer updates the parameters as follows:
[0072]
[0073] Where θ is a learnable parameter and η is the learning rate. For the total loss function, This represents the gradient of the parameter θ corresponding to the loss function.
[0074] Preferably, the hierarchical learning rate strategy is expressed as:
[0075]
[0076] in, Let be the learning rate of the i-th layer. The base learning rate is L, and the number of layers is L. This is the attenuation coefficient.
[0077] Preferably, the supervised fine-tuning training of the model fine-tuning step uses a joint loss function for end-to-end optimization, and the joint loss function is:
[0078]
[0079] Where Lgen is the cross-entropy loss for sequence generation, and Lcls is the relation classification loss. , The hyperparameters for balancing the weights.
[0080] Preferably, the supervised fine-tuning training of the model fine-tuning step incorporates agricultural professional question-and-answer data.
[0081] Preferably, the supervised fine-tuning training of the model fine-tuning step adopts a regularization strategy, which includes: random deactivation strategy, gradient pruning strategy and early stopping strategy.
[0082] I. System Overview
[0083] Step 1: Data Collection and Preprocessing. Unstructured text data from multiple sources are acquired, including agricultural scientific papers, agricultural extension documents, agricultural policy announcements, and agricultural Q&A platforms. Through data cleaning, deduplication, sentence segmentation, and manual annotation of named entities, a standardized agricultural information extraction training set is formed. This data includes entities from various domains such as crops (e.g., rice, wheat), pests and diseases (e.g., rice blast, aphids), pesticides, control measures, and climate conditions.
[0084] Step 2: Model Construction. The general information extraction module from the PaddleNLP framework is used as the basic architecture, and a pre-trained Chinese language model (such as ERNIE-3.0-base) is selected as the underlying language representation model. Based on the characteristics of the agricultural knowledge system, a hierarchical information extraction template (Schema) is designed to describe multi-level relationships such as "crop-disease-pesticide" and "crop-environmental factors-yield impact".
[0085] Step 3: Model Fine-tuning and Training. Supervised fine-tuning and training are performed using an agricultural corpus within the framework of the general information extraction module. By introducing an agricultural lexicon, a dynamic dictionary expansion mechanism, and a Prompt-based semantic constraint module, the model's ability to recognize agricultural terms and implicit relationships is improved. During model training, the Adam optimizer and a hierarchical learning rate strategy are employed to prevent overfitting and maintain the stability of the pre-trained semantic representations.
[0086] Step 4: Model Reasoning and Knowledge Extraction. After training, the fine-tuned model is deployed in the agricultural text analysis system. The input text to be extracted is used, and the model automatically outputs entity and relation pairs.
[0087] II. Algorithm Optimization
[0088] (1) Input representation: The input sequence consists of task instructions (Prompt) and agricultural text, as follows:
[0089]
[0090] Here, Ptask represents the task prompt statement (such as "Extract the relationship between crops, diseases, and pesticides from the following text"), and Tinput is the original agricultural text. The model's encoder uses a Transformer architecture to encode the input sequence into a context-sensitive representation:
[0091]
[0092] Where H is the hidden layer output matrix and d is the hidden layer dimension.
[0093] (2) Attention Mechanism: The encoding layer uses a multi-head self-attention mechanism to model the contextual information of the text. The calculation formula is as follows:
[0094]
[0095] Where Q=HWQ, K=HWK, V=HWV,
[0096] dk is the learnable weight matrix, and dk is the dimension of the key vector.
[0097] Through a multi-head mechanism, the model can focus on different entity relationships in agricultural texts in different semantic subspaces, such as "crop-disease", "disease-pesticide", and "crop-environmental factors".
[0098] (3) Decoding and Generation: In the decoding stage, the general information extraction model transforms the extraction task into a generation task. Given the encoding result H, the model predicts the target output sequence. Each yt represents a text fragment (such as an entity name or relation label) in the extracted results. The generation process is implemented through conditional probability modeling:
[0099]
[0100] Where θ represents the model parameters, and y < t represents the historical generated sequence. This conditional probability is calculated through the softmax output layer:
[0101]
[0102] ht represents the hidden state of the decoder in the current step, and Wo and bo are learnable parameters.
[0103] PCBA: Circuit Assembly, the first circuit board is the main board, the main board is the PCB, and the AIDC (Automatic Integrated Circuit) is the assembly of various components according to the surface-mount packaging process.
[0104] (4) Loss Function Design: In the agricultural knowledge extraction task, the model simultaneously faces multiple tasks, including entity recognition (NER) and relation extraction (RE). To improve robustness and training efficiency, this invention employs a joint loss function for end-to-end optimization:
[0105]
[0106] Where Lgen is the cross-entropy loss of sequence generation, used to constrain the extraction results generated by the decoder;
[0107]
[0108] Lcls is a relation classification loss used to distinguish different relation types;
[0109]
[0110] Where N is the number of relation categories, and yture and ypred represent the true and predicted relation labels, respectively. λ1 and λ2 are weight coefficients used to balance the training intensity of the two tasks.
[0111] (5) Parameter optimization and regularization: The model uses the AdamW optimizer to update parameters:
[0112]
[0113] Where η is the learning rate. To prevent overfitting, Dropout, gradient clipping, and early stopping strategies are introduced during training. Furthermore, a layer-wise learning rate (LLRD) is used to maintain the semantic stability of the pre-trained layers, i.e.:
[0114]
[0115] Where L is the number of layers. This is the attenuation coefficient.
[0116] Through the aforementioned fine-tuning process, the model can adaptively learn domain knowledge features from agricultural texts, achieving high-precision extraction of crops, diseases, pesticides, and their multidimensional relationships. Experiments demonstrate that this optimization mechanism significantly improves the precision and recall of the extraction results.
[0117] It should be noted that the agricultural knowledge extraction method provided in this embodiment of the invention can be executed by an electronic device, a apparatus, or a control module within that apparatus for executing the method. This embodiment of the invention uses an apparatus to execute the method as an example to illustrate the agricultural knowledge extraction apparatus provided in this embodiment of the invention.
[0118] Figure 2 This is a schematic diagram of the agricultural knowledge extraction device provided in Embodiment 2 of the present invention. The agricultural knowledge extraction device 100 includes a data preprocessing module 10, a model building module 20, a model fine-tuning module 30, and a model inference module 40, wherein:
[0119] The data preprocessing module 10 is used to acquire multi-source agricultural data, preprocess the multi-source agricultural data, and construct a training set for agricultural knowledge extraction.
[0120] The model building module 20 is used to construct an agricultural knowledge extraction model based on a general information extraction module as the basic architecture, select a pre-trained language model as the underlying representation model, and design a hierarchical information extraction template in combination with agricultural knowledge features.
[0121] The model fine-tuning module 30 is used to perform supervised fine-tuning training on the agricultural knowledge extraction model using the training set.
[0122] The model reasoning module 40 is used to extract output entities and relationships from the agricultural data to be processed through an agricultural knowledge extraction model.
[0123] Preferably, the data preprocessing module 10 is used to perform the following actions:
[0124] Acquire multi-source agricultural data, including academic papers, agricultural technology manuals, pest and disease control announcements, and / or agricultural technology Q&A texts.
[0125] Data cleaning and labeling were performed on multi-source agricultural data to complete preprocessing, and a training set for agricultural knowledge extraction was constructed.
[0126] Preferably, the entities include entities in the fields of crops, pests and diseases, pesticides, control measures and / or climate conditions.
[0127] Preferably, the hierarchical information extraction template adopts a multi-granularity tagging system and defines multi-level entities and relationships.
[0128] Preferably, the supervised fine-tuning training of the model fine-tuning module 30 employs an adaptive moment estimation optimizer and a hierarchical learning rate strategy.
[0129] Preferably, the adaptive moment estimator optimizer updates the parameters as follows:
[0130]
[0131] Where θ is a learnable parameter and η is the learning rate. For the total loss function, This represents the gradient of the parameter θ corresponding to the loss function.
[0132] Preferably, the hierarchical learning rate strategy is expressed as:
[0133]
[0134] in, Let be the learning rate of the i-th layer. The base learning rate is L, and the number of layers is L. This is the attenuation coefficient.
[0135] Preferably, the supervised fine-tuning training of the model fine-tuning module 30 uses a joint loss function for end-to-end optimization, and the joint loss function is:
[0136]
[0137] Where Lgen is the cross-entropy loss for sequence generation, and Lcls is the relation classification loss. , The hyperparameters for balancing the weights.
[0138] Preferably, the supervised fine-tuning training of the model fine-tuning module 30 incorporates agricultural professional question-and-answer data.
[0139] Preferably, the supervised fine-tuning training of the model fine-tuning module 30 employs a regularization strategy, which includes: a random deactivation strategy, a gradient pruning strategy, and an early stopping strategy.
[0140] The agricultural knowledge extraction device provided in this embodiment of the invention can achieve Figures 1-2 The various processes implemented in the agricultural knowledge extraction method embodiment shown are not described in detail here to avoid repetition.
[0141] The agricultural knowledge extraction device provided in this invention constructs an agricultural knowledge extraction model, achieving significant performance improvements in multiple tasks such as agricultural knowledge extraction and agricultural knowledge graph construction. This model not only overcomes the shortcomings of general models in agricultural semantic recognition but also realizes automatic, efficient, and scalable extraction of agricultural knowledge, providing technical support for agricultural knowledge graph construction and intelligent decision-making.
[0142] The present invention also provides a storage medium for storing, for example, Figures 1-2 A computer program for any of the agricultural knowledge extraction methods described above. For example, computer program instructions, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the present invention through the operation of the computer, achieving the same technical effect. To avoid repetition, these will not be elaborated further here. The program instructions for invoking the methods of the present invention may be stored in a fixed or removable storage medium, and / or transmitted via data streams in broadcast or other signal carrying media, and / or stored in the storage medium of a computer device operating according to the program instructions.
[0143] According to one embodiment of the present invention, the present invention also provides such a Figure 3 The illustrated electronic device 400 may optionally include a storage medium 200 for storing a computer program and a processor 300 for executing the computer program. When the computer program is executed by the processor 300, it implements any of the aforementioned agricultural knowledge extraction methods, triggering the electronic device 400 to execute methods and / or technical solutions based on the foregoing embodiments, achieving the same technical effect. To avoid repetition, these methods will not be elaborated upon here. It should be noted that the electronic devices in this embodiment include mobile electronic devices and non-mobile electronic devices. For example, mobile electronic devices may be mobile phones, tablets, laptops, handheld computers, in-vehicle electronic devices, wearable devices, super mobile personal computers, netbooks, or personal digital assistants, etc., while non-mobile electronic devices may be servers, network-attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. This embodiment does not specifically limit the scope of the invention.
[0144] It should be noted that the present invention can be implemented in software and / or a combination of software and hardware, for example, using an application-specific integrated circuit (ASIC), a general-purpose computer, or any other similar hardware device. In one embodiment, the software program of the present invention can be executed by a processor to implement the steps or functions described above. Similarly, the software program of the present invention (including associated data structures) can be stored in a computer-readable recording medium, such as RAM memory, a magnetic or optical drive, a floppy disk, or similar devices. Furthermore, some steps or functions of the present invention can be implemented in hardware, for example, as circuitry that works with a processor to perform the various steps or functions.
[0145] This invention can be implemented on a computer as a computer-based method, or in dedicated hardware, or a combination of both. Executable code or portions thereof for the method according to the invention can be stored on a computer program product. Examples of computer program products include memory devices, optical storage devices, integrated circuits, servers, online software, etc. Optionally, the computer program product includes non-transitory program code components stored on a computer-readable medium so as to execute the method according to the invention when the program product is executed on a computer.
[0146] In an optional embodiment, the computer program includes computer program code components adapted to perform all the steps of the method according to the invention when the computer program is run on a computer. Optionally, the computer program is embodied on a computer-readable medium.
[0147] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of the present invention is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0148] Of course, the present invention may have other various embodiments. Without departing from the spirit and essence of the present invention, those skilled in the art can make various corresponding changes and modifications according to the present invention, but these corresponding changes and modifications should all fall within the protection scope of the appended claims.
Claims
1. A method for extracting agricultural knowledge, characterized in that, Includes the following steps: The data preprocessing step involves acquiring multi-source agricultural data, preprocessing the multi-source agricultural data, and constructing a training set for agricultural knowledge extraction. The model construction steps are based on a general information extraction module as the basic architecture, a pre-trained language model is selected as the underlying representation model, and a hierarchical information extraction template is designed in combination with agricultural knowledge features to jointly construct an agricultural knowledge extraction model. The model fine-tuning step involves supervising the agricultural knowledge extraction model using the training set. The model reasoning step involves extracting output entities and relationships from the agricultural data to be processed using the agricultural knowledge extraction model.
2. The agricultural knowledge extraction method according to claim 1, characterized in that, The data preprocessing steps include: Acquire multi-source agricultural data, including academic papers, agricultural technology manuals, pest and disease control announcements and / or agricultural technology Q&A texts; The multi-source agricultural data is preprocessed by data cleaning and labeling to construct the training set for agricultural knowledge extraction. The entities include entities in the categories of crops, pests and diseases, pesticides, control measures, and / or climate conditions.
3. The agricultural knowledge extraction method according to claim 1, characterized in that, The hierarchical information extraction template adopts a multi-granularity tagging system and defines multi-level entities and relationships.
4. The agricultural knowledge extraction method according to claim 1, characterized in that, The supervised fine-tuning training step of the model fine-tuning process employs an adaptive moment estimation optimizer and a hierarchical learning rate strategy. The updated parameters of the adaptive moment estimator optimizer are expressed as follows: Where θ is a learnable parameter and η is the learning rate. For the total loss function, The gradient of the parameter θ corresponding to the loss function; The hierarchical learning rate strategy is expressed as follows: in, Let be the learning rate of the i-th layer. Let L be the base learning rate, and L be the number of layers. This is the attenuation coefficient.
5. The agricultural knowledge extraction method according to claim 1, characterized in that, The supervised fine-tuning training of the model fine-tuning step uses a joint loss function for end-to-end optimization. The joint loss function is: Where Lgen is the cross-entropy loss for sequence generation, and Lcls is the relation classification loss. , The hyperparameters for balancing the weights.
6. The agricultural knowledge extraction method according to claim 1, characterized in that, The supervised fine-tuning training of the model fine-tuning steps incorporates agricultural professional question-and-answer data.
7. The agricultural knowledge extraction method according to claim 1, characterized in that, The supervised fine-tuning training of the model fine-tuning step adopts a regularization strategy, which includes: random deactivation strategy, gradient pruning strategy and early stopping strategy.
8. An agricultural knowledge extraction device constructed based on the method described in any one of claims 1 to 7, characterized in that, The device includes: The data preprocessing module is used to acquire multi-source agricultural data, preprocess the multi-source agricultural data, and construct a training set for agricultural knowledge extraction. The model building module is used to construct an agricultural knowledge extraction model based on the general information extraction module as the basic architecture, select a pre-trained language model as the underlying representation model, and design a hierarchical information extraction template in combination with agricultural knowledge features. The model fine-tuning module is used to perform supervised fine-tuning training on the agricultural knowledge extraction model using the training set. The model reasoning module is used to extract output entities and relationships from the agricultural data to be processed through the agricultural knowledge extraction model.
9. A storage medium, characterized in that, Used to store a computer program for performing the method according to any one of claims 1 to 7.
10. An electronic device comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 7.
