Method for extracting image-text multi-mode entity relationship in military field by combining yov8 and UIE models

By combining the yolov8 and UIE models to construct image and text data sets, identify aircraft types in the military field and extract entity relationships, it solves the problem of accuracy in identifying aircraft types and relationships in the existing technology, and achieves efficient recognition and extraction effects.

CN118734851APending Publication Date: 2024-10-01NANJING UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410740909.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-07
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

Existing technologies in the fields of natural language processing and computer vision make it difficult to accurately identify aircraft types and their relationships in the military field using text or images alone, and cannot meet the needs of the intelligent era.

Method used

Combining yolov8 target detection with the UIE model, by constructing an image data set and a text relationship data set, use yolov8 to detect the aircraft model and combine it with the UIE model to extract entity relationships and output a standard triplet form.

Benefits of technology

It achieves accurate identification of aircraft models and accurate extraction of entity relationships in the military field, improving the recognition rate, especially when clear images and text information are insufficient.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118734851A_ABST
    Figure CN118734851A_ABST
Patent Text Reader

Abstract

The invention provides an image-text multi-mode entity relation extraction method for the military field by combining a yov8 model and a UIE model. For the multi-mode problem in the field of natural language processing, the steps of separate image-text extraction and combined output are considered, that is, a general information extraction model UIE after fine adjustment and retraining is used for basic text information extraction, and a relation triple (a head entity, a relation and a tail entity) is obtained; the yolov8 is used for target identification in the image, the identified object type focuses on the aircraft type in the military field, the identification accuracy can reach the specific model in the defined schema, that is, the fine-grained identification degree is achieved, the accurate model identification result is used for outputting, and the identification accuracy is improved. And the effect of image-text multi-modal entity relationship extraction in the military field can be achieved. According to the method, based on the background of the military field, the target detection technology and the text information extraction technology are combined respectively, the precision effect of aircraft type fine-grained recognition is achieved, and the result of outputting the relation triple is obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language processing, and in particular to a method for extracting entity relationships of multimodal graphic and text information. Background Art

[0002] Natural language processing (NLP) is an important branch of computer science and artificial intelligence, which aims to enable computers to understand and process human language. Relation extraction (RE) is an important task in NLP, which aims to automatically identify the relationship between entities from text. At the same time, natural language processing is also closely related to computer vision.

[0003] Relation extraction (RE) is a basic process for building a knowledge graph, and its task is to identify the semantic relationship between two entities given in a sentence. Multimodal relation extraction (MRE) is a task that uses visual cues to identify textual relationships. Visual information is an important channel for humans to obtain information, and more than 80% of the information humans obtain comes from visual information. Visual sensors, as tools to assist humans in obtaining visual information, occupy an important position in human production and life. There are certain limitations to obtaining information from text alone. Visual content helps to identify relationships more accurately compared to a pure text baseline. Therefore, the method of combining images and text for entity relationship extraction has emerged.

[0004] In recent years, deep learning has developed rapidly in the fields of computer vision and natural language processing, among which object recognition and information extraction are important fields. The effect obtained by using only one source, text or image, is relatively simple and cannot meet the needs of the intelligent era. Summary of the invention

[0005] The present invention provides a method for the military field that combines target detection with text information extraction, which can accurately identify the specified aircraft type and output a standard triplet form.

[0006] The technical solution adopted by the present invention is: a method for extracting multimodal entity relationships of images and texts in the military field by combining yolov8 and UIE model, comprising the following steps:

[0007] Step 1: Search for images of aircraft or aircraft on official military equipment websites or official military power websites available at home and abroad, build an image dataset, and use yolov8 to detect images and identify the specific model of the aircraft;

[0008] Step 2: formulate the schema of the relationship between entities and build a text relationship dataset based on the schema;

[0009] Step 3: Use the text dataset to fine-tune the UIE information extraction model;

[0010] Step 4: Use the fine-tuned UIE to extract the input text, and combine the results obtained by yolov8 to output the final entity relationship triples.

[0011] Furthermore, in step 1, 46 different aircraft types were first formulated, and the required aircraft images were selected and crawled from official military equipment websites or official military force websites (https: / / www.seaforces.org / ) at home and abroad:

[0012] Based on the crawled aircraft images, we screened and removed the images of poor quality to construct a data set, which was divided into a training set, a validation set, and a test set. The final training set had 10,472 images, the validation set had 1,164 images, and the test set had 1,293 images.

[0013] Use yolov8 to train aircraft pictures, use NVIDIA GeForce RTX 3070 Ti GPU for acceleration, set the cuda version to 11.3, the software environment to Python 3.8, the pytorch version to 1.9.0+cu111, the torchaucio version to 0.9.0, the torchvision version to 0.10.0+cu111, load the yolov8n.pt pre-trained model file, the input image size is 640*640, the batch size is set to 4, the number of training rounds is set to 100, 200, and 300 respectively, and the learning rate is set to 0.001.

[0014] We used some test images to compare the results of 100, 200, and 300 rounds, and found that 300 rounds had the best effect on model recognition of aircraft images.

[0015] In the test pictures, if there are many aircraft scenes, such as an aircraft carrier carrying many carrier-based aircraft, the recognition rate of aircraft models will decrease due to the large number of identification targets, the small image of the target being photographed from a long distance, or the obstruction of the surrounding aircraft and other equipment. In the case of fewer or even only a single aircraft target, the recognition rate of the aircraft target model can exceed 0.95 or even approach 1 because the number of targets to be identified is small and the image is clear enough.

[0016] Furthermore, in step 2, for the relationship between entities, a schema is developed around the entity "airplane". The process of specifying the schema needs to consider words with similar meanings, which need to be screened and eliminated, and the final relationship words need to conform to the actual scenario.

[0017] For these 10 different aircraft-related entity-relationship triples, we selected relevant news texts collected from military websites and news websites, and added manual writing to form a text sentence dataset that can reflect the entity-relationship triples specified in the schema for use in the UIE model.

[0019] Furthermore, in step 3, the UIE model is a general information extraction unified framework that can be used for information extraction in different tasks. In the military field, when the input text does not mention the specific model, but the corresponding image can identify the model of the aircraft, consider using visual information to supplement the single text information as a supplement to the information.

[0020] The UIE model can extract general text information and has good migration and generalization capabilities in different tasks. Based on the ERNIE 3.0 knowledge enhancement pre-training model, the first Chinese general information extraction model UIE was trained and open-sourced.

[0021] The UIE model uses the default uie-base model, with a structure of 12-layers, 768-hidden, and 12-heads, and the language mode is set to "Chinese". The application scenario is "extractive model for text scenarios, supporting Chinese".

[0022] Given a pre-trained UIE model, we can quickly adapt it to different IE tasks and settings through model fine-tuning. task ={(s, x, y)}, and fine-tune the UIE model using teacher-forcing cross entropy loss:

[0023] The special doccano annotation tool was used to annotate the head and tail entities and relations of the previous text dataset. The annotation criteria were based on the 10 types of relations specified in the previously specified schema, with a total of 120 text sentences.

[0024] Export the data text annotated by the doccano tool in the admin.jsonl format and place it in the . / data directory.

[0025] Call the UIE model, input the specified schema, set the task-path to uie-base, input the instance test text, and obtain the extracted entity triple relationship results.

[0026] Use the single-card fine-tuning command, set the learning rate learning_rate to 1e-5, the batch size to 4, the maximum length of the sequence to 512, the number of rounds to 4, the model selected to be uie-base, the random seed seed to 1000 --logging_steps to 10, the reasonable number of steps to 10, and the final saved training file name is checkpoint-1880.

[0027] Call the UIE model, input the specified schema, set the task-path to checkpoint-1880, and input the instance test text. The input test instance text is required not to contain specific aircraft models, but to use fuzzy words or directly write "aircraft" to obtain the extracted entity triple relationship results.

[0028] Comparing the results of uie-base and checkpoint-1880, we find that the extraction effect of the latter is significantly better than that of the former. It not only filters out entities and relationships that do not need to be extracted, but also significantly improves the accuracy of extracting entities and relationships required by the schema.

[0029] Furthermore, in step 4, checkpoint-1880 is selected. In the obtained results, a threshold is set by comparison. If it is higher than the threshold, the relationship is selected for output; if it is lower than the threshold, it is not output. The output format is "head entity relationship tail entity".

