CN111160218A - Feature vector comparison method, device electronic equipment and storage medium - Google Patents

Feature vector comparison method, device electronic equipment and storage medium Download PDF

Info

Publication number
CN111160218A
CN111160218A CN201911365035.4A CN201911365035A CN111160218A CN 111160218 A CN111160218 A CN 111160218A CN 201911365035 A CN201911365035 A CN 201911365035A CN 111160218 A CN111160218 A CN 111160218A
Authority
CN
China
Prior art keywords
feature vector
attribute information
feature
attribute
library
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.)
Pending
Application number
CN201911365035.4A
Other languages
Chinese (zh)
Inventor
张宏
李永配
潘武
王标荣
李浙伟
陆振善
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN201911365035.4A priority Critical patent/CN111160218A/en
Publication of CN111160218A publication Critical patent/CN111160218A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/168Feature extraction; Face representation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/161Detection; Localisation; Normalisation

Abstract

The invention discloses a feature vector comparison method, device electronic equipment and a storage medium, wherein in the embodiment of the invention, the electronic equipment determines first attribute information of a first feature vector to be compared and second attribute information of each second feature vector in a feature library; and screening the feature vectors in the feature library according to the attribute information of the feature vectors, taking second feature vectors corresponding to second attribute information which is the same as the first attribute information as candidate feature vectors, and then comparing the first feature vectors with each candidate feature vector to obtain target feature vectors. According to the embodiment of the invention, the feature vectors in the feature library are screened according to the attribute information of the feature vectors, so that the number of the feature vectors participating in feature vector comparison is small, the comparison efficiency is high, the obtained target feature vectors and the attribute information of the first feature vectors to be compared are ensured to be the same, and the accuracy of feature vector comparison is improved.

Description

