Agricultural pest control methods, devices, equipment and media based on knowledge graph

By identifying ontology in the agricultural pest and disease knowledge graph and performing named entity recognition and relation extraction, the problem of insufficient accuracy and completeness of the agricultural pest and disease knowledge graph is solved, and higher precision support for agricultural pest and disease control is achieved.

CN119128180BActive Publication Date: 2025-02-07SHIJIAZHUANG UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411604207.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-12
Publication Date
2025-02-07
Estimated Expiration
2044-11-12

AI Technical Summary

Technical Problem

The accuracy and completeness of agricultural pest and disease knowledge graphs are poor, which affects the prevention and control of agricultural pests and diseases.

Method used

When constructing an agricultural pest and disease knowledge graph, the ontology in the knowledge graph is determined based on the membership degree between the topics contained in the agricultural pest and disease corpus and the preset candidate ontology. Named entity recognition and relation extraction are then performed based on the ontology to improve the accuracy of named entity recognition and relation extraction.

Benefits of technology

It improves the accuracy and completeness of agricultural pest and disease knowledge graphs, enhances the precision of named entity recognition and relation extraction, and supports more efficient agricultural pest and disease control decisions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119128180B_ABST
    Figure CN119128180B_ABST
Patent Text Reader

Abstract

The present invention provides a method, device, equipment and medium for preventing and controlling agricultural pests and diseases based on a knowledge graph. The method includes: obtaining pest and disease problems to be retrieved, and determining entities in the pest and disease problems to be retrieved according to the pest and disease problems to be retrieved; searching in a pre-constructed agricultural pest and disease knowledge graph according to the entity, determining a target triple corresponding to the entity, determining an answer according to the target triple, and outputting it; wherein, the process of constructing an agricultural pest and disease knowledge graph includes: based on the subject included in the agricultural pest and disease corpus and the degree of membership between the preset candidate ontology, determining the ontology in the agricultural pest and disease knowledge graph from the preset candidate ontology; based on the ontology, performing named entity recognition and relationship extraction respectively to construct triples to obtain an agricultural pest and disease knowledge graph; the agricultural pest and disease knowledge graph contains multiple triples. The present invention can improve the accuracy and completeness of the agricultural pest and disease knowledge graph.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of electronic digital data processing technology, and in particular to a method, device, equipment and medium for controlling agricultural pests and diseases based on a knowledge graph. Background Art

[0002] There are many types of crop diseases and pests, and they mutate and reproduce quickly, which has a great impact on agricultural production. The prevention and treatment of agricultural diseases and pests are particularly important for agricultural production.

[0003] When preventing and treating agricultural pests and diseases, agricultural workers can ask questions and search in the pre-built agricultural pest and disease knowledge graph to determine the prevention and treatment methods of agricultural pests and diseases, and carry out agricultural pest and disease prevention and treatment work based on the prevention and treatment methods. Therefore, there is an urgent need for a complete and efficient knowledge graph database to provide support for the prevention and treatment of agricultural pests and diseases.

[0004] Knowledge graph is a technology that can represent complex information in a structured manner. It collects massive amounts of information from different documents to establish different entities and their relationships, thus forming a multi-dimensional knowledge network. Different entities and their relationships are represented in the form of triples.

[0005] However, the professional terms related to agricultural pests and diseases are diverse and complex, covering different types of diseases, pests and their prevention and control methods. In addition, the expressions of professional terms in different documents vary greatly, which makes the accuracy of entity recognition low in the process of building the knowledge graph of agricultural pests and diseases, which in turn leads to poor accuracy and completeness of the knowledge graph of agricultural pests and diseases, affecting the prevention and control of agricultural pests and diseases. Summary of the invention

[0006] The embodiments of the present invention provide a method, device, equipment and medium for agricultural pest control based on a knowledge graph to solve the problem that the accuracy and completeness of the agricultural pest knowledge graph are poor, thereby affecting the agricultural pest control work.

[0007] In a first aspect, an embodiment of the present invention provides an agricultural pest control method based on a knowledge graph, comprising:

[0008] Obtaining the pest and disease problem to be retrieved, and determining the entity in the pest and disease problem to be retrieved according to the pest and disease problem to be retrieved;

[0009] Searching the entity in a pre-constructed agricultural pest knowledge graph to determine a target triple corresponding to the entity, determining an answer based on the target triple, and outputting the answer;

[0010] The process of constructing the agricultural pest knowledge graph includes:

[0011] Based on the subject matter included in the agricultural pests and diseases corpus and the degree of membership between the preset candidate ontologies, determining the ontology in the agricultural pests and diseases knowledge graph from the preset candidate ontologies;

[0012] Based on the ontology, named entity recognition and relationship extraction are performed respectively to construct triples to obtain the agricultural pests and diseases knowledge graph; the agricultural pests and diseases knowledge graph contains multiple triples.

[0013] In a possible implementation, there are multiple candidate ontologies, and there are multiple topics included in the agricultural pest and disease corpus;

[0014] Based on the subject matter included in the agricultural pests and diseases corpus and the degree of membership between the preset candidate ontology, determining the ontology in the agricultural pests and diseases knowledge graph from the preset candidate ontology, including:

[0015] For each candidate ontology, the membership degree of the candidate ontology to each topic is calculated and

[0016] The candidate ontology accumulates the membership of each topic to obtain the comprehensive membership corresponding to the candidate ontology;

[0017] Based on the frequency of occurrence of the candidate ontology in the agricultural pests and diseases corpus, a smoothing factor corresponding to the candidate ontology is determined; the smoothing factor is used to characterize the distribution of the candidate ontology in the agricultural pests and diseases corpus;

[0018] Determine the weight corresponding to the candidate ontology based on the comprehensive membership degree and smoothing factor corresponding to the candidate ontology;

[0019] If the weight corresponding to the candidate ontology is greater than a preset threshold, the candidate ontology is determined as the ontology in the agricultural pest and disease knowledge graph.

[0020] In a possible implementation, performing named entity recognition based on the ontology includes:

[0021] Based on the ontology, an entity tag sequence is determined, and a named entity recognition model is trained based on the entity tag sequence to obtain a trained named entity recognition model;

[0022] Based on the named entity recognition model, named entity recognition is performed on the text information in the agricultural pests and diseases knowledge graph to obtain entities in the agricultural pests and diseases knowledge graph;

[0023] The named entity recognition model includes: a pre-trained language model, an LSTM feature extraction layer, a positive and negative attention mechanism layer, and a conditional random field layer connected in sequence;

[0024] The pre-trained language model is used to receive text information in the agricultural pest corpus, encode the text information, obtain a word embedding vector sequence, and input it into the LSTM feature extraction layer;

[0025] The LSTM feature extraction layer is used to receive the word embedding vector sequence, perform feature extraction on the word embedding vector sequence, obtain different initial feature sequences, and input them into the positive and negative attention mechanism layer;