[0030] The results detected by yolov8 are mapped to the specified dictionary of 46 aircraft types as replaceable entity names.

[0031] If the word "airplane" appears in the output head entity or tail entity, it is replaced by the specific model of the aircraft obtained by yolov8 target detection.

[0032] The final result is output in the form of "head entity relationship tail entity".

[0033] The present invention will be further described below in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 It is a schematic diagram of the implementation process of the structure of the present invention;

[0035] Figure 2 Schematic diagram of yolov8 structure

[0036] Figure 3 This is the test image input to yolov8;

[0037] Figure 4 This is the picture of the aircraft model tested by yolov8.

[0038] Figure 5 Diagram of the doccano tool interface

[0039] Figure 6 Schematic diagram of the text extraction effect using uie-base

[0040] Figure 7 A diagram showing the effect of text extraction after fine-tuning using checkpoint-1880

[0041] Figure 8 The final output entity relationship triple DETAILED DESCRIPTION

[0042] In order to better understand the specific content of the present invention, a specific embodiment is given and described as follows with reference to the accompanying drawings. In this disclosure, each step of the present invention is described with reference to the accompanying drawings, and the present invention is described in detail.

[0043] The present invention provides a method for extracting multimodal entity relationships between images and texts in the military field by combining yolov8 and UIE models. The method comprises the following steps:

[0044] Step 1: Search for relevant military websites on the Internet, not limited to domestic and foreign, not limited to the fields of land, sea and air. Look for pictures of aircraft or aircraft on official military equipment websites or official military power websites at home and abroad, build an image dataset, and use yolov8 to detect images and identify the specific model of the aircraft. Figure 1 This is the overall flow chart of the invention. The present invention uses yolov8 to train the constructed data set for target detection, with the aim of obtaining the specific aircraft model that can be identified.

[0045] Step 2: formulate the schema of the relationship between entities, and build a text relationship dataset based on the schema. Use the annotation tool to generate a jsonl file to train the UIE model to extract entity relationship triples. Combine the results of the two to output the final accurate entity relationship triple results.

[0046] Through search investigations on Baidu, Google, and various aircraft illustration websites, 46 different aircraft types were eventually identified, and the required aircraft images were selected and crawled from official domestic and foreign military equipment websites or official military power websites (https: / / www.seaforces.org / ).

[0047] Based on the crawled aircraft images, after screening, some images with unclear image quality, black and white, too old, too oxidized and unrecognizable were removed. A special aircraft dataset was built and divided into training set, validation set and test set according to a certain ratio. The final training set has 10,472 images, the validation set has 1,164, and the test set has 1,293 images.

[0048] Figure 2 This is a schematic diagram of the network structure of yolov8, using yolov8 to train aircraft images.

[0049] Use yolov8 to train the aircraft pictures, use the NVIDIA GeForce RTX 3070 Ti GPU for acceleration, set the cuda version to 11.3, the software environment to Python 3.8, the pytorch version to 1.9.0+cu111, the torchaudio version to 0.9.0, the torchvision version to 0.10.0+cu111, load the yolov8n.pt pre-trained model file, the input image size is 640*640, the batch size is set to 4, the number of training rounds is set to 100, 200, and 300 respectively, and the learning rate is set to 0.001.

[0050] Figure 3 To input the test picture to yolov8, Figure 4 This is the result image of the aircraft model tested by yolov8. The images selected for testing will also affect the final detection results of yolov8. Different scene conditions have a certain impact on the recognition accuracy of aircraft models. When choosing images, try to choose some clear images with fewer targets and no other objects blocking them for the best results.

[0051] Some regulations need to be made for the relationship extracted from the text, that is, the head-tail entity relationship that can be extracted should be in the military field and be a prescribed relationship. In addition, when using words at the right time, there will be situations where the relationship words are close. For example, the words "attack", "attack" and "strike" need to be unified, and in the final schema determination, the relationship word "strike" should be left; the words "equipped", "loaded", "equipped" and "assembled" need to be unified, and in the final schema determination, the relationship word "equipped" should be left.