Feature vector comparison method, device electronic equipment and storage medium
Technical Field
The invention relates to the technical field of video processing and artificial intelligence, in particular to a feature vector comparison method, device electronic equipment and storage medium.
Background
With the rapid development of artificial intelligence technology in recent years, the application field of the artificial intelligence technology is more and more extensive, and a great amount of practical applications are already available in the field of image recognition, particularly in the aspect of face recognition.
The face recognition technology acquires images through image acquisition equipment, detects face images in the acquired images by a certain method, extracts feature vectors of each face according to information such as positions and shapes of all parts of the face according to a certain rule, compares the extracted feature vectors with feature vectors in a face feature library stored in advance, finds out the face with the highest similarity, and accordingly recognizes the identity of a target object. Other types of image recognition, such as vehicle recognition, etc., are similar to the process described above.
In practical applications, such as the fields of public security, transportation and the like, along with the increase of the capacity of the feature library and the increase of the number of concurrent processing paths, the requirement on the comparison speed of the feature vectors is higher and higher, and the calculation power of the comparison becomes more and more a challenge.
The conventional common comparison method is to compare the feature vectors to be compared with all the feature vectors in the feature library one by one to generate a similarity with each feature vector in the feature library, and then to sequence all the similarities to find out the top n most similar results. However, in many cases, when comparing the feature vectors, the user only wants to compare the feature vectors generated in a certain time period or a certain area, but does not need to compare all the feature vectors in the feature library, which results in a low efficiency of the existing feature vector comparison method, and the n selected results may not be in the comparison time period or the comparison area, resulting in a poor accuracy of the obtained comparison result.
Disclosure of Invention
The embodiment of the invention provides a feature vector comparison method, device electronic equipment and a storage medium, which are used for solving the problems of low efficiency and poor comparison result accuracy of the conventional feature vector comparison method.
The embodiment of the invention provides a feature vector comparison method, which comprises the following steps:
determining first attribute information of a first feature vector to be compared and second attribute information of each second feature vector in a feature library which is stored in advance;
taking a second feature vector corresponding to second attribute information which is the same as the first attribute information as a candidate feature vector;
and determining the similarity between the first feature vector and each candidate feature vector, and selecting a preset number of candidate feature vectors as successfully-compared target feature vectors according to the sequence from high similarity to low similarity.
Further, the taking, as a candidate feature vector, a second feature vector corresponding to second attribute information that is the same as the first attribute information includes:
aiming at each second feature vector in the feature library, judging whether second attribute information of the second feature vector is the same as the first attribute information, if so, adding a first enabling mark for the second feature vector, and if not, adding a second enabling mark for the second feature vector;
and taking the second feature vector of the first enabling mark in the feature library as a candidate feature vector.
Further, the process of pre-saving the second attribute information of each second feature vector in the feature library includes:
for each second feature vector in the feature library, determining each second attribute information of the second feature vector; and writing each piece of second attribute information into the corresponding bit of the attribute table of the second feature vector according to the predetermined bit corresponding to each piece of attribute information.
Further, the determining the first attribute information of the first feature vector to be compared includes:
and writing the first attribute information of the first feature vector into corresponding bits of an attribute table of the first feature vector according to the predetermined corresponding bits of each attribute information.
Further, the determining whether the second attribute information of the second feature vector is the same as the first attribute information includes:
determining the bit of the corresponding position in the attribute table of the second characteristic vector and the attribute table of the first characteristic vector; and judging whether the second attribute information of the bit at each corresponding position is the same as the first attribute information.
In another aspect, an embodiment of the present invention provides a feature vector comparison apparatus, where the apparatus includes:
the first determining module is used for determining first attribute information of the first feature vectors to be compared and second attribute information of each second feature vector in a feature library which is stored in advance;
a second determining module, configured to use a second feature vector corresponding to second attribute information that is the same as the first attribute information as a candidate feature vector;
and the third determining module is used for determining the similarity between the first feature vector and each candidate feature vector, and selecting a preset number of candidate feature vectors as the successfully-compared target feature vectors according to the sequence from high similarity to low similarity.
Further, the second determining module is specifically configured to determine, for each second feature vector in the feature library, whether second attribute information of the second feature vector is the same as the first attribute information, add a first enabling flag to the second feature vector if the second attribute information of the second feature vector is the same as the first attribute information, and add a second enabling flag to the second feature vector if the second attribute information of the second feature vector is not the same as the first attribute information; and taking the second feature vector of the first enabling mark in the feature library as a candidate feature vector.
Further, the apparatus further comprises:
the storage module is used for determining each second attribute information of each second feature vector in the feature library; and writing each piece of second attribute information into the corresponding bit of the attribute table of the second feature vector according to the predetermined bit corresponding to each piece of attribute information.
Further, the first determining module is specifically configured to write the first attribute information of the first feature vector into a corresponding bit of an attribute table of the first feature vector according to a predetermined bit corresponding to each attribute information.
Further, the second determining module is specifically configured to determine bits of corresponding positions in the attribute table of the second feature vector and the attribute table of the first feature vector; and judging whether the second attribute information of the bit at each corresponding position is the same as the first attribute information.
On the other hand, the embodiment of the invention provides electronic equipment, which comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
a memory for storing a computer program;
a processor for implementing any of the above method steps when executing a program stored in the memory.
In another aspect, an embodiment of the present invention provides a computer-readable storage medium, in which a computer program is stored, and the computer program, when executed by a processor, implements the method steps of any one of the above.
The embodiment of the invention provides a feature vector comparison method, device electronic equipment and a storage medium, wherein the method comprises the following steps: determining first attribute information of a first feature vector to be compared and second attribute information of each second feature vector in a feature library which is stored in advance; taking a second feature vector corresponding to second attribute information which is the same as the first attribute information as a candidate feature vector; and determining the similarity between the first feature vector and each candidate feature vector, and selecting a preset number of candidate feature vectors as successfully-compared target feature vectors according to the sequence from high similarity to low similarity.
In the embodiment of the invention, the electronic equipment determines the first attribute information of the first feature vector to be compared and the second attribute information of each second feature vector in the feature library; and screening the feature vectors in the feature library according to the attribute information of the feature vectors, taking second feature vectors corresponding to second attribute information which is the same as the first attribute information as candidate feature vectors, and then comparing the first feature vectors with each candidate feature vector to obtain target feature vectors. According to the embodiment of the invention, the feature vectors in the feature library are screened according to the attribute information of the feature vectors, so that the number of the feature vectors participating in feature vector comparison is small, the comparison efficiency is high, the obtained target feature vectors and the attribute information of the first feature vectors to be compared are ensured to be the same, and the accuracy of feature vector comparison is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic diagram of a feature vector comparison process provided in embodiment 1 of the present invention;
fig. 2 is a schematic diagram of an attribute table provided in embodiment 1 of the present invention;
fig. 3 is a schematic diagram of an enable flag of an attribute table according to embodiment 1 of the present invention;
fig. 4 is a block diagram of a feature vector comparison system provided in embodiment 1 of the present invention;
fig. 5 is a schematic structural diagram of a feature vector comparison apparatus according to embodiment 2 of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to embodiment 3 of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the attached drawings, and it should be understood that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example 1:
fig. 1 is a schematic diagram of a feature vector comparison process provided in an embodiment of the present invention, where the process includes:
s101: and determining first attribute information of the first feature vector to be compared and second attribute information of each second feature vector in a feature library which is stored in advance.
S102: and taking a second feature vector corresponding to second attribute information which is the same as the first attribute information as a candidate feature vector.
S103: and determining the similarity between the first feature vector and each candidate feature vector, and selecting a preset number of candidate feature vectors as successfully-compared target feature vectors according to the sequence from high similarity to low similarity.
The feature vector comparison method provided by the embodiment of the invention is applied to electronic equipment, and the electronic equipment can be a PC (personal computer), a tablet computer and the like.
For a first feature vector to be compared, first attribute information of the first feature vector is determined. And in a feature library pre-stored by the electronic device, each second feature vector also stores corresponding second attribute information. The attribute information of the feature vector in the embodiment of the present invention refers to some flag information corresponding to the feature vector, for example, information such as time, channel, and gender corresponding to the feature vector, and if the feature vector is a vehicle, information such as a corresponding brand, a body color, and a vehicle type of the vehicle.
And the electronic equipment matches the second attribute information of each second feature vector in the feature library with the first attribute information of the first feature vector to be compared, and takes the second feature vector corresponding to the second attribute information which is the same as the first attribute information as a candidate feature vector. If the first attribute information is multiple, the second feature vector corresponding to the second attribute information that is the same as each first attribute information may be used as a candidate feature vector, or it may also be specified by the user and matched with which attribute information, and then the second feature vector corresponding to the second attribute information that is the same as the specified first attribute information may be used as a candidate feature vector.
After determining the candidate feature vectors, the electronic device calculates the similarity between the first feature vector and each candidate feature vector, and selects a preset number of candidate feature vectors as successfully-compared target feature vectors according to the sequence of the similarity from high to low. Specifically, calculating the similarity between the two feature vectors may be measuring the similarity between the two feature vectors by calculating a cosine value of an included angle between the two feature vectors, where the smaller the included angle between the two feature vectors is, the closer the cosine value is to 1, and the higher the similarity is. And selecting a preset number of candidate eigenvectors as successfully-compared target eigenvectors according to the sequence from high similarity to low similarity. The preset number can be set by a user according to needs.
In the embodiment of the invention, the electronic equipment determines the first attribute information of the first feature vector to be compared and the second attribute information of each second feature vector in the feature library; and screening the feature vectors in the feature library according to the attribute information of the feature vectors, taking second feature vectors corresponding to second attribute information which is the same as the first attribute information as candidate feature vectors, and then comparing the first feature vectors with each candidate feature vector to obtain target feature vectors. According to the embodiment of the invention, the feature vectors in the feature library are screened according to the attribute information of the feature vectors, so that the number of the feature vectors participating in feature vector comparison is small, the comparison efficiency is high, the obtained target feature vectors and the attribute information of the first feature vectors to be compared are ensured to be the same, and the accuracy of feature vector comparison is improved.
In this embodiment of the present invention, the taking, as the candidate feature vector, the second feature vector corresponding to the second attribute information that is the same as the first attribute information includes:
aiming at each second feature vector in the feature library, judging whether second attribute information of the second feature vector is the same as the first attribute information, if so, adding a first enabling mark for the second feature vector, and if not, adding a second enabling mark for the second feature vector;
and taking the second feature vector of the first enabling mark in the feature library as a candidate feature vector.
In the embodiment of the present invention, the second feature vector is divided into two types according to whether the second attribute information of the second feature vector is the same as the first attribute information of the first feature vector to be compared, where one type is a candidate feature vector and the other type is a non-candidate feature vector. And when the feature vector comparison is carried out to determine the target feature vector, only carrying out similarity calculation with the candidate feature vector. In the embodiment of the invention, a first enabling mark is added to the candidate feature vector, and a second enabling mark different from the first enabling mark is added to the non-candidate feature vector. For example, the first enable flag is 1 and the second enable flag is 0. Of course, the first enabling flag and the second enabling flag may be other different numbers or symbols.
When the electronic equipment compares the first feature vector with each second feature vector in the feature library, firstly identifying an enabling mark of the second feature vector, and if the enabling mark of the second feature vector is the first enabling mark, the second feature vector participates in comparison; if the enable flag of the second feature vector is the second enable flag, the second feature vector does not participate in the comparison.
In the embodiment of the present invention, corresponding bits, for example, i bits of the time information occupied attribute table, m bits of the channel information occupied attribute table, n bits of the gender information occupied attribute table, and the like, may be allocated to each attribute information in advance. And the order of each attribute information is specified in advance, for example, bits 0 to i-1 of the attribute table are time information, bits i to i + m-1 are channel information, and bits i + m to i + m + n-1 are gender information. Typically, reserved bits are also included in the attribute table.
The process of pre-saving the second attribute information of each second feature vector in the feature library comprises the following steps:
for each second feature vector in the feature library, determining each second attribute information of the second feature vector; and writing each piece of second attribute information into the corresponding bit of the attribute table of the second feature vector according to the predetermined bit corresponding to each piece of attribute information.
The determining first attribute information of the first feature vector to be compared includes:
and writing the first attribute information of the first feature vector into corresponding bits of an attribute table of the first feature vector according to the predetermined corresponding bits of each attribute information.
Determining the bit of the corresponding position in the attribute table of the second characteristic vector and the attribute table of the first characteristic vector when judging whether the first attribute information of the first characteristic vector is the same as the second attribute information of the second characteristic vector; and judging whether the second attribute information of the bit at each corresponding position is the same as the first attribute information. Thereby, the efficiency of attribute information matching can be improved.
The process of feature vector alignment is described in detail below.
Fig. 2 is a schematic diagram of an attribute table provided in an embodiment of the present invention, and it should be noted that fig. 2 is only an example. As shown in FIG. 2, bits 0 to i-1 of the attribute table are time information, bits i to i + m-1 are channel information, bits i + m to i + m + n-1 are gender information, and bits i + m + n to i + m + n + r-1 are reserved information. The first attribute information and the second attribute information both store the attribute information according to the attribute table shown in fig. 2, and for each second feature vector, determine the bit of the corresponding position in the attribute table of the second feature vector and the attribute table of the first feature vector; and judging whether the second attribute information of the bit at each corresponding position is the same as the first attribute information. If the two are the same, adding a first enabling mark 1 to the second feature vector, otherwise adding a second enabling mark 0 to the second feature vector.
Fig. 3 is a schematic diagram of an enable flag of an attribute table according to an embodiment of the present invention, as shown in fig. 3, time information, channel information, and gender information of a certain second feature vector are added, and are respectively identical to the time information, channel information, and gender information of the first feature vector, that is, the enable flag of each attribute information is 1, at this time, the enable flag of the second feature vector is 1, and as long as the enable flag of any one attribute information is 0, the enable flag of the second feature vector is 0.
And performing similarity calculation on the first feature vector XF to be compared and a second feature vector LF with an enabling mark of 1 in the feature library. The second feature vector with the enable flag of 0 is directly skipped without processing.
The similarity calculation here may be a cosine similarity calculation or other similarity calculation, and if the similarity calculation is a cosine similarity calculation, then:
if XF ═ XF1, XF2, XF3 … xfmT,LF=【lf1,lf2,lf3…lfm】TAssume that XF and LF have been normalized. Then the cosine distance similarity between XF and LF is XFTAnd (4) LF. And respectively calculating cosine distances between the first feature vector to be compared and all second feature vectors with the enabling marks of 1 in the feature library. And selecting a preset number of candidate eigenvectors as successfully-compared target eigenvectors according to the sequence from high similarity to low similarity.
Fig. 4 is a block diagram of a feature vector comparison system according to an embodiment of the present invention, and as shown in fig. 4, the system is divided into two major parts, namely a main control part and a comparison card.
The master control is responsible for controlling and scheduling each part of the comparison card.
The comparison card is responsible for comparing the feature vectors, and compares and finds out the most similar N results from the feature library and returns the most similar N results to the master control. The attribute filtering, similarity calculating and sorting unit of the comparison card can be realized on carriers such as an FPGA, a GPU or a CPU.
The system comprises the following steps:
step 1: the master controller puts all the feature vectors LF of the feature library into the memory of the comparison card, as shown in the LF of the DDR in the figure, there are q LF in total, that is, there are q feature vectors in the feature library.
Step 2: the main control puts the attribute information corresponding to each feature vector in the feature library into another area in the memory of the comparison card according to the format, wherein the LS is q LS in total as shown in the figure of DDR, and LS corresponds to LF one by one.
And step 3: and the master control puts the feature vector XF to be compared, which is acquired in real time, into the memory of the comparison card.
The system supports concurrent alignment of p XFs.
And 4, step 4: and the master control puts attribute information XS corresponding to the feature vector XF to be compared, which is acquired in real time, into a memory of the comparison card. XS corresponds to XF one by one, and p XS are arranged.
And 5: and the master control compares the card and starts comparison operation.
Step 6: the attribute filter unit of the match card reads the XS from the DDR. The number of XS read is p, which is the number of concurrent ways per alignment.
And 7: the attribute filter unit of the match card reads the LS from the DDR, r LS at a time.
And 8: and comparing the attribute filter unit of the card and simultaneously performing attribute matching filter operation of p XSs and r LS.
And step 9: and writing the result of attribute matching filtering, namely the similarity calculation enabling mark corresponding to each feature vector in the library into the DDR by the attribute filtering unit of the comparison card.
Step 10: and repeating the steps 7, 8 and 9 until all the attribute filtering operations in the DDR are finished, and needing q/r rounds of 7, 8 and 9 operations.
Step 11: the similarity calculation unit of the match card reads p XFs from the DDR. p is the number of concurrent lanes per alignment.
Step 12: and the similarity calculation unit of the comparison card reads the similarity enabling mark from the DDR, reads the feature vector LF of the bank from the DDR according to the enabling mark, if the enabling mark is 1, reads the bank feature vector corresponding to the mark from the DDR, if the enabling mark is 0, ignores the bank feature vector corresponding to the mark, and reads r feature vectors from the DDR in total in each round.
Step 13: the similarity calculation unit of the comparison card simultaneously calculates the similarities of p XFs and r LFs, and here, the cosine similarity is taken as an example, and the similarities in other modes can also be taken as an example.
Step 14: and the comparison card sorting unit sorts according to the similarity in the step 13 and discharges the TOP N in the calculated library.
Step 15: and repeating the steps 12, 13 and 14 until the comparison calculation of all the banks in the DDR is completed to obtain the total TOP N.
Step 16: the result of TOP N is returned to the master.
It should be noted that the similarity calculation enabling flag generated in step 9 may not be written in the DDR but directly used by the similarity calculation unit according to a specific practical application scenario.
The method in the embodiment of the invention is not only suitable for face comparison and vehicle comparison, but also suitable for other image-based feature comparison; the method is not only suitable for FPGA, but also suitable for other implementation modes such as GPU, CPU and the like.
The feature vector comparison method provided by the embodiment of the invention firstly carries out attribute filtering on the whole feature library, and only carries out comparison calculation on a small part of feature vectors after filtering, thereby avoiding carrying out feature comparison calculation on the whole feature library one by one, greatly reducing the calculation amount and improving the comparison speed. Through attribute filtering, the overall comparison performance can be improved by more than ten times in most scenes.
Through attribute filtering, the interference of irrelevant characteristic vectors on the final result can be avoided, and the accuracy of the comparison result is improved. For example, only the face shot by the camera in a certain channel in a certain time period is searched to find out TOP N results most similar to the target face, and if attribute filtering is not performed, the faces shot by other channels in other time periods may be mixed into TOP N of the final result, which is not intended by the user, and the accuracy of the result is affected.
For each attribute information item, a corresponding attribute item enabling mark is provided to indicate the attribute item concerned by current retrieval, so that the flexibility and convenience of system use are greatly improved.
Example 2:
fig. 5 is a schematic structural diagram of a feature vector comparison apparatus according to an embodiment of the present invention, where the apparatus includes:
a first determining module 51, configured to determine first attribute information of a first feature vector to be compared, and second attribute information of each second feature vector in a feature library that is pre-stored;
a second determining module 52, configured to use a second feature vector corresponding to second attribute information that is the same as the first attribute information as a candidate feature vector;
a third determining module 53, configured to determine a similarity between the first feature vector and each candidate feature vector, and select a preset number of candidate feature vectors as target feature vectors successfully compared according to a sequence from high to low in similarity.
The second determining module 52 is specifically configured to determine, for each second feature vector in the feature library, whether second attribute information of the second feature vector is the same as the first attribute information, if so, add a first enabling flag to the second feature vector, and if not, add a second enabling flag to the second feature vector; and taking the second feature vector of the first enabling mark in the feature library as a candidate feature vector.
The device further comprises:
a saving module 54, configured to determine, for each second feature vector in the feature library, each second attribute information of the second feature vector; and writing each piece of second attribute information into the corresponding bit of the attribute table of the second feature vector according to the predetermined bit corresponding to each piece of attribute information.
The first determining module 51 is specifically configured to write the first attribute information of the first feature vector into a corresponding bit of an attribute table of the first feature vector according to a predetermined bit corresponding to each piece of attribute information.
The second determining module 52 is specifically configured to determine bits of corresponding positions in the attribute table of the second feature vector and the attribute table of the first feature vector; and judging whether the second attribute information of the bit at each corresponding position is the same as the first attribute information.
Example 3:
on the basis of the foregoing embodiments, an embodiment of the present invention further provides an electronic device, as shown in fig. 6, including: the system comprises a processor 301, a communication interface 302, a memory 303 and a communication bus 304, wherein the processor 301, the communication interface 302 and the memory 303 complete mutual communication through the communication bus 304;
the memory 303 has stored therein a computer program which, when executed by the processor 301, causes the processor 301 to perform the steps of:
determining first attribute information of a first feature vector to be compared and second attribute information of each second feature vector in a feature library which is stored in advance;
taking a second feature vector corresponding to second attribute information which is the same as the first attribute information as a candidate feature vector;
and determining the similarity between the first feature vector and each candidate feature vector, and selecting a preset number of candidate feature vectors as successfully-compared target feature vectors according to the sequence from high similarity to low similarity.
Based on the same inventive concept, the embodiment of the present invention further provides an electronic device, and as the principle of the electronic device for solving the problem is similar to the feature vector comparison method, the implementation of the electronic device may refer to the implementation of the method, and repeated details are not repeated.
The electronic device provided by the embodiment of the invention can be a desktop computer, a portable computer, a smart phone, a tablet computer, a Personal Digital Assistant (PDA), a network side device and the like.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface 302 is used for communication between the above-described electronic apparatus and other apparatuses.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Alternatively, the memory may be at least one memory device located remotely from the processor.
The processor may be a general-purpose processor, including a central processing unit, a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an application specific integrated circuit, a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or the like.
When the processor executes the program stored in the memory in the embodiment of the invention, the first attribute information of the first feature vector to be compared and the second attribute information of each second feature vector in the pre-stored feature library are determined; taking a second feature vector corresponding to second attribute information which is the same as the first attribute information as a candidate feature vector; and determining the similarity between the first feature vector and each candidate feature vector, and selecting a preset number of candidate feature vectors as successfully-compared target feature vectors according to the sequence from high similarity to low similarity.
In the embodiment of the invention, the electronic equipment determines the first attribute information of the first feature vector to be compared and the second attribute information of each second feature vector in the feature library; and screening the feature vectors in the feature library according to the attribute information of the feature vectors, taking second feature vectors corresponding to second attribute information which is the same as the first attribute information as candidate feature vectors, and then comparing the first feature vectors with each candidate feature vector to obtain target feature vectors. According to the embodiment of the invention, the feature vectors in the feature library are screened according to the attribute information of the feature vectors, so that the number of the feature vectors participating in feature vector comparison is small, the comparison efficiency is high, the obtained target feature vectors and the attribute information of the first feature vectors to be compared are ensured to be the same, and the accuracy of feature vector comparison is improved.
Example 4:
on the basis of the foregoing embodiments, an embodiment of the present invention further provides a computer storage readable storage medium, in which a computer program executable by an electronic device is stored, and when the program is run on the electronic device, the electronic device is caused to execute the following steps:
determining first attribute information of a first feature vector to be compared and second attribute information of each second feature vector in a feature library which is stored in advance;
taking a second feature vector corresponding to second attribute information which is the same as the first attribute information as a candidate feature vector;
and determining the similarity between the first feature vector and each candidate feature vector, and selecting a preset number of candidate feature vectors as successfully-compared target feature vectors according to the sequence from high similarity to low similarity.
Based on the same inventive concept, embodiments of the present invention further provide a computer-readable storage medium, and since a principle of solving a problem when a processor executes a computer program stored in the computer-readable storage medium is similar to the feature vector comparison method, implementation of the computer program stored in the computer-readable storage medium by the processor may refer to implementation of the method, and repeated details are not repeated.
The computer readable storage medium may be any available medium or data storage device that can be accessed by a processor in an electronic device, including but not limited to magnetic memory such as floppy disks, hard disks, magnetic tape, magneto-optical disks (MO), etc., optical memory such as CDs, DVDs, BDs, HVDs, etc., and semiconductor memory such as ROMs, EPROMs, EEPROMs, nonvolatile memories (NANDFLASH), Solid State Disks (SSDs), etc.
The computer program is stored in a computer-readable storage medium provided in the embodiment of the present invention, and when executed by a processor, the computer program implements determining first attribute information of a first feature vector to be compared, and second attribute information of each second feature vector in a feature library that is pre-stored; taking a second feature vector corresponding to second attribute information which is the same as the first attribute information as a candidate feature vector; and determining the similarity between the first feature vector and each candidate feature vector, and selecting a preset number of candidate feature vectors as successfully-compared target feature vectors according to the sequence from high similarity to low similarity.
In the embodiment of the invention, the electronic equipment determines the first attribute information of the first feature vector to be compared and the second attribute information of each second feature vector in the feature library; and screening the feature vectors in the feature library according to the attribute information of the feature vectors, taking second feature vectors corresponding to second attribute information which is the same as the first attribute information as candidate feature vectors, and then comparing the first feature vectors with each candidate feature vector to obtain target feature vectors. According to the embodiment of the invention, the feature vectors in the feature library are screened according to the attribute information of the feature vectors, so that the number of the feature vectors participating in feature vector comparison is small, the comparison efficiency is high, the obtained target feature vectors and the attribute information of the first feature vectors to be compared are ensured to be the same, and the accuracy of feature vector comparison is improved.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (12)

