CN107480273A - Picture Hash code generating method, device, picture retrieval method and device - Google Patents
Picture Hash code generating method, device, picture retrieval method and device Download PDFInfo
- Publication number
- CN107480273A CN107480273A CN201710716517.4A CN201710716517A CN107480273A CN 107480273 A CN107480273 A CN 107480273A CN 201710716517 A CN201710716517 A CN 201710716517A CN 107480273 A CN107480273 A CN 107480273A
- Authority
- CN
- China
- Prior art keywords
- picture
- hash
- mapping matrix
- matrix
- rbf
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/50—Information retrieval; Database structures therefor; File system structures therefor of still image data
- G06F16/58—Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
- G06F16/583—Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content
Landscapes
- Engineering & Computer Science (AREA)
- Library & Information Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
A kind of picture Hash code generating method, device, picture retrieval method and device provided in an embodiment of the present invention, are related to picture Processing Technique field.The picture Hash code generating method includes carrying out feature extraction to the picture got, obtains first eigenvector corresponding to the picture;The first eigenvector is normalized again, obtains second feature vector corresponding to the picture;The second feature vector and the first preset rules are then based on, obtain the first RBF mapping matrix corresponding to the picture;Based on the first RBF mapping matrix and the second preset rules, Hash codes corresponding to the picture are generated.It is simple to operate, efficiently.
Description
Technical field
The present invention relates to picture Processing Technique field, in particular to a kind of picture Hash code generating method, device,
Picture retrieval method and device.
Background technology
Extensive visual search is very crucial in the multimedia analysis application field based on content always, recently in computer
Vision and artificial intelligence community have attracted extensive research concern.However, with the popularization of network and digital device, management possesses
The database of millions of images becomes very universal, and in this case, it is not content with to all images in database
Carry out the cost that linear search expends on both time and internal memory.Nearest-neighbors are found different from huger real-valued
Precise search, approximate KNN (ANN) search just accomplished accurate search enough in numerous applications.It is many in the past
In the document of ANN methods, Hash, binary code, come into vogue in various computer visions and artificial intelligence application,
Such as picture search and retrieval, target detection, pattern-recognition.Existing generation Hash codes method is complicated, inaccurately.
The content of the invention
It is an object of the invention to provide a kind of picture Hash code generating method, device, picture retrieval method and device, with
Improve above mentioned problem.To achieve these goals, the technical scheme that the present invention takes is as follows:
In a first aspect, the embodiments of the invention provide a kind of picture Hash code generating method, methods described includes:To obtaining
The picture arrived carries out feature extraction, obtains first eigenvector corresponding to the picture;The first eigenvector is returned
One change is handled, and obtains second feature vector corresponding to the picture;Based on second feature vector and the first preset rules, obtain
Obtain the first RBF mapping matrix corresponding to the picture;It is pre- based on the first RBF mapping matrix and second
If regular, Hash codes corresponding to the picture are generated.
Second aspect, the embodiments of the invention provide a kind of picture Hash codes generating means, described device carries including feature
Take unit, normalization unit, first obtains unit and the second obtaining unit.Feature extraction unit, for the picture to getting
Feature extraction is carried out, obtains first eigenvector corresponding to the picture.Normalization unit, for the first eigenvector
It is normalized, obtains second feature vector corresponding to the picture.First obtains unit, for special based on described second
Sign vector and the first preset rules, obtain the first RBF mapping matrix corresponding to the picture.Second obtaining unit, use
In based on the first RBF mapping matrix and the second preset rules, Hash codes corresponding to the picture are generated.
The third aspect, the embodiments of the invention provide a kind of picture retrieval method, methods described includes:Pass through above-mentioned figure
Piece Hash code generating method generates Hash codes corresponding to picture to be retrieved;Based on Hash codes corresponding to the picture to be retrieved, from
Searched in default search library and export at least one arest neighbors image corresponding to the picture to be retrieved.
Fourth aspect, the embodiments of the invention provide a kind of picture searching device, described device includes generation unit and inspection
Cable elements.Generation unit, for generating Hash codes corresponding to picture to be retrieved by above-mentioned picture Hash code generating method.Inspection
Cable elements, for based on Hash codes corresponding to the picture to be retrieved, searching and exporting described to be retrieved from default search library
At least one arest neighbors image corresponding to picture.
A kind of picture Hash code generating method, device, picture retrieval method and device provided in an embodiment of the present invention, to obtaining
The picture got carries out feature extraction, obtains first eigenvector corresponding to the picture;The first eigenvector is entered again
Row normalized, obtain second feature vector corresponding to the picture;It is then based on second feature vector and first pre-
If regular, the first RBF mapping matrix corresponding to the picture is obtained;Square is mapped based on first RBF
Battle array and the second preset rules, generate Hash codes corresponding to the picture.It is simple to operate, efficiently.
Other features and advantages of the present invention will illustrate in subsequent specification, also, partly become from specification
It is clear that or by implementing understanding of the embodiment of the present invention.The purpose of the present invention and other advantages can be by saying what is write
Specifically noted structure is realized and obtained in bright book, claims and accompanying drawing.
Brief description of the drawings
In order to illustrate the technical solution of the embodiments of the present invention more clearly, below by embodiment it is required use it is attached
Figure is briefly described, it will be appreciated that the following drawings illustrate only certain embodiments of the present invention, therefore be not construed as pair
The restriction of scope, for those of ordinary skill in the art, on the premise of not paying creative work, can also be according to this
A little accompanying drawings obtain other related accompanying drawings.
Fig. 1 is the structured flowchart of electronic equipment provided in an embodiment of the present invention;
Fig. 2 is the flow chart of picture Hash code generating method provided in an embodiment of the present invention;
Fig. 3 is based on cifar-10 data sets and existing hash algorithm in picture retrieval method provided in an embodiment of the present invention
Accuracy rate and the relation schematic diagram of code length in comparing result;
Fig. 4 is based on cifar-10 data sets and existing hash algorithm in picture retrieval method provided in an embodiment of the present invention
The relation schematic diagram of accuracy rate and recall rate in comparing result;
Fig. 5 is based on cifar-10 data sets and existing hash algorithm in picture retrieval method provided in an embodiment of the present invention
Accuracy rate and the relation schematic diagram of sample size in comparing result;
Fig. 6 is based on cifar-10 data sets and existing hash algorithm in picture retrieval method provided in an embodiment of the present invention
Recall rate rate and the relation schematic diagram of sample size in comparing result;
Fig. 7 is based on minist data sets and existing hash algorithm pair in picture retrieval method provided in an embodiment of the present invention
Than accuracy rate in result and the relation schematic diagram of code length;
Fig. 8 is based on minist data sets and existing hash algorithm pair in picture retrieval method provided in an embodiment of the present invention
Than accuracy rate in result and the relation schematic diagram of recall rate;
Fig. 9 is based on minist data sets and existing hash algorithm pair in picture retrieval method provided in an embodiment of the present invention
Than accuracy rate in result and the relation schematic diagram of sample size;
Figure 10 is based on minist data sets and existing hash algorithm in picture retrieval method provided in an embodiment of the present invention
Recall rate rate and the relation schematic diagram of sample size in comparing result;
Figure 11 is to be calculated in picture retrieval method provided in an embodiment of the present invention based on ImageNet data sets and existing Hash
Accuracy rate and the relation schematic diagram of code length in method comparing result;
Figure 12 is to be calculated in picture retrieval method provided in an embodiment of the present invention based on ImageNet data sets and existing Hash
The relation schematic diagram of accuracy rate and recall rate in method comparing result;
Figure 13 is to be calculated in picture retrieval method provided in an embodiment of the present invention based on ImageNet data sets and existing Hash
Accuracy rate and the relation schematic diagram of sample size in method comparing result;
Figure 14 is to be calculated in picture retrieval method provided in an embodiment of the present invention based on ImageNet data sets and existing Hash
Recall rate rate and the relation schematic diagram of sample size in method comparing result;
Figure 15 is the structured flowchart of picture Hash codes generating means provided in an embodiment of the present invention;
Figure 16 is the structured flowchart of picture searching device provided in an embodiment of the present invention.
Embodiment
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention
In accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is
Part of the embodiment of the present invention, rather than whole embodiments.The present invention implementation being generally described and illustrated herein in the accompanying drawings
The component of example can be configured to arrange and design with a variety of.Therefore, the reality of the invention to providing in the accompanying drawings below
The detailed description for applying example is not intended to limit the scope of claimed invention, but is merely representative of the selected implementation of the present invention
Example.Based on the embodiment in the present invention, what those of ordinary skill in the art were obtained under the premise of creative work is not made
Every other embodiment, belongs to the scope of protection of the invention.
It should be noted that:Similar label and letter represents similar terms in following accompanying drawing, therefore, once a certain Xiang Yi
It is defined, then it further need not be defined and explained in subsequent accompanying drawing in individual accompanying drawing.Meanwhile the present invention's
In description, term " first ", " second " etc. are only used for distinguishing description, and it is not intended that instruction or hint relative importance.
Fig. 1 shows a kind of structured flowchart for the electronic equipment 100 that can be applied in the embodiment of the present invention.As shown in figure 1,
Electronic equipment 100 can include memory 102, storage control 104, one or more (one is only shown in Fig. 1) processors
106th, Peripheral Interface 108, input/output module 110, audio-frequency module 112, display module 114, radio-frequency module 116 and picture Hash
Code generation and picture searching device.
Memory 102, storage control 104, processor 106, Peripheral Interface 108, input/output module 110, audio mould
Directly or indirectly electrically connected between block 112, display module 114,116 each element of radio-frequency module, with realize the transmission of data or
Interaction.For example, electrical connection can be realized by one or more communication bus or signal bus between these elements.Picture Hash
Code generation and picture retrieval method can be stored in including at least one in the form of software or firmware (firmware) respectively
Software function module in reservoir 102, such as the software function mould that picture Hash codes generation and picture searching device include
Block or computer program.
Memory 102 can store various software programs and module, the picture Hash codes provided such as the embodiment of the present application
Programmed instruction/module corresponding to generation and picture retrieval method and device.Processor 106 is stored in memory 102 by operation
In software program and module, so as to perform various function application and data processing, that is, realize in the embodiment of the present application
Picture Hash codes generate and picture retrieval method.
Memory 102 can include but is not limited to random access memory (Random Access Memory, RAM), only
Read memory (Read Only Memory, ROM), programmable read only memory (Programmable Read-Only
Memory, PROM), erasable read-only memory (Erasable Programmable Read-Only Memory, EPROM),
Electricallyerasable ROM (EEROM) (Electric Erasable Programmable Read-Only Memory, EEPROM) etc..
Processor 106 can be a kind of IC chip, have signal handling capacity.Above-mentioned processor can be general
Processor, including central processing unit (Central Processing Unit, abbreviation CPU), network processing unit (Network
Processor, abbreviation NP) etc.;It can also be digital signal processor (DSP), application specific integrated circuit (ASIC), ready-made programmable
Gate array (FPGA) either other PLDs, discrete gate or transistor logic, discrete hardware components.It can
To realize or perform disclosed each method, step and the logic diagram in the embodiment of the present application.General processor can be micro-
Processor or the processor can also be any conventional processors etc..
Various input/output devices are coupled to processor 106 and memory 102 by the Peripheral Interface 108.At some
In embodiment, Peripheral Interface 108, processor 106 and storage control 104 can be realized in one single chip.Other one
In a little examples, they can be realized by independent chip respectively.
Input/output module 110 is used to be supplied to user input data to realize interacting for user and electronic equipment 100.It is described
Input/output module 110 may be, but not limited to, mouse and keyboard etc..
Audio-frequency module 112 provides a user COBBAIF, and it may include one or more microphones, one or more raises
Sound device and voicefrequency circuit.
Display module 114 provides an interactive interface (such as user interface) between electronic equipment 100 and user
Or referred to for display image data to user.In the present embodiment, the display module 114 can be liquid crystal display or touch
Control display.If touch control display, it can be that the capacitance type touch control screen or resistance-type for supporting single-point and multi-point touch operation touch
Control screen etc..Single-point and multi-point touch operation is supported to refer to that touch control display can sense on the touch control display one or more
Individual opening position is with caused touch control operation, and the touch control operation that this is sensed transfers to processor 106 to be calculated and handled.
Radio-frequency module 116 is used to receiving and sending electromagnetic wave, realizes the mutual conversion of electromagnetic wave and electric signal, so that with
Communication network or other equipment are communicated.
It is appreciated that structure shown in Fig. 1 is only to illustrate, electronic equipment 100 may also include it is more more than shown in Fig. 1 or
Less component, or there is the configuration different from shown in Fig. 1.Each component shown in Fig. 1 can use hardware, software or its
Combination is realized.
In the embodiment of the present invention, electronic equipment 100 can be used as user terminal, or as server.User terminal
Can be PC (personal computer) computer, tablet personal computer, mobile phone, notebook computer, intelligent television, set top box, vehicle-mounted
The terminal devices such as terminal.
Referring to Fig. 2, the embodiments of the invention provide a kind of picture Hash code generating method, methods described can include step
Rapid S200, step S210, step S220 and step S230.
Step S200:Feature extraction is carried out to the picture got, obtains first eigenvector corresponding to the picture.
Step S210:The first eigenvector is normalized, obtains second feature corresponding to the picture
Vector.
Step S220:Based on second feature vector and the first preset rules, the first footpath corresponding to the picture is obtained
To basic function mapping matrix.
First preset rules areBased on step S220, enter one
Step ground, the second feature vector is brought intoObtain corresponding to the picture
First RBF mapping matrix, x are second feature vector, and φ (x) is the first radial direction base letter corresponding to the picture
Number mapping matrix, a1,a2,…amRespectively m default characteristic vectors, δ is the first preset constant.
Step S230:Based on the first RBF mapping matrix and the second preset rules, the picture pair is generated
The Hash codes answered.
Second preset rules are f (x)=PTφ (x), based on step S230, further, by the described first radial direction
Basic function mapping matrix brings f (x)=P intoTφ (x), generates Hash codes corresponding to the picture, and φ (x) is the described first radial direction
Basic function mapping matrix, P are predetermined coefficient mapping matrix, and f (x) is Hash codes corresponding to the picture.
As a kind of embodiment, in order to obtain predetermined coefficient mapping matrix P, before step S220, methods described is also
It can include:
The multiple training sample pictures got are subjected to feature extraction, obtained corresponding to the multiple training sample picture
First eigenvector collection and initial Hash code collection;
For second feature vector set, x corresponding to the multiple training sample pictureiFor i-th
Second feature vector, B=[b corresponding to individual training sample picture1,b2,…,bn]∈{-1,1}n×rFor the Hash codes matrix, bi
∈{-1,1}n×1For Hash codes corresponding to i-th of training sample picture.
The first eigenvector collection is normalized, obtained second corresponding to the multiple training sample picture
Set of eigenvectors;
Based on the second feature vector set and first preset rules, calculate and obtain the multiple training sample picture
Corresponding second RBF mapping matrix;
Further, from the second feature vector setM second feature of middle random selection
Vector is as m default characteristic vector a1,a2,…am, bring each second feature vector into first preset rules and calculate, obtain
Second RBF mapping matrix corresponding to the multiple training sample picture.M default characteristic vector a1,a2,…amAlso may be used
To be referred to as m core, δ is the width of core.
Calculate and minimize corresponding to the first eigenvector collection any two data on the unit hyper-sphere of feature space
The difference of second cosine value on any two summit of the first cosine value hypercube corresponding with the initial Hash code collection of point,
Obtain the cost equation of hash function;
Further, the unit hyper-sphere for calculating and minimizing feature space corresponding to the first eigenvector collection is taken up an official post
First cosine value of two data points of anticipatingHypercube corresponding with the initial Hash code collection
Second cosine value on any two summit of bodyDifference, obtainBring arrangement into and obtain the cost equation of hash function:
Unsupervised hash algorithm is mainly by using data structure, distribution, topology information, etc. study binary code and
Hash function, including spectrum Hash (SH), binary system rebuild embedded Hash (BRE), PCA Hash, iterative quantization Hash (ITQ), angle
Metrization Hash (AQBC), anchor point figure Hash (AGH) etc..It is different from unsupervised scheme, there is supervision Hash to pass through sample class mark
Sign information learning Semantic Aware binary code and more effective hash function and, such as semi-supervised Hash (SSH), least disadvantage
Hash (MLH), there is supervision iterative quantization Hash (CCA-ITQ), the supervision Hash (KSH) based on kernel, supervise discrete Hash
(SDH) etc..
Most of above-mentioned hash methods are all designed to keep Euclidean distance similar, only seldom based on target
Hamming distance be difficult to optimize, and the angle between cosine binary code is easy to optimize, so selection cosine similarity.It is false
If input data is on a unit hyper-sphere, i.e., these characteristic vectors are normalized the unit length for making it have " 2 " norm.
It is readily apparent that paired Euclid's similarity is equivalent to paired cosine similarity under this setting.In super feature
It is naturally that original feature vector (rather than only in the positive deviation of a unit hyper-sphere), which keeps distribution,.It is different from AQBC,
Explore the corresponding binary code being made up of as far as possible many hypercube summits and rebuild original distribution.It is different from AQBC, this reality
Apply similitude of the Euclidean space with angle similarity space that example is directed to preserving the Hamming except different similarities, measurement.
As a kind of embodiment, continuous solving is carried out to first object equation, adds and loosens in the cost equation
Discrete constraint condition and the penalty term to error, obtain first object equation;
The first object equation is solved, obtains the predetermined coefficient mapping matrix.
Further, existDiscrete constraint condition and the penalty term to error are loosened in middle addition, obtain
First object equation:
Based on the first object equation, feature decomposition is carried out to correlation matrix, obtains weight matrix, and be based on the power
Weight matrix obtains Hash matrix;
Based on the Hash matrix, the second RBF mapping matrix and the 3rd preset rules, obtain described pre-
If coefficient mapping matrix;
Further, it is based onFeature decomposition is carried out to correlation matrix M, obtained
To preceding c characteristic vector, calculateAnd to Q Choleski decompositions Q=LLT, obtain L;Further it is calculated
WIt is nonopiate=LUc, and then obtain B=sgn (XW).
Wherein,For second feature vector set, x corresponding to the multiple training sample picturei
For second feature vector, B=[b corresponding to i-th of training sample picture1,b2,…,bn]∈{-1,1}n×rFor the Hash codes square
Battle array, bi∈{-1,1}n×1For Hash codes corresponding to i-th of training sample picture,For the power
Weight matrix, B=sgn (XW), M=XT(XXT)X+ηXTX, M are the correlation matrix, BTB=nIr, RTR=Ir, IrFor r × r list
Bit matrix, r are the digit of Hash codes, and η is the second preset constant, and ρ is the 3rd preset constant.
Further, the 3rd preset rules areBy the Hash
RBF mapping matrix corresponding to matrix, the multiple training sample picture brings the 3rd preset rules into, obtains institute
State predetermined coefficient mapping matrix;
Wherein, P is the predetermined coefficient mapping matrix, IsFor s × s unit matrix, φ (X) is the second radial direction base
Function Mapping matrix, B=[b1,b2,…,bn]∈{-1,1}n×rFor the Hash codes matrix, μ is the 4th preset constant, λ
Five preset constants.
As another embodiment, in order to obtain predetermined coefficient mapping matrix P, before step S220, methods described
It can also include:
The multiple training sample pictures got are subjected to feature extraction, obtained corresponding to the multiple training sample picture
First eigenvector collection and initial Hash code collection;
The first eigenvector collection is normalized, obtained second corresponding to the multiple training sample picture
Set of eigenvectors;
Based on the second feature vector set and first preset rules, calculate and obtain the multiple training sample picture
Corresponding second RBF mapping matrix;
Calculate and minimize corresponding to the first eigenvector collection any two data on the unit hyper-sphere of feature space
The difference of second cosine value on any two summit of the first cosine value hypercube corresponding with the initial Hash code collection of point,
Obtain the cost equation of hash function;
The cost equation of the hash function is converted into the second target equation, the second target equation carried out discrete
Solve, obtain the predetermined coefficient mapping matrix.
Further, the second target equation is:
In the second target equation,The Frobenius norms of representing matrix, predetermined coefficient mapping matrixThe mapping relations of the feature space after kernel operation is handled and Hash code space are represented, are introduced auxiliary
Help similar matrix Z to help train, and meet BTB=nIr, RTR=Ir, RTR=Ir, ZTZ=nIr, 1TB=0,1TZ=0.Balance
Parameter lambda, μ, γ are the number more than 0.
It is fixed except P all variables based on the second target equation, it can obtain:
Wherein, P is the predetermined coefficient mapping matrix, IsFor s × s unit matrix, φ (X) is the second radial direction base
Function Mapping matrix, B=[b1,b2,…,bn]∈{-1,1}n×rFor the Hash codes matrix, μ is the 4th preset constant, λ
Five preset constants.
In addition, the second target equation is based on, and it is fixed except R all variables, it can obtain:
By to BTφ (X) P carries out singular value decompositionObtain
It is fixed except B all variables based on the second target equation, it can obtain:
s.t.B∈{-1,1}n×r
XXTFor a positive semidefinite matrix, pass through minimax algorithm.If rewriting above formula with g (B), can obtainWherein,
It is fixed except B all variables based on the second target equation, it can obtain:Make a center
Matrix C=In-11T/ n, and bySingular value decomposition obtains:
The embodiments of the invention provide a kind of picture Hash code generating method, and feature extraction is carried out to the picture got,
Obtain first eigenvector corresponding to the picture;The first eigenvector is normalized again, obtains the figure
Second feature vector corresponding to piece;The second feature vector and the first preset rules are then based on, it is corresponding to obtain the picture
The first RBF mapping matrix;Based on the first RBF mapping matrix and the second preset rules, institute is generated
State Hash codes corresponding to picture.It is simple to operate, efficiently.
The embodiments of the invention provide a kind of picture retrieval method, methods described includes:
Hash codes corresponding to picture to be retrieved are generated by above-mentioned picture Hash code generating method;
Based on Hash codes corresponding to the picture to be retrieved, searched from default search library and export the picture to be retrieved
Corresponding at least one arest neighbors image.
It is understood that picture retrieval method provided in an embodiment of the present invention, may be referred to foregoing picture Hash codes life
It is succinct in order to describe into method, repeat no more here.
In order to which the beneficial effect of picture retrieval method provided in an embodiment of the present invention is further illustrated, below with three
Cifar -10, minist, ImageNet data set illustrate.
After all image feature datas are normalized, with existing hash algorithm such as local sensitivity Hash (LSH), spectrum
Hash (SH), binary system rebuild embedded Hash (BRE), PCA Hash, iterative quantization Hash (ITQ), angular quantification Hash
(AQBC), shift features core position sensitive hash (SIKH), etc. tropism Hash (IsoH), maximum search inner product Hash
(AIBC) contrasted.For the picture retrieval method of continuous solving, η=10 are made4, ρ=106.For the picture of discrete solution
Search method, σ=1 is made, and there are λ=10 in cifar-10 and minist data sets6, γ=104, μ=106, ImageNet numbers
According to concentration λ=105, γ=104, μ=105.As a result as shown in Fig. 3 to Figure 14, a1 represents the picture retrieval that present example provides
The result of method, a2-a10 represent ITQ, PCA, AQBC, BRE, AIBC, SIKH, LSH, SH, IsoH result.Fig. 3-Fig. 6 distinguishes
For based on cifar -10 data sets, the abscissa in Fig. 3 is code length, and ordinate is accuracy rate, and the abscissa in Fig. 4 is calls together
The rate of returning, ordinate are accuracy rate, and the abscissa in Fig. 5 is number of samples, and ordinate is accuracy rate, and the abscissa in Fig. 6 is sample
This number, ordinate are recall rate;Fig. 7-Figure 10 is respectively to be based on minist data sets, and the abscissa in Fig. 7 is code length,
Ordinate is accuracy rate, and the abscissa in Fig. 8 is recall rate, and ordinate is accuracy rate, and the abscissa in Fig. 9 is number of samples,
Ordinate is accuracy rate, and the abscissa in Figure 10 is number of samples, and ordinate is recall rate;Figure 11-Figure 14 is respectively to be based on
ImageNet data sets, the abscissa in Figure 11 are code length, and ordinate is accuracy rate, and the abscissa in Figure 12 is recalls
Rate, ordinate are accuracy rate, and the abscissa in Figure 13 is number of samples, and ordinate is accuracy rate, and the abscissa in Figure 14 is sample
This number, ordinate are recall rate.In Fig. 6-Figure 14, a1 curves are above a2-a10 curves, can obtain implementation of the present invention
The effect for the picture retrieval method that example provides is better than existing hash method.
The embodiments of the invention provide a kind of picture retrieval method, the picture retrieval method includes passing through above-mentioned picture
Hash code generating method generates Hash codes corresponding to picture to be retrieved;Based on Hash codes corresponding to the picture to be retrieved, from pre-
If searched in search library and export at least one arest neighbors image corresponding to the picture to be retrieved.Recall precision is high, the degree of accuracy
It is high.
Figure 15 is referred to, the embodiments of the invention provide a kind of picture Hash codes generating means 300, the picture Hash codes
Generating means 300 can include feature extraction unit 320, normalization unit 330, first obtains unit 340 and second and obtain list
Member 350.
Feature extraction unit 320, for carrying out feature extraction to the picture got, obtain first corresponding to the picture
Characteristic vector.
Normalization unit 330, for the first eigenvector to be normalized, obtain corresponding to the picture
Second feature vector.
First obtains unit 340, for based on second feature vector and the first preset rules, obtaining the picture pair
The the first RBF mapping matrix answered.
Second obtaining unit 350, for based on the first RBF mapping matrix and the second preset rules, generation
Hash codes corresponding to the picture.
First obtains unit 340 can include first and obtain subelement 341.
First preset rules areFirst obtains son
Unit 341, for the second feature vector to be brought intoObtain
The first RBF mapping matrix corresponding to the picture is obtained, x is second feature vector, and φ (x) is the picture pair
The the first RBF mapping matrix answered, a1,a2,…amRespectively m default characteristic vectors, δ is the first preset constant.
Second obtaining unit 350 can include second and obtain subelement 351.
Second preset rules are f (x)=PTφ (x), second obtain subelement 351, for will described first radial direction
Basic function mapping matrix brings f (x)=P intoTφ (x), generates Hash codes corresponding to the picture, and φ (x) is the described first radial direction
Basic function mapping matrix, P are predetermined coefficient mapping matrix, and f (x) is Hash codes corresponding to the picture.
The picture Hash codes generating means 300 can also include the first training unit 310.
First training unit 310, for the multiple training sample pictures got to be carried out into feature extraction, obtain described more
First eigenvector collection and initial Hash code collection corresponding to individual training sample picture;Normalizing is carried out to the first eigenvector collection
Change is handled, and obtains second feature vector set corresponding to the multiple training sample picture;Based on the second feature vector set and
First preset rules, calculate and obtain the second RBF mapping matrix corresponding to the multiple training sample picture;Meter
Calculate and minimize corresponding to the first eigenvector collection more than first of any two data point on the unit hyper-sphere of feature space
The difference of second cosine value on any two summit of string value hypercube corresponding with the initial Hash code collection, obtain Hash letter
Several cost equations;Added in the cost equation and loosen discrete constraint condition and the penalty term to error, obtain first
Target equation;The first object equation is solved, obtains the predetermined coefficient mapping matrix.
First training unit 310 can include the first training subelement 311.
The cost equation isIt is described first training subelement 311, forIn plus
Enter to loosen discrete constraint condition and the penalty term to error, obtain first object equation:
Based on the first object equation, feature decomposition is carried out to correlation matrix, obtains weight matrix, and obtain based on the weight matrix
Obtain Hash matrix;Based on the Hash matrix, the second RBF mapping matrix and the 3rd preset rules, described in acquisition
Predetermined coefficient mapping matrix;Wherein,For second feature corresponding to the multiple training sample picture
Vector set, xiFor second feature vector, B=[b corresponding to i-th of training sample picture1,b2,…,bn]∈{-1,1}n×rFor institute
State Hash codes matrix, bi∈{-1,1}n×1For Hash codes corresponding to i-th of training sample picture,For
The weight matrix, B=sgn (XW), M=XT(XXT)X+ηXTX, M are the correlation matrix, BTB=nIr, RTR=Ir, IrFor r
× r unit matrix, r are the digit of Hash codes, and η is the second preset constant, and ρ is the 3rd preset constant.
3rd preset rules areThe first training subelement
311, it is additionally operable to bring into RBF mapping matrix corresponding to the Hash matrix, the multiple training sample picture described
3rd preset rules, obtain the predetermined coefficient mapping matrix;Wherein, P is the predetermined coefficient mapping matrix, IsFor s × s's
Unit matrix, φ (X) are the second RBF mapping matrix, B=[b1,b2,…,bn]∈{-1,1}n×rFor the Kazakhstan
Uncommon code matrix, μ is the 4th preset constant, and λ is the 5th preset constant.
The picture Hash codes generating means 300 can also include the second training unit 312.
Second training unit 312, for the multiple training sample pictures got to be carried out into feature extraction, obtain described more
First eigenvector collection and initial Hash code collection corresponding to individual training sample picture;Normalizing is carried out to the first eigenvector collection
Change is handled, and obtains second feature vector set corresponding to the multiple training sample picture;Based on the second feature vector set and
First preset rules, calculate and obtain the second RBF mapping matrix corresponding to the multiple training sample picture;Meter
Calculate and minimize corresponding to the first eigenvector collection more than first of any two data point on the unit hyper-sphere of feature space
The difference of second cosine value on any two summit of string value hypercube corresponding with the initial Hash code collection, obtain Hash letter
Several cost equations;The cost equation of the hash function is converted into the second target equation, the second target equation is entered
The discrete solution of row, obtains the predetermined coefficient mapping matrix.
Above each unit can be that now, above-mentioned each unit can be stored in memory 102 by software code realization.
Above each unit can equally be realized by hardware such as IC chip.
Picture Hash codes generating means 300 provided in an embodiment of the present invention, its realization principle and caused technique effect and
Preceding method embodiment is identical, and to briefly describe, device embodiment part does not refer to part, refers to foregoing picture Hash codes life
The corresponding contents into embodiment of the method.
Figure 16 is referred to, the embodiments of the invention provide a kind of picture searching device 400, described device can include generation
Unit 410 and retrieval unit 420.
Generation unit 410, for generating Hash corresponding to picture to be retrieved by above-mentioned picture Hash code generating method
Code.
Retrieval unit 420, for based on Hash codes corresponding to the picture to be retrieved, being searched from default search library and defeated
Go out at least one arest neighbors image corresponding to the picture to be retrieved.
Above each unit can be that now, above-mentioned each unit can be stored in memory 102 by software code realization.
Above each unit can equally be realized by hardware such as IC chip.
Picture searching device 400 provided in an embodiment of the present invention, its realization principle and caused technique effect and foregoing side
Method embodiment is identical, and to briefly describe, device embodiment part does not refer to part, refers to foregoing picture retrieval method embodiment
Middle corresponding contents.
In several embodiments provided herein, it should be understood that disclosed apparatus and method, can also pass through
Other modes are realized.Device embodiment described above is only schematical, for example, flow chart and block diagram in accompanying drawing
Show the device of multiple embodiments according to the present invention, method and computer program product architectural framework in the cards,
Function and operation.At this point, each square frame in flow chart or block diagram can represent the one of a module, program segment or code
Part, a part for the module, program segment or code include one or more and are used to realize holding for defined logic function
Row instruction.It should also be noted that at some as in the implementation replaced, the function that is marked in square frame can also with different from
The order marked in accompanying drawing occurs.For example, two continuous square frames can essentially perform substantially in parallel, they are sometimes
It can perform in the opposite order, this is depending on involved function.It is it is also noted that every in block diagram and/or flow chart
The combination of individual square frame and block diagram and/or the square frame in flow chart, function or the special base of action as defined in performing can be used
Realize, or can be realized with the combination of specialized hardware and computer instruction in the system of hardware.
In addition, each functional module in each embodiment of the present invention can integrate to form an independent portion
Point or modules individualism, can also two or more modules be integrated to form an independent part.
If the function is realized in the form of software function module and is used as independent production marketing or in use, can be with
It is stored in a computer read/write memory medium.Based on such understanding, technical scheme is substantially in other words
The part to be contributed to prior art or the part of the technical scheme can be embodied in the form of software product, the meter
Calculation machine software product is stored in a storage medium, including some instructions are causing a computer equipment (can be
People's computer, server, or network equipment etc.) perform all or part of step of each embodiment methods described of the present invention.
And foregoing storage medium includes:USB flash disk, mobile hard disk, read-only storage (ROM, Read-Only Memory), arbitrary access are deposited
Reservoir (RAM, Random Access Memory), magnetic disc or CD etc. are various can be with the medium of store program codes.Need
Illustrate, herein, such as first and second or the like relational terms be used merely to by an entity or operation with
Another entity or operation make a distinction, and not necessarily require or imply between these entities or operation any this reality be present
The relation or order on border.Moreover, term " comprising ", "comprising" or its any other variant are intended to the bag of nonexcludability
Contain, so that process, method, article or equipment including a series of elements not only include those key elements, but also including
The other element being not expressly set out, or also include for this process, method, article or the intrinsic key element of equipment.
In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that including the key element
Process, method, other identical element also be present in article or equipment.
The preferred embodiments of the present invention are the foregoing is only, are not intended to limit the invention, for the skill of this area
For art personnel, the present invention can have various modifications and variations.Within the spirit and principles of the invention, that is made any repaiies
Change, equivalent substitution, improvement etc., should be included in the scope of the protection.It should be noted that:Similar label and letter exists
Similar terms is represented in following accompanying drawing, therefore, once being defined in a certain Xiang Yi accompanying drawing, is then not required in subsequent accompanying drawing
It is further defined and explained.
The foregoing is only a specific embodiment of the invention, but protection scope of the present invention is not limited thereto, any
Those familiar with the art the invention discloses technical scope in, change or replacement can be readily occurred in, should all be contained
Cover within protection scope of the present invention.Therefore, protection scope of the present invention described should be defined by scope of the claims.
It should be noted that herein, such as first and second or the like relational terms are used merely to a reality
Body or operation make a distinction with another entity or operation, and not necessarily require or imply and deposited between these entities or operation
In any this actual relation or order.Moreover, term " comprising ", "comprising" or its any other variant are intended to
Nonexcludability includes, so that process, method, article or equipment including a series of elements not only will including those
Element, but also the other element including being not expressly set out, or it is this process, method, article or equipment also to include
Intrinsic key element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that
Other identical element also be present in process, method, article or equipment including the key element.
Claims (10)
1. a kind of picture Hash code generating method, it is characterised in that methods described includes:
Feature extraction is carried out to the picture got, obtains first eigenvector corresponding to the picture;
The first eigenvector is normalized, obtains second feature vector corresponding to the picture;
Based on second feature vector and the first preset rules, obtain the first RBF corresponding to the picture and map square
Battle array;
Based on the first RBF mapping matrix and the second preset rules, Hash codes corresponding to the picture are generated.
2. according to the method for claim 1, first preset rules areIt is described that rule are preset based on second feature vector and first
Then, the first RBF mapping matrix corresponding to the picture is obtained, including:
The second feature vector is brought intoObtain the figure
First RBF mapping matrix corresponding to piece, x are second feature vector, and φ (x) is first corresponding to the picture
RBF mapping matrix, a1,a2,…amRespectively m default characteristic vectors, δ is the first preset constant.
3. according to the method for claim 2, second preset rules are f (x)=PTφ (x), it is described to be based on described first
RBF mapping matrix and the second preset rules, generate the picture corresponding to Hash codes include:
Bring the first RBF mapping matrix into f (x)=PTφ (x), generate Hash codes corresponding to the picture, φ
(x) it is the first RBF mapping matrix, P is predetermined coefficient mapping matrix, and f (x) is Hash corresponding to the picture
Code.
4. according to the method for claim 3, it is characterised in that based on the second feature vector and the first preset rules,
Before obtaining RBF mapping matrix corresponding to the picture, methods described also includes:
The multiple training sample pictures got are subjected to feature extraction, obtained first corresponding to the multiple training sample picture
Set of eigenvectors and initial Hash code collection;
The first eigenvector collection is normalized, obtains second feature corresponding to the multiple training sample picture
Vector set;
Based on the second feature vector set and first preset rules, it is corresponding to calculate the multiple training sample picture of acquisition
The second RBF mapping matrix;
Calculate and minimize corresponding to the first eigenvector collection any two data point on the unit hyper-sphere of feature space
The difference of second cosine value on any two summit of the first cosine value hypercube corresponding with the initial Hash code collection, obtain
The cost equation of hash function;
Added in the cost equation and loosen discrete constraint condition and the penalty term to error, obtain first object equation;
The first object equation is solved, obtains the predetermined coefficient mapping matrix.
5. according to the method for claim 4, it is characterised in that the cost equation isIt is described to institute
State first object equation to be solved, obtain the predetermined coefficient mapping matrix, including:
Discrete constraint condition and the penalty term to error are loosened in middle addition, obtain first object equation:
Based on the first object equation, feature decomposition is carried out to correlation matrix, obtains weight matrix, and be based on the weight square
Battle array obtains Hash matrix;
Based on the Hash matrix, the second RBF mapping matrix and the 3rd preset rules, the default system is obtained
Number mapping matrix;
Wherein,For second feature vector set, x corresponding to the multiple training sample pictureiFor
Second feature vector, B=[b corresponding to i training sample picture1,b2,…,bn]∈{-1,1}n×rFor the Hash codes matrix,
bi∈{-1,1}n×1For Hash codes corresponding to i-th of training sample picture,For the weight square
Battle array, B=sgn (XW), M=XT(XXT)X+ηXTX, M are the correlation matrix, BTB=nIr, RTR=Ir, IrFor r × r unit square
Battle array, r are the digit of Hash codes, and η is the second preset constant, and ρ is the 3rd preset constant.
6. according to the method for claim 5, it is characterised in that the 3rd preset rules areIt is described that square is mapped based on the Hash matrix, second RBF
Battle array and the 3rd preset rules, obtain the predetermined coefficient mapping matrix, including:
It is pre- to bring RBF mapping matrix corresponding to the Hash matrix, the multiple training sample picture the into described 3rd
If regular, the predetermined coefficient mapping matrix is obtained;
Wherein, P is the predetermined coefficient mapping matrix, IsFor s × s unit matrix, φ (X) is second RBF
Mapping matrix, B=[b1,b2,…,bn]∈{-1,1}n×rFor the Hash codes matrix, μ is the 4th preset constant, and λ is the 5th pre-
If constant.
7. according to the method for claim 3, it is characterised in that based on the second feature vector and the first preset rules,
Before obtaining RBF mapping matrix corresponding to the picture, methods described also includes:
The multiple training sample pictures got are subjected to feature extraction, obtained first corresponding to the multiple training sample picture
Set of eigenvectors and initial Hash code collection;
The first eigenvector collection is normalized, obtains second feature corresponding to the multiple training sample picture
Vector set;
Based on the second feature vector set and first preset rules, it is corresponding to calculate the multiple training sample picture of acquisition
The second RBF mapping matrix;
Calculate and minimize corresponding to the first eigenvector collection any two data point on the unit hyper-sphere of feature space
The difference of second cosine value on any two summit of the first cosine value hypercube corresponding with the initial Hash code collection, obtain
The cost equation of hash function;
The cost equation of the hash function is converted into the second target equation, discrete ask is carried out to the second target equation
Solution, obtains the predetermined coefficient mapping matrix.
8. a kind of picture Hash codes generating means, it is characterised in that described device includes:
Feature extraction unit, for carrying out feature extraction to the picture that gets, obtain fisrt feature corresponding to the picture to
Amount;
Normalization unit, for the first eigenvector to be normalized, obtain the second spy corresponding to the picture
Sign vector;
First obtains unit, for based on second feature vector and the first preset rules, obtaining corresponding to the picture the
One RBF mapping matrix;
Second obtaining unit, for based on the first RBF mapping matrix and the second preset rules, generating the figure
Hash codes corresponding to piece.
9. a kind of picture retrieval method, it is characterised in that methods described includes:
Hash corresponding to picture to be retrieved is generated by the picture Hash code generating method as described in claim any one of 1-7
Code;
Based on Hash codes corresponding to the picture to be retrieved, searched from default search library and export the picture to be retrieved correspondingly
At least one arest neighbors image.
10. a kind of picture searching device, it is characterised in that described device includes:
Generation unit, for generating figure to be retrieved by the picture Hash code generating method as described in claim any one of 1-7
Hash codes corresponding to piece;
Retrieval unit, for based on Hash codes corresponding to the picture to be retrieved, searching and exporting described from default search library
At least one arest neighbors image corresponding to picture to be retrieved.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710716517.4A CN107480273B (en) | 2017-08-21 | 2017-08-21 | Picture hash code generation method and device and picture retrieval method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710716517.4A CN107480273B (en) | 2017-08-21 | 2017-08-21 | Picture hash code generation method and device and picture retrieval method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107480273A true CN107480273A (en) | 2017-12-15 |
CN107480273B CN107480273B (en) | 2020-06-19 |
Family
ID=60601029
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710716517.4A Active CN107480273B (en) | 2017-08-21 | 2017-08-21 | Picture hash code generation method and device and picture retrieval method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107480273B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109036439A (en) * | 2018-08-24 | 2018-12-18 | 兰州理工大学 | A kind of perceptual hash feature extraction method and system encrypting voice signal |
CN110275991A (en) * | 2019-06-03 | 2019-09-24 | 腾讯科技(深圳)有限公司 | The determination method and apparatus of cryptographic Hash, storage medium, electronic device |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104834693A (en) * | 2015-04-21 | 2015-08-12 | 上海交通大学 | Depth-search-based visual image searching method and system thereof |
-
2017
- 2017-08-21 CN CN201710716517.4A patent/CN107480273B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104834693A (en) * | 2015-04-21 | 2015-08-12 | 上海交通大学 | Depth-search-based visual image searching method and system thereof |
Non-Patent Citations (1)
Title |
---|
LU FENG等: "Supervised Class Graph Preserving Hashing for Image Retrieval and Classification", 《SPRINGERLINK》 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109036439A (en) * | 2018-08-24 | 2018-12-18 | 兰州理工大学 | A kind of perceptual hash feature extraction method and system encrypting voice signal |
CN110275991A (en) * | 2019-06-03 | 2019-09-24 | 腾讯科技(深圳)有限公司 | The determination method and apparatus of cryptographic Hash, storage medium, electronic device |
CN110275991B (en) * | 2019-06-03 | 2021-05-14 | 腾讯科技(深圳)有限公司 | Hash value determination method and device, storage medium and electronic device |
Also Published As
Publication number | Publication date |
---|---|
CN107480273B (en) | 2020-06-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108334574B (en) | Cross-modal retrieval method based on collaborative matrix decomposition | |
Yu et al. | Semantic preserving distance metric learning and applications | |
Zhu et al. | Unsupervised visual hashing with semantic assistant for content-based image retrieval | |
Liu et al. | Query-adaptive reciprocal hash tables for nearest neighbor search | |
Li et al. | Spectral hashing with semantically consistent graph for image indexing | |
Rehman et al. | Content based image retrieval: survey | |
CN112395506A (en) | Information recommendation method and device, electronic equipment and storage medium | |
Zhang et al. | Personalized recommendation of social images by constructing a user interest tree with deep features and tag trees | |
Liu et al. | Weakly supervised graph propagation towards collective image parsing | |
Niu et al. | Knowledge-based topic model for unsupervised object discovery and localization | |
Ding et al. | Novelty detection using level set methods | |
Li et al. | Hashing with dual complementary projection learning for fast image retrieval | |
CN113254354A (en) | Test case recommendation method and device, readable storage medium and electronic equipment | |
Samantaray et al. | New design of adaptive Gabor wavelet filter bank for medical image retrieval | |
Patro et al. | Dictionary-based classifiers for exploiting feature sequence information and their application to hyperspectral remotely sensed data | |
Al-Garaawi et al. | BRIEF-based face descriptor: an application to automatic facial expression recognition (AFER) | |
CN107480273A (en) | Picture Hash code generating method, device, picture retrieval method and device | |
Li et al. | Speed up dynamic time warpingof multivariate time series | |
Liang et al. | Semi-supervised image clustering with multi-modal information | |
Elleuch et al. | A generic framework for semantic video indexing based on visual concepts/contexts detection | |
Lv et al. | Retrieval oriented deep feature learning with complementary supervision mining | |
Bhardwaj et al. | A futuristic hybrid image retrieval system based on an effective indexing approach for swift image retrieval | |
Rad et al. | A multi-view-group non-negative matrix factorization approach for automatic image annotation | |
Li et al. | Semi-supervised emotional classification of color images by learning from cloud | |
Van Le et al. | An efficient pretopological approach for document clustering |
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 |