[0026] The positive and negative attention mechanism layer is used to extract positive attention features and negative attention features from the initial feature sequence to obtain a strengthened feature sequence and a weakened feature sequence; according to the extracted strengthened feature sequence and weakened feature sequence, a final target language feature sequence is determined and input into the conditional random field layer;

[0027] The conditional random field layer is used to receive the target feature sequence, perform named entity recognition on the target feature sequence, and determine the entity corresponding to the target feature sequence.

[0028] In a possible implementation, the positive and negative attention mechanism layers include: a positive attention layer and a negative attention layer;

[0029] The positive attention layer is used to extract important features from the initial feature sequence to obtain the enhanced feature sequence, so as to strengthen the data features in the initial feature sequence;

[0030] The negative attention layer is used to extract noise features from the initial feature sequence to obtain the weakened feature sequence, so as to suppress noise information in the initial feature sequence;

[0031] The step of determining the final target feature sequence according to the extracted enhanced feature sequence and weakened feature sequence comprises:

[0032] The difference between the enhanced feature sequence and the weakened feature sequence is determined as the final target feature sequence.

[0033] In a possible implementation, for each candidate ontology, the membership of the candidate ontology to each topic is calculated respectively, and the membership of the candidate ontology to each topic is accumulated to obtain the comprehensive membership corresponding to the candidate ontology, including:

[0034] For each candidate ontology, according to Determine the comprehensive membership degree corresponding to the candidate ontology;

[0035] in, Representing candidate ontology The corresponding comprehensive membership degree is Indicates Theme The word embedding vector corresponding to the topic word, Representing candidate ontology The corresponding word embedding vector, Indicates the number of keywords contained in each topic. represents the number of topics, express A topic set consisting of 3 topics.

[0036] In a possible implementation, for each candidate ontology, based on the frequency of occurrence of the candidate ontology in the agricultural pest corpus, a smoothing factor corresponding to the candidate ontology is determined, including:

[0037] For each candidate ontology, according to Determine the smoothing factor corresponding to the candidate ontology;

[0038] in, Representing candidate ontology The corresponding smoothing factor is, Representing candidate ontology The frequency of occurrence in the corpus, Indicates The frequency of occurrence of a keyword in the corpus, represents the number of documents in the corpus, Indicates that the corpus contains candidate ontology The number of files.

[0039] In a possible implementation, for each candidate ontology, based on the comprehensive membership degree and smoothing factor corresponding to the candidate ontology, a weight corresponding to the candidate ontology is determined, including:

[0040] For each candidate ontology, according to Determine the weight corresponding to the candidate ontology;

[0041] in, Representing candidate ontology The corresponding weights, represents the Sigmoid function, Representing candidate ontology The corresponding comprehensive membership degree is Representing candidate ontology The corresponding smoothing factor.

[0042] In a second aspect, an embodiment of the present invention provides an agricultural pest control device based on a knowledge graph, comprising:

[0043] An acquisition module, used for acquiring the pest and disease problem to be retrieved, and determining the entity in the pest and disease problem to be retrieved according to the pest and disease problem to be retrieved;

[0044] A retrieval module searches the pre-built agricultural pest knowledge graph according to the entity, determines the target triple corresponding to the entity, determines the answer according to the target triple, and outputs it;

[0045] The process of constructing the agricultural pest knowledge graph includes:

[0046] Based on the subject matter included in the agricultural pests and diseases corpus and the degree of membership between the preset candidate ontologies, determining the ontology in the agricultural pests and diseases knowledge graph from the preset candidate ontologies;

[0047] Based on the ontology, named entity recognition and relationship extraction are performed respectively to construct triples to obtain the agricultural pests and diseases knowledge graph; the agricultural pests and diseases knowledge graph contains multiple triples.

[0048] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the processor implements the steps of the method described in the first aspect or any possible implementation manner of the first aspect.

[0049] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method described in the first aspect or any possible implementation of the first aspect are implemented.

[0050] The embodiment of the present invention provides a method, device, equipment and medium for preventing and controlling agricultural pests and diseases based on a knowledge graph. In the process of constructing the knowledge graph of the agricultural pest and disease corpus, the ontology in the agricultural pest and disease corpus is determined based on the subject included in the agricultural pest and disease corpus and the membership between the preset candidate ontology. Among them, the subject included in the agricultural pest and disease corpus can reflect the potential semantic structure in the agricultural pest and disease corpus. By determining the membership between the candidate ontology and the subject, the importance of the candidate ontology to the overall corpus distribution can be reflected, and the ontology of the agricultural pest and disease corpus is determined based on the importance, which can effectively improve the accuracy and completeness of the ontology. On this basis, named entity recognition and relationship extraction are performed based on the above-mentioned ontology, which can correspondingly improve the accuracy of named entity recognition and relationship extraction, and finally achieve the goal of improving the accuracy and completeness of the knowledge graph of agricultural pests and diseases. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0052] Figure 1 is a schematic diagram of triples in the knowledge graph provided by an embodiment of the present invention;

[0053] Figure 2 It is a flow chart for implementing the agricultural pest control method based on the knowledge graph provided by an embodiment of the present invention;

[0054] Figure 3 This is a flowchart for implementing the process of determining the ontology in the agricultural pest knowledge graph provided by an embodiment of the present invention;

[0055] Figure 4 It is a schematic diagram of determining the entity tag sequence using the BIO tag format;

[0056] Figure 5 is a schematic diagram of the structure of a named entity recognition model provided by an embodiment of the present invention;

[0057] Figure 6 is a structural diagram of a relationship extraction model provided by an embodiment of the present invention;

[0058] Figure 7 It is a schematic diagram of the structure of an agricultural pest control device based on a knowledge graph provided in an embodiment of the present invention;

[0059] Figure 8 is a schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0060] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present invention.

[0061] Before introducing the agricultural pest control method based on knowledge graph provided by this application, a brief introduction to knowledge graph is first given. Knowledge graph is a technology that can structure complex information. It collects massive information from different documents to establish different entities and the relationships between them, thereby forming a multi-dimensional knowledge network. Among them, different entities and the relationships between them are represented in the form of triples. See Figure 1 , the structure of triples can be expressed as: <entity, relationship, entity>. For example, for apple pests and diseases, <apple brown spot disease, control agent, tebuconazole> can be stored as a set of triples in the agricultural pests and diseases knowledge graph to indicate that tebuconazole can be used to prevent and treat apple brown spot disease.

[0062] In the related technology, when preventing and treating agricultural pests and diseases, agricultural workers can ask questions and search in the pre-built agricultural pests and diseases knowledge graph to determine the prevention and treatment methods of agricultural pests and diseases. However, the professional terms related to agricultural pests and diseases are diverse and complex, covering different types of diseases, pests and their prevention and control methods. In addition, the expressions of professional terms in different documents vary greatly, which makes the accuracy of named entity recognition low in the process of constructing the agricultural pests and diseases knowledge graph, which in turn leads to poor accuracy and completeness of the agricultural pests and diseases knowledge graph, affecting the prevention and control of agricultural pests and diseases.