[0052] There are 10 different head-tail entity relationship triples around the entity “aircraft”, where “aircraft” can be the head entity or the tail entity in the relationship triple, for example, “aircraft taking off from aircraft carrier” or “missile attack aircraft”, or it can be both the head entity and the tail entity, for example, “aircraft supply aircraft” or “aircraft refueling aircraft”.

[0053] For these 10 different aircraft-related entity relationship triples, we selected relevant news texts collected from military websites and news websites, and added manual writing to form a text sentence dataset that can reflect the entity relationship triples specified in the schema. We constructed 120 texts for annotation in UIE model fine-tuning training.

[0054] Figure 5 This is a schematic diagram of the doccano tool interface. First, use the following command in the terminal to create a virtual environment and specify python=3.9: conda create-n glenn python=3.9; then enter conda activate glenn to activate the glenn environment, and then enter pip install doccano to install doccano in the conda virtual environment glenn to complete the installation of doccano.

[0055] First, enter the virtual environment glenn, use the doccano init command to initialize, and use the doccanocreateuser --username admin --password pass command to set the username = admin and the password = pass. Start the WebServer in the terminal glenn environment: doccano webserver --port 8000. Open another new terminal and start the task queue: conda activate glenn and doccano task to complete the startup of doccano.

[0056] Open the link http: / / 127.0.0.1:8000 / and enter the interface. After entering the account and password, create a new project, select the "Sequence Labeling" task in NLP, import the prepared text sentences to label the head and tail entities and their relationships. After labeling, select jsonl as the export format, name it admin.jsonl, and put it in the ". / data" directory.

[0057] Call the UIE model, input the specified schema, set the task-path to uie-base, input the example test text "Fighter equipped with RDI radar system", and get the extracted entity triple relationship results. The results are as follows Figure 6 As shown. Use the single card fine-tuning command, set the learning rate learning_rate to 1e-5, the batch size to 4, the maximum length of the sequence to 512, the number of rounds to 4, the model selected to be uie-base, the random seed seed to 1000 --logging_steps to 10, the reasonable number of steps to 10, and the final saved training file name is checkpoint-1880.

[0059] Step 3: Enter the specified schema in UIE, set the task-path to checkpoint-1880, enter the example test text "Fighter equipped with RDI radar system", and get the extracted entity triple relationship results. The results are as follows: Figure 7 Comparing the results of uie-base and checkpoint-1880, we find that the extraction effect of the latter is significantly better than that of the former. It not only filters out the entities and relationships that do not need to be extracted, but also significantly improves the accuracy of extracting the entities and relationships required by the schema.

[0060] Step 4, select checkpoint-1880, and compare the probability of the relationship predicted by the head and tail entities in the obtained results. Set the threshold to 0.95. If it is higher than this threshold, the relationship is selected for output; if it is lower than this value, it is not output. The output format is "head entity relationship tail entity".

[0061] The results detected by yolov8 are mapped to the specified dictionary of 46 aircraft types as replaceable entity names. If the word "aircraft" appears in the output head entity or tail entity, the specific aircraft model obtained by yolov8 target detection is used to replace it. The final result is output in the form of "head entity relationship tail entity".

[0062] The test input text is "The fighter jet is equipped with missiles, which are used to attack enemy warships", and the fighter jet type identified by yolov8 target monitoring is "F18 fighter jet". Figure 8 It is the final output entity relationship triple.

[0063] Although the present invention has been disclosed as above with preferred embodiments, it is not intended to limit the present invention. A person with ordinary knowledge in the technical field to which the present invention belongs may make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention shall be determined by the definition of the claims.

Claims

1. A method combining yolov8 and UIE models for multimodal entity relationship extraction in military fields. The following steps are involved: Step 1: Develop an aircraft model dictionary, build a military aircraft image dataset, and divide it. Step 2, train the yolov8 model and use yolov8 to detect the aircraft model. Step 3: Develop a schema for the head-tail entity relationship pair, use the doccano tool for text annotation, and fine-tune the UIE model to improve the accuracy of text extraction and adapt to military-related texts. Step 4: Combine yolov8 and UIE models to output the final relation triples.

