CN111027325B - 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
CN111027325B
CN111027325B CN201911255072.XA CN201911255072A CN111027325B CN 111027325 B CN111027325 B CN 111027325B CN 201911255072 A CN201911255072 A CN 201911255072A CN 111027325 B CN111027325 B CN 111027325B
Authority
CN
China
Prior art keywords
image
region
entity
preset
generating
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.)
Active
Application number
CN201911255072.XA
Other languages
Chinese (zh)
Other versions
CN111027325A (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

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 transformation in the plane of the image
    • G06T3/40Scaling the whole image or part thereof
    • G06T3/4038Scaling the whole image or part thereof for image mosaicing, i.e. plane images composed of 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

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 formed by a plurality of region image blocks and a class label of the target sentence, the target sentence comprises a plurality of characters, and each character corresponds to a region image block respectively; extracting feature vectors of the feature images by adopting a preset neural network model; calculating corresponding training loss according to the feature vector and the corresponding class label; and carrying out iterative updating on the neural network model according to the training loss so as to obtain the entity recognition model after training.

Description

Model generation method, entity identification device and electronic equipment
Technical Field
The present application relates to the field of entity identification technologies, and in particular, to a model generation method, an entity identification device, and an electronic device.
Background
The traditional entity recognition method is to convert the labeling corpus into vectors through word2vec, and then to perform entity recognition on the labeling corpus through a neural network model, but the entity information stored by converting the labeling corpus into the vectors is less, so that the problem of low entity recognition accuracy is caused.
Disclosure of Invention
The embodiment of the application aims to provide a model generation method, an entity identification device and electronic equipment, which are used for solving the problem of low entity identification precision caused by less vector storage entity information in the conventional entity identification method, which is caused by converting a labeling corpus into a vector and then carrying out entity identification on the vector through a neural network model.
In a first aspect, an embodiment provides a method for generating a model, the method comprising: generating characteristic image information according to a target sentence to be trained, wherein the characteristic image information comprises a characteristic image formed by a plurality of region image blocks and a class label of the target sentence, the target sentence comprises a plurality of characters, and each character corresponds to one region image block respectively; extracting feature vectors of the feature images by adopting a preset neural network model; calculating corresponding training loss according to the feature vector and the corresponding class label; and carrying out iterative updating on the neural network model according to the training loss so as to obtain a training-completed entity identification model.
In the 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, and the characteristic image is subjected to characteristic extraction through the neural network model, so that training of the entity recognition model is completed, more entity information can be saved in the mode of the image in the characteristic extraction, further the entity recognition precision is improved, and the problem of low entity recognition precision caused by the fact that the vector storage entity information is less in the fact that the labeling corpus is converted into the vector in the existing entity recognition method, and then the entity recognition is carried out on the vector through the neural network model is solved.
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 block according to each extracted character, and pre-establishing a mapping relation between each character and the corresponding region block 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: acquiring a plurality of characters in an entity database and a plurality of preset region blocks, wherein each character in the plurality of characters is not repeated, and each region block in the plurality of preset region blocks is not repeated; and establishing a mapping relation between each character and a preset region block and storing the mapping relation in the database.
In an optional implementation manner of the first aspect, the generating the feature image according to the plurality of region tiles includes: sequentially combining the searched multiple region image blocks according to the positions of the 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 except the preset area of the blank image as preset unicode to obtain the characteristic image.
In an optional implementation manner of the first aspect, the generating the feature image according to the plurality of region tiles includes: sequentially combining the searched multiple region image blocks according to the positions of the corresponding characters in the target sentence to be trained to obtain a combined image; copying a plurality of the combined images to splice to obtain a combined spliced image; and filling the combined spliced image in a preset area of a blank image, and setting the rest areas except the preset area of the blank image as preset unicode to obtain the characteristic image.
In an optional implementation manner of the first aspect, the generating the feature image according to the plurality of region tiles includes: dispersing and filling the plurality of region tiles in a plurality of preset regions of a blank image, wherein the number of the preset regions is the same as that of the region tiles; and setting the rest areas except the preset areas of the blank image as preset unified characters to obtain the characteristic image.
In an optional implementation manner of the first aspect, after the generating feature image information according to the target sentence to be trained, the method further includes: and normalizing the image and performing data enhancement processing.
In the implementation mode of the design, the normalization processing is adopted to facilitate data processing, so that 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, so that the reliability of recognition is improved.
In a second aspect, an embodiment provides an entity identification method, the method including: generating a characteristic image according to an entity sentence to be identified, wherein the characteristic image information comprises a characteristic image formed by a plurality of region image blocks, the entity sentence to be identified comprises a plurality of characters, and each character corresponds to one region image block respectively; inputting the characteristic image into a solid recognition model, wherein the solid recognition model is generated by any optional implementation manner in the first aspect; and obtaining the prediction label of the entity statement to be recognized, which is output by the entity recognition model.
In the entity recognition method designed in the 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 by the entity model obtained through training in the first embodiment, so as to obtain the prediction tag output by the entity recognition model.
In a third aspect, an embodiment provides a model generating apparatus, the apparatus including: the generating 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 formed by a plurality of region image blocks and a class label of the target sentence, the target sentence comprises a plurality of characters, and each character corresponds to one region image block respectively; 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 vector and the corresponding class label; 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 a training-completed entity identification model.
In the model generating device designed in the above way, 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, and the characteristic image is subjected to characteristic extraction through the neural network model, so that training of the entity recognition model is completed, more entity information can be saved in the mode of the image in the characteristic extraction, further the accuracy of entity recognition is improved, and the problem of low entity recognition accuracy caused by the fact that the vector storage entity information is less in the fact that the labeling corpus is converted into the vector in the existing entity recognition method, and then the entity recognition is carried out on the vector through the neural network model is solved.
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 block according to each extracted character, and pre-establishing a mapping relation between each character and the corresponding region block 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 in the entity database and a plurality of preset region tiles, where each of the plurality of characters is not repeated with each other, and each of the plurality of preset region tiles is not repeated with each other; the building module is used for building the mapping relation between each character and a preset region 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 normalize the feature image and perform data enhancement processing.
In a fourth aspect, an embodiment provides an entity identification device, the device comprising: the generating module is used for generating a characteristic image according to an entity sentence to be identified, wherein the characteristic image consists of a plurality of region image blocks, the entity sentence to be identified comprises a plurality of characters, and each character corresponds to one region image block respectively; the input module is used for inputting the characteristic image into an entity recognition model, wherein the entity recognition model is generated by any one of the previous embodiments; the obtaining module is used for obtaining the prediction label of the entity statement to be recognized, which is output by the entity recognition model.
In the entity recognition device designed in the above way, 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 by the entity model obtained through training in the first embodiment, and then the prediction label output by the entity recognition model is obtained.
In a fifth aspect, an embodiment provides an electronic device comprising a memory storing a computer program and a processor that when executing the computer program performs the method of any of the first aspect, any of the optional implementations of the first aspect, the second aspect, and any of the optional implementations of the second aspect.
In a sixth aspect, embodiments provide a non-transitory readable storage medium having stored thereon a computer program which, when executed by a processor, performs the method of any of the first aspect, any of the optional implementations of the first aspect, the second aspect, and any of the optional implementations of the second aspect.
In a seventh aspect, embodiments provide a computer program product which, when run on a computer, causes the computer to perform the method of any of the optional implementations of the first aspect, the second aspect, or the optional implementations 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 needed 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 should not be considered as limiting the scope, and other related drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
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 model generating method according to the first embodiment of the present application;
FIG. 3 is a third flowchart of a model generating method according to the first embodiment of the present application;
FIG. 4 is a fourth flowchart of a model generating method according to the first embodiment of the present application;
FIG. 5 is a first exemplary view of a feature image provided by a first embodiment of the present application;
FIG. 6 is a fifth flowchart of a model generating method according to the first embodiment of the present application;
FIG. 7 is a diagram of a second example of a feature image provided by the first embodiment of the present application;
FIG. 8 is a sixth flowchart of a model generating method according to the first embodiment of the present application;
FIG. 9 is a third exemplary view of a feature image provided by the first embodiment of the present application;
FIG. 10 is a fifth flowchart of a model generating method according to the first embodiment of the present application;
FIG. 11 is a flowchart of a method for entity identification according to a second embodiment of the present application;
FIG. 12 is a block diagram of a model generating apparatus according to a third embodiment of the present application;
fig. 13 is a block diagram of an entity recognition 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 computing module; 306-an update module; 308-an acquisition module; 310-establishing a module; 312-a processing module; 400-generating a module; 402-an input module; 404-obtaining a module; 5-an electronic device; 501-a processor; 502-memory; 503-communication bus.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings in the embodiments of the present application.
First embodiment
As shown in fig. 1, an embodiment of the present application provides a model generating method, which specifically includes the following steps:
step S100: generating feature image information according to a target sentence to be trained, wherein the feature image information comprises a feature image formed by a plurality of region image blocks and a category label of the target sentence, the target sentence comprises a plurality of characters, and each character corresponds to a region 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 the corresponding training loss according to the feature vector and the corresponding class label.
Step S106: and carrying out iterative updating on the neural network model according to the training loss so as to obtain the entity recognition model after training.
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 having a plurality of Chinese words, such as "ABXY gate", "CBEF temple", etc.; a string of characters such as "139 xxxxxx", "6125xxxxxxxxxxxxxxx" and the like is also possible. 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 term "ABXY gate" may be labeled as a place name, "139xxxxxxxx" may be labeled as a mobile phone number, "6125 xxxxxxxxxxxxx" may be labeled as an identification card number, and the place name, the mobile phone number and the identification card number represent the category label of the target sentence. On this basis, the generation of the feature image information according to the target sentence to be trained in step S100 may be understood as that each character in the target sentence to be trained corresponds to a region block, and the region image may be configured in advance. Since the target sentence has a plurality of characters, a plurality of region blocks can be obtained, and a characteristic image is generated according to the plurality of region blocks. Based on the foregoing, multiple types of feature images may be obtained based on multiple types of target sentences to be trained, these images may be type-labeled, and the labeled multiple feature images may be divided into a training set, a test set, and a verification set, where the number proportion 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 performing the foregoing operations.
The feature vector extraction of the feature image using the preset neural network model in step S102 can be understood as: inputting the feature image generated in the 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 res net model, and the feature images in the training set may be scrambled and input into the res net model in batches (for example, each batch is 64 feature images), and after multiple convolutions, multiple pooling and multiple activation of the neural network model, feature vectors corresponding to each feature image are obtained, so that step S104 is further executed.
The calculation of the corresponding training loss according to the feature vector and the corresponding class label in step S104 can be understood as: after the feature vector corresponding to the feature image is obtained in step S102, the extracted features of the feature image may be classified by a preset classification function to obtain a preliminary recognition result, and then the preliminary recognition result and the labeled class label are compared and calculated to obtain a loss value of one training, and step S106 is further performed.
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, the neural network model is counter-propagated according to a counter-propagation algorithm, so as to update and optimize parameters of the neural network model. And after updating and optimizing, entering the next training process, further obtaining a second training loss value, and repeating the steps to perform continuous iterative updating on the parameters of the neural network model, and obtaining a trained entity identification model according to the parameters of the neural network model when the obtained training loss value meets the requirement or reaches the upper limit of the set times after the obtained training loss value meets the requirement or the training reaches the upper limit of the set times. After the model is obtained, whether the obtained entity model meets the requirement can be verified through the verification set, and the accuracy of the trained entity recognition model can be tested through the test set.
In the 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, and the characteristic image is subjected to characteristic extraction through the neural network model, so that training of the entity recognition model is completed, more entity information can be saved in the mode of the image in the characteristic extraction, further the entity recognition precision is improved, and the problem of low entity recognition precision caused by the fact that the vector storage entity information is less in the fact that the labeling corpus is converted into the vector in the existing entity recognition method, and then the entity recognition is carried out on the vector through the neural network model is solved.
In an alternative implementation of the present embodiment, before generating the 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: acquiring a plurality of characters in an entity database and a plurality of preset region blocks.
Step S92: and establishing a mapping relation between each character and a preset region block and storing the mapping relation in a database.
In step S90, a plurality of characters may be acquired in advance from the entity database, for example, a plurality of words may be acquired from the dictionary; the preset region block can be Arabic numerals or preset patterns. Taking Arabic numerals as an example, the above process is specifically as follows: and encoding each acquired character with an Arabic number so that each character corresponds to one Arabic number, wherein Arabic numbers corresponding to the same character are the same, and Arabic numbers corresponding to different characters are different. For example, the characters "a", "B", "X", "Y", "gate" in the "ABXY gate" in the foregoing examples may correspond to the arabic numerals "1", "3", "5", "7", "9", respectively; the characters "C", "B", "E", "F", "temple" in the "CBEF temple" may correspond to "11", "3", "4", "12", "13", respectively. In addition, the preset pattern can be a graphic symbol or greek number. The mapping relation between the characters and the corresponding region blocks is established in the mode, and the mapping relation is stored in a database.
In an optional implementation manner of this embodiment, in step S100, feature image information is generated according to a target sentence to be trained, as shown in fig. 3, which may specifically be:
step S1000: and extracting each character in the target sentence to be trained.
Step S1002: and searching a corresponding region block according to each extracted character, and pre-establishing a mapping relation between each character and the corresponding region block and storing the mapping relation in a database.
Step S1004: a feature image is generated from the plurality of region tiles.
In the aforementioned step S100, it has been mentioned that the target sentence to be trained includes a plurality of characters, and in step S1000, it may be understood that each character in the target sentence to be trained is extracted, for example, when the target sentence to be trained is "ABXY gate", step S1000 may extract the characters "a", "B", "X", "Y", "gate" in the target sentence, and then step S1002 is performed.
Step S1002 can be understood as: according to the mapping relationship established in the foregoing steps S90 to S92, corresponding arabic numerals "1", "3", "5", "7" and "9" may be found in the database according to the extracted characters "a", "B", "X", "Y" and "gate", and then step S1004 is executed, and a feature image is generated according to the found arabic numerals "1", "3", "5", "7" and "9".
In an optional implementation manner of the present embodiment, step S1004 generates a feature Image according to a plurality of region tiles, and may generate a corresponding feature Image through a word2Image model, as shown in fig. 4, which may specifically be:
step S10040: and sequentially combining the searched multiple region 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 except the preset area of the blank image as preset unicode to obtain a characteristic image.
In addition to the aforementioned step S1002, step S10040 is performed, and after the corresponding arabic numerals "1", "3", "5", "7", "9" are found in the database by "a", "B", "X", "Y" and "gate", the "1", "3", "5", "7", "9" are sequentially combined to form a combined image of "1, 3, 5, 7, 9", and step S10042 is further performed.
In step S10042, the filling of the combined image in the preset area of the blank image may be understood as filling the above-mentioned image in the preset area of the blank image, where the size of the blank image may be set in advance, for example, the blank image may be a 64×64 blank image or another 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 then the remaining areas of the blank image may be set as 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 size, the "1, 3, 5, 7, 9" is a 5-position area, and the remaining areas of the blank image are set to character 0 except for the combined image of five area tiles representing "1, 3, 5, 7, 9" in the central preset area, so that the feature image is obtained.
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 generally shorter, after the combined images are sequentially combined in sequence, a plurality of identical 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, and specifically as shown in fig. 6, the method comprises the following steps:
step S10044: and sequentially combining the searched multiple region 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 the plurality of combined images to splice 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 except the preset area of the blank image as preset unicode to obtain a characteristic image.
As shown in the example of fig. 7, after forming the combined images of "1, 3, 5, 7, and 9", the combined images of the plurality of (6 in the figure) forming "1, 3, 5, 7, and 9" may be spliced and arranged at the center of the 10×10 blank image, so as to increase the feature information of the feature image.
In an alternative implementation manner of the present embodiment, in addition to sequentially combining the region tiles corresponding to the characters in the manner of step S10040 to obtain a combined image, the region tiles corresponding to the characters may also be directly and randomly distributed in the blank image in a scattered manner. Specifically, as shown in fig. 8, the method comprises the following steps:
step S10047: and dispersing and filling a plurality of region blocks in a plurality of preset regions of the blank image, wherein the number of the preset regions is the same as that of the region blocks.
Step S10048: and setting the rest areas except the preset areas of the blank image as preset unified characters to obtain the characteristic image.
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 1*1 position, and the "3" corresponding to the "B" is set at the 10×1 position; setting "5" corresponding to the "X" at 5*5; setting "7" corresponding to "Y" at 1×10 positions; the "9" corresponding to the "gate" is set at the 10×10 position.
In an alternative implementation of the present embodiment, after generating the 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 normalizing the characteristic image and carrying out data enhancement processing.
In the above steps, the normalization processing of the feature image can be understood as: because the pixel value interval of the image is 0, 255, and the number of entities in the entity database is far more than 255, the pixel value of the generated feature image is likely to be more than 255 according to the above mode, 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 the interval of 0, 1), so that the contribution of each pixel point in the image to the training result is ensured to be the same, the data processing is convenient, the neural network learning speed is accelerated, and the recognition robustness is improved.
The data enhancement processing of the feature image is represented by noise adding/flipping/enhancing and other operations of the generated feature image, so that the deep learning model is prevented from being over-fitted, and the reliability of recognition is improved.
Second embodiment
The application provides an entity identification method, as shown in fig. 11, which specifically comprises the following steps:
step S200: generating a feature image according to an entity sentence to be identified, wherein the feature image information comprises a feature image formed by a plurality of region tiles, the entity sentence to be identified comprises a plurality of characters, and each character corresponds to a region tile respectively.
Step S202: the feature image is input into a solid recognition model, which is generated by any of the alternative implementations of the first embodiment.
Step S204: and obtaining the prediction label of the entity statement to be recognized, which is output by the entity recognition model.
The manner in which the step S200 in the above steps generates the feature image according to the entity sentence of the model to be identified is identical to the manner in step S100 in the first embodiment, and will not be described herein.
After generating the feature image in step S200, step S202 is performed 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 identified is input into the trained entity identification model, the entity identification model outputs a prediction label corresponding to the feature image, namely, a prediction label of the entity sentence to be identified. For example, the entity sentence to be identified is "UVW beach", and the "UVW beach" is converted into the corresponding feature image, and then the feature image is input into the entity identification model obtained by training in the first embodiment, where the entity identification model outputs the predicted tag as the possible place name.
In the entity recognition method designed in the 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 by the entity model obtained through training in the first embodiment, so as to obtain the prediction tag output by the entity recognition model.
Third embodiment
Fig. 12 shows a schematic block diagram of a model generating apparatus provided by the present application, and it should be understood that the apparatus corresponds to the method embodiment in fig. 1 to 10, 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 may be referred to the above description, and detailed descriptions thereof are omitted herein as appropriate to avoid redundancy. The device includes at least one software functional module that can be stored in memory in the form of software or firmware (firmware) or cured in an Operating System (OS) of the device. Specifically, the device comprises: the generating module 300 is configured to generate feature image information according to a target sentence to be trained, where the feature image information includes a feature image formed by a plurality of region tiles and a class label of the target sentence, and the target sentence includes a plurality of characters, and each character corresponds to a region tile; the extracting module 302 is configured to extract a feature vector of the feature image by using a preset neural network model; a calculation 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 training entity recognition model.
In the model generating device designed in the above way, 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, and the characteristic image is subjected to characteristic extraction through the neural network model, so that training of the entity recognition model is completed, more entity information can be saved in the mode of the image in the characteristic extraction, further the accuracy of entity recognition is improved, and the problem of low entity recognition accuracy caused by the fact that the vector storage entity information is less in the fact that the labeling corpus is converted into the vector in the existing entity recognition method, and then the entity recognition is carried out on the vector through the neural network model is solved.
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 block according to each extracted character, and pre-establishing a mapping relation between each character and the corresponding region block 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 in the entity database and a plurality of preset region tiles, where each of the plurality of characters is not repeated with each other, and each of the plurality of preset region tiles is not repeated with each other; 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 the database.
In an alternative implementation manner of this embodiment, the apparatus further includes a processing module 312, configured to normalize the feature image and perform data enhancement processing.
Fourth embodiment
Fig. 13 shows a schematic block diagram of an entity recognition device according to the present application, and it should be understood that the device corresponds to the method embodiment in fig. 11, and is capable of executing the steps involved in the method executed by the server in the first embodiment, and specific functions of the device may be referred to the above description, and detailed descriptions thereof are omitted herein as appropriate to avoid redundancy. The device includes at least one software functional module that can be stored in memory in the form of software or firmware (firmware) or cured in an Operating System (OS) of the device. Specifically, the device comprises: the generating module 400 is configured to generate a feature image according to an entity sentence to be identified, where the feature image is composed of a plurality of region tiles, and the entity sentence to be identified includes a plurality of characters, and each character corresponds to a region tile respectively; an input module 402, configured to input the feature image into a entity recognition model, where the entity recognition model is generated by any implementation manner in the first embodiment; and the obtaining module 404 is configured to obtain a prediction tag of the entity sentence to be recognized output by the entity recognition model.
In the entity recognition device designed in the above way, 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 by the entity model obtained through training in the first embodiment, and then the prediction label output by the entity recognition model is obtained.
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 by 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, which when executed by the computing device, the processor 501 executes the method of the first embodiment, any alternative implementation of the first embodiment, the second embodiment, any alternative implementation of the second embodiment, for example steps S100-S106: generating characteristic image information according to a target sentence to be trained, wherein the characteristic image information comprises a characteristic image formed by a plurality of region image blocks and a class label of the target sentence, the target sentence comprises a plurality of characters, and each character corresponds to a region image block respectively; extracting feature vectors of the feature images by adopting a preset neural network model; calculating corresponding training loss according to the feature vector and the corresponding class label; and carrying out iterative updating on the neural network model according to the training loss so as to obtain the entity recognition model after training.
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 the first embodiment, any optional implementation of the first embodiment, the second embodiment, or any optional implementation of the second embodiment.
The storage medium may be implemented by any type of volatile or nonvolatile Memory device or combination thereof, such as static random access Memory (Static Random Access Memory, SRAM), electrically erasable Programmable Read-Only Memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), erasable Programmable Read-Only Memory (Erasable Programmable Read Only Memory, EPROM), programmable Read-Only Memory (PROM), read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk, or optical disk.
The present application provides a computer program product which, when run on a computer, causes the computer to perform the method of the first embodiment, any alternative implementation of the first embodiment, the second embodiment, any alternative implementation 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 manners. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be other manners of division in actual implementation, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
Further, the units described as separate units may or may not be physically separate, and units displayed as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
It should be noted that the functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM) random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
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 variations will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (9)

1. A method of generating a model, the method comprising:
generating characteristic image information according to a target sentence to be trained, wherein the characteristic image information comprises a characteristic image formed by a plurality of region image blocks and a class label of the target sentence, the target sentence comprises a plurality of characters, and each character corresponds to one region image block respectively;
extracting feature vectors of the feature images by adopting a preset neural network model;
calculating corresponding training loss according to the feature vector and the corresponding class label;
performing iterative updating on the neural network model according to the training loss to obtain a training-completed entity identification model;
the generating feature image information according to the target sentence to be trained comprises the following steps:
extracting each character in the target sentence to be trained;
searching a corresponding region block according to each extracted character, and pre-establishing a mapping relation between each character and the corresponding region block and storing the mapping relation in a database;
generating the feature image from a plurality of region tiles;
the generating the feature image from a plurality of region tiles includes:
sequentially combining the searched multiple region image blocks according to the positions of the 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 except the preset area of the blank image as preset unicode to obtain the characteristic image.
2. The method of claim 1, wherein prior to the generating feature image information from the target sentence to be trained, the method further comprises:
acquiring a plurality of characters in an entity database and a plurality of preset region blocks, wherein each character in the plurality of characters is not repeated, and each region block in the plurality of preset region blocks is not repeated;
and establishing a mapping relation between each character and a preset region block and storing the mapping relation in the database.
3. The method of claim 1, wherein the generating the feature image from a plurality of region tiles comprises:
sequentially combining the searched multiple region image blocks according to the positions of the corresponding characters in the target sentence to be trained to obtain a combined image;
copying a plurality of the combined images to splice to obtain a combined spliced image;
and filling the combined spliced image in a preset area of a blank image, and setting the rest areas except the preset area of the blank image as preset unicode to obtain the characteristic image.
4. The method of claim 1, wherein the generating the feature image from a plurality of region tiles comprises:
dispersing and filling the plurality of region tiles in a plurality of preset regions of a blank image, wherein the number of the preset regions is the same as that of the region tiles;
and setting the rest areas except the preset areas of the blank image as preset unified characters to obtain the characteristic image.
5. The method of claim 1, wherein after the generating feature image information from the target sentence to be trained, the method further comprises:
and normalizing the characteristic image and carrying out data enhancement processing.
6. A method of entity identification, the method comprising:
generating a characteristic image according to an entity sentence to be identified, wherein the characteristic image consists of a plurality of region blocks, the entity sentence to be identified comprises a plurality of characters, and each character corresponds to one region block respectively;
inputting the feature image into a entity recognition model, wherein the entity recognition model is generated by any one of claims 1-5;
and obtaining the prediction label of the entity statement to be recognized, which is output by the entity recognition model.
7. A model generation apparatus, characterized in that the apparatus comprises:
the generating 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 formed by a plurality of region image blocks and a class label of the target sentence, the target sentence comprises a plurality of characters, and each character corresponds to one region image block respectively;
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 vector and the corresponding class label;
the updating module is used for carrying out iterative updating on the neural network model according to the training loss so as to obtain a training-completed entity identification model;
the generating module is specifically used for extracting each character in the target sentence to be trained;
searching a corresponding region block according to each extracted character, and pre-establishing a mapping relation between each character and the corresponding region block and storing the mapping relation in a database; generating the feature image from a plurality of region tiles; the generating the feature image from a plurality of region tiles includes: sequentially combining the searched multiple region image blocks according to the positions of the 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 except the preset area of the blank image as preset unicode to obtain the characteristic image.
8. An entity identification device, the device comprising:
the generating module is used for generating a characteristic image according to an entity sentence to be identified, wherein the characteristic image consists of a plurality of region image blocks, the entity sentence to be identified comprises a plurality of characters, and each character corresponds to one region image block respectively;
an input module for inputting the feature image into a solid recognition model, the solid recognition model being the solid recognition model generated in any one of claims 1-5;
the obtaining module is used for obtaining the prediction label of the entity statement to be recognized, which is output by the entity recognition model.
9. An electronic device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the method of any one of claims 1 to 6 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 CN111027325A (en) 2020-04-17
CN111027325B true 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)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112784675B (en) * 2020-11-25 2023-06-30 上海芯翌智能科技有限公司 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
数字字符识别算法研究;苑全兵;黄福;;电子测试(04);全文 *