[0063] In order to improve the accuracy of named entity recognition and thus improve the accuracy and completeness of the knowledge graph of agricultural pests and diseases, in the specific implementation of the present application, when constructing the knowledge graph of agricultural pests and diseases, the ontology in the knowledge graph of agricultural pests and diseases is determined from the preset candidate ontology based on the subject contained in the corpus of agricultural pests and diseases and the degree of membership between the preset candidate ontology; then, based on the ontology, named entity recognition and relationship extraction are performed respectively to obtain the knowledge graph of agricultural pests and diseases. Among them, the ontology is the basis of named entity recognition and relationship extraction. The degree of membership of each candidate ontology to the corpus theme can reflect the importance of each candidate ontology in the semantic distribution structure of the corpus of agricultural pests and diseases. The present application determines the ontology in the knowledge graph of agricultural pests and diseases from multiple candidate ontologies through the degree of membership of each candidate ontology to the corpus theme, which can effectively improve the accuracy of the ontology of the knowledge graph of agricultural pests and diseases, thereby improving the accuracy of named entity recognition and relationship extraction, and finally improving the accuracy and completeness of the knowledge graph of agricultural pests and diseases.

[0064] In order to make the purpose, technical solutions and advantages of the present invention more clear, specific embodiments will be described below in conjunction with the accompanying drawings.

[0065] Figure 2 The implementation flow chart of the agricultural pest control method based on the knowledge graph provided in the embodiment of the present invention is described in detail as follows:

[0066] Step 201, obtaining the pest and disease problem to be retrieved, and determining the entity in the pest and disease problem to be retrieved according to the pest and disease problem to be retrieved.

[0067] When determining entities in a pest problem to be retrieved, the embodiment of the present invention may input the pest problem to be retrieved into a pre-trained named entity recognition model, and the named entity recognition model correspondingly outputs the entities contained in the pest problem.

[0068] Among them, the named entity recognition model is trained based on different text information and its corresponding entity labels, and is used to output the entity corresponding to the text information according to the input text information.

[0069] Step 202, search the pre-built agricultural pest knowledge graph according to the entity, determine the target triple corresponding to the entity, determine the answer according to the target triple, and output it.

[0070] The embodiment of the present invention generates a corresponding structured query statement based on the entities contained in the pest problem, for example, through a logical expression or SPARQL query. Based on the structured query statement, an accurate search is performed in the pre-built agricultural pest knowledge graph to determine one or more target triples corresponding to the entity, and the content linked to the target triple is output as an answer for user reference.

[0071] Still taking the above-mentioned apple brown spot disease as an example, the user can input "Prevention and control methods of apple brown spot disease" into the named entity recognition model. The named entity recognition model performs named entity recognition on the text information "Prevention and control methods of apple brown spot disease" and outputs the entity contained in the text information, namely "apple brown spot disease".

[0072] Next, using the entity "apple brown spot disease", logical expressions or SPARQL queries are used to search for multiple sets of triples contained in the pre-built agricultural pest and disease knowledge graph to determine the target triple <apple brown spot disease, control agent, tebuconazole> corresponding to the entity "apple brown spot disease", and the content "tebuconazole" linked to the target triple <apple brown spot disease, control agent, tebuconazole> is output as the answer.

[0073] It is understandable that there may be one or more target triples containing the entity "apple brown spot disease", and the embodiment of the present invention may output the content linked to all target triples containing the entity "apple brown spot disease" as the answer.

[0074] In addition, according to user needs, the relevance sorting method of deep learning can be used to determine multiple triples with the highest semantic similarity to the entities contained in the search question from the agricultural pest and disease knowledge graph, and the content linked by the multiple triples can be output as answers to provide more detailed answers.

[0075] When constructing the knowledge graph of agricultural pests and diseases, the specific process of the embodiment of the present invention is as follows:

[0076] First, based on the subject matter contained in the agricultural pests and diseases corpus and the degree of membership between the preset candidate ontology, the ontology in the agricultural pests and diseases knowledge graph is determined from the preset candidate ontology; secondly, based on the ontology, named entity recognition and relationship extraction are performed to construct triples and obtain the agricultural pests and diseases knowledge graph. Here, the agricultural pests and diseases knowledge graph contains multiple triples.

[0077] Here, in order to ensure the diversity and comprehensiveness of the information source, an agricultural pest corpus can be constructed based on information crawled from scientific research literature, agricultural reports, monitoring data and other websites, as well as documents related to agricultural pests, teaching materials and databases established by research institutions. Further, data cleaning operations can also be performed on the data information in the agricultural pest corpus to ensure the validity of the data information in the agricultural pest corpus. Specifically, the data cleaning operation can include completing missing values, removing abnormal values ​​and erroneous data, and removing duplicate information. In addition, in order to facilitate subsequent named entity recognition operations, the text information in the agricultural pest corpus can also be segmented, segmented, and stop words can be removed. Among them, root operations can also be performed on the English words contained in the agricultural pest corpus.

[0078] After completing operations such as data cleaning, sentence segmentation, word segmentation, and stop word removal, the embodiment of the present invention can use a topic model (Latent Dirichlet Allocation, LDA) to perform topic discovery on the agricultural pests and diseases corpus to obtain the topics contained in the agricultural pests and diseases corpus. Here, the topics contained in the agricultural pests and diseases corpus can be used to reflect the potential semantic structure in the agricultural pests and diseases corpus.

[0079] The embodiment of the present invention can collect keywords from relevant agricultural websites, agricultural scientific research documents and other materials, and experts in related fields can determine multiple candidate ontologies from the above keywords.

[0080] The embodiment of the present invention can reflect the importance of each candidate ontology in the potential semantic structure of the agricultural pest and disease corpus by determining the subject included in the agricultural pest and disease corpus and the degree of membership between the preset candidate ontology, so as to screen out a candidate ontology with greater importance from multiple candidate ontologies as the ontology of the agricultural pest and disease corpus, thereby improving the ontology accuracy of the agricultural pest and disease corpus.

[0081] Ontology is used to define the types of entities and the types of relationships. Ontology is the basis of named entity recognition and relationship extraction. The embodiment of the present invention determines the ontology of the agricultural pests and diseases corpus by determining the degree of membership between the agricultural pests and diseases corpus topic and the candidate ontology, which can effectively improve the accuracy of the ontology, and then improve the accuracy of named entity recognition and relationship extraction, and finally achieve the purpose of improving the accuracy and completeness of the agricultural pests and diseases knowledge graph.