2. The method according to claim 1, Features: The specific process of step 1 is as follows: First, crawl the aircraft pictures in the relevant military field from the special military websites and armed forces websites, including but not limited to transport aircraft, supply aircraft, helicopters, and fighters. A dictionary of 46 different aircraft types was developed, and the required aircraft pictures were selected and crawled from the official military equipment websites or official military force websites at home and abroad, that is, the types presented in the aircraft pictures should be included in the 46 different models specified. After screening, the pictures with poor quality were eliminated, and the data set was constructed and divided into training set, verification set, and test set. The final training set pictures totaled 10,472, the verification set 1,164, and the test set 1,293.

3. The method according to claim 1, Features: Step 2 specifically includes the following steps: Step 1. After the aircraft pictures are screened, use yolov8 to train the aircraft pictures, use the NVIDIA GeForce RTX 3070 Ti GPU for acceleration, set the cuda version to 11.3, and the software environment to Python 3.

8. The pytorch version is set to 1.9.0+cu111, the torchaudio version is set to 0.9.0, and the torchvision version is set to 0.10.0+cu111. Load the pre-trained model file of yolov8n.pt, the input image size is 640*640, the batch processing is set to 4, the number of training rounds is set to 100, 200, and 300 respectively, and the learning rate is set to 0.

001. Step 2: Use yolov8 to detect the test aircraft images and compare the accuracy of identifying aircraft models. After comparison, the optimal number of training rounds should be set at 300 rounds, and the highest accuracy is achieved when the images are clear, colorful, with a small number of identified targets and no overlapping occlusion. In most images, the recognition rate of aircraft models exceeds 0.

95.

4. The method according to claim 1, Features: The specific process of step 3 includes the following steps: Step 1: For the relationship between entities, a schema is formulated around the entity "aircraft". The process of formulating the schema needs to consider that words with similar meanings will affect the extraction effect. For example, words such as "attack", "attack" and "strike" all have offensive meanings. If no unified regulations are made, the relationship words extracted by the UIE model will most likely be consistent with the words in the input text. However, the relationship words need to be unified and the final relationship words must be output consistently through fine-tuning training. Finally, 10 relationship words around the entity "aircraft" were determined, and a text dataset of 120 pieces for fine-tuning training was constructed. Step 2: Use the special doccano annotation tool to annotate the head and tail entities and relationships of the previous text dataset. The annotation criteria are based on the 10 types of relationships specified in the previously specified schema, with a total of 120 text statements. Export the data text annotated by the doccano tool in the format of admin.json1 and place it in the . / data directory. Step 3: Given a pre-trained UIE model, quickly adapt it to different IE tasks and settings through model fine-tuning. Given a labeled corpus Dtask = {(s, x, y)}, fine-tune the UIE model using the teacher-forcing cross entropy loss: Use the single-card fine-tuning command, set the learning rate learning_rate to 1e-5, the batch size to 4, the maximum length of the sequence to 512, the number of rounds to 4, the model selected to be uie-base, the random seed seed to 1000 --logging_steps to 10, the reasonable number of steps to 10, and the final saved training file name is checkpoint-1880. Step 4: The UIE model uses the default uie-base model, with 12-layers, 768-hidden, 12-heads structure, and the language mode is set to "Chinese". The application scenario is "extractive model for text scenarios, supporting Chinese". First, test with the uie-base model; then set the task-path to checkpoint-1880, that is, fine-tune the trained model to train the unified text. After comparison, the extraction effect of the checkpoint-1880 model is significantly better than that of the default uie-base model. The final result will not extract the head and tail entities and relationships that are not required by the schema, and the extraction accuracy is also greatly improved, approaching 1.

5. The method according to claim 1, Features: The specific process of step 4 is: use the trained yolov8 to identify the aircraft model of the specified picture. Then call the UIE model, set the task-path to checkpoint-1880, and compare the probability of the relationship predicted by the head and tail entities in the obtained results. Set the threshold to 0.

95. If it is higher than this threshold, choose to output this relationship; if it is lower than this value, do not output the result. The output format is "head entity relationship tail entity". The results detected by yolov8 are mapped to the specified 46 aircraft types dictionary as replaceable entity names. In the output head entity or tail entity, if the word "aircraft" appears, use the specific aircraft model obtained by yolov8 target detection to replace it. Output the final accurate result in the form of "head entity relationship tail entity".