1. A method for feature vector alignment, the method comprising:
determining first attribute information of a first feature vector to be compared and second attribute information of each second feature vector in a feature library which is stored in advance;
taking a second feature vector corresponding to second attribute information which is the same as the first attribute information as a candidate feature vector;
and determining the similarity between the first feature vector and each candidate feature vector, and selecting a preset number of candidate feature vectors as successfully-compared target feature vectors according to the sequence from high similarity to low similarity.
2. The method of claim 1, wherein the regarding a second feature vector corresponding to second attribute information that is the same as the first attribute information as a candidate feature vector comprises:
aiming at each second feature vector in the feature library, judging whether second attribute information of the second feature vector is the same as the first attribute information, if so, adding a first enabling mark for the second feature vector, and if not, adding a second enabling mark for the second feature vector;
and taking the second feature vector of the first enabling mark in the feature library as a candidate feature vector.
3. The method of claim 2, wherein pre-storing second attribute information for each second feature vector in the feature library comprises:
for each second feature vector in the feature library, determining each second attribute information of the second feature vector; and writing each piece of second attribute information into the corresponding bit of the attribute table of the second feature vector according to the predetermined bit corresponding to each piece of attribute information.
4. The method of claim 3, wherein determining the first attribute information of the first feature vector to be compared comprises:
and writing the first attribute information of the first feature vector into corresponding bits of an attribute table of the first feature vector according to the predetermined corresponding bits of each attribute information.
5. The method of claim 4, wherein the determining whether the second attribute information of the second eigenvector is the same as the first attribute information comprises:
determining the bit of the corresponding position in the attribute table of the second characteristic vector and the attribute table of the first characteristic vector; and judging whether the second attribute information of the bit at each corresponding position is the same as the first attribute information.
6. An apparatus for feature vector matching, the apparatus comprising:
the first determining module is used for determining first attribute information of the first feature vectors to be compared and second attribute information of each second feature vector in a feature library which is stored in advance;
a second determining module, configured to use a second feature vector corresponding to second attribute information that is the same as the first attribute information as a candidate feature vector;
and the third determining module is used for determining the similarity between the first feature vector and each candidate feature vector, and selecting a preset number of candidate feature vectors as the successfully-compared target feature vectors according to the sequence from high similarity to low similarity.
7. The apparatus according to claim 6, wherein the second determining module is specifically configured to determine, for each second feature vector in the feature library, whether second attribute information of the second feature vector is the same as the first attribute information, if so, add a first enable flag to the second feature vector, and if not, add a second enable flag to the second feature vector; and taking the second feature vector of the first enabling mark in the feature library as a candidate feature vector.
8. The apparatus of claim 7, wherein the apparatus further comprises:
the storage module is used for determining each second attribute information of each second feature vector in the feature library; and writing each piece of second attribute information into the corresponding bit of the attribute table of the second feature vector according to the predetermined bit corresponding to each piece of attribute information.
9. The apparatus as claimed in claim 8, wherein the first determining module is specifically configured to write the first attribute information of the first feature vector into corresponding bits of the attribute table of the first feature vector according to predetermined bits corresponding to each attribute information.
10. The apparatus of claim 9, wherein the second determining module is specifically configured to determine bits of corresponding positions in the attribute table of the second eigenvector and the attribute table of the first eigenvector; and judging whether the second attribute information of the bit at each corresponding position is the same as the first attribute information.
11. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1 to 5 when executing a program stored in the memory.
12. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1-5.
CN201911365035.4A 2019-12-26 2019-12-26 Feature vector comparison method, device electronic equipment and storage medium Pending CN111160218A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911365035.4A CN111160218A (en) 2019-12-26 2019-12-26 Feature vector comparison method, device electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911365035.4A CN111160218A (en) 2019-12-26 2019-12-26 Feature vector comparison method, device electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111160218A true CN111160218A (en) 2020-05-15