[0082] Compared with the prior art, in the process of constructing the knowledge graph of the agricultural pest and disease corpus, the embodiment of the present invention determines the ontology in the agricultural pest and disease corpus through the subject included in the agricultural pest and disease corpus and the membership between the preset candidate ontology. Among them, the subject included in the agricultural pest and disease corpus can reflect the potential semantic structure in the agricultural pest and disease corpus. By determining the membership between the candidate ontology and the subject, the importance of the candidate ontology in the semantic distribution structure of the entire agricultural pest and disease corpus can be reflected, and the ontology of the agricultural pest and disease corpus is determined based on the importance, which can effectively improve the accuracy of the ontology. On this basis, named entity recognition and relationship extraction are performed based on the above-mentioned ontology, which can correspondingly improve the accuracy of named entity recognition and relationship extraction, and finally achieve the improvement of the accuracy and completeness of the knowledge graph of agricultural pests and diseases.

[0083] The following is an introduction to the specific method of determining the ontology in the knowledge graph of agricultural pests and diseases. Figure 3 ,When determining the ontology in the knowledge graph of agricultural pests and diseases, the following steps can be followed:

[0084] Step 301, for each candidate ontology, the membership of the candidate ontology to each topic is calculated respectively, and the membership of the candidate ontology to each topic is accumulated to obtain the comprehensive membership corresponding to the candidate ontology. Here, the comprehensive membership corresponding to the candidate ontology can reflect the importance weight of the candidate ontology in the semantic distribution structure of the entire agricultural pest corpus.

[0085] It should be noted that there may be multiple candidate ontologies, and there may also be multiple topics included in the agricultural pests and diseases corpus. The multiple topics included in the agricultural pests and diseases corpus can be represented in the form of a set as follows: .in, T express The theme set consists of themes. Indicates the first topic, Indicates the second topic, Indicates i Themes, Indicates m Themes.

[0086] Here, for each topic, the top probability distribution in the topic is used. A keyword is used to characterize the topic. That is, .in, Indicates The first keyword in the topic, Indicates The second keyword in the topic, Indicates of the topics Keywords. Among them, is an integer greater than or equal to 1.

[0087] For each candidate ontology,

[0088] Determine the comprehensive membership degree corresponding to the candidate ontology;

[0089] in, Representing candidate ontology The corresponding comprehensive membership degree is Indicates Theme The word embedding vector corresponding to the topic word, Representing candidate ontology The corresponding word embedding vector, Indicates the number of keywords contained in each topic. represents the number of topics, express A topic set consisting of 3 topics.

[0090] Here, the membership of the candidate ontology to the topics in the agricultural pests and diseases corpus can reflect the comprehensive voting weight of the topics in the agricultural pests and diseases corpus to the candidate ontology, and can be used to measure the importance of the candidate ontology to the semantic distribution structure of the agricultural pests and diseases corpus.

[0091] Step 302: Based on the frequency of occurrence of the candidate ontology in the agricultural pest and disease corpus, a smoothing factor corresponding to the candidate ontology is determined.

[0092] For each candidate ontology, Determine the smoothing factor corresponding to the candidate ontology;

[0093] in, Representing candidate ontology The corresponding smoothing factor is, Representing candidate ontology The frequency of occurrence in the corpus, Indicates The frequency of occurrence of a keyword in the corpus, represents the number of documents in the corpus, Indicates that the corpus contains candidate ontology The number of files.

[0094] Here, the smoothing factor is used to characterize the distribution of candidate ontologies in the agricultural pest and disease corpus, and can be used to correct the importance weight of the candidate ontology to the semantic distribution structure of the agricultural pest and disease corpus (i.e., the above-mentioned comprehensive membership), thereby suppressing the uncertainty caused by the excessive dependence of the Bayesian posterior distribution on the prior probability.

[0095] Step 303: Determine the weight corresponding to the candidate ontology based on the comprehensive membership degree and smoothing factor corresponding to the candidate ontology.

[0096] For each candidate ontology, Determine the weight corresponding to the candidate ontology;

[0097] in, Representing candidate ontology The corresponding weight, represents the Sigmoid function, Representing candidate ontology The corresponding comprehensive membership degree is Representing candidate ontology The corresponding smoothing factor.

[0098] Step 304: If the weight corresponding to the candidate ontology is greater than a preset threshold, the candidate ontology is determined as an ontology in the agricultural pest knowledge graph.

[0099] Here, by determining the candidate ontologies with weights greater than a preset threshold as the ontologies in the agricultural pest and disease knowledge graph, the ontology in the agricultural pest and disease knowledge graph can be made more representative in the agricultural pest and disease corpus and the candidate ontologies, thereby effectively improving the accuracy of ontology construction.

[0100] The above embodiment mainly introduces the specific method of determining the ontology in the agricultural pest knowledge graph. The following is an introduction to the named entity recognition process and the relationship extraction process.

[0101] Ontology is mainly used to define the types of entities and relationships. Taking apple pests and diseases as an example, the two specific entities "apple brown spot" and "apple dry rot" can be classified as the type of "apple disease". In other words, "apple disease" can be used as an ontology to represent the entity type "apple disease". Similarly, the relationship between the two specific entities "apple brown spot" and "tebuconazole" can be classified as the type of "control agent". Accordingly, "control agent" can be used as an ontology to represent the relationship type "control agent".

[0102] When performing named entity recognition based on ontology, the embodiment of the present invention can first determine the entity label sequence based on the ontology, and perform model training on the named entity recognition model based on the entity label sequence to obtain a trained named entity recognition model; then, based on the named entity recognition model, perform named entity recognition on the text information in the agricultural pest and disease knowledge graph to obtain the entities in the agricultural pest and disease knowledge graph.

[0103] Here, we can first use part of the text information in the agricultural pest and disease corpus as a training set, and combine it with the corresponding entity label sequence to train the named entity recognition model, and then use the trained named entity recognition model to perform entity extraction on the remaining text information in the agricultural pest and disease corpus, so as to finally realize the entity extraction work for the agricultural pest and disease corpus.

[0104] Among them, when determining the entity label sequence based on the ontology, the BIO tag format can be used to perform entity annotation on part of the text information in the agricultural pest and disease corpus to form an entity label sequence. In an embodiment of the present invention, each sentence in the agricultural pest and disease corpus can be regarded as a text message. For each piece of text information, different entity types can be obtained according to the previously determined ontology, and corresponding BIO labels can be constructed for each type of entity. Then, each piece of text information is annotated with the BIO label to obtain the entity label sequence corresponding to each piece of text information. For example, see Figure 4 , for the entity "rice false smut", its corresponding ontology can be "rice field diseases". The ontology "rice field diseases" can be represented as "Disease". Accordingly, the BIO tags corresponding to the ontology "rice field diseases" can be represented as B-Disease, I-Disease and O. On this basis, it can be obtained that the entity label sequence corresponding to the text information "flooding is an important cause of the spread of rice false smut" is "OOOOOO B-Disease I-Disease I-Disease OOOOOOO".

[0105] Based on the pre-built ontology, the text information in the agricultural pest and disease corpus can be annotated to obtain an entity label sequence, and the entity extraction model can be trained based on each text information and its corresponding entity label sequence to obtain a trained named entity recognition model.

[0106] In some embodiments, see Figure 5 ,The named entity recognition model includes: a pre-trained language model, an LSTM feature extraction layer, a positive and negative attention mechanism layer, and a conditional random field layer connected in sequence;

[0107] The pre-trained language model is used to receive text information from the agricultural pest and disease corpus, encode the text information, obtain a word embedding vector sequence, and input it into the LSTM feature extraction layer;

[0108] The LSTM feature extraction layer is used to receive the word embedding vector sequence, extract features from the word embedding vector sequence, obtain different initial feature sequences, and input them into the positive and negative attention mechanism layers;

[0109] The positive and negative attention mechanism layers are used to extract positive attention features and negative attention features from the initial feature sequence, respectively, to obtain enhanced feature sequences and weakened feature sequences; based on the extracted enhanced feature sequences and weakened feature sequences, the final target feature sequence is determined and input into the conditional random field layer.

[0110] Among them, the positive and negative attention mechanism layers can not only extract important features from the initial feature sequence to strengthen the important data features in the initial feature sequence to obtain the above-mentioned enhanced feature sequence, but also suppress non-important features (i.e., noise features) in the initial feature sequence to obtain the above-mentioned weakened feature sequence.

[0111] The positive and negative attention mechanism layer determines the final target feature sequence based on the enhanced feature sequence after strengthening the important data features and the weakened feature sequence after suppressing the noise features, and inputs the target feature sequence into the conditional random field layer;

[0112] The conditional random field layer is used to receive the target feature sequence, perform named entity recognition on the target feature sequence, and determine the entity corresponding to the target feature sequence.

[0113] For example, see Figure 5 , the text information "Characteristics of Grape Powdery Mildew" is input into the named entity recognition model, and processed by the pre-trained language model, LSTM feature extraction layer, positive and negative attention mechanism layer, and conditional random field layer in sequence, and finally outputs the entity label sequence corresponding to the text information: B-Dis I-Dis I-Dis I-Dis I-Dis OOO. According to the entity label sequence, the entity "grape powdery mildew" contained in the text information can be determined, and the entity type corresponding to "grape powdery mildew" is "Dis". Here, "Dis" is used as an example to represent the entity type of "grape disease".

[0114] Here, the pre-trained language model processes the input text information to generate semantically rich word embedding vectors that effectively represent the polysemy of words. Subsequently, these word embedding vectors are passed to the LSTM feature extraction layer to further capture contextual features, and then the positive and negative attention mechanism layer extracts important features and suppresses noise features to enhance semantic relevance. Finally, the conditional random field layer is used for decoding and named entity recognition to output the entities contained in the text information and their corresponding entity types.

[0115] Specifically, the pre-trained language model can be a bidirectional encoder representation from transformers (BERT) model based on transformers. The BERT model can encode the input text information into a word embedding form to solve the problem that a single word cannot distinguish multiple meanings of a word and cannot effectively use the context when using a bag-of-words model.

[0116] The LSTM feature extraction layer can be a bidirectional long short-term memory network (Bidirectional Long Short-Term Memory, BiLSTM), which captures context information from both the forward and backward directions. For each time step, the output of the bidirectional long short-term memory network is the hidden state , which is generated by LSTM units in two directions. The specific formula is as follows:

[0117] Forward LSTM unit: ;

[0118] Backward LSTM unit: ;

[0119] Merge the hidden states of the forward LSTM cell and the backward LSTM cell: ;

[0120] in, and Respectively represent t The output results of the forward LSTM unit and the backward LSTM unit, and Represents the mathematical function corresponding to the forward LSTM unit and the backward LSTM unit, Indicates t The input data of the forward LSTM unit and the backward LSTM unit, Indicates t - the hidden state of 1 forward LSTM unit, Indicates t +1 hidden state of the backward LSTM unit, Indicatest - the cell state of 1 forward LSTM unit, Indicates t +1 cell state of the backward LSTM unit, Represents the first t The output of each time step.

[0121] The final output of the entire bidirectional long short-term memory network can be expressed as .in, Represents the final output result of the bidirectional long short-term memory network, represents the output result of the first time step, represents the output result of the second time step, Indicates t The output result of each time step is Indicates The output of each time step.

[0122] The entire bidirectional long short-term memory network is designed to better understand and capture the contextual relationship of words in the text. By processing sequences in both directions, it overcomes the limitation of the traditional unidirectional LSTM that can only see past or future information, allowing the model to more accurately understand the role and meaning of each word in the sentence. This enhanced context understanding ability can extract richer features and help the model identify entity boundaries and types, which is crucial for the named entity recognition task of processing complex Chinese text.

[0123] In some embodiments, the positive and negative attention mechanism layers include: a positive attention layer and a negative attention layer;

[0124] The forward attention layer is used to extract important features from the initial feature sequence to obtain a reinforced feature sequence to strengthen the data features in the initial feature sequence;

[0125] The negative attention layer is used to extract noise features from the initial feature sequence to obtain a weakened feature sequence to suppress the noise information in the initial feature sequence;

[0126] Here, both the positive attention layer and the negative attention layer are implemented using the encoder part of Transformer.

[0127] It should be noted that the network structures of the positive attention layer and the negative attention layer are the same, but the network parameters of the two are different. The network parameters in the positive attention layer are used to enhance the important features of the input text information. The network parameters in the negative attention layer are used to suppress the noise information of the input text information.

[0128] It can be understood that the network parameters of the positive attention layer and the negative attention layer can be continuously adjusted during the training process of the named entity recognition model, so as to ultimately achieve the purpose of strengthening the data features in the positive attention layer and suppressing the noise features in the negative attention layer.

[0129] Among them, the output formula of the forward attention layer can be expressed as:

[0130]

[0131] in, represents the output of the positive attention layer, Represents the mathematical function corresponding to the forward attention layer.

[0132] The output formula of the negative attention layer is similar and will not be repeated here.

[0133] Finally, the difference between the enhanced feature sequence output by the positive attention layer and the weakened feature sequence output by the negative attention layer is determined as the final target feature sequence to achieve the purpose of strengthening important data features and suppressing noise information. The specific formula can be expressed as:

[0134] in, Represents the output results of the positive and negative attention mechanism layers, Represents the output of the negative attention layer.

[0135] The embodiment of the present invention sets positive and negative attention mechanism layers in the named entity recognition model, which can effectively enhance the capture of key information while suppressing noise information. It also enhances the processing capability of the named entity recognition model for complex agricultural texts to a certain extent, enabling it to adapt to different agricultural fields and scenarios, thereby further improving the named entity recognition accuracy of agricultural pests and diseases.

