An agricultural multi-modal data-oriented automatic semantic labeling method
By constructing an agricultural semantic lexicon and using a cross-attention mechanism to generate preset label probability values, the problem of low efficiency in agricultural automated labeling in existing technologies is solved, and efficient and adaptable automated labeling is achieved.
Patent Information
- Application Number
- CN202611108692.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-24
- Publication Date
- 2026-11-27
AI Technical Summary
Existing automated annotation methods for agricultural scenarios require model reconstruction and retraining, resulting in low efficiency.
An agricultural semantic lexicon is constructed, which includes multimodal observation lexicons and labeled rule lexicons. The probability values of preset labels are generated using a cross-attention mechanism to achieve automated labeling. Only the lexicon needs to be updated, without retraining the model.
It improves the efficiency of automated annotation, reduces the frequency of model reconstruction and retraining, and adapts to the dynamic changes in agricultural business scenarios.
Smart Images

Figure CN123180145A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of agricultural data annotation technology, and in particular to an automated semantic annotation method for agricultural multimodal data. Background Technology
[0002] In the current era of rapid development of smart agriculture, the intelligent upgrading of core scenarios such as field crop growth monitoring, greenhouse environmental parameter detection, and pest and disease identification and early warning cannot be separated from the support of high-quality labeled data. Automated labeling technology has become one of the key core technologies in the data processing of smart agriculture because it can greatly improve labeling efficiency and reduce labor costs.
[0003] In existing technologies, the automated labeling of agricultural scenarios is usually carried out by training a model for automated labeling through supervised learning. The input of the model can be indicator data related to agricultural scenarios (such as temperature, humidity, and images related to plants), and the output can be the prediction result for a specific business scenario in the agricultural network scenario (such as the degree of drought stress of tomato plants). Then, for the data to be labeled, the data is input into the model, and the model generates the prediction result as the label.
[0004] However, in agricultural business scenarios, actual business needs may require updating the specifications of training samples. For example, adding classification categories to the model's output, adding dimensions to the input data, or changing the input data and labels of the training samples due to changes in the business scenario. In the current approach, this requires rebuilding the model and retraining it, which reduces the efficiency of automated labeling.
[0005] There is currently no effective solution to the technical problem that the existing technologies require rebuilding the model and retraining it, which reduces the efficiency of automated annotation. Summary of the Invention
[0006] The embodiments of this disclosure provide an automated semantic annotation method for agricultural multimodal data, which at least solves the technical problem in the prior art that requires rebuilding the model and retraining the rebuilt model, thus reducing the efficiency of automated annotation.
[0007] According to one aspect of the present disclosure, an automated semantic annotation method for agricultural multimodal data is provided, comprising: constructing an agricultural semantic lexicon, the agricultural semantic lexicon including multimodal observation terms, annotation rule terms, codes corresponding to the multimodal observation terms, and codes corresponding to the annotation rule terms; obtaining observation data to be annotated and rule text corresponding to multiple preset labels; generating observation text vectors corresponding to the observation data to be annotated based on the multimodal observation terms corresponding to the observation data to be annotated and the codes corresponding to the corresponding multimodal observation terms in the agricultural semantic lexicon; generating rule text vectors corresponding to the rule text based on the annotation rule terms and the codes corresponding to the annotation rule terms; generating probability values of preset labels corresponding to the rule text based on the observation text vectors and the rule text vectors corresponding to the rule text using a cross-attention mechanism; and annotating the observation data to be annotated based on the probability values of the preset labels corresponding to the rule text.
[0008] According to another aspect of the present disclosure, a storage medium is also provided, the storage medium including a stored program, wherein, when the program is executed, a processor performs any of the methods described above.
[0009] According to another aspect of the present disclosure, an automated semantic annotation device for agricultural multimodal data is also provided, comprising: a construction module for constructing an agricultural semantic lexicon, the agricultural semantic lexicon including multimodal observation terms, annotation rule terms, codes corresponding to the multimodal observation terms, and codes corresponding to the annotation rule terms; an acquisition module for acquiring observation data to be annotated and rule text corresponding to multiple preset labels; an observation vector generation module for generating an observation text vector corresponding to the observation data to be annotated based on the multimodal observation terms corresponding to the observation data to be annotated in the agricultural semantic lexicon and the codes corresponding to the corresponding multimodal observation terms; a rule vector generation module for generating a rule text vector corresponding to the rule text based on the annotation rule terms and the codes corresponding to the annotation rule terms; a probability generation module for generating probability values of preset labels corresponding to the rule text based on the observation text vector and the rule text vector corresponding to the rule text using a cross-attention mechanism; and an annotation module for annotating the observation data to be annotated based on the probability values of the preset labels corresponding to the rule text.
[0010] According to another aspect of the present disclosure, an automated semantic annotation device for agricultural multimodal data is also provided, comprising: a processor; and a memory connected to the processor, for providing the processor with instructions to perform the following processing steps: constructing an agricultural semantic lexicon, the agricultural semantic lexicon including multimodal observation terms, annotation rule terms, codes corresponding to the multimodal observation terms, and codes corresponding to the annotation rule terms; acquiring observation data to be annotated and rule text corresponding to multiple preset labels; generating observation text vectors corresponding to the observation data to be annotated based on the multimodal observation terms corresponding to the observation data to be annotated in the agricultural semantic lexicon and the codes corresponding to the corresponding multimodal observation terms; generating rule text vectors corresponding to the rule text based on the annotation rule terms and the codes corresponding to the annotation rule terms; generating probability values of preset labels corresponding to the rule text based on the observation text vectors and the rule text vectors corresponding to the rule text using a cross-attention mechanism; and annotating the observation data to be annotated based on the probability values of the preset labels corresponding to the rule text.
[0011] In this embodiment, an agricultural semantic lexicon is first constructed, comprising two types of lexical units: multimodal observation lexical units and annotation rule lexical units. After obtaining the observation data to be annotated, an observation text vector corresponding to the observation data is generated based on the multimodal observation lexical units in the agricultural semantic lexicon, and a rule text vector corresponding to the rule text is generated based on the annotation rule lexical units in the agricultural semantic lexicon. Then, using a cross-attention mechanism, a probability value for a preset label corresponding to the rule text is generated based on the observation text vector and the rule text vector. The corresponding observation data to be annotated is then labeled based on this probability value. In the above embodiment, the multimodal observation lexical units of the agricultural semantic lexicon correspond to the input data of the training samples, and the annotation rule lexical units correspond to the labels of the training samples. Therefore, this embodiment determines the multimodal observation lexical units corresponding to the observation data to be labeled. Then, it generates text vectors (observation text vector and rule text vector) of the observation data and the rule text corresponding to the preset labels, respectively. Using a cross-attention mechanism, it performs semantic matching between the two (observation text vector and rule text vector) to generate the probability value of the preset label corresponding to the rule text, thereby achieving automated labeling. Compared with the prior art, when it is necessary to update the labels of the training samples or the dimensions of the input data, it is only necessary to update the multimodal observation lexical units and / or labeling rule lexical units in the agricultural semantic lexicon. The cross-attention mechanism is used to match the labeling rules of each preset label with the observation data to be labeled. It is not necessary to modify the internal structure of the model used for labeling, so that the model does not need to be completely retrained, which can improve the efficiency of automated labeling. Attached Figure Description
[0012] The accompanying drawings, which are included to provide a further understanding of this disclosure and form part of this application, illustrate exemplary embodiments of this disclosure and are used to explain this disclosure, but do not constitute an undue limitation of this disclosure. In the drawings: Figure 1 This is a hardware structure block diagram of a computing device for implementing the method described in Embodiment 1 of this disclosure; Figure 2 This is a flowchart illustrating an automated semantic annotation method for agricultural multimodal data according to the first aspect of Embodiment 1 of this disclosure; Figure 3 This is a flowchart illustrating the process of generating probability values corresponding to corresponding preset labels using a cross-self-attention mechanism according to the first aspect of Embodiment 1 of this disclosure; Figure 4 This is a schematic diagram of an automated semantic annotation device for agricultural multimodal data according to the first aspect of Embodiment 2 of this disclosure; Figure 5 This is a schematic diagram of an automated semantic annotation device for agricultural multimodal data according to the first aspect of Embodiment 3 of this disclosure. Detailed Implementation
[0013] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this disclosure.
[0014] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0015] Example 1
[0016] According to this embodiment, an automated semantic annotation method for agricultural multimodal data is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Also, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0017] The method embodiments provided in this example can be executed on mobile terminals, computer terminals, servers, or similar computing devices. Figure 1 A hardware block diagram of a computing device for implementing an automated semantic annotation method for agricultural multimodal data is shown. Figure 1 As shown, a computing device may include one or more processors (processors may include, but are not limited to, microprocessors such as MCUs or programmable logic devices such as FPGAs), a memory for storing data, a transmission device for communication functions, and an input / output interface. The memory, transmission device, and input / output interface are connected to the processor via a bus. In addition, it may also include a display, keyboard, and cursor control device connected to the input / output interface. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, a computing device may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0018] It should be noted that the aforementioned one or more processors and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element in a computing device. As involved in the embodiments of this disclosure, the data processing circuits serve as processor control (e.g., selection of a variable resistor termination path connected to an interface).
[0019] The memory can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the automated semantic annotation method for agricultural multimodal data in this embodiment of the present disclosure. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby realizing the aforementioned application of the automated semantic annotation method for agricultural multimodal data. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the computing device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0020] The transmission device is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the computing device's communication provider. In one example, the transmission device includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0021] The display can be, for example, a touchscreen liquid crystal display (LCD), which allows users to interact with the user interface of the computing device.
[0022] It should be noted here that, in some optional embodiments, the above... Figure 1 The computing device shown may include hardware elements (including circuitry), software elements (including computer code stored on a computer-readable medium), or a combination of both hardware and software elements. It should be noted that... Figure 1 This is only one instance of a specific particular instance, and is intended to illustrate the types of components that may exist in the aforementioned computing devices.
[0023] According to a first aspect of this embodiment, an automated semantic annotation method for agricultural multimodal data is provided, the method comprising: Figure 1 The computing device shown is implemented. Figure 2 A flowchart illustrating the method is shown below. (Refer to...) Figure 2 As shown, the method includes: S202: Construct an agricultural semantic lexicon, which includes multimodal observation lexicons, labeled rule lexicons, the codes corresponding to multimodal observation lexicons, and the codes corresponding to labeled rule lexicons. S204: Obtain the observation data to be labeled and the rule text corresponding to multiple preset labels; S206: Generate an observation text vector corresponding to the observation data to be labeled based on the multimodal observation lexicon in the agricultural semantic lexicon and the encoding corresponding to the corresponding multimodal observation lexicon; S208: Generate a rule text vector corresponding to the rule text based on the annotation rule lexical units and the corresponding codes of the annotation rule lexical units; S210: Utilizing a cross-attention mechanism, based on the observed text vector and the corresponding rule text vector, generate probability values for preset labels corresponding to the rule text; and S212: Label the observation data to be labeled according to the probability value of the preset label corresponding to the rule text.
[0024] First, the computing device can construct an agricultural semantic lexicon, which includes multimodal observation terms, annotation rule terms, codes corresponding to the multimodal observation terms, and codes corresponding to the annotation rule terms (S202). The construction of the agricultural semantic lexicon is crucial for solving the technical problem required by the automated semantic annotation method for agricultural multimodal data provided in this application. The role of the agricultural semantic lexicon will be explained in detail later. In this application, the agricultural semantic lexicon is used to automatically annotate agricultural-related observation data, thereby automatically generating training samples for training agricultural-related models. It should be noted that the observation data (the observation data to be annotated) is not in text form, but rather data determined through sensor data or image data to represent the state of the plant itself or its environment. In this embodiment, automated annotation is achieved by associating the observation data with the multimodal observation terms in the agricultural semantic lexicon.
[0025] The agricultural semantic lexicon primarily includes two types of tokens: multimodal observation tokens and annotation rule tokens. Furthermore, the lexicon includes encodings corresponding to each multimodal observation token and encodings corresponding to each annotation rule token. Multimodal observation tokens correspond to the observed data (i.e., the input data of the training samples), while annotation rule tokens correspond to the labels of the training samples. Examples illustrating the forms of multimodal observation tokens and annotation rule tokens will be provided later.
[0026] It should be noted that the codes corresponding to multimodal observation lexical units and labeled rule lexical units in the agricultural semantic lexicon can be generated using methods commonly used in natural language processing. For example, one-hot codes corresponding to each multimodal observation lexical unit and labeled rule lexical unit can be generated first. Then, a pre-trained language model can be trained using a large corpus containing multimodal observation lexical units and labeled rule lexical units, thereby generating the codes corresponding to each multimodal observation lexical unit and labeled rule lexical unit through the pre-trained language model.
[0027] Then, the computing device can acquire the observation data to be labeled and the rule text corresponding to multiple preset labels (S204). The observation data to be labeled is equivalent to the input data of the training samples (i.e., corresponding to the input of the model required for training). The observation data to be labeled can be determined based on sensor data and image data collected from the plant itself or its environment. The rule text corresponding to the preset labels refers to a piece of text defined manually for each preset label. Through this embodiment, those skilled in the art can flexibly edit the rule text corresponding to the preset labels, add new preset labels and define the rule text corresponding to the newly added preset labels, or replace the rule text of the preset labels.
[0028] Then, the computing device can generate an observation text vector corresponding to the observation data to be labeled based on the multimodal observation lexicon in the agricultural semantic lexicon and the encoding corresponding to the corresponding multimodal observation lexicon (S206).
[0029] It should be noted that the observation data to be labeled can be normalized in advance to make the dimensions of different categories of observation data uniform.
[0030] This section uses a case study of monitoring drought stress in greenhouse tomatoes to illustrate the unlabeled observation data and the rule text corresponding to multiple preset labels.
[0031] A set of observational data to be labeled may include, for example, the relative soil moisture content determined by sensors, the percentage of normal leaves, the percentage of leaves with diminished gloss, the percentage of distorted leaves, the percentage of curled leaves, and the percentage of yellowed leaves determined by image data collected from greenhouse tomatoes. Subsequent steps (steps S210-S212) can determine the labels corresponding to this set of observational data. This set of observational data and its corresponding labels can form a complete training sample, thereby achieving automated labeling. In practical applications, the specific categories of observational data included in a set need to be defined manually.
[0032] Multiple preset labels can be set as follows: label a "no drought stress"; label b "mild drought stress"; label c "severe drought stress".
[0033] The rule text corresponding to tag a can be set as: "The relative soil moisture content is greater than or equal to 0.7, most leaves are normal leaves, the proportion of leaf luster decay and unfolding distortion is extremely low, there are almost no leaf curling, yellowing and wilting phenomena, and the plant is in sufficient water condition."
[0034] The rule text corresponding to tag b can be set as follows: "The relative soil moisture content is between 0.5 and 0.7, the proportion of normal leaves decreases, some leaves show luster loss and deformity, a small number of leaves are slightly curled, there are no obvious yellowing and wilting leaves, and the plant is under slight water stress."
[0035] The rule text corresponding to tag c can be set as: "The relative soil moisture content is less than 0.5, the proportion of normal leaves is greatly reduced, a large number of leaves are curled, withered and wilted, the leaves show obvious signs of water loss, and the plant suffers irreversible drought damage."
[0036] For a set of observational data to be labeled, multimodal observational terms corresponding to the corresponding observational data can be determined from the relevant agricultural semantic lexicon. In this example, the multimodal observational terms corresponding to the set of observational data to be labeled mentioned above include: "relative soil moisture content z", "percentage of normal leaves v0", "percentage of leaves withered gloss v1", "percentage of leaves with distorted spread v2", "percentage of leaves curled v3", and "percentage of leaves withered v4". Here, z is the percentage of normal leaves, v0 is the percentage of normal leaves, v1 is the percentage of leaves withered gloss, v2 is the percentage of leaves with distorted spread, v3 is the percentage of leaves curled, and v4 is the percentage of leaves withered.
[0037] For example, "relative soil moisture content z" can be in the form of "relative soil moisture content 53%", and "leaf curling percentage v3" can be in the form of "leaf curling percentage 10%".
[0038] Then, the computing device can generate an observation text vector corresponding to the observation semantic text based on the multimodal observation terms corresponding to the observation data to be labeled and the codes corresponding to the corresponding multimodal observation terms.
[0039] Furthermore, the computing device can generate a rule text vector corresponding to the rule text based on the labeled rule lexical units and the corresponding codes of the labeled rule lexical units (S208).
[0040] The observed text vector and the rule text vector mentioned above can be generated through the same word embedding layer.
[0041] Then, the computing device can use the cross-attention mechanism to generate a probability value of a preset label corresponding to the corresponding rule text based on the observed text vector and the rule text vector corresponding to the rule text (S210), and label the observation data to be labeled based on the probability value of the preset label corresponding to the corresponding rule text (S212).
[0042] The computing device can use the preset label with the highest probability value among multiple preset labels as the label for labeling the observation data to be labeled.
[0043] As described in the background section, existing methods for automated labeling in agricultural scenarios typically involve training a model using supervised learning. The model's input can be agricultural-related metrics (e.g., temperature, humidity, and plant-related images), and its output can be a classification result (e.g., drought level). For data to be labeled, this data is input into the model, which generates the classification result as the label. However, in agricultural business scenarios, actual business needs may require updating the specifications of the training samples. For example, adding categories to the model's output or adding dimensions to the input data, or even changing the input data and labels due to changes in the business scenario. In existing methods, this necessitates rebuilding the model and retraining it, which reduces the efficiency of automated labeling.
[0044] Therefore, in this embodiment, an agricultural semantic lexicon is first constructed, containing two types of lexical units: multimodal observation lexical units and annotation rule lexical units. After obtaining the observation data to be annotated, an observation text vector corresponding to the observation data is generated based on the multimodal observation lexical units in the agricultural semantic lexicon, and a rule text vector corresponding to the rule text is generated based on the annotation rule lexical units in the agricultural semantic lexicon. Then, using a cross-attention mechanism, a probability value of a preset label corresponding to the rule text is generated based on the observation text vector and the rule text vector. Based on this probability value, the corresponding observation data to be annotated is then labeled. In the above embodiment, the multimodal observation lexical units of the agricultural semantic lexicon correspond to the input data of the training samples, and the annotation rule lexical units correspond to the labels of the training samples. Therefore, this embodiment determines the multimodal observation lexical units corresponding to the observation data to be labeled, and then generates text vectors (observation text vector and rule text vector) of the observation data and the rule text corresponding to the preset labels respectively. The cross-attention mechanism is used to perform semantic matching between the two (observation text vector and rule text vector) to generate the probability value of the preset label corresponding to the rule text, thereby realizing automated labeling. Compared with the prior art, when it is necessary to update the label of the training sample or the dimension of the input data, it is only necessary to update the multimodal observation lexical units and / or labeling rule lexical units in the agricultural semantic lexicon. The cross-attention mechanism is used to match the labeling rules of each preset label with the observation data to be labeled. It is not necessary to modify the internal structure of the model used for labeling, so that the model does not need to be completely retrained, which can improve the efficiency of automated labeling.
[0045] When determining the multimodal observation terms (i.e., the multimodal observation terms that match the observation data to be labeled) in the agricultural semantic lexicon, the computing device can directly determine the multimodal observation terms corresponding to the observation data to be labeled based on the pre-defined multimodal observation terms associated with the corresponding categories of observation data in the agricultural semantic lexicon. In other words, several terms (multimodal observation terms) corresponding to each type of observation data can be predefined in the agricultural semantic lexicon, thereby directly determining the multimodal observation terms corresponding to the observation data to be labeled.
[0046] Of course, computing devices can also determine the multimodal observation terms corresponding to the observation data to be labeled in the agricultural semantic lexicon in the following way: first, convert the observation data to be labeled into observation semantic text, and then determine the multimodal observation terms corresponding to the observation semantic text as the multimodal observation terms corresponding to the observation data to be labeled.
[0047] Optionally, the operation of generating an observation text vector corresponding to the observation data to be labeled, based on the multimodal observation lexicons in the agricultural semantic lexicon corresponding to the observation data to be labeled and the codes corresponding to the corresponding multimodal observation lexicons, includes: converting the observation data to be labeled into observation semantic text corresponding to the observation data to be labeled, wherein the observation semantic text contains the observation values corresponding to the observation data to be labeled; determining the multimodal observation lexicons in the agricultural semantic lexicon that match the observation semantic text; and generating an observation text vector corresponding to the observation data to be labeled based on the codes corresponding to the multimodal observation lexicons that match the observation semantic text through the word embedding layer of the preset labeling model.
[0048] For example, the set of observation data to be labeled in the above example can be converted into natural language text to generate corresponding observation semantic text, including: "relative soil moisture content z", "percentage of normal leaves v0", "percentage of leaves with diminished gloss v1", "percentage of leaves with distortion v2", "percentage of leaves curled v3", and "percentage of leaves withered v4". Here, z is the percentage of normal leaves, v0 is the percentage of normal leaves, v1 is the percentage of leaves with diminished gloss, v2 is the percentage of leaves with distortion, v3 is the percentage of leaves curled, and v4 is the percentage of leaves withered.
[0049] For example, the observational semantic text "relative soil moisture content z" can be in the form of "relative soil moisture content 53%", and the observational semantic text "leaf curling percentage v3" can be in the form of "leaf curling percentage 10%". In the agricultural semantic lexicon, a multimodal observational term can be identical to an observational semantic text.
[0050] The computing device can convert the observation data to be labeled into observation semantic text corresponding to the corresponding observation data category. The observation semantic text contains the observation value corresponding to the observation data to be labeled. That is to say, the generated observation semantic text is different for different categories of observation data to be labeled. For example, in the example above, when the observation data is a numerical value of relative soil moisture content, the corresponding observation semantic text is "relative soil moisture content z", where z is the observation value corresponding to the observation data; when the observation data is a numerical value of the percentage of leaf curling, the corresponding observation semantic text is "percentage of leaf curling v3", where v3 is the observation value corresponding to the observation data.
[0051] Using the above method, the computing device can directly determine the multimodal observation terms corresponding to the observation data to be labeled from the agricultural semantic lexicon. Then, refer to... Figure 3 As shown, Figure 3The structure of the annotation model is shown. The computing device can determine the multimodal observation units corresponding to the observed semantic text from the agricultural semantic lexicon. Then, through the word embedding layer of the annotation model, it generates observation text vectors corresponding to the corresponding observation data to be labeled based on the corresponding multimodal observation units. As mentioned above, a training sample to be labeled can contain a set of observation data to be labeled. The computing device can generate observation text vectors corresponding to each observation data to be labeled through the word embedding layer.
[0052] Optionally, the operation of generating a rule text vector corresponding to the rule text based on the annotation rule lexical and the encoding corresponding to the annotation rule lexical includes: segmenting the rule text into words, matching the segmented rule text with the annotation rule lexical in the agricultural semantic lexicon to determine the target annotation rule lexical; and generating a rule text vector corresponding to the rule text based on the encoding corresponding to the target annotation rule lexical through the word embedding layer of the preset annotation model.
[0053] Specifically, for each preset label corresponding to a rule text, the computing device can segment the rule text into words. This allows it to determine the target labeled rule units that match the segmented rule text from the agricultural semantic lexicon. Then, through the word embedding layer of the annotation model, it generates a rule text vector corresponding to the corresponding rule text based on the encoding of the target labeled rule units that match the segmented rule text. Specifically, the computing device can generate word vectors corresponding to each target labeled rule unit through the word embedding layer, and thus determine the rule text vector corresponding to the corresponding rule text based on the word vectors corresponding to each target labeled rule unit. For example, the word vectors corresponding to each target labeled rule unit can be directly used as the determined rule text vector corresponding to the corresponding rule text, or the word vectors corresponding to each target labeled rule unit can be further fused to obtain the determined rule text vector corresponding to the corresponding rule text.
[0054] Optionally, the operation of generating a probability value of a preset label corresponding to a rule text based on the observation text vector corresponding to the observation semantic text and the rule text vector corresponding to the rule text, using a cross-attention mechanism, includes: generating a query matrix corresponding to the observation data to be labeled based on the observation text vector; generating a key matrix and a value matrix corresponding to the rule text based on the rule text vector; generating an attention fusion feature corresponding to the rule text based on the attention layer of a preset labeling model using a cross-attention mechanism, based on the query matrix corresponding to the observation semantic text, the key matrix and the value matrix corresponding to the rule text; and generating a probability value of a preset label corresponding to the rule text based on the attention fusion feature.
[0055] Continue to refer to Figure 3As shown, the computing device can then generate a query matrix based on the observation text vectors corresponding to the observation data to be labeled. And based on the rule text vector corresponding to the rule text of the i-th preset tag, generate the key matrix corresponding to the corresponding rule text. Sum matrix .
[0056] Then, through the attention layer, using the cross-attention mechanism, attention fusion features corresponding to the corresponding rule text are generated based on the query matrix corresponding to the observation data to be labeled, the key matrix and value matrix corresponding to the corresponding rule text. The formula is shown below:
[0057] Here, softmax() represents the softmax activation function, and d represents the dimension of the word vectors generated by the word embedding layer.
[0058] Then, the computing device can fuse features based on the attention corresponding to the rule text. Generate the probability value of the i-th preset tag corresponding to the rule text, refer to Figure 3 As shown, the computing device can fuse attention features corresponding to the rule text. A binary classifier consisting of a fully connected layer and a sigmoid activation function is input to generate a probability value corresponding to the i-th preset label. Based on the probability values of each preset label, the computing device can determine the label to be assigned to the observation data to be labeled.
[0059] For example, suppose the computing device determines a probability value of 0.94 for label a based on the rule text corresponding to label a (the process involves generating a key matrix based on the rule text corresponding to label a). and value matrix And based on the key matrix and value matrix The query matrix Q, determined based on the observation data to be labeled, is matched using a cross-attention mechanism, resulting in a probability value of 0.94. The computing device, based on the rule text corresponding to label b, determines a probability value of 0.05 for label b (the process involves generating a key matrix based on the rule text corresponding to label b). and value matrix And based on the key matrix and value matrix The query matrix Q is matched using a cross-attention mechanism to determine a probability value of 0.05. Based on the rule text corresponding to the label c, the computing device determines a probability value of 0.01 for label c (the process involves generating a key matrix based on the rule text corresponding to label c). and value matrix And based on the key matrix and value matrix The cross-attention mechanism is used to match the query matrix Q, thus determining a probability value of 0.01. The computing device can then select the label with the highest probability value (label a) as the label for labeling the set of observation data to be labeled in the above example.
[0060] The training samples automatically labeled in this embodiment can be used to train neural network models related to agricultural scenarios. If the input data or labels of the training samples need to be updated due to actual business needs, it is only necessary to iteratively update the agricultural semantic lexicon, that is, to add new multimodal observation terms and labeling rule terms to the agricultural semantic lexicon, and define the labeling rules corresponding to the new labels.
[0061] It should be noted that the annotation model in this specification can be pre-trained using supervised training. That is, the annotation model can be trained using training data containing observation data samples and rule text samples with corresponding labels. When it is necessary to update the specifications of the training samples automatically annotated by the annotation model, the internal structure of the annotation model does not need to be modified. To improve the automatic annotation effect of the annotation model, even when it is necessary to update the specifications of the training samples automatically annotated by the annotation model, supervised training can still be used to fine-tune the annotation model.
[0062] In addition, refer to Figure 1 As shown, according to a second aspect of this embodiment, a storage medium is provided. The storage medium includes a stored program, wherein, when the program is executed, a processor performs any of the methods described above.
[0063] Therefore, according to this embodiment, an agricultural semantic lexicon is first constructed, containing two types of lexical units: multimodal observation lexical units and annotation rule lexical units. After obtaining the observation data to be annotated, an observation text vector corresponding to the observation data to be annotated is generated based on the multimodal observation lexical units in the agricultural semantic lexicon that correspond to the corresponding observation data. A rule text vector corresponding to the rule text is also generated based on the annotation rule lexical units in the agricultural semantic lexicon. Then, using a cross-attention mechanism, a probability value for a preset label corresponding to the rule text is generated based on the observation text vector and the rule text vector. The corresponding observation data to be annotated is then labeled based on this probability value. In the above embodiment, the multimodal observation lexical units of the agricultural semantic lexicon correspond to the input data of the training samples, and the annotation rule lexical units correspond to the labels of the training samples. Therefore, this embodiment determines the multimodal observation lexical units corresponding to the observation data to be labeled, and then generates text vectors (observation text vector and rule text vector) of the observation data to be labeled and the rule text corresponding to the preset labels, respectively. The two (observation text vector and rule text vector) are semantically matched using a cross-attention mechanism to generate the probability value of the preset label corresponding to the rule text, thereby achieving automated labeling. Compared with the prior art, when it is necessary to update the label of the training sample or the dimension of the input data, it is only necessary to update the multimodal observation lexical units and / or labeling rule lexical units in the agricultural semantic lexicon, and update the rule text corresponding to the label. The rule text of each preset label is matched with the observation data to be labeled using the cross-attention mechanism, without modifying the internal structure of the model used for labeling, thus eliminating the need to completely retrain the model and improving the efficiency of automated labeling.
[0064] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the present invention.
[0065] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0066] Example 2
[0067] Figure 4 An automated semantic annotation apparatus for agricultural multimodal data according to a first aspect of this embodiment is shown, corresponding to the method described according to the first aspect of Embodiment 1. Reference Figure 4 As shown, the device includes: a construction module 410 for constructing an agricultural semantic lexicon, which includes multimodal observation terms, annotation rule terms, codes corresponding to the multimodal observation terms, and codes corresponding to the annotation rule terms; an acquisition module 420 for acquiring observation data to be labeled and rule text corresponding to multiple preset labels; an observation vector generation module 430 for generating observation text vectors corresponding to the observation data to be labeled based on the multimodal observation terms and codes corresponding to the multimodal observation terms in the agricultural semantic lexicon; a rule vector generation module 440 for generating rule text vectors corresponding to the rule text based on the annotation rule terms and codes corresponding to the annotation rule terms; a probability generation module 450 for generating probability values of preset labels corresponding to the rule text based on the observation text vectors and the rule text vectors corresponding to the rule text using a cross-attention mechanism; and an annotation module 460 for annotating the observation data to be labeled based on the probability values of the preset labels corresponding to the rule text.
[0068] Optionally, the observation vector generation module is used to convert the observation data to be labeled into observation semantic text corresponding to the observation data to be labeled, wherein the observation semantic text contains the observation values corresponding to the observation data to be labeled; determine the multimodal observation lexicons that match the observation semantic text in the agricultural semantic lexicon; and generate the observation text vector corresponding to the observation data to be labeled by means of the word embedding layer of the preset labeling model and the encoding corresponding to the multimodal observation lexicons that match the observation semantic text.
[0069] Optionally, the rule vector generation module is used to segment the rule text into words, match the segmented rule text with the labeled rule words in the agricultural semantic lexicon to determine the target labeled rule words; and generate a rule text vector corresponding to the rule text based on the encoding corresponding to the target labeled rule words through the word embedding layer of the preset labeling model.
[0070] Optionally, the probability generation module is used to generate a query matrix corresponding to the observed semantic text based on the observed text vector; generate a key matrix and a value matrix corresponding to the rule text based on the rule text vector; generate attention fusion features corresponding to the rule text based on the query matrix corresponding to the observed semantic text, the key matrix and the value matrix corresponding to the rule text through the attention layer of the preset annotation model and using a cross-attention mechanism; and generate probability values of preset labels corresponding to the rule text based on the attention fusion features.
[0071] Therefore, according to this embodiment, an agricultural semantic lexicon is first constructed, containing two types of lexical units: multimodal observation lexical units and annotation rule lexical units. After obtaining the observation data to be annotated, an observation text vector corresponding to the observation data to be annotated is generated based on the multimodal observation lexical units in the agricultural semantic lexicon that correspond to the corresponding observation data. A rule text vector corresponding to the rule text is also generated based on the annotation rule lexical units in the agricultural semantic lexicon. Then, using a cross-attention mechanism, a probability value for a preset label corresponding to the rule text is generated based on the observation text vector and the rule text vector. The corresponding observation data to be annotated is then labeled based on this probability value. In the above embodiment, the multimodal observation lexical units of the agricultural semantic lexicon correspond to the input data of the training samples, and the annotation rule lexical units correspond to the labels of the training samples. Therefore, this embodiment determines the multimodal observation lexical units corresponding to the observation data to be labeled, and then generates text vectors (observation text vector and rule text vector) of the observation text data and the rule text corresponding to the preset labels, respectively. The two (observation text vector and rule text vector) are semantically matched using a cross-attention mechanism to generate the probability value of the preset label corresponding to the rule text, thereby achieving automated labeling. Compared with the prior art, when it is necessary to update the label of the training sample or the dimension of the input data, it is only necessary to update the multimodal observation lexical units and / or the labeled rule lexical units in the agricultural semantic lexicon, and update the rule text corresponding to the label. The rule text of each preset label is matched with the observation data to be labeled using the cross-attention mechanism, without modifying the internal structure of the model used for labeling, thus eliminating the need to completely retrain the model and improving the efficiency of automated labeling.
[0072] Example 3
[0073] Figure 5An automated semantic annotation apparatus for agricultural multimodal data according to a first aspect of this embodiment is shown, corresponding to the method described according to the first aspect of Embodiment 1. Reference Figure 5 As shown, the device includes: a processor 510; and a memory 520 connected to the processor 510, used to provide the processor 510 with instructions to process the following steps: constructing an agricultural semantic lexicon, which includes multimodal observation terms, annotation rule terms, codes corresponding to the multimodal observation terms, and codes corresponding to the annotation rule terms; acquiring observation data to be annotated and rule text corresponding to multiple preset labels; generating observation text vectors corresponding to the observation data to be annotated based on the multimodal observation terms and codes corresponding to the multimodal observation terms in the agricultural semantic lexicon; generating rule text vectors corresponding to the rule text based on the annotation rule terms and codes corresponding to the annotation rule terms; generating probability values of preset labels corresponding to the rule text based on the observation text vectors and the rule text vectors corresponding to the rule text using a cross-attention mechanism; and annotating the observation data to be annotated based on the probability values of the preset labels corresponding to the rule text.
[0074] Optionally, the operation of generating an observation text vector corresponding to the observation data to be labeled, based on the multimodal observation lexicons in the agricultural semantic lexicon corresponding to the observation data to be labeled and the codes corresponding to the corresponding multimodal observation lexicons, includes: converting the observation data to be labeled into observation semantic text corresponding to the observation data to be labeled, wherein the observation semantic text contains the observation values corresponding to the observation data to be labeled; determining the multimodal observation lexicons in the agricultural semantic lexicon that match the observation semantic text; and generating an observation text vector corresponding to the observation data to be labeled based on the codes corresponding to the multimodal observation lexicons that match the observation semantic text through the word embedding layer of a preset labeling model.
[0075] Optionally, the operation of generating a rule text vector corresponding to the rule text based on the annotation rule lexical and the encoding corresponding to the annotation rule lexical includes: segmenting the rule text into words, matching the segmented rule text with the annotation rule lexical in the agricultural semantic lexicon to determine the target annotation rule lexical; and generating a rule text vector corresponding to the rule text based on the encoding corresponding to the target annotation rule lexical through the word embedding layer of the preset annotation model.
[0076] Optionally, the operation of generating a probability value of a preset label corresponding to a rule text based on the observed text vector corresponding to the observed semantic text and the rule text vector corresponding to the rule text, using a cross-attention mechanism, includes: generating a query matrix corresponding to the observed semantic text based on the observed text vector; generating a key matrix and a value matrix corresponding to the rule text based on the rule text vector; generating an attention fusion feature corresponding to the rule text based on the query matrix corresponding to the observed semantic text, the key matrix and the value matrix corresponding to the rule text, through the attention layer of a preset annotation model, using a cross-attention mechanism; and generating a probability value of a preset label corresponding to the rule text based on the attention fusion feature.
[0077] Therefore, according to this embodiment, an agricultural semantic lexicon is first constructed, containing two types of lexical units: multimodal observation lexical units and annotation rule lexical units. After obtaining the observation data to be annotated, an observation text vector corresponding to the observation data to be annotated is generated based on the multimodal observation lexical units in the agricultural semantic lexicon that correspond to the corresponding observation data. A rule text vector corresponding to the rule text is also generated based on the annotation rule lexical units in the agricultural semantic lexicon. Then, using a cross-attention mechanism, a probability value for a preset label corresponding to the rule text is generated based on the observation text vector and the rule text vector. The corresponding observation data to be annotated is then labeled based on this probability value. In the above embodiment, the multimodal observation lexical units of the agricultural semantic lexicon correspond to the input data of the training samples, and the annotation rule lexical units correspond to the labels of the training samples. Therefore, this embodiment determines the multimodal observation lexical units corresponding to the observation data to be labeled, and then generates text vectors (observation text vector and rule text vector) of the observation text data and the rule text corresponding to the preset labels, respectively. The two (observation text vector and rule text vector) are semantically matched using a cross-attention mechanism to generate the probability value of the preset label corresponding to the rule text, thereby achieving automated labeling. Compared with the prior art, when it is necessary to update the label of the training sample or the dimension of the input data, it is only necessary to update the multimodal observation lexical units and / or the labeled rule lexical units in the agricultural semantic lexicon, and update the rule text corresponding to the label. The rule text of each preset label is matched with the observation data to be labeled using the cross-attention mechanism, without modifying the internal structure of the model used for labeling, thus eliminating the need to completely retrain the model and improving the efficiency of automated labeling.
[0078] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0079] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0080] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0081] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0082] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0083] If the integrated unit is implemented as 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 technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0084] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. An automated semantic annotation method for agricultural multimodal data, characterized in that, include: An agricultural semantic lexicon is constructed, which includes multimodal observation lexicons, labeled rule lexicons, codes corresponding to the multimodal observation lexicons, and codes corresponding to the labeled rule lexicons. Obtain the observation data to be labeled and the rule text corresponding to multiple preset labels; Based on the multimodal observation lexicon in the agricultural semantic lexicon corresponding to the observation data to be labeled and the encoding corresponding to the corresponding multimodal observation lexicon, an observation text vector corresponding to the observation data to be labeled is generated; Based on the labeled rule words and their corresponding codes, a rule text vector corresponding to the rule text is generated. Using a cross-attention mechanism, based on the observation text vector corresponding to the observation data to be labeled and the rule text vector corresponding to the rule text, a probability value for a preset label corresponding to the rule text is generated; and The observation data to be labeled is labeled according to the probability value of the preset label corresponding to the rule text.
2. The method according to claim 1, characterized in that, The operation of generating an observation text vector corresponding to the observation data to be labeled, based on the multimodal observation lexicon in the agricultural semantic lexicon and the encoding corresponding to the corresponding multimodal observation lexicon, includes: The observation data to be labeled is converted into observation semantic text corresponding to the observation data to be labeled, and the observation semantic text contains the observation value corresponding to the observation data to be labeled. Determine the multimodal observation lexicons in the agricultural semantic lexicon that match the observed semantic text; and By using the word embedding layer of the preset annotation model, an observation text vector corresponding to the observation data to be annotated is generated based on the encoding of the multimodal observation lexical that matches the observed semantic text.
3. The method according to claim 1, characterized in that, The operation of generating a rule text vector corresponding to the rule text based on the labeled rule lexical units and their corresponding codes includes: The rule text is segmented into words, and the segmented words are matched with the labeled rule lexical units in the agricultural semantic lexicon to determine the target labeled rule lexical units; and By using the word embedding layer of the preset annotation model, a rule text vector corresponding to the rule text is generated based on the encoding corresponding to the target annotation rule lexical.
4. The method according to claim 1, characterized in that, The operation of generating a probability value for a preset label corresponding to the rule text based on the observation text vector corresponding to the observation data to be labeled and the rule text vector corresponding to the rule text using the cross-attention mechanism includes: Based on the observed text vector, a query matrix corresponding to the observation data to be labeled is generated; Based on the rule text vector, generate a key matrix and a value matrix corresponding to the rule text; Through the attention layer of the pre-defined annotation model, and utilizing a cross-attention mechanism, attention fusion features corresponding to the rule text are generated based on the query matrix corresponding to the observation data to be annotated, the key matrix, and the value matrix corresponding to the rule text; and Based on the attention fusion features, a probability value for a preset label corresponding to the rule text is generated.
5. A storage medium, characterized in that, The storage medium includes a stored program, wherein, when the program is executed, the method described in any one of claims 1 to 4 is performed by a processor.
6. An automated semantic annotation device for agricultural multimodal data, characterized in that, include: A construction module is used to construct an agricultural semantic lexicon, which includes multimodal observation lexicons, labeled rule lexicons, codes corresponding to the multimodal observation lexicons, and codes corresponding to the labeled rule lexicons. The acquisition module is used to acquire the observation data to be labeled and the rule text corresponding to multiple preset labels; The observation vector generation module is used to generate an observation text vector corresponding to the observation data to be labeled based on the multimodal observation lexicon in the agricultural semantic lexicon that corresponds to the observation data to be labeled and the encoding corresponding to the corresponding multimodal observation lexicon. The rule vector generation module is used to generate a rule text vector corresponding to the rule text based on the labeled rule lexical and the encoding corresponding to the labeled rule lexical. The probability generation module is used to generate a probability value of a preset label corresponding to the rule text based on the observation text vector corresponding to the observation data to be labeled and the rule text vector corresponding to the rule text, using a cross-attention mechanism. as well as The annotation module is used to annotate the observation data to be annotated according to the probability value of the preset label corresponding to the rule text.
7. The apparatus according to claim 6, characterized in that, An observation vector generation module is used to convert the observation data to be labeled into observation semantic text corresponding to the observation data to be labeled, wherein the observation semantic text contains the observation value corresponding to the observation data to be labeled; determine the multimodal observation lexicon in the agricultural semantic lexicon that matches the observation semantic text; and generate an observation text vector corresponding to the observation data to be labeled based on the encoding corresponding to the multimodal observation lexicon that matches the observation semantic text through the word embedding layer of a preset labeling model.
8. The apparatus according to claim 6, characterized in that, The rule vector generation module is used to segment the rule text into words and match the segmented rule text with the labeled rule words in the agricultural semantic lexicon to determine the target labeled rule words. And through the word embedding layer of the preset annotation model, a rule text vector corresponding to the rule text is generated according to the encoding corresponding to the target annotation rule word.
9. The apparatus according to claim 6, characterized in that, The probability generation module is used to generate a query matrix corresponding to the observation data to be labeled based on the observed text vector; generate a key matrix and a value matrix corresponding to the rule text based on the rule text vector; and generate an attention fusion feature corresponding to the rule text based on the query matrix corresponding to the observation data to be labeled, the key matrix and the value matrix corresponding to the rule text through the attention layer of the preset labeling model and using a cross-attention mechanism. And based on the attention fusion features, generate a probability value for a preset label corresponding to the rule text.
10. An automated semantic annotation device for agricultural multimodal data, characterized in that, include: processor; as well as A memory, connected to the processor, for providing the processor with instructions to perform the following processing steps: An agricultural semantic lexicon is constructed, which includes multimodal observation lexicons, labeled rule lexicons, codes corresponding to the multimodal observation lexicons, and codes corresponding to the labeled rule lexicons. Obtain the observation data to be labeled and the rule text corresponding to multiple preset labels; Based on the multimodal observation lexicon in the agricultural semantic lexicon corresponding to the observation data to be labeled and the encoding corresponding to the corresponding multimodal observation lexicon, an observation text vector corresponding to the observation data to be labeled is generated; Based on the labeled rule words and their corresponding codes, a rule text vector corresponding to the rule text is generated. Using a cross-attention mechanism, based on the observation text vector corresponding to the observation data to be labeled and the rule text vector corresponding to the rule text, a probability value for a preset label corresponding to the rule text is generated; and The observation data to be labeled is labeled according to the probability value of the preset label corresponding to the rule text.