Family

ID=70558048

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911365035.4A Pending CN111160218A (en) 2019-12-26 2019-12-26 Feature vector comparison method, device electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111160218A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150199567A1 (en) * 2012-09-25 2015-07-16 Kabushiki Kaisha Toshiba Document classification assisting apparatus, method and program
CN108009465A (en) * 2016-10-31 2018-05-08 杭州海康威视数字技术股份有限公司 A kind of face identification method and device
JP2019016128A (en) * 2017-07-06 2019-01-31 富士通株式会社 Image similarity determining program, image similarity determining device and image similarity determining method
CN109543566A (en) * 2018-11-05 2019-03-29 深圳市商汤科技有限公司 Information processing method and device, electronic equipment and storage medium
CN109740573A (en) * 2019-01-24 2019-05-10 北京旷视科技有限公司 Video analysis method, apparatus, equipment and server
WO2019154262A1 (en) * 2018-02-07 2019-08-15 腾讯科技(深圳)有限公司 Image classification method, server, user terminal, and storage medium
CN110443120A (en) * 2019-06-25 2019-11-12 深圳英飞拓科技股份有限公司 A kind of face identification method and equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150199567A1 (en) * 2012-09-25 2015-07-16 Kabushiki Kaisha Toshiba Document classification assisting apparatus, method and program
CN108009465A (en) * 2016-10-31 2018-05-08 杭州海康威视数字技术股份有限公司 A kind of face identification method and device
JP2019016128A (en) * 2017-07-06 2019-01-31 富士通株式会社 Image similarity determining program, image similarity determining device and image similarity determining method
WO2019154262A1 (en) * 2018-02-07 2019-08-15 腾讯科技(深圳)有限公司 Image classification method, server, user terminal, and storage medium
CN109543566A (en) * 2018-11-05 2019-03-29 深圳市商汤科技有限公司 Information processing method and device, electronic equipment and storage medium
CN109740573A (en) * 2019-01-24 2019-05-10 北京旷视科技有限公司 Video analysis method, apparatus, equipment and server
CN110443120A (en) * 2019-06-25 2019-11-12 深圳英飞拓科技股份有限公司 A kind of face identification method and equipment