[0136] The embodiment of the present invention can map the target feature sequence to a label space based on the output target feature sequence, so that the subsequent conditional random field layer can perform named entity recognition on it.

[0137] Among them, the linear layer can be used to map the target feature sequence to the label space, and its specific formula is expressed as: .

[0138] in, represents the target feature sequence after mapping to the label space, and Represents the network parameters of the linear layer.

[0139] The Conditional Random Field (CRF) layer is used to model the dependencies between labels. , the conditional random field is used to calculate The probability of corresponding to different entity tag sequences. In this embodiment of the present invention, the entity tag sequence with the highest probability is used as The entity tag sequence output is used to determine Entities in .

[0140] Among them, the conditional random field layer can be expressed by the formula:

[0141]

[0142] in, Represents the target feature sequence Z With a given entity tag sequence Y The score between represents the energy function of CRF, represents all possible entity tag sequences, Represents the target feature sequence Z With a given entity tag sequence Y probability.

[0143] In the entire named entity recognition model training process, the negative log-likelihood loss function can be used as the model loss function. During the training process, the back propagation algorithm is used to minimize the loss function. In the back propagation process, the gradient of the loss function to the model parameters is first calculated, and then the optimization algorithm is used to update each model parameter until the loss function is minimized. The updated model parameters are used as the final model parameters of the named entity recognition model to obtain a trained named entity recognition model.

[0144] The negative log-likelihood loss function can be expressed as: .

[0145] in, represents the negative log-likelihood loss function, represents the number of training samples, Indicates that when the sample The corresponding entity label sequence is When , the output probability of CRF is, Indicates n The true entity label sequence of samples, Indicates n samples.

[0146] Here, the model parameters include the network parameters of the bidirectional long short-term memory network layer, the conditional random field layer, the positive and negative attention mechanism layer, etc. The optimization algorithm can be the adaptive moment estimation algorithm (ADAM) or the stochastic gradient descent algorithm (SGD).

[0147] Similar to named entity recognition, when performing relationship extraction, we can first train the relationship extraction model with some entities in the agricultural pests and diseases knowledge graph and combine them with the corresponding relationship labels. Then, we can use the trained relationship extraction model to perform relationship extraction on all entities in the agricultural pests and diseases knowledge graph to determine the relationship between different entities in the agricultural pests and diseases knowledge graph.

[0148] Similarly, when determining the relationship label sequence based on the ontology, the BIO tag format is still used to annotate the relationships between different entities in the agricultural pest knowledge graph to form relationship labels. The relationship extraction model is trained based on different entities and their corresponding relationship labels to obtain a trained relationship extraction model.

[0149] The relationship extraction model in the embodiment of the present invention adopts a text semantic relationship extraction model based on LSTM and attention mechanism. This model is based on LSTM and mainly uses LSTM to solve the long-distance dependency problem existing in traditional deep learning methods; the model can effectively analyze the correlation between input and output, thereby obtaining more contextual semantic information.

[0150] See Figure 6 The model mainly includes a text embedding network Text Embedding, a position embedding network Position Embedding, a concatenation layer Concatenate, a bidirectional long short-term memory network (BiLSTM) and a fully connected layer Dense layer. Different entities are input into the text embedding network and the position embedding network to extract features such as entity position, part of speech, word dependency, etc., and converted into word vectors to capture local features. The word vectors capture local features and input them into the BiLSTM network. The BiLSTM network has a built-in multi-head attention mechanism (Multi-head Attention, MHA) to extract features and calculate attention probabilities, and evaluate the input-output correlation of the BiLSTM network. The output features of the BiLSTM network are obtained, and the output features are max-pooled to extract overall features. After fusing local and overall features, they are input into the Dense Layer fully connected layer, and the classification results are finally output.

[0151] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0152] The following is an embodiment of the device of the present invention. For details not described in detail therein, reference may be made to the corresponding method embodiment described above.

[0153] Figure 7 The schematic diagram of the structure of the agricultural pest control device based on the knowledge graph provided by the embodiment of the present invention is shown. For the convenience of explanation, only the part related to the embodiment of the present invention is shown, which is described in detail as follows:

[0154] like Figure 7 As shown, the agricultural pest control method device 7 based on the knowledge graph includes: an acquisition module 71 and a retrieval module 72.

[0155] The acquisition module 71 is used to acquire the pest and disease problem to be retrieved, and determine the entity in the pest and disease problem to be retrieved according to the pest and disease problem to be retrieved;

[0156] A retrieval module 72 is used to search the pre-built agricultural pest knowledge graph according to the entity, determine the target triple corresponding to the entity, determine the answer according to the target triple, and output it;

[0157] In the process of constructing the agricultural pest knowledge graph, the retrieval module 72 is specifically used for:

[0158] Based on the subject matter contained in the agricultural pests and diseases corpus and the degree of membership between the preset candidate ontologies, the ontology in the agricultural pests and diseases knowledge graph is determined from the preset candidate ontologies;

[0159] Based on the ontology, named entity recognition and relationship extraction are performed respectively to construct triples and obtain the agricultural pests and diseases knowledge graph; the agricultural pests and diseases knowledge graph contains multiple triples.

[0160] Optionally, there are multiple candidate ontologies and multiple topics included in the agricultural pest and disease corpus;

[0161] The search module 72 is specifically used for:

[0162] For each candidate ontology, the membership degree of the candidate ontology to each topic is calculated and

[0163] The candidate ontology accumulates the membership of each topic to obtain the corresponding comprehensive membership of the candidate ontology;

[0164] Based on the frequency of occurrence of the candidate ontology in the agricultural pests and diseases corpus, a smoothing factor corresponding to the candidate ontology is determined; the smoothing factor is used to characterize the distribution of the candidate ontology in the agricultural pests and diseases corpus;

[0165] Determine the weight corresponding to the candidate ontology based on the comprehensive membership degree and smoothing factor corresponding to the candidate ontology;

[0166] If the weight corresponding to the candidate ontology is greater than a preset threshold, the candidate ontology is determined as the ontology in the agricultural pest and disease knowledge graph.

[0167] Optionally, the retrieval module 72 is specifically used for:

[0168] Based on the ontology, an entity label sequence is determined, and a named entity recognition model is trained based on the entity label sequence to obtain a trained named entity recognition model;

[0169] Based on the named entity recognition model, named entity recognition is performed on the text information in the agricultural pests and diseases knowledge graph to obtain the entities in the agricultural pests and diseases knowledge graph;

[0170] The named entity recognition model includes: a pre-trained language model, an LSTM feature extraction layer, a positive and negative attention mechanism layer, and a conditional random field layer connected in sequence;

[0171] The pre-trained language model is used to receive text information from the agricultural pest and disease corpus, encode the text information, obtain a word embedding vector sequence, and input it into the LSTM feature extraction layer;