Also Published As

Publication number Publication date
CN111027325A (en) 2020-04-17

Similar Documents

Publication Publication Date Title
CN111615702B (en) Method, device and equipment for extracting structured data from image
CN112396049A (en) Text error correction method and device, computer equipment and storage medium
CN110807314A (en) Text emotion analysis model training method, device and equipment and readable storage medium
CN111027605A (en) Fine-grained image recognition method and device based on deep learning
CN110222330B (en) Semantic recognition method and device, storage medium and computer equipment
CN111339787B (en) Language identification method and device, electronic equipment and storage medium
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
CN111612081B (en) Training method, device, equipment and storage medium for recognition model
CN112214775A (en) Injection type attack method and device for graph data, medium and electronic equipment
CN112784582A (en) Error correction method and device and computing equipment
CN113850251A (en) Text correction method, device and equipment based on OCR technology and storage medium
CN112183494A (en) Character recognition method and device based on neural network and storage medium
CN111027325B (en) Model generation method, entity identification device and electronic equipment
CN112307749A (en) Text error detection method and device, computer equipment and storage medium
CN115984886A (en) Table information extraction method, device, equipment and storage medium
CN111488574A (en) Malicious software classification method, system, computer equipment and storage medium
CN114741697B (en) Malicious code classification method and device, electronic equipment and medium
US9378466B2 (en) Data reduction in nearest neighbor classification
CN116311276A (en) Document image correction method, device, electronic equipment and readable medium
CN111126420A (en) Method and device for establishing recognition model
CN114818627A (en) Form information extraction method, device, equipment and medium
US11275969B2 (en) Visually-aware encodings for characters
CN113468906A (en) Graphic code extraction model construction method, recognition method, device, equipment and medium
CN115700519A (en) Text-to-image generation method and device, storage medium and terminal

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