Summary of the invention
In view of this, be designed to provide a kind of instrument recognition methods, device, electronic equipment and the storage of the application are situated between
Matter, the embodiment of the present application can obtain instrument to be identified by the way that the Instruments Image of instrument to be identified is input to final classification model
The instrument title of device, has achieved the purpose that identify instrument, also improves the accuracy and efficiency of instrument identification.
In a first aspect, the embodiment of the present application provides a kind of instrument recognition methods, comprising: utilize the sample of an at least quasi-instrument
This image carries out model training to preliminary classification model, obtains final classification model;The Instruments Image of instrument to be identified is inputted
To final classification model, the instrument classification and the corresponding first eigenvector of Instruments Image of instrument to be identified are determined;According to wait know
The instrument classification and first eigenvector of other instrument, search the instrument name of instrument to be identified in the property data base pre-established
Claim.
With reference to first aspect, the embodiment of the present application provides the first possible embodiment of first aspect, wherein benefit
Before carrying out model training to preliminary classification model with the sample image of an at least quasi-instrument, further includes: according to the instrument of instrument
Function and instrument appearance classify to sample image, obtain the sample image of an at least quasi-instrument.
With reference to first aspect, the embodiment of the present application provides second of possible embodiment of first aspect, wherein benefit
Model training is carried out to preliminary classification model with the sample image of an at least quasi-instrument, after obtaining final classification model, is also wrapped
It includes: sample image being separately input into final classification model, determines second feature vector corresponding with sample image;According to sample
The title of instrument corresponding to image and affiliated instrument classification, determine the second feature vector of sample image and the name of instrument
Title and the other corresponding relationship of instrument class;Property data base is established according to corresponding relationship.
The possible embodiment of second with reference to first aspect, the embodiment of the present application provide the third of first aspect
Possible embodiment, wherein the instrument title of instrument to be identified is searched in the property data base pre-established, comprising: from
The second feature vector of sample image identical with the instrument classification of instrument to be identified is obtained in property data base;According to the second spy
The similarity degree for levying vector sum first eigenvector, determines the title of instrument to be identified.
The third possible embodiment with reference to first aspect, the embodiment of the present application provide the 4th kind of first aspect
Possible embodiment, wherein according to the similarity degree of second feature vector sum first eigenvector, determine instrument to be identified
Title, comprising: obtain and the maximum second feature vector of first eigenvector similarity degree;It will journey similar to first eigenvector
The instrument title for spending the corresponding sample image of maximum second feature vector, the title as instrument to be identified.
The third possible embodiment with reference to first aspect, the embodiment of the present application provide the 5th kind of first aspect
Possible embodiment further includes;Judge whether similarity degree is greater than or equal to preset threshold;If similarity degree is greater than or equal to
Preset threshold, output similarity degree are greater than or equal to the instrument name of the corresponding sample image of second feature vector of preset threshold
Claim.
Second aspect, the embodiment of the present application also provide a kind of instrument identification device, comprising: training module, for using extremely
The sample image of a few quasi-instrument carries out model training to preliminary classification model, obtains final classification model;Determining module is used for
The Instruments Image of instrument to be identified is input to final classification model, determines the instrument classification and Instruments Image pair of instrument to be identified
The first eigenvector answered;Searching module is built for the instrument classification and first eigenvector according to instrument to be identified in advance
The instrument title of instrument to be identified is searched in vertical property data base.
In conjunction with second aspect, the embodiment of the present application provides the first possible embodiment of second aspect, further includes:
Categorization module, for according to instrument instrumental function and instrument appearance classify to sample image, obtain an at least quasi-instrument
Sample image.
The third aspect, the embodiment of the present application also provide a kind of electronic equipment, comprising: processor, memory and bus, storage
Device is stored with the executable machine readable instructions of processor, when electronic equipment operation, by total between processor and memory
Line communication, executes above-mentioned in a first aspect, or any possible reality in first aspect when machine readable instructions are executed by processor
Apply the step in mode.
Fourth aspect, the embodiment of the present application also provide a kind of computer readable storage medium, the computer-readable storage medium
Computer program is stored in matter, which executes above-mentioned in a first aspect, or first aspect when being run by processor
In step in any possible embodiment.
Instrument recognition methods, device and electronic equipment provided by the embodiments of the present application, by the way of model+database,
Achieve the purpose that directly to identify instrument by final classification model, has also improved the accuracy and effect of instrument identification
Rate.
Further, instrument recognition methods provided by the embodiments of the present application, according to the instrumental function and instrument appearance pair of instrument
Sample image is classified, and compared with being classified completely according to the function of instrument to instrument in the prior art, can not only be expired
The requirement of sufficient computer identification instrument image, moreover it is possible to promote the efficiency of identification.
To enable the above objects, features, and advantages of the application to be clearer and more comprehensible, preferred embodiment is cited below particularly, and cooperate
Appended attached drawing, is described in detail below.
Specific embodiment
To keep the purposes, technical schemes and advantages of the embodiment of the present application clearer, below in conjunction with the embodiment of the present application
Middle attached drawing, the technical scheme in the embodiment of the application is clearly and completely described, it is clear that described embodiment is only
It is some embodiments of the present application, instead of all the embodiments.The application being usually described and illustrated herein in the accompanying drawings is real
The component for applying example can be arranged and be designed with a variety of different configurations.Therefore, below to the application's provided in the accompanying drawings
The detailed description of embodiment is not intended to limit claimed scope of the present application, but is merely representative of the selected reality of the application
Apply example.Based on embodiments herein, those skilled in the art institute obtained without making creative work
There are other embodiments, shall fall in the protection scope of this application.
In view of in the prior art, the image of instrument is classified all in accordance with the function of instrument greatly, but this and computer root
It is identified according to image of the vision to instrument and is mutually conflicted;If every instrument is established disaggregated model, classification number as one kind
Mesh it is too many and it is every one kind in picture number it is very little, model extraction feature is insufficient, and classifying quality in practical applications is bad.Base
In this, the embodiment of the present application provides a kind of instrument recognition methods, identification device and electronic equipment, carries out below by embodiment
Description.
For convenient for understanding the present embodiment, first to a kind of instrument recognition methods disclosed in the embodiment of the present application into
Row is discussed in detail.
The embodiment of the application first aspect provides a kind of instrument recognition methods, as shown in Figure 1, including the following steps:
S101 carries out model training to preliminary classification model using the sample image of an at least quasi-instrument, is finally divided
Class model;
The Instruments Image of instrument to be identified is input to final classification model, determines the instrument class of instrument to be identified by S102
The other and corresponding first eigenvector of Instruments Image;
S103, according to the instrument classification and first eigenvector of instrument to be identified, in the property data base pre-established
Search the instrument title of instrument to be identified.
Instrument recognition methods provided by the present application, in step s101, firstly, obtaining preliminary classification model, preliminary classification
Model can choose the neural network classification model based on deep learning, as depth residual error network (Residual Networks,
Resnet it) is used as preliminary classification model, preferably Resnet-50 further will divide the sample of the instrument of a lot of classification in advance
This image is separately input into preliminary classification model, carries out model training to preliminary classification model, is continually entered by sample image
To the iterative process of preliminary classification model, the purpose of the parameter of continuous training pattern can achieve, and then obtain final classification mould
Type.Here, preliminary classification model can extract the feature of input picture, specifically such as, the default of preliminary classification model can be set
Feature, when there are input picture, preliminary classification model can extract default feature respectively in the input image, and will extract
Characteristics of image composition characteristic vector exported.In step s 102, the Instruments Image for obtaining instrument to be identified, will be to be identified
The Instruments Image of instrument is input to final classification model, can since the powerful feature of convolutional neural networks is extensive and extractability
Directly to extract the instrument classification and the corresponding first eigenvector of Instruments Image to be identified of instrument to be identified, wherein first
Feature vector is used to characterize the feature of Instruments Image to be identified, and the application preferably exports the feature vector of 1024*1 dimension.In step
It, can be pre- according to the first eigenvector of the instrument classification of obtained instrument to be identified and Instruments Image to be identified in S103
The instrument title of instrument to be identified is searched in the property data base first established, wherein property data base is all kinds of instrumentation diagrams of storage
The database of the feature vector of picture.The embodiment of the present application is by being input to final classification mould for the Instruments Image of instrument to be identified
Type can obtain the instrument title of instrument to be identified, while achieving the purpose that identify instrument, improve instrument identification
Accuracy and efficiency.
In one embodiment of the application, it is preferable that another instrument recognition methods is provided, as shown in Fig. 2, including
Following steps:
S201 classifies to sample image according to the instrumental function and instrument appearance of instrument, obtains an at least quasi-instrument
Sample image;
S202 carries out model training to preliminary classification model using the sample image of an at least quasi-instrument, is finally divided
Class model;
The Instruments Image of instrument to be identified is input to final classification model, determines the instrument class of instrument to be identified by S203
The other and corresponding first eigenvector of Instruments Image;
S204, according to the instrument classification and first eigenvector of instrument to be identified, in the property data base pre-established
Search the instrument title of instrument to be identified.
In this embodiment, it is contemplated that computer is usually classified according to sense of vision factor to instrument and usual people
Classified according to function to instrument, so, the embodiment of the present application changes the mode classification of traditional instrument, by the instrument of same function
Device is split as multiclass according to the similitude of appearance, so that every quasi-instrument all includes more instruments, this mode classification was both unlikely to
So that classification is excessive (every instrument is as a kind of), instrument number (original a kind of quilt in each classification is also greatly reduced
It is split into tens even several hundred classes), and make the feature of instrument in every one kind closer to the division of sense of vision factor, because obtained from stroke
Can preferably preliminary classification model be trained by dividing the sample image of the instrument of good classification.
Wherein, instrument appearance is not limited to the shape and color of instrument.
In one embodiment of the application, it is preferable that another instrument recognition methods is provided, as shown in figure 3, including
Following steps:
S301 carries out model training to preliminary classification model using the sample image of an at least quasi-instrument, is finally divided
Class model;
Sample image is separately input into final classification model by S302, determine second feature corresponding with sample image to
Amount;The title of the instrument according to corresponding to sample image and affiliated instrument classification, determine the second feature of sample image to
The title and the other corresponding relationship of instrument class of amount and instrument;Property data base is established according to corresponding relationship;
The Instruments Image of instrument to be identified is input to final classification model, determines the instrument class of instrument to be identified by S303
The other and corresponding first eigenvector of Instruments Image;
S304, according to the instrument classification and first eigenvector of instrument to be identified, in the property data base pre-established
Search the instrument title of instrument to be identified.
In this embodiment, the final classification model obtained using training, by every image of class every in sample image point
It is not input to final classification model, extracts in final classification model in the last one convolutional layer (Convolutional layer)
1024*7*7 dimensional feature vector, and maximum pond (max-pooling) processing is carried out to this feature vector, respectively obtained multiple
The second feature vector of 1024*1 dimension corresponding with sample image, by the second feature vector and sample of multiple sample images
Title, the classification of the corresponding instrument of image, are corresponded in the form of dictionary and are stored, to generate property data base.
It should be noted that the convolutional layer in neural network model is made of several convolution units, each convolution unit
Parameter is optimized by back-propagation algorithm, and the purpose of convolution algorithm is to extract the different characteristic of input, first
Layer convolutional layer may can only extract some rudimentary features such as levels such as edge, lines and angle, and the network of more layers can be from rudimentary
The more complicated feature of iterative extraction in feature.Wherein, maximum pond takes the maximum point of local acceptance region intermediate value.
In one embodiment of the application, it is preferable that another instrument recognition methods is provided, as shown in figure 4, including
Following steps:
S401 carries out model training to preliminary classification model using the sample image of an at least quasi-instrument, is finally divided
Class model;
Sample image is separately input into final classification model by S402, determine second feature corresponding with sample image to
Amount;The title of the instrument according to corresponding to sample image and affiliated instrument classification, determine the second feature of sample image to
The title and the other corresponding relationship of instrument class of amount and instrument;Property data base is established according to corresponding relationship;
The Instruments Image of instrument to be identified is input to final classification model, determines the instrument class of instrument to be identified by S403
The other and corresponding first eigenvector of Instruments Image;
S404, according to the instrument classification and first eigenvector of instrument to be identified, obtained from property data base with wait know
The second feature vector of the identical sample image of instrument classification of other instrument;According to second feature vector sum first eigenvector
Similarity degree determines the title of instrument to be identified.
In this embodiment, using the instrument classification of instrument to be identified obtained in step S403 as index, in characteristic
According to the second feature vector of lookup sample image identical with the instrument classification of instrument to be identified in library, and then obtain category institute
There is the corresponding second feature vector of sample image, further, calculates separately the corresponding second feature vector of all sample images
With the similarity degree of the first eigenvector of Instruments Image to be identified, still further, according to the similarity degree being calculated, really
The title of fixed instrument to be identified.
In one embodiment of the application, it is preferable that another instrument recognition methods is provided, as shown in figure 5, including
Following steps:
S501 carries out model training to preliminary classification model using the sample image of an at least quasi-instrument, is finally divided
Class model;
Sample image is separately input into final classification model by S502, determine second feature corresponding with sample image to
Amount;The title of the instrument according to corresponding to sample image and affiliated instrument classification, determine the second feature of sample image to
The title and the other corresponding relationship of instrument class of amount and instrument;Property data base is established according to corresponding relationship;
The Instruments Image of instrument to be identified is input to final classification model, determines the instrument class of instrument to be identified by S503
The other and corresponding first eigenvector of Instruments Image;
S504, according to the instrument classification and first eigenvector of instrument to be identified, obtained from property data base with wait know
The second feature vector of the identical sample image of instrument classification of other instrument;
S505 is obtained and the maximum second feature vector of first eigenvector similarity degree;It will be with first eigenvector phase
Title like the instrument title of the corresponding sample image of the maximum second feature vector of degree, as instrument to be identified.
In this embodiment, firstly, calculating the of the corresponding second feature vector of all images and Instruments Image to be identified
The similarity degree of one feature vector, further, find out with the maximum second feature vector of first eigenvector similarity degree, i.e.,
The instrument of sample image corresponding with the maximum second feature vector of first eigenvector similarity degree is exactly instrument to be identified, into
And the name of the instrument is referred to as to the title of instrument to be identified, that is, have identified the title of instrument to be identified.
It should be noted that the similarity degree of first eigenvector and second feature vector can use COS distance or Euclidean
Distance indicates.Wherein, COS distance uses in vector space two vectorial angle cosine values as measuring two inter-individual differences
Size, compare distance metric, cosine similarity more focuses on difference of two vectors on direction, rather than distance or length
On;Euclidean distance is the most common distance metric, and measurement is absolute distance in hyperspace between each point, because calculating
It is the absolute figure based on each dimensional characteristics, so Euclidean measurement needs to guarantee each dimension index in identical scale rank.It examines
Consider the actual conditions of the application, the preferred COS distance of the embodiment of the present application calculate first eigenvector and second feature vector it
Between similarity degree because Euclidean distance measure be spatial points absolute distance, it is straight with the position coordinates where each point
Correlation is connect, what Euclidean distance embodied is the antipode of individual numerical characteristics, so more numerical value for needing from dimension
The analysis of difference is embodied in size;And COS distance measure be space vector angle, the difference being more embodied on direction,
Rather than position, it is insensitive to absolute numerical value, by observing and testing it was found that being used to measure the similar journey of instrument in image
Degree, COS distance better effect.
In one embodiment of the application, it is preferable that judge whether similarity degree is greater than or equal to preset threshold;If phase
It is greater than or equal to preset threshold like degree, output similarity degree is greater than or equal to the corresponding sample of second feature vector of preset threshold
The instrument title of this image.
In this embodiment, the understanding of identification instrument is treated for the ease of user, and recognizes more and instrument to be identified
The relevant content of device, the embodiment of the present application provide kit similar with instrument to be identified according to similarity degree, specifically,
After obtaining final classification model and property data base, the image for treating identification instrument is identified, and passes through setting preset threshold
The similarity degree for measuring instrument to be identified instrument corresponding with sample image, will meet the instrument of similarity degree requirement to user into
Row is recommended, naturally it is also possible to directly.It is ascending according to COS distance, successively recommend same money, similar instrument,
Based on the same inventive concept, it is additionally provided in the embodiment of the application second aspect corresponding with instrument recognition methods
Identification device, the principle and the above-mentioned recognition methods of the embodiment of the present application solved the problems, such as due to the identification device in the embodiment of the present application
It is similar, therefore the implementation of device may refer to the implementation of method, overlaps will not be repeated.
The embodiment of the application second aspect, as shown in fig. 6, for a kind of instrument identification dress provided by the embodiment of the present application
It sets, which includes:
Training module 10 carries out model training to preliminary classification model for the sample image using an at least quasi-instrument,
Obtain final classification model;
Determining module 20 determines instrument to be identified for the Instruments Image of instrument to be identified to be input to final classification model
The corresponding first eigenvector of instrument classification and Instruments Image of device;
Searching module 30, for the instrument classification and first eigenvector according to instrument to be identified, in the spy pre-established
The instrument title of instrument to be identified is searched in sign database.
In one embodiment of the application, it is preferable that as shown in fig. 7, for a kind of instrument provided by the embodiment of the present application
Device identification device, the device include:
Categorization module 40, for according to instrument instrumental function and instrument appearance classify to sample image, obtain to
The sample graphics of a few quasi-instrument;
Training module 10 carries out model training to preliminary classification model for the sample image using an at least quasi-instrument,
Obtain final classification model;
Determining module 20 determines instrument to be identified for the Instruments Image of instrument to be identified to be input to final classification model
The corresponding first eigenvector of instrument classification and Instruments Image of device;
Searching module 30, for the instrument classification and first eigenvector according to instrument to be identified, in the spy pre-established
The instrument title of instrument to be identified is searched in sign database.
In one embodiment of the application, it is preferable that determining module 20 is also used to: sample image is separately input into
Final classification model determines second feature vector corresponding with sample image;The title of the instrument according to corresponding to sample image
And affiliated instrument classification, determine the second feature vector of sample image and the other corresponding pass of the title of instrument and instrument class
System;Property data base is established according to corresponding relationship.
In one embodiment of the application, it is preferable that searching module 30, be also used to from property data base obtain with to
The second feature vector of the identical sample image of instrument classification of identification instrument;Determining module 20, is also used to according to second feature
The similarity degree of vector sum first eigenvector determines the title of instrument to be identified.
In one embodiment of the application, it is preferable that instrument identification device further include: obtain module, for obtain with
The maximum second feature vector of first eigenvector similarity degree;It will be with the maximum second feature of first eigenvector similarity degree
The instrument title of the corresponding sample image of vector, the title as instrument to be identified.
In one embodiment of the application, it is preferable that instrument identification device further include: judgment module is also used to judge
Whether similarity degree is greater than or equal to preset threshold;If similarity degree is greater than or equal to preset threshold, output similarity degree is greater than
Or the instrument title of the corresponding sample image of second feature vector equal to preset threshold.
The embodiment of the application third aspect, as shown in figure 8, for a kind of electronic equipment provided by the embodiment of the present application
Structural schematic diagram, the electronic equipment include: processor 100, memory 200 and bus 300, and memory 200 is stored with processor
100 executable machine readable instructions pass through bus 300 when electronic equipment operation between processor 100 and memory 200
Communication is executed when machine readable instructions are executed by processor 100 and is executed instruction as follows:
Model training is carried out to preliminary classification model using the sample image of an at least quasi-instrument, obtains final classification mould
Type;
The Instruments Image of instrument to be identified is input to final classification model, determines the instrument classification and instrument of instrument to be identified
The corresponding first eigenvector of device image;
According to the instrument classification and first eigenvector of instrument to be identified, searched in the property data base pre-established to
The instrument title of identification instrument.
In one embodiment of the application, it is preferable that in the step of above-mentioned processor 100 executes, utilization is at least a kind of
The sample image of instrument carries out preliminary classification model before model training, further includes: according to the instrumental function and instrument of instrument
Appearance classifies to sample image, obtains the sample image of an at least quasi-instrument.
In one embodiment of the application, it is preferable that in the step of above-mentioned processor 100 executes, utilization is at least a kind of
The sample image of instrument carries out model training to preliminary classification model, after obtaining final classification model, further includes: by sample graph
As being separately input into final classification model, second feature vector corresponding with sample image is determined;According to corresponding to sample image
Instrument title and affiliated instrument classification, determine the second feature vector of sample image and the title and instrument of instrument
The corresponding relationship of classification;Property data base is established according to corresponding relationship.
In one embodiment of the application, it is preferable that in the step of above-mentioned processor 100 executes, what is pre-established
The instrument title of instrument to be identified is searched in property data base, comprising: the instrument with instrument to be identified is obtained from property data base
The second feature vector of the identical sample image of device classification;According to the similarity degree of second feature vector sum first eigenvector,
Determine the title of instrument to be identified.
In one embodiment of the application, it is preferable that in the step of above-mentioned processor 100 executes, according to second feature
The similarity degree of vector sum first eigenvector determines the title of instrument to be identified, comprising: obtains similar to first eigenvector
The maximum second feature vector of degree;It will sample graph corresponding with the maximum second feature vector of first eigenvector similarity degree
The instrument title of picture, the title as instrument to be identified.
In one embodiment of the application, it is preferable that in the step of above-mentioned processor 100 executes, judge similarity degree
Whether preset threshold is greater than or equal to;If similarity degree is greater than or equal to preset threshold, output similarity degree is greater than or equal to pre-
If the instrument title of the corresponding sample image of second feature vector of threshold value.
The embodiment of the application fourth aspect additionally provides a kind of computer readable storage medium, computer-readable storage
It is stored with computer program on medium, above-mentioned instrument recognition methods is executed when computer program is run by processor.
Specifically, computer readable storage medium can be general storage medium, such as mobile disk, hard disk, this is deposited
When computer program on storage media is run, it is able to carry out above-mentioned instrument recognition methods.
The computer program product of instrument recognition methods provided by the embodiment of the present application, including storing program code
Computer readable storage medium, the instruction that program code includes can be used for executing the method in previous methods embodiment, specific real
Now reference can be made to embodiment of the method, details are not described herein.
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description,
The specific work process of device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In several embodiments provided herein, it should be understood that disclosed systems, devices and methods, it can be with
It realizes by another way.The apparatus embodiments described above are merely exemplary, for example, the division of the unit,
Only a kind of logical function partition, there may be another division manner in actual implementation, in another example, multiple units or components can
To combine or be desirably integrated into another system, or some features can be ignored or not executed.Another point, it is shown or beg for
The mutual coupling, direct-coupling or communication connection of opinion can be through some communication interfaces, device or unit it is indirect
Coupling or communication connection can be electrical property, mechanical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit
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, read-only memory (Read-Only
Memory, ROM), random access memory (Random Access Memory, RAM), magnetic or disk etc. is various to deposit
Store up the medium of program code.
Finally, it should be noted that embodiment described above, the only specific embodiment of the application, to illustrate the application
Technical solution, rather than its limitations, the protection scope of the application is not limited thereto, although with reference to the foregoing embodiments to this Shen
It please be described in detail, those skilled in the art should understand that: anyone skilled in the art
Within the technical scope of the present application, it can still modify to technical solution documented by previous embodiment or can be light
It is readily conceivable that variation or equivalent replacement of some of the technical features;And these modifications, variation or replacement, do not make
The essence of corresponding technical solution is detached from the spirit and scope of the embodiment of the present application technical solution, should all cover the protection in the application
Within the scope of.Therefore, the protection scope of the application shall be subject to the protection scope of the claim.