[0172] The LSTM feature extraction layer is used to receive the word embedding vector sequence, extract features from the word embedding vector sequence, obtain different initial feature sequences, and input them into the positive and negative attention mechanism layers;

[0173] The positive and negative attention mechanism layer is used to extract positive attention features and negative attention features from the initial feature sequence respectively to obtain a strengthened feature sequence and a weakened feature sequence; the final target feature sequence is determined based on the extracted strengthened feature sequence and weakened feature sequence, and is input into the conditional random field layer;

[0174] The conditional random field layer is used to receive the target feature sequence, perform named entity recognition on the target feature sequence, and determine the entity corresponding to the target feature sequence.

[0175] Optionally, the positive and negative attention mechanism layers include: a positive attention layer and a negative attention layer;

[0176] The forward attention layer is used to extract important features from the initial feature sequence to obtain a reinforced feature sequence to strengthen the data features in the initial feature sequence;

[0177] The negative attention layer is used to extract the noise features of the initial feature sequence to obtain a weakened feature sequence to suppress the noise information in the initial feature sequence;

[0178] According to the extracted enhanced feature sequence and weakened feature sequence, the final target feature sequence is determined, including:

[0179] The difference between the enhanced feature sequence and the weakened feature sequence is determined as the final target feature sequence.

[0180] Optionally, the retrieval module 72 is specifically used for:

[0181] For each candidate ontology, according to Determine the comprehensive membership degree corresponding to the candidate ontology;

[0182] in, Representing candidate ontology The corresponding comprehensive membership degree is Indicates Theme The word embedding vector corresponding to the topic word, Representing candidate ontology The corresponding word embedding vector, Indicates the number of keywords contained in each topic. represents the number of topics, express A topic set consisting of 3 topics.

[0183] Optionally, the retrieval module 72 is specifically used for:

[0184] For each candidate ontology, according to Determine the smoothing factor corresponding to the candidate ontology;

[0185] in, Representing candidate ontology The corresponding smoothing factor is, Representing candidate ontology The frequency of occurrence in the corpus, Indicates The frequency of occurrence of a keyword in the corpus, represents the number of documents in the corpus, Indicates that the corpus contains candidate ontology The number of files.

[0186] Optionally, the retrieval module 72 is specifically used for:

[0187] For each candidate ontology, according to Determine the weight corresponding to the candidate ontology;

[0188] in, Representing candidate ontology The corresponding weight, represents the Sigmoid function, Representing candidate ontology The corresponding comprehensive membership degree is Representing candidate ontology The corresponding smoothing factor.

[0189] The present device embodiment can be used to implement the above method embodiment. Its technical principle and implementation effect are the same as those of the above method embodiment, and will not be described in detail here.

[0190] Figure 8 Schematic diagram of an electronic device provided by an embodiment of the present invention. Figure 8 As shown, the electronic device 8 of this embodiment includes: a processor 80, a memory 81, and a computer program 82 stored in the memory 81 and executable on the processor 80. When the processor 80 executes the computer program 82, the steps in the above-mentioned agricultural pest control method embodiments based on the knowledge graph are implemented, for example Figure 2 Alternatively, when the processor 80 executes the computer program 82, the functions of each module / unit in the above-mentioned device embodiments are realized, for example Figure 7 The functions of modules 71 to 72 are shown.

[0191] Exemplarily, the computer program 82 may be divided into one or more modules / units, which are stored in the memory 81 and executed by the processor 80 to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of implementing specific functions, which are used to describe the execution process of the computer program 82 in the electronic device 8. For example, the computer program 82 may be divided into Figure 7 Modules 71 to 72 are shown.

[0192] The electronic device 8 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The electronic device 8 may include, but is not limited to, a processor 80 and a memory 81. Those skilled in the art will appreciate that Figure 8 It is only an example of the electronic device 8 and does not constitute a limitation of the electronic device 8. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device may also include input and output devices, network access devices, buses, etc.

[0193] The processor 80 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0194] The memory 81 may be an internal storage unit of the electronic device 8, such as a hard disk or memory of the electronic device 8. The memory 81 may also be an external storage device of the electronic device 8, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 8. Further, the memory 81 may also include both an internal storage unit and an external storage device of the electronic device 8. The memory 81 is used to store the computer program and other programs and data required by the electronic device. The memory 81 may also be used to temporarily store data that has been output or is to be output.

[0195] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0196] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0197] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0198] In the embodiments provided by the present invention, it should be understood that the disclosed devices / electronic devices and methods can be implemented in other ways. For example, the device / electronic device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0199] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0200] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0201] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned agricultural pest control method embodiments based on the knowledge graph can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device that can carry the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A method for controlling agricultural pests and diseases based on knowledge graph, characterized in that: include: Obtaining the pest and disease problem to be retrieved, and determining the entity in the pest and disease problem to be retrieved according to the pest and disease problem to be retrieved; Searching the entity in a pre-constructed agricultural pest knowledge graph to determine a target triple corresponding to the entity, determining an answer based on the target triple, and outputting the answer; The process of constructing the agricultural pest knowledge graph includes: Based on the subject matter included in the agricultural pests and diseases corpus and the degree of membership between the preset candidate ontologies, determining the ontology in the agricultural pests and diseases knowledge graph from the preset candidate ontologies; Based on the ontology, named entity recognition and relationship extraction are performed respectively to construct triples to obtain the agricultural pest knowledge graph; the agricultural pest knowledge graph contains multiple triples; There are multiple candidate ontologies, and there are multiple topics included in the agricultural pest and disease corpus; Based on the subject matter included in the agricultural pests and diseases corpus and the degree of membership between the preset candidate ontology, determining the ontology in the agricultural pests and diseases knowledge graph from the preset candidate ontology, including: For each candidate ontology, calculate the membership of the candidate ontology to each topic, and accumulate the membership of the candidate ontology to each topic to obtain the comprehensive membership corresponding to the candidate ontology; Based on the frequency of occurrence of the candidate ontology in the agricultural pests and diseases corpus, a smoothing factor corresponding to the candidate ontology is determined; the smoothing factor is used to characterize the distribution of the candidate ontology in the agricultural pests and diseases corpus; Determine the weight corresponding to the candidate ontology based on the comprehensive membership degree and smoothing factor corresponding to the candidate ontology; If the weight corresponding to the candidate ontology is greater than a preset threshold, the candidate ontology is determined as the ontology in the agricultural pest knowledge graph; For each candidate ontology, the membership of the candidate ontology to each topic is calculated respectively, and the membership of the candidate ontology to each topic is accumulated to obtain the comprehensive membership corresponding to the candidate ontology, including: For each candidate ontology, according to Determine the comprehensive membership degree corresponding to the candidate ontology; in, Representing candidate ontology The corresponding comprehensive membership degree is Indicates Theme The word embedding vector corresponding to the topic word, Representing candidate ontology The corresponding word embedding vector, Indicates the number of keywords contained in each topic. represents the number of topics, express The theme set is composed of themes; For each candidate ontology, based on the frequency of occurrence of the candidate ontology in the agricultural pest and disease corpus, the smoothing factor corresponding to the candidate ontology is determined, including: For each candidate ontology, according to Determine the smoothing factor corresponding to the candidate ontology; in, Representing candidate ontology The corresponding smoothing factor is, Representing candidate ontology The frequency of occurrence in the corpus, Indicates The frequency of occurrence of a keyword in the corpus, represents the number of documents in the corpus, Indicates that the corpus contains candidate ontology The number of files; For each candidate ontology, based on the comprehensive membership degree and smoothing factor corresponding to the candidate ontology, the weight corresponding to the candidate ontology is determined, including: For each candidate ontology, according to Determine the weight corresponding to the candidate ontology; in, Representing candidate ontology The corresponding weights, represents the Sigmoid function, Representing candidate ontology The corresponding comprehensive membership degree is Representing candidate ontology The corresponding smoothing factor.