Similar Documents

Publication Publication Date Title
US10366275B2 (en) Method and device for improving fingerprint template, and terminal device
CN111160140B (en) Image detection method and device
CN106156755A (en) Similarity calculating method in a kind of recognition of face and system
JP6161266B2 (en) Information processing apparatus, control method therefor, electronic device, program, and storage medium
CN110503682B (en) Rectangular control identification method and device, terminal and storage medium
CN108108734A (en) A kind of licence plate recognition method and device
CN115033184A (en) Memory access processing device and method, processor, chip, board card and electronic equipment
US20200065707A1 (en) Learning device and learning method
CN111008620A (en) Target user identification method and device, storage medium and electronic equipment
CN110941989A (en) Image verification method, image verification device, video verification method, video verification device, equipment and storage medium
CN111984204B (en) Data reading and writing method and device, electronic equipment and storage medium
US9104946B2 (en) Systems and methods for comparing images
CN110033092B (en) Data label generation method, data label training device, event recognition method and event recognition device
CN111160218A (en) Feature vector comparison method, device electronic equipment and storage medium
CN110659538B (en) Non-maximum suppression calculator and calculation method
US10997497B2 (en) Calculation device for and calculation method of performing convolution
KR20150142250A (en) Method for operating controller and method for operating device including the same
CN113344792B (en) Image generation method and device and electronic equipment
US20220207892A1 (en) Method and device for classifing densities of cells, electronic device using method, and storage medium
CN112906728B (en) Feature comparison method, device and equipment
Zhu et al. Feature fusion for image retrieval with adaptive bitrate allocation and hard negative mining
CN112232417A (en) Classification method and device, storage medium and terminal
CN106874101B (en) Configuration implementation method and device of software system
Huang et al. Robust saliency detection via fusing foreground and background priors
US20240095142A1 (en) Apparatus for processing a deep learning model and a method thereof

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