Search method, device, equipment and the storage medium of target image
Technical field
This application involves field of image search, in particular to a kind of search method of target image, device, equipment and storage
Medium.
Background technique
During carrying out target image retrieval, researcher often examines target image by structured features
Rope.The structured features of one target image can be described as the attribute of target in the target image, for example, when target image is
Whether when people, structured features be can be described as: being women, if be long hair, if wear trousers, if having thing in arms, if
It is back side etc..
Currently, during carrying out target image retrieval, often according to the structured features of the target image extracted
Target image is indexed, but extracts inaccuracy due to that there can be structured features, and to the accuracy band of search result
To influence.
The technical issues of accuracy for how improving search result is this field urgent need to resolve.
Summary of the invention
The search method for being designed to provide a kind of target image, device, equipment and the storage medium of the application, to solve
The prior art is not enough to generate the technical issues of being largely used to the labeled data of training information extraction model.
In a first aspect, the embodiment of the present application provides a kind of search method of target image, comprising:
Determine the first structure feature vector of target image to be retrieved;The first structure feature vector is that attribute is special
Levy sequence;
The description of the first structure feature vector is standardized;
According to the accuracy rate for extracting attributive character, the first structure feature vector after the standardization is carried out at layering
Reason, obtains corresponding at least two subvector;
Image data base is retrieved by different level according at least two subvector, obtains target image set.
In one possible implementation, in the above method provided by the embodiments of the present application, it is described according to extremely
Before few two subvectors retrieve by different level to image data base, further includes:
Extract the second structured features vector and the second structured features vector pair of each image in image data base
The confidence level vector answered;The second structured features vector is corresponding with the element of the first structure feature vector;
The description of the second structured features vector is standardized;
The second structured features vector after standardization is done into multiplication with the confidence level vector, it is special to obtain third structuring
Levy vector;
Layered shaping identical with the first structure feature vector is carried out to the third structured features vector, is obtained
To corresponding at least two subvector.
In one possible implementation, described to be belonged to according to extraction in the above method provided by the embodiments of the present application
Property feature accuracy rate, to after the standardization first structure feature vector carry out layered shaping, obtain it is corresponding at least
Two subvectors, comprising:
First structure feature vector after the standardization is divided into the first subvector and the second subvector;First son
The corresponding extraction accuracy rate of attributive character is more than or equal to default accuracy rate in vector, and attributive character is corresponding in second subvector
Extraction accuracy rate be less than the default accuracy rate.
In one possible implementation, described to the third in the above method provided by the embodiments of the present application
Structured features vector carries out layered shaping identical with the first structure feature vector, obtains corresponding at least two son
Vector, comprising:
The third structured features vector is divided into third subvector and the 4th subvector;The third subvector and institute
It is corresponding to state the first subvector, the 4th subvector is corresponding with second subvector.
In one possible implementation, in the above method provided by the embodiments of the present application, it is described according to extremely
Few two subvectors retrieve image data base by different level, obtain target image set, comprising:
Based on the first Euclidean distance between the third subvector and first subvector, in image data base into
Row retrieval, obtains the first retrieval image collection;
Image in the first retrieval image collection is ranked up from small to large according to the first Euclidean distance, the row of selection
The first forward quantity image of sequence retrieves image collection as second, sorts in reservation the second retrieval image collection forward
The second quantity image as third retrieve image collection;
Based on the second Euclidean distance between the 4th subvector and second subvector, in the second retrieval figure
Image set is retrieved in closing, and obtains the 4th retrieval image collection;
Image in the 4th retrieval image collection is ranked up from small to large according to the second Euclidean distance, the row of selection
The forward third quantity image of sequence is as the 5th retrieval image collection;
The third is retrieved into image collection and the 5th retrieval image collection carries out taking union operation, obtains target figure
Image set closes.
Second aspect, the embodiment of the present application provide a kind of retrieval device of target image, comprising:
Determining module, for determining the first structure feature vector of target image to be retrieved;The first structureization is special
Sign vector is attributive character sequence;
Standardized module is standardized for the description to the first structure feature vector;
Hierarchical block, for the accuracy rate according to extraction attributive character, to the first structure feature after the standardization
Vector carries out layered shaping, obtains corresponding at least two subvector;
Retrieval module obtains mesh for being retrieved by different level according at least two subvector to image data base
Logo image set.
In one possible implementation, in above-mentioned apparatus provided by the embodiments of the present application, further includes:
Preprocessing module, for being divided according at least two subvector image data base in the retrieval module
Level retrieval before, extract image data base in each image the second structured features vector and second structured features to
Measure corresponding confidence level vector;The second structured features vector is corresponding with the element of the first structure feature vector;
The description of the second structured features vector is standardized;By after standardization the second structured features vector with
The confidence level vector does multiplication, obtains third structured features vector;To third structured features vector progress and institute
The identical layered shaping of first structure feature vector is stated, corresponding at least two subvector is obtained.
In one possible implementation, in above-mentioned apparatus provided by the embodiments of the present application, the hierarchical block, tool
Body is used for:
First structure feature vector after the standardization is divided into the first subvector and the second subvector;First son
The corresponding extraction accuracy rate of attributive character is more than or equal to default accuracy rate in vector, and attributive character is corresponding in second subvector
Extraction accuracy rate be less than the default accuracy rate.
In one possible implementation, in above-mentioned apparatus provided by the embodiments of the present application, the preprocessing module,
It is specifically used for:
The third structured features vector is divided into third subvector and the 4th subvector;The third subvector and institute
It is corresponding to state the first subvector, the 4th subvector is corresponding with second subvector.
In one possible implementation, in above-mentioned apparatus provided by the embodiments of the present application, the retrieval module, tool
Body is used for:
Based on the first Euclidean distance between the third subvector and first subvector, in image data base into
Row retrieval, obtains the first retrieval image collection;
Image in the first retrieval image collection is ranked up from small to large according to the first Euclidean distance, the row of selection
The first forward quantity image of sequence retrieves image collection as second, sorts in reservation the second retrieval image collection forward
The second quantity image as third retrieve image collection;
Based on the second Euclidean distance between the 4th subvector and second subvector, in the second retrieval figure
Image set is retrieved in closing, and obtains the 4th retrieval image collection;
Image in the 4th retrieval image collection is ranked up from small to large according to the second Euclidean distance, the row of selection
The forward third quantity image of sequence is as the 5th retrieval image collection;
The third is retrieved into image collection and the 5th retrieval image collection carries out taking union operation, obtains target figure
Image set closes.
The third aspect, the embodiment of the present application provide a kind of electronic equipment, comprising: memory and processor;
The memory, for storing computer program;
Wherein, the processor executes the computer program in the memory, to realize above-mentioned first aspect and
Method described in each embodiment of one side.
Fourth aspect, the embodiment of the present application provide a kind of computer readable storage medium, the computer-readable storage
Computer program is stored in medium, for realizing above-mentioned first aspect and when the computer program is executed by processor
Method described in each embodiment of one side.
Compared with prior art, the search method of target image provided by the present application, device, equipment and storage medium, really
The first structure feature vector of fixed target image to be retrieved, is standardized the description of the first structure feature vector
Processing carries out layered shaping to the first structure feature vector after the standardization according to the accuracy rate for extracting attributive character,
Corresponding at least two subvector is obtained, image data base is retrieved by different level according at least two subvector, is obtained
To target image set.By being retrieved by different level according to the extraction accuracy rate of attributive character to structured features, Neng Gou
Retrieval accuracy is improved to a certain extent, is weakened structured features and is extracted inaccurate bring influence.
Detailed description of the invention
Fig. 1 is the flow diagram of the search method for the target image that the embodiment of the present application one provides;
Fig. 2 be the embodiment of the present application two provide to the pretreated flow diagram of image data base;
Fig. 3 is the structural schematic diagram of the retrieval device for the target image that the embodiment of the present application three provides;
Fig. 4 is the structural schematic diagram for the electronic equipment that the embodiment of the present application four provides.
Specific embodiment
With reference to the accompanying drawing, the specific embodiment of the application is described in detail, it is to be understood that the guarantor of the application
Shield range is not limited by the specific implementation.
Unless otherwise explicitly stated, otherwise in entire disclosure and claims, term " includes " or its change
Changing such as "comprising" or " including " etc. will be understood to comprise stated element or component, and not exclude other members
Part or other component parts.
Embodiment one
Fig. 1 is the flow diagram of the search method for the target image that the embodiment of the present application one provides, as shown in Figure 1, should
Method includes the following steps S101~S104:
S101, the first structure feature vector for determining target image to be retrieved;
Wherein, first structure feature vector is attributive character sequence.
In practical application, the executing subject of the present embodiment can be the retrieval device of target image, the inspection of the target image
Rope device can be realized by virtual bench, such as software code, can also be filled by being written with the related entity for executing code
Realization, such as USB flash disk are set, then alternatively, can also realize by being integrated with the related entity apparatus for executing code, for example, chip, each
Formula computer etc..
In the present embodiment, it is first determined the structured features of target image to be retrieved, in the description of structured features, often
Common 1 indicates that current goal has the attributive character, and use 0 indicates that current goal does not have the attributive character.It is not female with retrieval
Property, be not it is old, be the back side, wear long sleeves, without knapsack, for wearing trousers, be converted into first structure feature vector be (0,0,
1,1,0,1)。
S102, the description of the first structure feature vector is standardized.
In practical application, 0 does not have directionality in retrieval, and the confidence value of integrated structure feature carries out target retrieval
When, confidence value cannot be embodied, it is therefore desirable to be standardized to the description of first structure feature vector.For example, will
All attributive character describe to become -1 from 0, and (0,0,1,1,0,1) vector is converted to (- 1, -1,1,1, -1,1), after standardization
First structure feature vector be (- 1, -1,1,1, -1,1).
S103, according to extract attributive character accuracy rate, to after the standardization first structure feature vector carry out
Layered shaping obtains corresponding at least two subvector.
In practical application, for the structured features of a certain target image are extracted, inherently exists and extract corresponding belong to
Property feature accuracy rate, such as obtain this attributive character of the back side and have a higher accuracy, it is special that thing this attribute is had in acquisition in arms
Sign has lower accuracy.By taking above-mentioned vector (- 1, -1,1,1, -1,1) as an example, if be that the accuracy rate of femaleness is
67.2%, if the accuracy rate for being old age is 62.9%, if the detection for being the back side is accurately 77.3%, if wears long-sleeved inspection
Surveying accuracy rate is 66.5%, if the Detection accuracy of knapsack is 75.2%, if the Detection accuracy for wearing trousers is 76.9%.
Then in target retrieval, an accuracy rate threshold value can be set, be divided into according to the height of accuracy rate compared with high-accuracy subvector
(1, -1,1) and lower accuracy rate subvector (- 1, -1,1).Two accuracy rate threshold values can certainly be set, by first structure
Change feature vector and be divided into high, normal, basic three layers, just obtains three subvectors, can specifically be set according to actual needs, the application
It is without limitation.
S104, image data base is retrieved according at least two subvector by different level, obtains target image set
It closes.
In the present embodiment, image data base is retrieved first with compared with high-accuracy subvector, obtains examining for the first time
Rope obtains second of retrieval knot as a result, then retrieve again using lower accuracy rate subvector to first time search result
Fruit obtains target image set according to first time search result and second of search result.
The search method of target image provided in this embodiment, determine the first structure feature of target image to be retrieved to
Amount, is standardized the description of the first structure feature vector, according to the accuracy rate for extracting attributive character, to institute
First structure feature vector after stating standardization carries out layered shaping, corresponding at least two subvector is obtained, according to described
At least two subvectors retrieve image data base by different level, obtain target image set.By according to attributive character
It extracts accuracy rate to retrieve structured features by different level, retrieval accuracy can be improved to a certain extent, weaken structure
Changing feature extraction inaccuracy bring influences.
Embodiment two
Fig. 2 be the embodiment of the present application two provide to the pretreated flow diagram of image data base.As shown in Fig. 2, this
Apply in embodiment two, on the basis of the above embodiment 1, before step S104, the above method can also include following step
It is rapid:
S201, extract image data base in each image the second structured features vector and second structured features to
Measure corresponding confidence level vector.The second structured features vector is corresponding with the element of the first structure feature vector.
Specifically, extracting the counter structure feature of all images in image data base first, and it is converted into the lattice of vector
Formula.Such as: six numerical value in (0,0,1,1,0,1) vector respectively correspond whether have there are six structured features, with women, always
For six year, the back side, long sleeves, knapsack, trousers attributive character, respectively corresponding is not women, is not old age, is the back side, wears length
Sleeve, without knapsack, wears trousers.
Then obtain and be also expressed as the confidence value of all images this six structured features the form of vector, example
Such as: (0.1,0.9,0.7,0.8,0.3,0.6), confidence value indicates the confidence level of current structure feature extraction result, in area
Between in (0,1), it is 0.1 that target, which is the confidence level of women, by taking above-mentioned (0,0,1,1,0,1) vector as an example, in present image,
Be not old confidence level it is 0.9, be the confidence level at the back side is 0.7, wearing long-sleeved confidence level is 0.8, and knapsack is not credible
Degree is 0.3, and the confidence level for wearing trousers is 0.6.
S202, the description of the second structured features vector is standardized.
For example, in order to avoid attributive character 0 does not have this defect of directionality, its corresponding confidence value is embodied, it will
All structured features become -1 from 0, then above-mentioned (0,0,1,1,0,1) vector is converted to (- 1, -1,1,1, -1,1), complete
Standardization.
S203, the second structured features vector after standardization is done into multiplication with the confidence level vector, obtains third knot
Structure feature vector.
Specifically, by the structured features vector (- 1, -1,1,1, -1,1) after standardization, corresponding confidence level to
Amount (0.1,0.9,0.7,0.8,0.3,0.6) does multiplication, obtains (- 0.1-, 0.9,0.7,0.8, -0.3,0.6) vector for examining
Rope, the vector more can fully embody whether present image has a certain attributive character and confidence level is how many.
S204, the third structured features vector is carried out at layering identical with the first structure feature vector
Reason, obtains corresponding at least two subvector.
Specifically, being layered according to the delamination process in step S103 to the third structured features vector
Processing, obtains corresponding at least two subvector.
In a kind of embodiment, above-mentioned steps S103 specific implementation are as follows: by first structure feature after the standardization to
Amount is divided into the first subvector and the second subvector;The corresponding extraction accuracy rate of attributive character is more than or equal in first subvector
Accuracy rate is preset, the corresponding extraction accuracy rate of attributive character is less than the default accuracy rate in second subvector.
Correspondingly, step S204 is implemented are as follows: the third structured features vector is divided into third subvector and the
Four subvectors;The third subvector is corresponding with first subvector, the 4th subvector and second subvector pair
It answers.
For example, if default accuracy rate is 70%, first structure feature vector after standardization (- 1, -1,1,1, -
1,1) it is divided into the first subvector (1, -1,1) and the second subvector (- 1, -1,1).Correspondingly, third structured features vector (-
0.1-, 0.9,0.7,0.8, -0.3,0.6) be divided into third subvector (0.7, -0.3,0.6) and the 4th subvector (- 0.1, -0.9,
0.8)。
Further, above-mentioned steps S104 is implemented are as follows:
Based on the first Euclidean distance between the third subvector and first subvector, in image data base into
Row retrieval, obtains the first retrieval image collection;
Image in the first retrieval image collection is ranked up from small to large according to the first Euclidean distance, the row of selection
The first forward quantity image of sequence retrieves image collection as second, sorts in reservation the second retrieval image collection forward
The second quantity image as third retrieve image collection;
Based on the second Euclidean distance between the 4th subvector and second subvector, in the second retrieval figure
Image set is retrieved in closing, and obtains the 4th retrieval image collection;
Image in the 4th retrieval image collection is ranked up from small to large according to the second Euclidean distance, the row of selection
The forward third quantity image of sequence is as the 5th retrieval image collection;
The third is retrieved into image collection and the 5th retrieval image collection carries out taking union operation, obtains target figure
Image set closes.
For example, it is not women with retrieval, is not old age, is the back side, wears long sleeves, without knapsack, for wearing trousers, i.e.,
(- 1, -1,1,1, -1,1), in retrieving, to the relatively high-accuracy subvector of all targets, (back side, knapsack are long first
Trousers) it is retrieved with (1, -1,1) based on the Euclidean distance between calculating vector, and similarity is carried out after calculated result is normalized
Sequence, and first 1000 (by taking 10,000 retrieval data volumes as an example) of search result are taken out, before retaining in this 1000 results
100 results.Later in this obtained 1000 search results to the lower accuracy rate subvector of all targets (women, always
Year, long sleeves) it is retrieved with (- 1, -1,1) based on the Euclidean distance between calculating vector, and carried out after calculated result is normalized
Sequencing of similarity, and first 200 of search result are taken out, union is taken with obtained preceding 100 search results to this 200, is made
For final search result, i.e. target image set.
In the present embodiment, the defect of confidence value can not be embodied when can be 0 to avoid attributive character, using vector product
Mode can more fully embody whether a certain target has a certain structured features, pass through the detection according to structured features
Accuracy rate retrieves structured features by different level, can improve retrieval accuracy to a certain extent, and it is special to weaken structuring
Sign, which extracts inaccurate bring, to be influenced.
Following is the application Installation practice, can be used for executing the application embodiment of the method.It is real for the application device
Undisclosed details in example is applied, the application embodiment of the method is please referred to.
Fig. 3 is the structural schematic diagram of the retrieval device for the target image that the embodiment of the present application three provides, as shown in figure 3, should
Device may include:
Determining module 310, for determining the first structure feature vector of target image to be retrieved;The first structure
Feature vector is attributive character sequence;
Standardized module 320 is standardized for the description to the first structure feature vector;
Hierarchical block 330, it is special to the first structureization after the standardization for the accuracy rate according to extraction attributive character
It levies vector and carries out layered shaping, obtain corresponding at least two subvector;
Retrieval module 340 is obtained for being retrieved by different level according at least two subvector to image data base
Target image set.
The retrieval device of target image provided in this embodiment, determine the first structure feature of target image to be retrieved to
Amount, is standardized the description of the first structure feature vector, according to the accuracy rate for extracting attributive character, to institute
First structure feature vector after stating standardization carries out layered shaping, corresponding at least two subvector is obtained, according to described
At least two subvectors retrieve image data base by different level, obtain target image set.By according to attributive character
It extracts accuracy rate to retrieve structured features by different level, retrieval accuracy can be improved to a certain extent, weaken structure
Changing feature extraction inaccuracy bring influences.
In one possible implementation, in above-mentioned apparatus provided by the embodiments of the present application, further includes:
Preprocessing module 350, for the retrieval module according at least two subvector to image data base into
Before row is retrieved by different level, it is special to extract the second structured features vector of each image and second structuring in image data base
Levy the corresponding confidence level vector of vector;The element pair of the second structured features vector and the first structure feature vector
It answers;The description of the second structured features vector is standardized;By the second structured features after standardization to
Amount does multiplication with the confidence level vector, obtains third structured features vector;The third structured features vector is carried out
Layered shaping identical with the first structure feature vector, obtains corresponding at least two subvector.
In one possible implementation, in above-mentioned apparatus provided by the embodiments of the present application, the hierarchical block
330, it is specifically used for:
First structure feature vector after the standardization is divided into the first subvector and the second subvector;First son
The corresponding extraction accuracy rate of attributive character is more than or equal to default accuracy rate in vector, and attributive character is corresponding in second subvector
Extraction accuracy rate be less than the default accuracy rate.
In one possible implementation, in above-mentioned apparatus provided by the embodiments of the present application, the preprocessing module
350, it is specifically used for:
The third structured features vector is divided into third subvector and the 4th subvector;The third subvector and institute
It is corresponding to state the first subvector, the 4th subvector is corresponding with second subvector.
In one possible implementation, in above-mentioned apparatus provided by the embodiments of the present application, the retrieval module
340, it is specifically used for:
Based on the first Euclidean distance between the third subvector and first subvector, in image data base into
Row retrieval, obtains the first retrieval image collection;
Image in the first retrieval image collection is ranked up from small to large according to the first Euclidean distance, the row of selection
The first forward quantity image of sequence retrieves image collection as second, sorts in reservation the second retrieval image collection forward
The second quantity image as third retrieve image collection;
Based on the second Euclidean distance between the 4th subvector and second subvector, in the second retrieval figure
Image set is retrieved in closing, and obtains the 4th retrieval image collection;
Image in the 4th retrieval image collection is ranked up from small to large according to the second Euclidean distance, the row of selection
The forward third quantity image of sequence is as the 5th retrieval image collection;
The third is retrieved into image collection and the 5th retrieval image collection carries out taking union operation, obtains target figure
Image set closes.
Fig. 4 is the structural schematic diagram for the electronic equipment that the embodiment of the present application four provides, as shown in figure 4, the equipment includes: to deposit
Reservoir 401 and processor 402;
Memory 401, for storing computer program;
Wherein, processor 402 executes the computer program in memory 401, to realize each method embodiment as described above
Provided method.
In embodiment, example is carried out with retrieval device of the electronic equipment to target image provided by the present application.Processing
Device can be the place of central processing unit (CPU) or the other forms with data-handling capacity and/or instruction execution capability
Unit is managed, and can control the other assemblies in electronic equipment to execute desired function.
Memory may include one or more computer program products, and computer program product may include various forms
Computer readable storage medium, such as volatile memory and/or nonvolatile memory.Volatile memory for example can be with
Including random access memory (RAM) and/or cache memory (cache) etc..Nonvolatile memory for example can wrap
Include read-only memory (ROM), hard disk, flash memory etc..It can store one or more computers on computer readable storage medium
Program instruction, processor can run program instruction, method in each embodiment to realize the application above and/or
Other desired functions of person.Such as input signal, signal component, noise point can also be stored in a computer-readable storage medium
The various contents such as amount.
The embodiment of the present application five provides a kind of computer readable storage medium, stores in the computer readable storage medium
There is computer program, for realizing side provided by each method embodiment as described above when which is executed by processor
Method.
In practical application, the computer program in the present embodiment can be with any group of one or more programming languages
It closes to write the program code for executing the embodiment of the present application operation, programming language includes object-oriented programming
Language, Java, C++, python etc. further include conventional procedural programming language, such as " C " language or similar
Programming language.Program code can be executed fully on the user computing device, partly execute, make on a user device
It is executed for an independent software package, part partially executes on a remote computing on the user computing device or complete
It is executed in remote computing device or server.
In practical application, computer readable storage medium can be using any combination of one or more readable mediums.It can
Reading medium can be readable signal medium or readable storage medium storing program for executing.Readable storage medium storing program for executing for example can include but is not limited to electricity,
Magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, or any above combination.Readable storage medium storing program for executing
More specific example (non exhaustive list) includes: electrical connection with one or more conducting wires, portable disc, hard disk, random
It accesses memory (RAM), read-only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable
Formula compact disk read-only memory (CD-ROM), light storage device, magnetic memory device or above-mentioned any appropriate combination.
The description of the aforementioned specific exemplary embodiment to the application is in order to illustrate and illustration purpose.These descriptions
It is not wishing to for the application to be limited to disclosed precise forms, and it will be apparent that according to the above instruction, can much be changed
And variation.The purpose of selecting and describing the exemplary embodiment is that explaining the specific principle of the application and its actually answering
With so that those skilled in the art can be realized and utilize the application a variety of different exemplary implementation schemes and
Various chooses and changes.Scope of the present application is intended to be limited by claims and its equivalents.