2. The agricultural pest control method based on knowledge graph according to claim 1, characterized in that: Based on the ontology, named entity recognition is performed, including: Based on the ontology, an entity tag sequence is determined, and a named entity recognition model is trained based on the entity tag sequence to obtain a trained named entity recognition model; Based on the named entity recognition model, named entity recognition is performed on the text information in the agricultural pests and diseases knowledge graph to obtain entities in the agricultural pests and diseases knowledge graph; The named entity recognition model includes: a pre-trained language model, an LSTM feature extraction layer, a positive and negative attention mechanism layer, and a conditional random field layer connected in sequence; The pre-trained language model is used to receive text information in the agricultural pest corpus, encode the text information, obtain a word embedding vector sequence, and input it into the LSTM feature extraction layer; The LSTM feature extraction layer is used to receive the word embedding vector sequence, perform feature extraction on the word embedding vector sequence, obtain different initial feature sequences, and input them into the positive and negative attention mechanism layer; The positive and negative attention mechanism layer is used to extract positive attention features and negative attention features from the initial feature sequence respectively to obtain a strengthened feature sequence and a weakened feature sequence; according to the extracted strengthened feature sequence and weakened feature sequence, a final target feature sequence is determined and input into the conditional random field layer; The conditional random field layer is used to receive the target feature sequence, perform named entity recognition on the target feature sequence, and determine the entity corresponding to the target feature sequence.

3. The agricultural pest control method based on knowledge graph according to claim 2, characterized in that: The positive and negative attention mechanism layers include: a positive attention layer and a negative attention layer; The positive attention layer is used to extract important features from the initial feature sequence to obtain the enhanced feature sequence, so as to strengthen the data features in the initial feature sequence; The negative attention layer is used to extract noise features from the initial feature sequence to obtain the weakened feature sequence, so as to suppress noise information in the initial feature sequence; The step of determining the final target feature sequence according to the extracted enhanced feature sequence and weakened feature sequence comprises: The difference between the enhanced feature sequence and the weakened feature sequence is determined as the final target feature sequence.

4. An agricultural pest control device based on knowledge graph, characterized in that: include: An acquisition module, used for acquiring the pest and disease problem to be retrieved, and determining the entity in the pest and disease problem to be retrieved according to the pest and disease problem to be retrieved; A retrieval module searches the pre-built agricultural pest knowledge graph according to the entity, determines the target triple corresponding to the entity, determines the answer according to the target triple, and outputs it; The process of constructing the agricultural pest knowledge graph includes: Based on the subject matter included in the agricultural pests and diseases corpus and the degree of membership between the preset candidate ontologies, determining the ontology in the agricultural pests and diseases knowledge graph from the preset candidate ontologies; Based on the ontology, named entity recognition and relationship extraction are performed respectively to construct triples to obtain the agricultural pest knowledge graph; the agricultural pest knowledge graph contains multiple triples; There are multiple candidate ontologies, and there are multiple topics included in the agricultural pest and disease corpus; Based on the subject matter included in the agricultural pests and diseases corpus and the degree of membership between the preset candidate ontology, determining the ontology in the agricultural pests and diseases knowledge graph from the preset candidate ontology, including: For each candidate ontology, calculate the membership of the candidate ontology to each topic, and accumulate the membership of the candidate ontology to each topic to obtain the comprehensive membership corresponding to the candidate ontology; Based on the frequency of occurrence of the candidate ontology in the agricultural pests and diseases corpus, a smoothing factor corresponding to the candidate ontology is determined; the smoothing factor is used to characterize the distribution of the candidate ontology in the agricultural pests and diseases corpus; Determine the weight corresponding to the candidate ontology based on the comprehensive membership degree and smoothing factor corresponding to the candidate ontology; If the weight corresponding to the candidate ontology is greater than a preset threshold, the candidate ontology is determined as the ontology in the agricultural pest knowledge graph; For each candidate ontology, the membership of the candidate ontology to each topic is calculated respectively, and the membership of the candidate ontology to each topic is accumulated to obtain the comprehensive membership corresponding to the candidate ontology, including: For each candidate ontology, according to Determine the comprehensive membership degree corresponding to the candidate ontology; in, Representing candidate ontology The corresponding comprehensive membership degree is Indicates Theme The word embedding vector corresponding to the topic word, Representing candidate ontology The corresponding word embedding vector, Indicates the number of keywords contained in each topic. represents the number of topics, express The theme set is composed of themes; For each candidate ontology, based on the frequency of occurrence of the candidate ontology in the agricultural pest and disease corpus, the smoothing factor corresponding to the candidate ontology is determined, including: For each candidate ontology, according to Determine the smoothing factor corresponding to the candidate ontology; in, Representing candidate ontology The corresponding smoothing factor is, Representing candidate ontology The frequency of occurrence in the corpus, Indicates The frequency of occurrence of a keyword in the corpus, represents the number of documents in the corpus, Indicates that the corpus contains candidate ontology The number of files; For each candidate ontology, based on the comprehensive membership degree and smoothing factor corresponding to the candidate ontology, the weight corresponding to the candidate ontology is determined, including: For each candidate ontology, according to Determine the weight corresponding to the candidate ontology; in, Representing candidate ontology The corresponding weights, represents the Sigmoid function, Representing candidate ontology The corresponding comprehensive membership degree is Representing candidate ontology The corresponding smoothing factor.

5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the agricultural pest control method based on the knowledge graph as described in any one of claims 1 to 3 above are implemented.

6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the agricultural pest control method based on the knowledge graph as described in any one of claims 1 to 3 above are implemented.

Citation Information

Patent Citations

  • News recommendation method and device based on ontology model library

    CN106095762A

  • Ontology model construction method of domain knowledge graph

    CN111177322A