CN111027325A - Model generation method, entity identification device and electronic equipment - Google Patents

Model generation method, entity identification device and electronic equipment Download PDF

Info

Publication number
CN111027325A
CN111027325A CN201911255072.XA CN201911255072A CN111027325A CN 111027325 A CN111027325 A CN 111027325A CN 201911255072 A CN201911255072 A CN 201911255072A CN 111027325 A CN111027325 A CN 111027325A
Authority
CN
China
Prior art keywords
image
entity
feature
preset
trained
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201911255072.XA
Other languages
Chinese (zh)
Other versions
CN111027325B (en
Inventor
胡仁伟
陈效友
张会杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Knownsec Information Technology Co Ltd
Original Assignee
Beijing Knownsec Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Knownsec Information Technology Co Ltd filed Critical Beijing Knownsec Information Technology Co Ltd
Priority to CN201911255072.XA priority Critical patent/CN111027325B/en
Publication of CN111027325A publication Critical patent/CN111027325A/en
Application granted granted Critical
Publication of CN111027325B publication Critical patent/CN111027325B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/55Clustering; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/58Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • G06F16/583Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/58Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • G06F16/5866Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using information manually generated, e.g. tags, keywords, comments, manually generated location and time information
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4038Image mosaicing, e.g. composing plane images from plane sub-images
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Library & Information Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Image Analysis (AREA)
  • Character Discrimination (AREA)

Abstract

The application provides a model generation method, an entity identification device and electronic equipment, wherein the model generation method comprises the following steps: generating characteristic image information according to a target sentence to be trained, wherein the characteristic image information comprises a characteristic image composed of a plurality of area image blocks and a class label of the target sentence, the target sentence comprises a plurality of characters, and each character corresponds to one area image block; extracting a feature vector of the feature image by adopting a preset neural network model; calculating corresponding training loss according to the feature vectors and the corresponding class labels; and carrying out iterative updating on the neural network model according to the training loss so as to obtain the trained entity recognition model.

Description

Model generation method, entity identification device and electronic equipment
Technical Field
The present application relates to the technical field of entity identification, and in particular, to a model generation method, an entity identification device, and an electronic device.
Background
In the traditional entity identification method, the tagged corpus is converted into a vector mode through word2vec, and then entity identification is carried out on the tagged corpus through a neural network model, but the entity information stored by converting the tagged corpus into the vector is less, so that the problem of low entity identification precision is caused.
Disclosure of Invention
An object of the embodiments of the present application is to provide a model generation method, an entity identification device, and an electronic apparatus, so as to solve the problem of low entity identification precision due to less vector-stored entity information existing in the existing entity identification method in which a markup corpus is converted into a vector and then entity identification is performed on the markup corpus through a neural network model.
In a first aspect, an embodiment provides a model generation method, where the method includes: generating characteristic image information according to a target sentence to be trained, wherein the characteristic image information comprises a characteristic image composed of a plurality of area image blocks and a class label of the target sentence, the target sentence comprises a plurality of characters, and each character corresponds to one area image block; extracting a feature vector of the feature image by adopting a preset neural network model; calculating corresponding training loss according to the feature vectors and the corresponding class labels; and carrying out iterative updating on the neural network model according to the training loss so as to obtain a trained entity recognition model.
In the designed model generation method, each character in the target sentence to be trained is converted into a region image block, and then a characteristic image is generated according to a plurality of region image blocks, namely the target sentence is converted into the characteristic image, the characteristic image is subjected to characteristic extraction through the neural network model, and then the training of the entity recognition model is completed.
In an optional implementation manner of the first aspect, the generating feature image information according to the target sentence to be trained includes: extracting each character in the target sentence to be trained; searching a corresponding region image block according to each extracted character, and establishing a mapping relation between each character and the corresponding region image block in advance and storing the mapping relation in a database; the feature image is generated from a plurality of region tiles.
In an optional implementation manner of the first aspect, before the generating the feature image information according to the target sentence to be trained, the method further includes: the method comprises the steps of obtaining a plurality of characters and a plurality of preset regional image blocks in an entity database, wherein each character in the plurality of characters is not repeated, and each regional image block in the plurality of preset regional image blocks is not repeated; and establishing a mapping relation between each character and a preset region picture block and storing the mapping relation in the database.
In an optional implementation of the first aspect, the generating the feature image from a plurality of region tiles comprises: sequentially combining a plurality of searched regional image blocks according to the positions of corresponding characters in the target sentence to be trained to obtain a combined image; and filling the combined image in a preset area of a blank image, and setting the rest areas of the blank image except the preset area as preset unicames to obtain the characteristic image.
In an optional implementation of the first aspect, the generating the feature image from a plurality of region tiles comprises: sequentially combining a plurality of searched regional image blocks according to the positions of corresponding characters in the target sentence to be trained to obtain a combined image; copying and splicing a plurality of combined images to obtain a combined and spliced image; and filling the combined spliced image in a preset area of a blank image, and setting the rest areas of the blank image except the preset area as preset unicames to obtain the characteristic image.
In an optional implementation of the first aspect, the generating the feature image from a plurality of region tiles comprises: filling the plurality of region image blocks in a plurality of preset regions of a blank image in a scattered manner, wherein the number of the preset regions is the same as that of the region image blocks; and setting the rest areas of the blank image except the plurality of preset areas as preset Unicharacters to obtain the characteristic image.
In an optional implementation manner of the first aspect, after the generating the feature image information according to the target sentence to be trained, the method further includes: and carrying out normalization and data enhancement processing on the image.
In the embodiment of the design, data processing is facilitated through normalization processing, the learning speed of the neural network is increased, and the robustness of recognition is improved; the data enhancement processing is used for preventing the deep learning model from being over-fitted, and the reliability of identification is improved.
In a second aspect, an embodiment provides an entity identification method, including: generating a characteristic image according to an entity sentence to be recognized, wherein the characteristic image information comprises a characteristic image composed of a plurality of area image blocks, the entity sentence to be recognized comprises a plurality of characters, and each character corresponds to one area image block respectively; inputting the feature image into an entity recognition model, wherein the entity recognition model is the entity recognition model generated in any optional implementation manner of the first aspect; and obtaining the prediction label of the entity sentence to be recognized output by the entity recognition model.
In the designed entity recognition method, the feature image is generated according to the entity sentence to be recognized, the feature image generated by the entity sentence to be recognized is predicted through the entity model trained and obtained in the first embodiment, and the prediction label output by the entity recognition model is further obtained.
In a third aspect, an embodiment provides a model generation apparatus, including: the generation module is used for generating characteristic image information according to a target sentence to be trained, wherein the characteristic image information comprises a characteristic image composed of a plurality of area image blocks and a category label of the target sentence, the target sentence comprises a plurality of characters, and each character corresponds to one area image block; the extraction module is used for extracting the feature vector of the feature image by adopting a preset neural network model; the calculation module is used for calculating corresponding training loss according to the feature vectors and the corresponding class labels; and the updating module is used for carrying out iterative updating on the neural network model according to the training loss so as to obtain the trained entity recognition model.
In the model generation device designed above, each character in the target sentence to be trained is converted into a region image block, and then a feature image is generated according to a plurality of region image blocks, that is, the target sentence is converted into the feature image, the feature image is subjected to feature extraction through the neural network model, and then training of the entity recognition model is completed.
In an optional implementation manner of the third aspect, the generating module is specifically configured to extract each character in the target sentence to be trained; searching a corresponding region image block according to each extracted character, and establishing a mapping relation between each character and the corresponding region image block in advance and storing the mapping relation in a database; the feature image is generated from a plurality of region tiles.
In an optional implementation manner of the third aspect, the apparatus further includes an obtaining module, configured to obtain a plurality of characters and a plurality of preset region tiles in the entity database, where each character in the plurality of characters is not repeated, and each region tile in the plurality of preset region tiles is not repeated; and the establishing module is used for establishing a mapping relation between each character and a preset region image block and storing the mapping relation in the database.
In an optional implementation manner of the third aspect, the apparatus further includes a processing module, configured to perform normalization and data enhancement processing on the feature image.
In a fourth aspect, an embodiment provides an entity identifying apparatus, including: the generating module is used for generating a characteristic image according to the entity sentence to be recognized, wherein the characteristic image is composed of a plurality of regional image blocks, the entity sentence to be recognized comprises a plurality of characters, and each character corresponds to one regional image block; an input module, configured to input the feature image into an entity recognition model, where the entity recognition model is the entity recognition model generated in any one of the foregoing embodiments; and the obtaining module is used for obtaining the prediction label of the entity sentence to be recognized, which is output by the entity recognition model.
In the entity recognition device designed above, the feature image is generated according to the entity sentence to be recognized, and then the feature image generated by the entity sentence to be recognized is predicted through the entity model trained and obtained in the first embodiment, so as to obtain the prediction label output by the entity recognition model.
In a fifth aspect, an embodiment provides an electronic device, including a memory and a processor, where the memory stores a computer program, and the processor executes the computer program to perform the method in the first aspect, any optional implementation manner of the first aspect, and any optional implementation manner of the second aspect.
In a sixth aspect, embodiments provide a non-transitory readable storage medium on which a computer program is stored, the computer program, when executed by a processor, performing the method of the first aspect, any optional implementation of the first aspect, the second aspect, or any optional implementation of the second aspect.
In a seventh aspect, an embodiment provides a computer program product, which when run on a computer, causes the computer to execute the method in the first aspect, any optional implementation manner of the first aspect, and any optional implementation manner of the second aspect.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
FIG. 1 is a first flowchart of a model generation method according to a first embodiment of the present application;
FIG. 2 is a second flowchart of a method for generating a model according to the first embodiment of the present application;
FIG. 3 is a third flowchart of a method for generating a model according to the first embodiment of the present application;
FIG. 4 is a fourth flowchart of a model generation method according to the first embodiment of the present application;
FIG. 5 is a diagram of a first example of a feature image provided in a first embodiment of the present application;
FIG. 6 is a fifth flowchart of a model generation method according to the first embodiment of the present application;
FIG. 7 is a diagram of a second example of a feature image provided in the first embodiment of the present application;
FIG. 8 is a sixth flowchart of a model generation method according to the first embodiment of the present application;
FIG. 9 is a third exemplary diagram of a feature image provided in the first embodiment of the present application;
FIG. 10 is a fifth flowchart of a model generation method according to the first embodiment of the present application;
fig. 11 is a flowchart of an entity identification method according to a second embodiment of the present application;
fig. 12 is a block diagram of a model generation apparatus according to a third embodiment of the present application;
fig. 13 is a block diagram of an entity recognizing apparatus according to a fourth embodiment of the present application;
fig. 14 is a block diagram of an electronic device according to a fifth embodiment of the present application.
Icon: 300-a generation module; 302-an extraction module; 304-a calculation module; 306-an update module; 308-an acquisition module; 310-establishing module; 312-a processing module; 400-a generation module; 402-an input module; 404-an obtaining module; 5-an electronic device; 501, a processor; 502-a memory; 503 — a communication bus.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
First embodiment
As shown in fig. 1, an embodiment of the present application provides a model generation method, which specifically includes the following steps:
step S100: generating characteristic image information according to a target sentence to be trained, wherein the characteristic image information comprises a characteristic image composed of a plurality of area image blocks and a class label of the target sentence, the target sentence comprises a plurality of characters, and each character corresponds to one area image block respectively.
Step S102: and extracting the feature vector of the feature image by adopting a preset neural network model.
Step S104: and calculating corresponding training loss according to the feature vectors and the corresponding class labels.
Step S106: and carrying out iterative updating on the neural network model according to the training loss so as to obtain the trained entity recognition model.
In step S100, the target sentence to be trained is an entity recognition sentence to be trained, where the entity recognition sentence includes a plurality of characters, for example, the entity recognition sentence to be trained may be a sentence with a plurality of Chinese words, such as "ABXY gate", "CBEF temple", and the like; it may be a string such as "139 xxxxxxxx", "6125 xxxxxxxxxxxxxxx", etc. Wherein each Chinese character represents the aforementioned character. The target sentence to be trained may be labeled with a category label in advance, for example, the "ABXY gate" sentence may be labeled with a place name, "139 xxxxxxxxx" may be labeled with a mobile phone number, "6125 xxxxxxxxxxxxxxxxxxx" may be labeled with an identification number, and the place name, the mobile phone number, and the identification number represent the category label of the target sentence. On the basis, the step S100 of generating the feature image information according to the target sentence to be trained may be understood as corresponding each character in the target sentence to be trained to a region image block, and the region image may be configured in advance. Because the target sentence has a plurality of characters, a plurality of regional image blocks can be obtained, and a characteristic image is generated according to the regional image blocks. On the basis of the foregoing, multiple types of feature images may be obtained based on multiple types of target sentences to be trained, the images are subjected to type labeling, and the labeled multiple feature images may be divided into a training set, a test set, and a verification set, where the number ratio of the training set, the test set, and the verification set may be set by itself, for example, the training set is 60% of the total number, the test set is 20% of the total number, and the verification set is 20% of the total number, and step S102 is further performed after the above operations are performed.
The step S102 of extracting the feature vector of the feature image by using the preset neural network model may be understood as follows: inputting the feature image generated in step S100 into a preset neural network model, and extracting a feature vector corresponding to the feature image through the preset neural network model. Specifically, the preset neural network model may be a ResNet model, the feature images in the training set may be scrambled and input to the ResNet model in batches (for example, 64 feature images in each batch), and a feature vector corresponding to each feature image is obtained after multiple convolution, multiple pooling, and multiple activation of the neural network model, so as to execute step S104.
In step S104, calculating the corresponding training loss according to the feature vector and the corresponding class label may be: after the feature vectors corresponding to the feature images are obtained in step S102, the extracted features of the feature images may be classified through a preset classification function to obtain a preliminary recognition result, and then the preliminary recognition result and the labeled class labels are compared and calculated to obtain a loss value of one-time training, and then step S106 is executed.
In step S106, the neural network model is iteratively updated according to the training loss, and on the basis of the training loss value obtained in step S104, back propagation is performed according to a back propagation algorithm, so as to update and optimize parameters of the neural network model. And after the updating and optimization, entering the next training process to further obtain a second training loss value, continuously and iteratively updating the parameters of the neural network model by circulating the steps, and obtaining the trained entity recognition model according to the parameters of the neural network model when the obtained training loss value meets the preset value requirement or the training reaches the set upper limit of times. After obtaining the above model, the verification set can be used to verify whether the obtained entity model has reached the requirements, and the test set can be used to test the accuracy of the trained entity recognition model.
In the designed model generation method, each character in the target sentence to be trained is converted into a region image block, and then a characteristic image is generated according to a plurality of region image blocks, namely the target sentence is converted into the characteristic image, the characteristic image is subjected to characteristic extraction through the neural network model, and then the training of the entity recognition model is completed.
In an optional implementation manner of this embodiment, before generating feature image information according to the target sentence to be trained in step S100, as shown in fig. 2, the method further includes:
step S90: the method comprises the steps of obtaining a plurality of characters and a plurality of preset area image blocks in an entity database.
Step S92: and establishing a mapping relation between each character and a preset region picture block and storing the mapping relation in a database.
In step S90, a plurality of characters may be obtained from the entity database in advance, for example, a plurality of words may be obtained from a dictionary; the preset region image blocks can be Arabic numerals or preset patterns and the like. Taking arabic numerals as an example, the above process is as follows: and coding each acquired character and an Arabic numeral to enable each character to correspond to one Arabic numeral, wherein the Arabic numerals corresponding to the same character are the same, and the Arabic numerals corresponding to different characters are different. For example, the characters "a", "B", "X", "Y", "gate" in "ABXY gate" in the foregoing examples may correspond to arabic numerals "1", "3", "5", "7", "9", respectively; the characters "C", "B", "E", "F" and "temple" in "CBEF temple" may correspond to "11", "3", "4", "12" and "13", respectively. In addition, the predetermined pattern may be a graphic symbol or a greek number. And establishing the mapping relation between the characters and the corresponding region image blocks in the manner described above, and storing the mapping relation in the database after establishing the mapping relation.
In an optional implementation manner of this embodiment, the generating feature image information according to the target sentence to be trained in step S100 may specifically be, as shown in fig. 3:
step S1000: and extracting each character in the target sentence to be trained.
Step S1002: and searching a corresponding region image block according to each extracted character, and establishing a mapping relation between each character and the corresponding region image block in advance and storing the mapping relation in a database.
Step S1004: a feature image is generated from the plurality of region tiles.
While it has been mentioned in the foregoing step S100 that the target sentence to be trained includes a plurality of characters, step S1000 may be understood as extracting each character in the target sentence to be trained, for example, when the target sentence to be trained is "ABXY gate", step S1000 may be to extract characters "a", "B", "X", "Y", "gate" in the target sentence, and then perform step S1002.
Step S1002 can be understood as: according to the mapping relationships established in the foregoing steps S90 to S92, the corresponding arabic numerals "1", "3", "5", "7", and "9" can be respectively found in the database according to the extracted characters "a", "B", "X", "Y", and "gate", and then step S1004 is executed to generate feature images according to the found arabic numerals "1", "3", "5", "7", and "9".
In an optional implementation manner of this embodiment, in step S1004, the feature Image is generated according to a plurality of region tiles, and the corresponding feature Image may be generated by using a word2Image model, as shown in fig. 4, which may specifically be:
step S10040: and sequentially combining the searched multiple regional image blocks according to the positions of the corresponding characters in the target sentence to be trained to obtain a combined image.
Step S10042: and filling the combined image in a preset area of the blank image, and setting the rest areas of the blank image except the preset area as preset Unicharacters to obtain a characteristic image.
Based on the foregoing step S1002, step S10040 is executed, and after the corresponding arabic numerals "1", "3", "5", "7" and "9" are found in the database by "a", "B", "X", "Y" and "gate", the "1", "3", "5", "7" and "9" are sequentially combined to form a combined image of "1, 3, 5, 7 and 9", and then step S10042 is executed.
Filling the combined image in the preset area of the blank image in step S10042, which may be understood as filling the image in the preset area of the blank image, wherein the size of the blank image may be set in advance, for example, the blank image may be 64 × 64 blank image or a blank image with another size; the preset area may be set in advance, for example, the combined image may be filled in the center of the blank image, and the remaining area of the blank image may be set as a preset unicode. For example, as shown in fig. 5, after filling the above-mentioned "1, 3, 5, 7, 9" in the positions 3 × 5, 4 × 5, 5 × 5, 6 × 5, and 7 × 5 of the blank image of 10 × 10, the "1, 3, 5, 7, 9" is 5 position areas, and the remaining areas of the blank image are all set to the character 0 except for the combined image of the five area blocks representing the "1, 3, 5, 7, 9" in the central preset area, thereby obtaining the feature image.
Here, the preset area may be any area of the blank image, and is not limited to the center of the image.
In addition, considering that the length of the target sentence is short in the normal case, after the combined images are sequentially combined in sequence, a plurality of same combined images can be spliced and arranged in a preset area of the blank image, so as to increase the feature information of the feature image, as shown in fig. 6 in particular, the method includes the following steps:
step S10044: and sequentially combining the searched multiple regional image blocks according to the positions of the corresponding characters in the target sentence to be trained to obtain a combined image.
Step S10045: and copying and splicing the plurality of combined images to obtain a combined spliced image.
Step S10046: and filling the combined spliced image in a preset area of the blank image, and setting the rest areas of the blank image except the preset area as preset unicodes to obtain the characteristic image.
Specifically, as shown in the example of fig. 7, after the combined images of "1, 3, 5, 7, and 9" are formed, the plurality of (6 in the figure) combined images of "1, 3, 5, 7, and 9" may be stitched and disposed in the center of the 10 × 10 blank image, so as to increase the feature information of the feature image.
In an optional implementation manner of this embodiment, in addition to combining the region tiles corresponding to the characters in order to obtain the combined image in the manner of step S10040, the region tiles corresponding to the characters may be directly and randomly distributed in the blank image. Specifically, as shown in fig. 8, the method includes the following steps:
step S10047: and filling a plurality of region image blocks in a plurality of preset regions of the blank image in a scattered manner, wherein the number of the preset regions is the same as that of the region image blocks.
Step S10048: and setting the rest areas of the blank image except the plurality of preset areas as preset Unicharacters to obtain the characteristic image.
Specifically, as shown in the example of fig. 9, taking a blank image of 10 × 10 as an example, the "1" corresponding to the "a" is set at the position of 1 × 1, and the "3" corresponding to the "B" is set at the position of 10 × 1; setting the 5 corresponding to the X at the position of 5-5; setting the '7' corresponding to the 'Y' at the position 1 x 10; the "9" corresponding to the "gate" is set at the 10 x 10 position.
In an optional implementation manner of this embodiment, after generating feature image information according to the target sentence to be trained in step S100, as shown in fig. 10, the method further includes:
step S101: and carrying out normalization and data enhancement processing on the characteristic image.
In the above steps, the normalization process performed on the feature image may be: because the pixel value interval of the image is [0, 255] and the number of entities in the entity database far exceeds 255, the pixel value of the generated feature image is likely to exceed 255 in the aforementioned manner, so that the normalization processing is performed on the converted feature image, for example, the range exceeding 255 is converted into a preset range or the gray values of all pixels of the feature image are mapped into a preset range (such as [0,1] interval), so as to ensure that the contribution of each pixel point in the image to the training result is the same, thereby facilitating the data processing, accelerating the neural network learning speed and improving the recognition robustness.
The data enhancement processing on the characteristic image is represented by performing operation processing such as noise addition, inversion, enhancement and the like on the generated characteristic image, so that the overfitting of the deep learning model is prevented, and the reliability of identification is improved.
Second embodiment
The present application provides an entity identification method, as shown in fig. 11, the method specifically includes the following steps:
step S200: generating a characteristic image according to the entity sentence to be recognized, wherein the characteristic image information comprises a characteristic image composed of a plurality of area image blocks, the entity sentence to be recognized comprises a plurality of characters, and each character corresponds to one area image block respectively.
Step S202: the feature image is input to the entity recognition model, which is the entity recognition model generated in any of the alternative embodiments of the first embodiment.
Step S204: and obtaining a prediction tag of the entity sentence to be recognized output by the entity recognition model.
The manner of generating the feature image according to the entity sentence of the model to be recognized in step S200 in the above steps is the same as that of step S100 in the first embodiment, and is not described herein again.
After the feature image is generated in step S200, step S202 is executed to input the feature image into the entity recognition model, which is the trained entity recognition model obtained in the first embodiment. After the feature image corresponding to the entity to be recognized is input into the trained entity recognition model, the entity recognition model outputs a prediction tag corresponding to the feature image, that is, a prediction tag of the entity sentence to be recognized. For example, the entity sentence to be recognized is "UVW beach", and is converted into a corresponding feature image according to the "UVW beach", and the feature image is input into the entity recognition model trained in the first embodiment, and the entity recognition model outputs a predicted tag, which may be a place name.
In the designed entity recognition method, the feature image is generated according to the entity sentence to be recognized, the feature image generated by the entity sentence to be recognized is predicted through the entity model trained and obtained in the first embodiment, and the prediction label output by the entity recognition model is further obtained.
Third embodiment
Fig. 12 shows a schematic structural block diagram of a model generation apparatus provided in the present application, and it should be understood that the apparatus corresponds to the method embodiments in fig. 1 to 10 described above, and is capable of executing the steps involved in the method executed by the server in the first embodiment, and the specific functions of the apparatus can be referred to the description above, and in order to avoid repetition, the detailed description is appropriately omitted here. The device includes at least one software function that can be stored in memory in the form of software or firmware (firmware) or solidified in the Operating System (OS) of the device. Specifically, the apparatus includes: a generating module 300, configured to generate feature image information according to a target sentence to be trained, where the feature image information includes a feature image composed of multiple region blocks and a category label of the target sentence, the target sentence includes multiple characters, and each character corresponds to a region block; an extraction module 302, configured to extract a feature vector of the feature image by using a preset neural network model; a calculating module 304, configured to calculate a corresponding training loss according to the feature vector and the corresponding class label; and the updating module 306 is configured to iteratively update the neural network model according to the training loss to obtain a trained entity recognition model.
In the model generation device designed above, each character in the target sentence to be trained is converted into a region image block, and then a feature image is generated according to a plurality of region image blocks, that is, the target sentence is converted into the feature image, the feature image is subjected to feature extraction through the neural network model, and then training of the entity recognition model is completed.
In an optional implementation manner of this embodiment, the generating module 300 is specifically configured to extract each character in the target sentence to be trained; searching a corresponding region image block according to each extracted character, and establishing a mapping relation between each character and the corresponding region image block in advance and storing the mapping relation in a database; the feature image is generated from a plurality of region tiles.
In an optional implementation manner of this embodiment, the apparatus further includes an obtaining module 308, configured to obtain a plurality of characters and a plurality of preset region blocks in the entity database, where each character in the plurality of characters is not repeated, and each region block in the plurality of preset region blocks is not repeated; the establishing module 310 is configured to establish a mapping relationship between each character and a preset region tile and store the mapping relationship in a database.
In an optional implementation manner of this embodiment, the apparatus further includes a processing module 312, configured to perform normalization and data enhancement processing on the feature image.
Fourth embodiment
Fig. 13 shows a schematic block diagram of an entity identification apparatus provided in the present application, and it should be understood that the apparatus corresponds to the method embodiment in fig. 11 described above, and is capable of executing the steps involved in the method executed by the server in the first embodiment, and specific functions of the apparatus can be referred to the description above, and detailed description is appropriately omitted here to avoid repetition. The device includes at least one software function that can be stored in memory in the form of software or firmware (firmware) or solidified in the Operating System (OS) of the device. Specifically, the apparatus includes: a generating module 400, configured to generate a feature image according to an entity sentence to be recognized, where the feature image is composed of a plurality of region blocks, the entity sentence to be recognized includes a plurality of characters, and each character corresponds to a region block; an input module 402, configured to input the feature image into an entity recognition model, where the entity recognition model is the entity recognition model generated in any one of the embodiments in the first embodiment; an obtaining module 404, configured to obtain a prediction tag of an entity statement to be recognized, which is output by the entity recognition model.
In the entity recognition device designed above, the feature image is generated according to the entity sentence to be recognized, and then the feature image generated by the entity sentence to be recognized is predicted through the entity model trained and obtained in the first embodiment, so as to obtain the prediction label output by the entity recognition model.
Fifth embodiment
As shown in fig. 14, the present application provides an electronic device 5 including: the processor 501 and the memory 502, the processor 501 and the memory 502 being interconnected and communicating with each other through a communication bus 503 and/or other form of connection mechanism (not shown), the memory 502 storing a computer program executable by the processor 501, when the computing device is running, the processor 501 executing the computer program to execute the method in any of the first embodiment, the optional implementation manner of the first embodiment, the second embodiment, and the optional implementation manner of the second embodiment, for example, step S100 to step S106: generating characteristic image information according to a target sentence to be trained, wherein the characteristic image information comprises a characteristic image composed of a plurality of area image blocks and a class label of the target sentence, the target sentence comprises a plurality of characters, and each character corresponds to one area image block; extracting a feature vector of the feature image by adopting a preset neural network model; calculating corresponding training loss according to the feature vectors and the corresponding class labels; and carrying out iterative updating on the neural network model according to the training loss so as to obtain the trained entity recognition model.
The present application provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the method of any of the first embodiment, any of the alternative implementations of the first embodiment, the second embodiment, or any of the alternative implementations of the second embodiment.
The storage medium may be implemented by any type of volatile or nonvolatile storage device or combination thereof, such as a Static Random Access Memory (SRAM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), an Erasable Programmable Read-Only Memory (EPROM), a Programmable Read-Only Memory (PROM), a Read-Only Memory (ROM), a magnetic Memory, a flash Memory, a magnetic disk, or an optical disk.
The present application provides a computer program product, which when run on a computer causes the computer to perform the method of any of the first embodiment, any of the alternative implementations of the first embodiment, the second embodiment, or any of the alternative implementations of the second embodiment.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
In addition, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
It should be noted that the functions, if implemented in the form of software functional modules and sold or used as independent products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (11)

1. A method of model generation, the method comprising:
generating characteristic image information according to a target sentence to be trained, wherein the characteristic image information comprises a characteristic image composed of a plurality of area image blocks and a class label of the target sentence, the target sentence comprises a plurality of characters, and each character corresponds to one area image block;
extracting a feature vector of the feature image by adopting a preset neural network model;
calculating corresponding training loss according to the feature vectors and the corresponding class labels;
and carrying out iterative updating on the neural network model according to the training loss so as to obtain a trained entity recognition model.
2. The method of claim 1, wherein the generating feature image information according to the target sentence to be trained comprises:
extracting each character in the target sentence to be trained;
searching a corresponding region image block according to each extracted character, and establishing a mapping relation between each character and the corresponding region image block in advance and storing the mapping relation in a database;
the feature image is generated from a plurality of region tiles.
3. The method of claim 2, wherein before the generating feature image information from the target sentence to be trained, the method further comprises:
the method comprises the steps of obtaining a plurality of characters and a plurality of preset regional image blocks in an entity database, wherein each character in the plurality of characters is not repeated, and each regional image block in the plurality of preset regional image blocks is not repeated;
and establishing a mapping relation between each character and a preset region picture block and storing the mapping relation in the database.
4. The method of claim 2, wherein generating the feature image from a plurality of region tiles comprises:
sequentially combining a plurality of searched regional image blocks according to the positions of corresponding characters in the target sentence to be trained to obtain a combined image;
and filling the combined image in a preset area of a blank image, and setting the rest areas of the blank image except the preset area as preset unicames to obtain the characteristic image.
5. The method of claim 2, wherein generating the feature image from a plurality of region tiles comprises:
sequentially combining a plurality of searched regional image blocks according to the positions of corresponding characters in the target sentence to be trained to obtain a combined image;
copying and splicing a plurality of combined images to obtain a combined and spliced image;
and filling the combined spliced image in a preset area of a blank image, and setting the rest areas of the blank image except the preset area as preset unicames to obtain the characteristic image.
6. The method of claim 2, wherein generating the feature image from a plurality of region tiles comprises:
filling the plurality of region image blocks in a plurality of preset regions of a blank image in a scattered manner, wherein the number of the preset regions is the same as that of the region image blocks;
and setting the rest areas of the blank image except the plurality of preset areas as preset Unicharacters to obtain the characteristic image.
7. The method of claim 1, wherein after the generating feature image information from the target sentence to be trained, the method further comprises:
and carrying out normalization and data enhancement processing on the characteristic image.
8. An entity identification method, characterized in that the method comprises:
generating a characteristic image according to an entity sentence to be recognized, wherein the characteristic image is composed of a plurality of area image blocks, the entity sentence to be recognized comprises a plurality of characters, and each character corresponds to one area image block;
inputting the feature image into an entity recognition model, the entity recognition model being the entity recognition model generated by any one of claims 1-7;
and obtaining the prediction label of the entity sentence to be recognized output by the entity recognition model.
9. An apparatus for model generation, the apparatus comprising:
the generation module is used for generating characteristic image information according to a target sentence to be trained, wherein the characteristic image information comprises a characteristic image composed of a plurality of area image blocks and a category label of the target sentence, the target sentence comprises a plurality of characters, and each character corresponds to one area image block;
the extraction module is used for extracting the feature vector of the feature image by adopting a preset neural network model;
the calculation module is used for calculating corresponding training loss according to the feature vectors and the corresponding class labels;
and the updating module is used for carrying out iterative updating on the neural network model according to the training loss so as to obtain the trained entity recognition model.
10. An entity identification apparatus, the apparatus comprising:
the generating module is used for generating a characteristic image according to the entity sentence to be recognized, wherein the characteristic image is composed of a plurality of regional image blocks, the entity sentence to be recognized comprises a plurality of characters, and each character corresponds to one regional image block;
an input module for inputting the feature images into an entity recognition model, the entity recognition model being the entity recognition model generated by any one of claims 1-7;
and the obtaining module is used for obtaining the prediction label of the entity sentence to be recognized, which is output by the entity recognition model.
11. An electronic device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the method of any one of claims 1 to 8 when executing the computer program.
CN201911255072.XA 2019-12-09 2019-12-09 Model generation method, entity identification device and electronic equipment Active CN111027325B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911255072.XA CN111027325B (en) 2019-12-09 2019-12-09 Model generation method, entity identification device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911255072.XA CN111027325B (en) 2019-12-09 2019-12-09 Model generation method, entity identification device and electronic equipment

Publications (2)

Publication Number Publication Date
CN111027325A true CN111027325A (en) 2020-04-17
CN111027325B CN111027325B (en) 2023-11-28

Family

ID=70205119

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911255072.XA Active CN111027325B (en) 2019-12-09 2019-12-09 Model generation method, entity identification device and electronic equipment

Country Status (1)

Country Link
CN (1) CN111027325B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112784675A (en) * 2020-11-25 2021-05-11 上海芯翌智能科技有限公司 Target detection method and device, storage medium and terminal

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10198763A (en) * 1997-01-07 1998-07-31 Ricoh Co Ltd Character recognizer and computer readable storage medium storing program making computer function as character recognizer
CN106446782A (en) * 2016-08-29 2017-02-22 北京小米移动软件有限公司 Image identification method and device
CN106569998A (en) * 2016-10-27 2017-04-19 浙江大学 Text named entity recognition method based on Bi-LSTM, CNN and CRF
CN107451153A (en) * 2016-05-31 2017-12-08 北京京东尚科信息技术有限公司 The method and apparatus of export structure query statement
CN109460434A (en) * 2018-10-25 2019-03-12 北京知道创宇信息技术有限公司 Data extract method for establishing model and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10198763A (en) * 1997-01-07 1998-07-31 Ricoh Co Ltd Character recognizer and computer readable storage medium storing program making computer function as character recognizer
CN107451153A (en) * 2016-05-31 2017-12-08 北京京东尚科信息技术有限公司 The method and apparatus of export structure query statement
CN106446782A (en) * 2016-08-29 2017-02-22 北京小米移动软件有限公司 Image identification method and device
CN106569998A (en) * 2016-10-27 2017-04-19 浙江大学 Text named entity recognition method based on Bi-LSTM, CNN and CRF
CN109460434A (en) * 2018-10-25 2019-03-12 北京知道创宇信息技术有限公司 Data extract method for establishing model and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
苑全兵;黄福;: "数字字符识别算法研究", 电子测试 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112784675A (en) * 2020-11-25 2021-05-11 上海芯翌智能科技有限公司 Target detection method and device, storage medium and terminal
CN112784675B (en) * 2020-11-25 2023-06-30 上海芯翌智能科技有限公司 Target detection method and device, storage medium and terminal

Also Published As

Publication number Publication date
CN111027325B (en) 2023-11-28

Similar Documents

Publication Publication Date Title
CN109815339B (en) Knowledge extraction method and device based on TextCNN, computer equipment and storage medium
CN111615702B (en) Method, device and equipment for extracting structured data from image
CN110532381B (en) Text vector acquisition method and device, computer equipment and storage medium
CN112396049A (en) Text error correction method and device, computer equipment and storage medium
CN110334179B (en) Question-answer processing method, device, computer equipment and storage medium
CN110222330B (en) Semantic recognition method and device, storage medium and computer equipment
CN112183296B (en) Simulated bill image generation and bill image recognition method and device
CN112949476B (en) Text relation detection method, device and storage medium based on graph convolution neural network
CN108304376B (en) Text vector determination method and device, storage medium and electronic device
CN110348012B (en) Method, device, storage medium and electronic device for determining target character
CN110516251B (en) Method, device, equipment and medium for constructing electronic commerce entity identification model
CN115438650B (en) Contract text error correction method, system, equipment and medium fusing multi-source characteristics
CN110750984A (en) Command line character string processing method, terminal, device and readable storage medium
CN112784582A (en) Error correction method and device and computing equipment
CN113360654B (en) Text classification method, apparatus, electronic device and readable storage medium
CN111027325B (en) Model generation method, entity identification device and electronic equipment
CN110929647B (en) Text detection method, device, equipment and storage medium
CN109614494B (en) Text classification method and related device
CN115984886A (en) Table information extraction method, device, equipment and storage medium
CN114818627A (en) Form information extraction method, device, equipment and medium
CN115700519A (en) Text-to-image generation method and device, storage medium and terminal
CN113468906A (en) Graphic code extraction model construction method, recognition method, device, equipment and medium
CN111753548A (en) Information acquisition method and device, computer storage medium and electronic equipment
CN114399782B (en) Text image processing method, apparatus, device, storage medium, and program product
CN114462397B (en) Language identification model training method, language identification method, device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant