Summary of the invention
It is an object of the present invention in view of the deficiency of the prior art, provide a kind of Instrument image recognition methods and
Device, to solve in the prior art, the low problem of Instrument image recognition accuracy.
To achieve the above object, the embodiment of the present application the technical solution adopted is as follows:
In a first aspect, the embodiment of the present application provides a kind of Instrument image recognition methods, comprising:
Pre-segmentation is carried out to Instrument image to be identified, obtains multiple original character regions;
According to preset characters identification model, character recognition is carried out to each original character region, is obtained described each initial
The character confidence level of character zone;
According to the character confidence level in the multiple original character region, segmentation template is determined;
The position on the Instrument image according to the segmentation template and the multiple original character region, to described
Instrument image is divided again, obtains multiple target character regions;
According to the preset characters identification model, character recognition is carried out to each target character region, is obtained each
The character identification result of the target character region, the character of each target character region is set in the character identification result
Reliability is greater than or equal to preset threshold.
Optionally, described according to character confidence level in the multiple original character region, determine segmentation template, comprising:
The character confidence level for comparing each original character region, with the preset threshold;
According to comparison result, the segmentation template is determined.
Optionally, described according to comparison result, determine the segmentation template, comprising:
If there are the initial words that character confidence level is greater than or equal to the preset threshold in the multiple original character region
It accords with region and determines the segmentation then according to the highest original character region of character confidence level in the multiple original character region
Template.
Optionally, according to comparison result, the segmentation template is determined, comprising:
If there is no character confidence levels to be greater than or equal to the initial of the preset threshold in the multiple original character region
Character zone determines the segmentation template then according to the size of the Instrument image.
Optionally, it is described according to the segmentation template and the multiple original character region on the Instrument image
The Instrument image is divided in position again, obtains multiple target character regions, comprising:
According to the multiple original character region on the Instrument image position, by the segmentation template using preset
Unit moving distance is moved in the Instrument image, to be divided again to the Instrument image, is obtained the multiple
Target character region.
Optionally, it is described according to the multiple original character region on the Instrument image position, by the segmentation mould
Plate is moved using preset unit moving distance in the Instrument image, comprising:
If the length in abnormal original character region in the multiple original character region, less than the length of the segmentation template
Degree, then by the abnormal original character region in the position on the Instrument image centered on, by the segmentation template using institute
Unit moving distance is stated, is moved on the Instrument image;The character confidence level in the exception original character region is less than
The preset threshold.
Optionally, it is described according to the multiple original character region on the Instrument image position, by the segmentation mould
Plate is moved using preset unit moving distance in the Instrument image, comprising:
If the length in abnormal original character region in the multiple original character region, greater than the length of the segmentation template
Degree, then the position according to the abnormal original character region on the Instrument image, uses the list for the segmentation template
Position moving distance, is moved in the Instrument image;The character confidence level in the exception original character region is less than described
Preset threshold.
Second aspect, the embodiment of the present application provide a kind of Instrument image identification device, comprising: the first segmentation module calculates
Module, determining module, the second segmentation module and identification module;
The first segmentation module obtains multiple original character areas for carrying out pre-segmentation to Instrument image to be identified
Domain;
The computing module, for carrying out character recognition to each original character region according to preset characters identification model,
Obtain the character confidence level in each original character region;
The determining module, for determining segmentation template according to character confidence level in the multiple original character region;
The second segmentation module, is used for according to the segmentation template and the multiple original character region described
The Instrument image is divided in position on Instrument image again, obtains multiple target character regions;
The identification module, for being carried out to each target character region according to the preset characters identification model
Character recognition obtains the character identification result of each target character region, each mesh in the character identification result
The character confidence level for marking character zone is greater than or equal to preset threshold.
Optionally, the determining module, specifically for the character confidence level in each original character region, with institute
State preset threshold;According to comparison result, the segmentation template is determined.
Optionally, the second segmentation module, is specifically used for according to the multiple original character region in the meter diagram
As upper position, the segmentation template is moved using preset unit moving distance in the Instrument image, to described
Instrument image is divided again, obtains the multiple target character region.
The beneficial effect of the application is: Instrument image recognition methods provided by the embodiments of the present application and device, by treating
It identifies that Instrument image carries out pre-segmentation, obtains multiple original character regions, according to the confidence level in multiple original character regions, determine
Divide template, the target character band of position in Instrument image is divided again using segmentation template, obtains multiple target words
Region is accorded with, character recognition is carried out to each target character region, obtains the character identification result of each target character region,
In, the character confidence level of each target character region is greater than or equal to preset threshold.It is carried out in advance by treating identification Instrument image
Segmentation, and according to the character confidence level in each original character region after pre- separate, it determines and separates template, then according to segmentation
Template, which is treated, identifies that Instrument image is divided again, and identifies to segmentation result, each mesh that may make identification to obtain
The character confidence level for marking character zone is greater than or equal to preset threshold character, improves the accurate of character recognition in Instrument image
Degree.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention
In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is
A part of the embodiment of the present invention, instead of all the embodiments.The present invention being usually described and illustrated herein in the accompanying drawings is implemented
The component of example can be arranged and be designed with a variety of different configurations.
Therefore, the detailed description of the embodiment of the present invention provided in the accompanying drawings is not intended to limit below claimed
The scope of the present invention, but be merely representative of selected embodiment of the invention.Based on the embodiments of the present invention, this field is common
Technical staff's every other embodiment obtained without creative efforts belongs to the model that the present invention protects
It encloses.
Fig. 1 is please referred to, Fig. 1 is a kind of Instrument image recognition methods flow diagram provided by the embodiments of the present application, the party
The executing subject of method can be Instrument image identification equipment, which identifies that equipment can be computer, server, processing
The equipment that device etc. has processing function, as shown in Figure 1, method includes:
S101, pre-segmentation is carried out to Instrument image to be identified, obtains multiple original character regions.
Method provided by the following each embodiments of the application can be used for industrial control field, digital in digital instrument image
Identification is specifically unfolded, and method provided by the present application can be applied to industrial control field, to the character in Instrument image
It is identified.In practical application, Instrument image involved in method provided by the present application is not limited to digital instrument image, can also
To be other kinds of Instrument image.Instrument image for example can be the image of instrument viewing area, may include in the Instrument image
The character of at least one types such as number, letter or text.
Optionally, above-mentioned Instrument image to be identified can be user and shoot acquisition by video camera, and be uploaded to instrument
Image recognition apparatus is also possible to through the communication function between instrument and computer equipment, to carry out character recognition by instrument
Table image is sent in computer equipment, does not do specific limit particularly for acquisition modes the present embodiment of Instrument image to be identified
System.
In some embodiments, the image partition method based on pixel can be used, to the meter diagram to be identified of acquisition
As carrying out pre-segmentation, multiple original character regions are obtained.It wherein, may include one or more complete in each original character region
Whole character also may include incomplete character, or not include any character, when in original character only include a complete character
When, it can determine that the character zone is normal character zone, and working as includes being more or less than a complete word in original character
Fu Shi can determine that the character zone is unusual character region.It should be noted that the image segmentation based on pixel,
Obtained segmentation result is easy to the interference by image slices vegetarian refreshments, and so as to cause accidentally dividing, segmentation result accuracy is poor.Therefore
It also needs to optimize segmentation to the character for including in the unusual character region generated after pre-segmentation, to improve recognition accuracy.
And before treating identification Instrument image and carrying out pre-segmentation, binary conversion treatment first can also be carried out to images to be recognized, to reduce
The complexity of subsequent image calculating process.
S102, the progress character recognition of each original character region is obtained each initial according to preset characters identification model
The character confidence level of character zone.
It is alternatively possible to which by acquiring preset multiple character samples, training simultaneously obtains character recognition model, utilizes the word
Identification model is accorded with, the character in each original character region got above by pre-segmentation is identified, is obtained each
The character confidence level in original character region.
It in some embodiments, can be by will be trained in the character and character recognition model in each original character region
Good character is compared, when character similarity is higher in the character and character recognition model in initial character zone, at the beginning of
The corresponding character confidence level of beginning character zone is also higher.
S103, according to character confidence level in multiple original character regions, determine segmentation template.
Optionally, the character confidence level in original character region different in multiple original character regions obtained above may
It is identical, can also be different, segmentation template can be determined according to the character confidence level in multiple original character region.
It should be noted that the embodiment of the present application is illustrated so that the number in Instrument image carries out character recognition as an example,
And in general, using the digital representation of standard come when indicating 0-9, shared by the size in region be identical.Some
In embodiment, segmentation template can be determined according to the highest original character region of character confidence level, then utilizes the segmentation template
Abnormal separating character is divided again, segmentation accuracy is relatively high.
S104, according to segmentation template and multiple original character region positions on Instrument image, Instrument image is carried out
Divide again, obtains multiple target character regions.
In some embodiments, identification Instrument image progress pre-segmentation is being treated, is obtaining the same of multiple original character regions
When, the coordinate information in each original character region can also be obtained and record, coordinate information is used to indicate each original character area
Corresponding position of the domain in Instrument image.
The above-mentioned segmentation template determined can be used, target area in Instrument image is divided again, wherein mesh
Marking region may include one or more.The one or more target area can also include: multiple initial in the Instrument image
All or part of character zones in character zone.If partial character region, which for example can be with
It is less than the character zone of preset threshold for character confidence level in multiple original character regions for obtaining after pre-segmentation, i.e., abnormal word
Symbol.
S105, each target is obtained to the progress character recognition of each target character region according to preset characters identification model
The character identification result of character zone, the character confidence level of each target character region is greater than or equal to pre- in character identification result
If threshold value.
For being divided the character in obtained target character region again based on separation template, also need to use
Preset character recognition model identified, calculating character confidence level.For the character in either objective character zone, work as calculating
When character confidence level out is greater than or equal to preset threshold, it is determined that it is correctly validated, to the character of the target character region
End of identification, without continuing to separate and identify.Wherein, preset threshold namely confidence threshold value, when calculated character is set
When reliability is lower than confidence threshold value, determining Character segmentation, there are errors, it is also necessary to continue to divide line character identification of going forward side by side, directly
Terminate to character confidence level more than or equal to confidence threshold value.It should be pointed out that subsequent separation can be real with above-mentioned S104
Now similar, the identification after subsequent separation can be similar with the realization of above-mentioned S105, and referring in particular to above-mentioned, details are not described herein.
Confidence level is bigger, and the accuracy that character zone is separated is bigger, so that character recognition accuracy increases.Instead
It, confidence level is bigger, and the accuracy that character zone is separated is smaller, so that character recognition accuracy reduces.
To sum up, the application implements the Instrument image recognition methods provided, carries out pre-segmentation by treating identification Instrument image,
Multiple original character regions are obtained, according to the confidence level in multiple original character regions, segmentation template are determined, using segmentation template pair
The target character band of position is divided again in Instrument image, obtains multiple target character regions, to each target character area
Domain carries out character recognition, obtains the character identification result of each target character region, wherein the character of each target character region
Confidence level is greater than or equal to preset threshold.Pre-segmentation is carried out by treating identification Instrument image, and according to every after pre- separate
The character confidence level in a original character region determines and separates template, then treats identification Instrument image according to segmentation template and carries out
Divide again, and segmentation result is identified, the character confidence level for each target character region that may make identification to obtain is big
In or equal to preset threshold character, the accuracy of character recognition in Instrument image is improved.
Fig. 2 is that another Instrument image recognition methods flow diagram provided by the embodiments of the present application is further such as schemed
Shown in 2, according to character confidence level in multiple original character regions in above-mentioned S103, segmentation template is determined, it may include:
S201, each original character region of comparison character confidence level, with preset threshold.
S202, according to comparison result, determine segmentation template.
Specifically, the character confidence level in each original character region obtained above is compared with preset threshold, root
According to comparison result, segmentation template is determined.Wherein, comparison result can be character confidence level more than or equal to preset threshold, can also
To be that character confidence level is less than preset threshold.
Optionally, it in a kind of mode, according to comparison result in above-mentioned S202, determines segmentation template, may include:
If the original character region in multiple original character regions there are character confidence level more than or equal to preset threshold,
According to the highest original character region of character confidence level in multiple original character regions, segmentation template is determined.
If in comparison result obtained in above-mentioned S202, when there are character confidence levels to be greater than or equal to the initial of preset threshold
When character zone, character confidence level can be greater than to preset threshold, and the highest original character region of character confidence level is used as and divides
Cut template.Wherein, in the highest original character region of character confidence level, it is the word being segmented correctly that the character for including, which can determine,
Symbol.
Optionally, in a further mode of operation, it determines segmentation template according to comparison result in above-mentioned S202, may include:
If the original character region in multiple original character regions there is no character confidence level more than or equal to preset threshold,
Then according to the size of Instrument image, segmentation template is determined.
If in comparison result obtained in above-mentioned S202, there is no character confidence levels to be greater than or equal to the initial of preset threshold
When character zone, then segmentation template can be determined according to the dimension information of Instrument image to be identified.
Optionally, in a kind of feasible mode, segmentation template can be determined according to the width of Instrument image to be identified.Tool
Body, can using the half of the width of Instrument image to be identified as the length of segmentation template, using the width of Instrument image as
The width for dividing template can so obtain segmentation template.It should be noted that the half of the above-mentioned width by Instrument image is made
It is only a kind of example to divide the length of template, can also will be less than the other sizes of the width of the Instrument image as segmentation mould
The length of plate, such as 1/3,1/4, details are not described herein.
When there is no the original character region that character confidence level is greater than or equal to preset threshold, namely pass through pre-segmentation,
Any character is not divided correctly, therefore can be by smaller segmentation template, what is more refined is split Instrument image,
So that the traversal range of segmentation template is thinner, to improve segmentation accuracy rate.
Further, in above-mentioned S104 according to segmentation template and multiple original character region positions on Instrument image,
Instrument image is divided again, obtains multiple target character regions, may include:
According to multiple original character region positions on Instrument image, segmentation template is used into preset unit moving distance
It is moved in Instrument image, to be divided again to Instrument image, obtains multiple target character regions.
It should be noted that character confidence level is less than preset threshold in the original character region that obtains after pre-segmentation
Character zone, can determine each original character region on Instrument image according to the coordinate information in original character region
Position.
In some embodiments, the coordinate information in original character region can be the coordinate of original character region bottom right angle point
Information can determine the frame initial position in the original character region according to the coordinate information, and then can correspond in meter diagram
The position of character in the original character region is determined as in.
Further, it by the segmentation template of above-mentioned determination, is moved on Instrument image, specifically, template will be divided
It is moved at the multiple character positions determined on Instrument image, to be divided again to Instrument image, and is obtained more
A target character region.
Further, segmentation template is adopted according to multiple original character region positions on Instrument image in above-mentioned S104
It is moved with preset unit moving distance in Instrument image, may include:
If the length in abnormal original character region in multiple original character regions, less than the length of segmentation template, then with different
Centered on normal position of the original character region on Instrument image, segmentation template is used into unit moving distance, in Instrument image
On moved;The character confidence level in abnormal original character region is less than preset threshold.
It should be noted that it is above-mentioned treat identification Instrument image pre-segmentation after, obtain multiple original character regions, wherein
Character confidence level can be determined that abnormal original character region less than preset threshold in multiple original character regions, and abnormal
It may include multiple characters not being partitioned from original character region, such as: 59,5 and 9 two characters are not partitioned from, or
Person be include an incomplete character, such as: 7 are divided into two original character regions, in each original character region
It only include 7 a part.
Optionally, the dimension information for obtaining each abnormal original character region can be equally calculated, dimension information can wrap
It includes: the length or width in abnormal original character region.
Assuming that the length in any exception original character region is x1, the length for dividing template is x0, work as x1Less than x0When, then
The partial segmentation that can be a character that includes in abnormal original character region as a result, for example, be the left-half of number 7,
Either right half part, according to the coordinate information in the exception original character region, the corresponding position for obtaining number 7 in Instrument image
It sets, the position in Instrument image determined by the coordinate information in the exception original character region is number 7 in Instrument image
In approximate location, can't determine the position of complete number 7, therefore, it is also necessary to using segmentation template, with unit it is mobile away from
From being moved left and right centered on the position, and in preset range in the number 7 on position in Instrument image of acquisition
It is inside moved left and right, it is alternatively possible to be to move left and right 1/2 (x0-x1), also, every movement is primary, and it is corresponding to calculate once
Character confidence level then stops moving, and determine the word at 7 place of the number until character confidence level is greater than or equal to preset threshold
Symbol region is segmented correctly, i.e., number 7 is correctly validated.Meanwhile by the character zone where number 7 from Instrument image to be identified
The character zone for including, which is concentrated, to be deleted.
It should be noted that above-mentioned move left and right 1/2 (x0-x1), it is ensured that complete character is traversed, also
To guarantee that number 7 may finally be accurately segmented, if moving left and right range less than 1/2 (x0-x1), then the target word divided
Include in symbol region is still certain a part of number 7, in this way, calculating the character confidence level obtained can not reach default
Threshold value, to be unable to complete correct segmentation.
Further, segmentation template is adopted according to multiple original character region positions on Instrument image in above-mentioned S104
It is moved with preset unit moving distance in Instrument image, may include:
If in multiple original character regions abnormal original character region length, greater than the length of segmentation template, then basis
Position of the abnormal original character region on Instrument image, will segmentation template use unit moving distance, in Instrument image into
Row movement;The character confidence level in abnormal original character region is less than preset threshold.
In addition, for x1Greater than x0The case where, then it can determine to include more than one character in abnormal original character region,
That is, may including two, three characters etc., it is also possible to contain a complete character and the half of another character etc..
Such as: abnormal original character region includes 59 two characters.
Likewise, can according to the coordinate information in the exception original character region, determine it includes character in meter diagram
As upper position, and template will be divided according to unit moving distance, be moved at corresponding position, to be divided again
It cuts.Meanwhile it is mobile every time, it is also all corresponding to calculate a character confidence level, until character confidence level is greater than or equal to preset threshold,
Then determine correct segmentation.
Optionally, for x1Greater than x0The case where, because containing at least one complete character in abnormal original character region,
Therefore can also will segmentation template according to unit moving distance, be moved on the exception initial segmentation character, with to wherein wrapping
The complete character contained is correctly divided.
In addition, for x1Greater than x0The case where, limitation segmentation template is not needed in the either abnormal initial segmentation of Instrument image
The range moved on character is moved according to unit moving distance, until character confidence level is more than or equal to preset threshold
It can.
In some embodiments, above-mentioned unit moving distance can be 1/10 (x0), it, can according to the unit moving distance
So that traversal range is more accurate when segmentation template movement, alternatively it is also possible to be 1/8 (x0) or 1/5 (x0) etc., this Shen
Please embodiment unit moving distance is not particularly limited, as long as meet segmentation template Instrument image can be carried out accurate time
It goes through, guarantees segmentation effect.
The embodiment of the present application carries out pre-segmentation by treating identification Instrument image, obtains multiple original character regions, according to
The confidence level in multiple original character regions determines segmentation template, using segmentation template to target character position area in Instrument image
Domain is divided again, obtains multiple target character regions, carries out character recognition to each target character region, obtains each mesh
Mark the character identification result of character zone, wherein the character confidence level of each target character region is greater than or equal to preset threshold.
Pre-segmentation is carried out by treating identification Instrument image, identification Instrument image is further treated according to determining segmentation template and is carried out again
Secondary segmentation, and segmentation result is identified, to realize accurately identifying for Instrument image.
Fig. 3 is a kind of Instrument image identification device structural schematic diagram provided by the embodiments of the present application, as shown in figure 3, device
It include: the first segmentation module 301, computing module 302, the segmentation module 304 of determining module 303, second and identification module 305;
First segmentation module 301 obtains multiple original character areas for carrying out pre-segmentation to Instrument image to be identified
Domain;Computing module 302 obtains every for carrying out character recognition to each original character region according to preset characters identification model
The character confidence level in a original character region;Determining module 303, for the character confidence level according to multiple original character regions,
Determine segmentation template;Second segmentation module 304, is used for according to segmentation template and multiple original character regions in Instrument image
Upper position divides Instrument image again, obtains multiple target character regions;Identification module 305, for according to predetermined word
Identification model is accorded with, character recognition is carried out to each target character region, obtains the character identification result of each target character region,
The character confidence level of each target character region is greater than or equal to preset threshold in character identification result.
It is and default specifically for the character confidence level in more each original character region further, it is determined that module 303
Threshold value;According to comparison result, segmentation template is determined.
Further, the second segmentation module 304 is specifically used for upper in Instrument image according to multiple original character regions
It sets, segmentation template is moved using preset unit moving distance in Instrument image, to be divided again Instrument image
It cuts, obtains multiple target character regions.
Above-mentioned apparatus can be used for executing the method for above method embodiment offer, specific implementation and technical effect class
Seemingly, which is not described herein again.
Fig. 4 is another Instrument image identification device structural schematic diagram provided by the embodiments of the present application, as shown in figure 4, should
Device includes: processor 401 and memory 402, in which: memory 402 calls memory for storing program, processor 401
The program of 402 storages, to execute above method embodiment.Specific implementation is similar with technical effect, and which is not described herein again.
The device can integrate in the equipment such as terminal or server, the application with no restriction.
Optionally, the present invention also provides a kind of program product, such as computer readable storage medium, including program, the journeys
Sequence is when being executed by processor for executing above method embodiment.
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description
With the specific work process of device, the corresponding process in embodiment of the method can be referred to, is repeated no more in the application.In the application
In provided several embodiments, it should be understood that disclosed systems, devices and methods, it can be real by another way
It is existing.The apparatus embodiments described above are merely exemplary, for example, the division of the module, only a kind of logic function
It can divide, there may be another division manner in actual implementation, in another example, multiple module or components can combine or can collect
At another system is arrived, or some features can be ignored or not executed.Another point, shown or discussed mutual coupling
Conjunction or direct-coupling or communication connection can be the indirect coupling or communication connection by some communication interfaces, device or module,
It can be electrical property, mechanical or other forms.
The module as illustrated by the separation member may or may not be physically separated, aobvious as module
The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple
In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme
's.
It, can also be in addition, each functional unit in each embodiment of the application can integrate in one processing unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.
It, can be with if the function is realized in the form of SFU software functional unit and when sold or used as an independent product
It is stored in the executable non-volatile computer-readable storage medium of a processor.Based on this understanding, the application
Technical solution substantially the part of the part that contributes to existing technology or the technical solution can be with software in other words
The form of product embodies, which is stored in a storage medium, including some instructions use so that
One computer equipment (can be personal computer, server or the network equipment etc.) executes each embodiment institute of the application
State all or part of the steps of method.And storage medium above-mentioned includes: USB flash disk, mobile hard disk, ROM, RAM, magnetic or disk
Etc. the various media that can store program code.
The above is only the protection scopes of the specific embodiment of the application, but the application to be not limited thereto, any to be familiar with
Those skilled in the art within the technical scope of the present application, can easily think of the change or the replacement, and should all cover
Within the protection scope of the application.Therefore, the protection scope of the application should be subject to the protection scope in claims.