CN109271869A - Face characteristic value extracting method, device, computer equipment and storage medium - Google Patents
Face characteristic value extracting method, device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN109271869A CN109271869A CN201810953164.4A CN201810953164A CN109271869A CN 109271869 A CN109271869 A CN 109271869A CN 201810953164 A CN201810953164 A CN 201810953164A CN 109271869 A CN109271869 A CN 109271869A
- Authority
- CN
- China
- Prior art keywords
- extraction
- characteristic value
- face picture
- state
- face
- 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
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V40/00—Recognition of biometric, human-related or animal-related patterns in image or video data
- G06V40/10—Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
- G06V40/16—Human faces, e.g. facial parts, sketches or expressions
- G06V40/168—Feature extraction; Face representation
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Abstract
The invention discloses a kind of face characteristic value extracting method, device, computer equipment and storage mediums, which comprises the extraction for receiving client requests and modifies the extraction state and feature extraction master switch of the face picture of characteristic value to be extracted in sample database;Every the extraction state and feature extraction master switch of the face picture of characteristic value to be extracted in preset time interval, query sample database;Characteristics extraction task is distributed to processing thread;Information relevant to extraction in processing thread is passed into virtual computing server-side by middleware;After virtual computing server-side has extracted characteristic value, characteristic value is saved in second network storage platform, while updating the extraction state of the face picture of characteristic value to be extracted in sample database.Technical solution of the present invention takes full advantage of the hardware resource of server, greatly improves the speed of batch extracting face picture characteristic value.
Description
Technical field
The present invention relates to field of information processing more particularly to a kind of face characteristic value extracting methods, device, computer equipment
And storage medium.
Background technique
One performance bottleneck of existing face identification system is the extraction stage to face picture characteristic value.When model liter
Grade or request peak period, it can involve and characteristic value is extracted again to a large amount of or even all samples, the order of magnitude is with hundred
Ten thousand meters.
Currently, the way commonplace to face picture characteristics extraction is, asked when in face of a batch characteristics extraction
When asking, in background synchronization processing or switch to single thread asynchronous process, while batch characteristic value can only be carried out on a machine
It extracts.In this way, the utilization rate to hardware resource is not high, the low efficiency of extraction process, extraction rate is slow.
Summary of the invention
The embodiment of the present invention provides a kind of face characteristic value extracting method, device, computer equipment and storage medium, with solution
It is not high to the utilization rate of hardware server resource when batch extracting face characteristic value, the problem of extraction process low efficiency.
A kind of face characteristic value extracting method, comprising:
The extraction request that client is sent is received, and is requested to determine feature extraction tasks according to the extraction, wherein is described
Feature extraction tasks include the identification information of each face picture of characteristic value to be extracted;
Feature extraction master switch in sample database is set on state, and will be described according to the identification information
The extraction state of each of characteristic value to be extracted face picture is set as preparing extraction state in sample database;
Every preset time interval, the feature extraction master switch is inquired;
If the feature extraction master switch is the open state, for the feature extraction tasks allocation processing thread,
Wherein, the processing thread is used for the store path by the face picture of the characteristic value to be extracted in second network storage platform,
Virtual computing server-side is passed to by middleware, the virtual computing server-side is used for according to store path acquisition
Face picture, and extract the characteristic value of the face picture;
Receive identification information, characteristic value and the extraction state of the face picture that the virtual computing server-side returns;
The characteristic value is saved in the correspondence of the face picture of the mark of identification information described in the second network storage platform
Position, and the extraction state of the face picture of the mark of identification information described in the sample database is updated to extract and completes shape
State;
If the extraction state of each of the characteristic value to be extracted face picture is the extraction completion status, by institute
It states feature extraction master switch and is set to off closed state.
A kind of face characteristic value extraction element, comprising:
It receives and extracts request module, for receiving the extraction request of client transmission, and request to determine according to the extraction
Feature extraction tasks, wherein the feature extraction tasks include the identification information of each face picture of characteristic value to be extracted;
Block of state is set, for the feature extraction master switch in sample database to be set on state, and according to
The identification information sets the extraction state of each of characteristic value to be extracted in the sample database face picture to
Prepare extraction state;
Enquiry module, for inquiring the feature extraction master switch every preset time interval;
Threading models are distributed, if being the open state for the feature extraction master switch, for the feature extraction
Task allocation processing thread, wherein the processing thread is used for the face picture of the characteristic value to be extracted in network storage
Store path on platform passes to virtual computing server-side by middleware, and the virtual computing server-side is used for according to institute
It states store path and obtains the face picture, and extract the characteristic value of the face picture;
Return value module is received, for receiving the mark letter for the face picture that the virtual computing server-side returns
Breath, characteristic value and extraction state;
First update module, for the characteristic value to be saved in the mark of identification information described in the second network storage platform
Face picture corresponding position, and by identification information described in the sample database mark face picture extraction state
It is updated to extract completion status;
Second update module, if the extraction state for each of the characteristic value to be extracted face picture is described mentions
Completion status is taken, then the feature extraction master switch is set to off closed state.
A kind of computer equipment, including memory, processor and storage are in the memory and can be in the processing
The computer program run on device, the processor realize above-mentioned face characteristic value extracting method when executing the computer program
The step of.
A kind of computer readable storage medium, the computer-readable recording medium storage have computer program, the meter
The step of calculation machine program realizes above-mentioned face characteristic value extracting method when being executed by processor.
Above-mentioned face characteristic value extracting method, device, computer equipment and storage medium are sent according to client is received
Extraction request, determine feature extraction tasks, the feature extraction master switch in sample database be set on state, and root
According to the identification information of the face picture in feature extraction tasks, by mentioning for the face picture of characteristic value to be extracted in sample database
State is taken to be set as preparing extraction state;By timed task, query characteristics are gone to extract master switch every preset time interval
State be characterized extraction task allocation processing thread if feature extraction master switch is the open state so that virtual meter
Characteristics extraction calculating can be carried out to the face picture of characteristic value to be extracted simultaneously by calculating server-side;Due to each characteristic value to be extracted
The extraction state of face picture have record in sample database so that virtual computing server-side is in parallel processing, respectively
Processing thread will not both repeat to have extracted the face picture of completion, will not omit the face picture for not extracting completion;Together
When, the hardware resource of server-side is taken full advantage of, the extraction rate of batch face picture characteristic value is greatly improved, to improve
The extraction efficiency of entire extraction process.
Detailed description of the invention
In order to illustrate the technical solution of the embodiments of the present invention more clearly, below by institute in the description to the embodiment of the present invention
Attached drawing to be used is needed to be briefly described, it should be apparent that, the accompanying drawings in the following description is only some implementations of the invention
Example, for those of ordinary skill in the art, without any creative labor, can also be according to these attached drawings
Obtain other attached drawings.
Fig. 1 is an application environment schematic diagram of face characteristic value extracting method in one embodiment of the invention;
Fig. 2 is the flow chart of face characteristic value extracting method in one embodiment of the invention;
Fig. 3 is the flow chart of step S4 in face characteristic value extracting method in one embodiment of the invention;
Fig. 4 is will to identify to believe in sample database in the step S6 of face characteristic value extracting method in one embodiment of the invention
The extraction state for ceasing the face picture of mark is updated to extract the flow chart of completion status;
Fig. 5 is the schematic diagram of face characteristic value extraction system in one embodiment of the invention;
Fig. 6 is the schematic diagram of face characteristic value extraction element in one embodiment of the invention;
Fig. 7 is the schematic diagram of computer equipment in one embodiment of the invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are some of the embodiments of the present invention, instead of all the embodiments.Based on this hair
Embodiment in bright, every other implementation obtained by those of ordinary skill in the art without making creative efforts
Example, shall fall within the protection scope of the present invention.
Face characteristic value extracting method provided by the present application, can be applicable in the application environment such as Fig. 1, wherein Ruo Gantai
Physical server forms a server cluster by network, every server in server cluster pass through network simultaneously with
Sample database is connected with second network storage platform;Virtual communication service is deployed on every server in server cluster
End, virtual computing server-side and middleware, virtual communication server-side are communicated by middleware with virtual computing server-side.
Network can be cable network or wireless network.After client initiates the request of face characteristics extraction, on every server
Virtual communication server-side and virtual computing server-side cooperative cooperating, the common processing task for completing to extract face extraction characteristic value.
Face characteristic value extracting method provided in an embodiment of the present invention is applied to virtual communication server-side.
In one embodiment, as shown in Fig. 2, providing a kind of face characteristic value extracting method, implementation process includes such as
Lower step:
S1: the extraction request that client is sent is received, and requests to determine feature extraction tasks according to extracting, wherein feature
Extraction task includes the identification information of each face picture of characteristic value to be extracted.
Initiate to extract the client requested from different registration users, it is to use recognition of face system that these, which register user,
The recognition of face service of system and the enterprise registered in system or tissue, are referred to as business side.Business side is in face identification system
When being registered, need that the legal face picture for needing to identify in this enterprise or tissue is submitted to deposit to the network of face identification system
It stores up in platform, and the correlation attribute information of legal face picture is stored into sample database.For example, if certain is public
Department needs to carry out attendance using employee of the face identification system to our company, then the said firm needs to submit all employees' of our company
Legal face picture is as sample.These legal face pictures will be submitted in the second network storage platform of face identification system,
The correlation attribute information of legal face picture is stored in sample database, wherein correlation attribute information includes but is not limited to:
Store path in second network storage platform of business side's identification information, the identification information of face picture, face picture, face picture
File size etc..
Business side's identification information specifically can be business side id (identification, identity) number, face picture
Identification information specifically can be No. id of face picture.
When client is initiated to extract request, virtual communication server-side can be true according to the business side's identification information made an appointment
Recognizing extraction request is from which business side, to orient each face of characteristic value to be extracted in sample database
The identification information of picture.
For example, client submits the list for extracting request by web page, and it attached business side id in web page
Number.Virtual communication server-side according to No. id of business side inquired in sample database under the business side it is each of corresponding to
Extract the identification information of face picture.
S2: the feature extraction master switch in sample database is set on state, and according to each face picture
Identification information sets the extraction state of each face picture of characteristic value to be extracted in sample database to prepare extraction state.
A feature extraction master switch table is preserved in sample database, this feature is extracted to be had recorded often in master switch table
The feature extraction master switch state of a business side.Once have extract request and reach virtual communication server-side when, then the institute of business side
The feature extraction master switch of category will be set on state by virtual communication server-side, represent and carry out face to the business side
Characteristics extraction;After the completion of all people's face picture feature value is extracted, this feature is extracted master switch and will be set to off
State.
Meanwhile also preserving a face picture in sample database and extracting state table, which extracts state
Table has recorded the extraction state of every face picture, which, which extracts, field " extracting state " in state table.When mentioning
When request being taken to reach virtual communication server-side, virtual communication server-side is extracted according to the identification information of face picture in face picture
Corresponding face picture is found in state table, and is " preparing to extract " by the extraction status modifier in this record;When virtual logical
When telecommunications services termination receives the identification information of the face picture of virtual computing server-side return and extracts state, virtual communication service
End extracts in face picture according to the identification information of face picture and finds corresponding face picture in state table, and this is recorded
In extraction status modifier be " extract complete ".
Specifically, after receiving the extraction request in step S1, feature extraction is always opened according to business side's identification information
Feature extraction master switch belonging to the business side is set on state in the table of pass, and according to the face of each characteristic value to be extracted
The identification information of picture sets the characteristics extraction state of the face picture of characteristic value to be extracted in face picture extraction state table
It is set to and prepares extraction state.
S3: every preset time interval, query characteristics extract master switch.
Specifically, virtual communication server-side uses java server, and is deployed with Spring frame thereon.Wherein,
Spring frame is the design level frame an of open source code, is the Java Development Framework an of lightweight, what he solved
It is the loose coupling problem of Business Logic He other each layers.For large-scale Web application system, usually first Spring is deployed to
On server, then further according to the needs of practical application, secondary development is done on Spring.It does so and takes full advantage of Spring
The existing interface of frame, avoids the development of simple repeatability, and can quickly develop the application that suitable own service needs.
Start task of timer on the basis of Spring frame, at predetermined intervals, regular query sample data
On library in feature extraction master switch table feature extraction master switch state.
Preferably, task of timer can inquire the state of a feature extraction master switch with every 1 second.
S4: if feature extraction master switch is open state, it is characterized extraction task allocation processing thread, wherein processing
Thread passes to void by middleware for the store path by the face picture of characteristic value to be extracted in second network storage platform
Quasi- to calculate server-side, virtual computing server-side is used to obtain face picture according to store path, and extracts the feature of face picture
Value.
Specifically, when it is open state that task of timer, which inquires feature extraction master switch, show there is client initiation
Extraction task, the call back function of task of timer will start multiprocessing thread and go to execute extraction task.Each processing thread will
Store path of the face picture of characteristic value in second network storage platform is extracted, virtual computing service is passed to by middleware
End.
Wherein, virtual computing server-side is the actuating station for extracting the characteristic value of face picture, virtual computing server-side
According to store path of the face picture in second network storage platform that processing thread transmitting comes, second network storage platform acquisition face is removed
Picture simultaneously executes the operation for extracting characteristic value.
Due to the difference of C Plus Plus and Java language in operational efficiency, wanted using the C++ server of same extraction algorithm
Faster than java server many out, preferably, therefore, virtual computing server-side is served as by C++ server.
Middleware is a kind of independent system software or service routine, is two stand-alone utilities of connection or autonomous system
Software.The system being connected even if they have different interfaces, but remains to exchange information by middleware between each other,
Therefore, a critical applications of middleware are the information transmitting between heterogeneous system.
Virtual communication server-side and virtual computing server-side are deployed on same physical host, and middleware is for void
The storage that communication between quasi- communication service end and virtual computing server-side, i.e. virtual communication server-side need characteristics extraction
Path passes to virtual computing server-side by middleware, and virtual computing server-side returns to void for result is extracted by middleware
Quasi- communication service end.
Preferably, use ZeroMQ as middleware.ZeroMQ is a kind of multi-threaded network library based on message queue,
Socket type, connection processing, frame, the even low-level details that route are abstracted, the set across multiple transport protocols is provided
Connect word.ZeroMQ is one layer in network communication newly, between TCP/IP (Transmission Control Protocol/
Internet Protocol, transmission control protocol/Internet Protocol) agreement application layer and transport layer between, ZeroMQ
It is a scalable layer, can runs, be dispersed between distributed system parallel.ZeroMQ provides the socket character library based on frame
(socket library) is often applied so that Windows Sockets become simple, succinct and performance is higher in network communication
On.
In general, the JAVA server and C++ server being deployed on same physical host will carry out multi-thread
The communication of journey is more troublesome, and due to the two isomery, the communication between them needs special api interface to realize;Again due to more
The complexity of thread process, developing the work of special api interface is time-consuming and is easy to malfunction.Therefore, the net of ZeroMQ is utilized
Network communication advantage, using it as middleware, for being communicated between JAVA server and C++ server, instead of traditional API communication
Method improves development efficiency, reduces risk of error, while completely not defeated in traditional scheme in performance.
S5: identification information, characteristic value and the extraction state of the face picture that virtual computing server-side returns are received.
Specifically, each processing thread will execute the extraction procedure in virtual computing server-side.Extraction procedure is to receive
To store path of the face picture to be extracted in second network storage platform as input parameter, the result data completed will be extracted
Virtual communication server-side is returned to by middleware.Wherein, result data includes the identification information of face picture, characteristic value and mentions
State is taken, by virtual communication server-side reception result data.
S6: characteristic value is saved in the corresponding position of the face picture of second network storage platform identification information mark, and will
The extraction state of the face picture of sample database identification information mark is updated to extract completion status.
Second network storage platform also saves the characteristic value after characteristics extraction in addition to saving face picture file.Characteristic value
It is saved in the form of characteristic value file.
Virtual communication server-side is using the identification information of face picture as directory name, by the characteristic value received by being write as
The form of disk file is saved in second network storage platform.Meanwhile virtual communication server-side is by the face picture in sample database
Extraction state be updated.
Specifically, virtual communication server-side is extracted state table to the face picture in sample database by JDBC and is carried out more
It newly, is " extract and complete " by the extraction status modifier of face picture corresponding with the identification information of face picture.Wherein, JDBC
(connection of Java DataBase Connectivity, Java database) is a kind of for executing the Java API of SQL statement, can
To provide unified access for a variety of relational databases, the class and interface that it is write by one group with Java language are formed.JDBC is provided
A kind of benchmark, can construct more advanced tool and interface accordingly, database development personnel is enable to write database application
Program.Database development personnel can be suitably used for different databases by the interface routine that JDBC writes, and no longer need for not
Same database writes interface routine respectively, greatly improves development efficiency.
S7: if the extraction state of each face picture of characteristic value to be extracted is extraction completion status, feature is mentioned
Master switch is taken to be set to off closed state.
In primary extraction task, the quantity of the face picture of characteristic value to be extracted is to determine that in step sl
's.The every extraction state for having modified a face picture of virtual communication server-side, then will extract the face picture quantity of completion
Add one, and accumulated value is saved in a global variable.When the value of this global variable is equal to the face of characteristic value to be extracted
When the quantity of picture, it is determined that the secondary extraction task all executes completion, and feature extraction master switch is set off
State.
Specifically, the task of timer that more new task is executed in virtual communication server-side is primary global every inquiry in 0.5 second
Whether the value of variable is equal with the face picture quantity of characteristic value to be extracted, if the two is equal, passes through JDBC for sample data
Feature extraction master switch in library in feature extraction master switch table is set to off closed state.
In the present embodiment, it is requested according to the extraction for receiving client transmission, feature extraction tasks is determined, by sample number
It is set on state according to the feature extraction master switch in library, and is believed according to the mark of the face picture in feature extraction tasks
Breath sets the extraction state of the face picture of characteristic value to be extracted in sample database to prepare extraction state;Pass through timing
Task goes the state of query characteristics extraction master switch every preset time interval, if feature extraction master switch is the unlatching
State is then characterized extraction task allocation processing thread, enables virtual computing server-side simultaneously to the people of characteristic value to be extracted
Face picture carries out characteristics extraction calculating;Due to each characteristic value to be extracted face picture extraction state in sample database
In have record so that virtual computing server-side is in parallel processing, lineation journey will not both repeat extract completion everywhere
Face picture, the face picture for not extracting completion will not be omitted;Meanwhile taking full advantage of the hardware resource of server-side, pole
The extraction rate of batch face picture characteristic value is improved greatly, to improve the extraction efficiency of entire extraction process.
Further, in one embodiment, as shown in figure 3, in step s 4, even feature extraction master switch is opening state
State is then characterized extraction task allocation processing thread, specifically comprises the following steps:
S41: if feature extraction master switch is open state, CPU configuration information is detected.
The configuration information of CPU, main includes the number of threads of the machine CPU.When feature extraction master switch be open state, if
Detect the CPU of 4 core, 8 thread, then the number of threads of CPU is 8.Similarly, each virtual communication server-side detects this landlord
The CPU line number of passes of machine.
Specifically, virtual communication server-side can detect the configuration information of CPU by calling system interface.For example,
Order can be used under linux system: grep'processor'/proc/cpuinfo | sort-u | wc-l carries out CPU with confidence
The detection of breath.
S42: according to CPU configuration information, determining number of threads, and starts M processing thread, wherein M is number of threads.
The number of threads of CPU is consistent by processing Thread Count to be started with virtual communication server-side.If being examined in step S41
The CPU line number of passes amount measured is 8, then virtual communication server-side starts 8 processing threads.Similarly, each virtual communication service
End starts the processing Thread Counts of respective numbers according to the CPU line number of passes of local host is detected.
Specifically, the CPU line number of passes amount that virtual communication server-side is detected using in step S41 starts as input parameter
Handle thread.If the CPU line number of passes amount detected is 8, new method is called in virtual communication server-side, starts 8 threads
The example of object.
S43: it according to preset individual human face picture feature value average extraction time, can be locked for the distribution of each processing thread
The Objective extraction number of tasks of processing.
Processing thread in each virtual computing server-side can obtain characteristic value to be extracted from second network storage platform
Face picture, and behaviour is read out and updated to the corresponding record of the face picture of the characteristic value to be extracted in sample database
Make, therefore, unordered contention resource and duplicate extraction occurs between thread in order not to allow, need to distribute for each processing thread
The Objective extraction number of tasks of energy locking processing.The foundation of the Objective extraction number of tasks of distribution energy locking processing, is according to preset
Individual human face picture feature value average extraction time.
For example, if the characteristic value that a thread extracts a face picture needs averagely about 500 milliseconds.If every
One thread only locks a data, then he understands frequent visit database;If 1,000,000 datas, it is necessary to access number
According to library 1,000,000 times, the waste of resource, hardware excessive loss will cause in this way.If the record number of each thread locked is too many,
Such as 100,000, and per thread working capability finite, processing not in time, wait the time to be processed also can be very long, thus efficiency
It can be low.
If extracting server of the time less than 500 milliseconds that a face picture characteristic value needs in cluster, the clothes are represented
The machine cpu performance of business device is superior, then is that the processing thread of this server distributes the Objective extraction of 1500 energy locking processings
Number of tasks;If extracting server of the time more than or equal to 500 milliseconds that a face picture characteristic value needs in cluster, representing should
The machine cpu performance relative disadvantage of server distributes the mesh of 1000 energy locking processings then for the processing thread of this server
Mark extracts number of tasks.
Locking process is specifically as follows: each processing thread of setting at most locks 1500 records, then for 1,000,000 to
For the record of extraction, each processing thread can lock in sample database 1500 records, and each processing thread is by sample number
It is labeled according to the data record to one's name handled in library, such as sets the lock state of characteristic value face picture to be extracted to
" locked ".Same record can only be by a processing thread locked.When a processing thread process complete one's own 1500
After item record, then new untreated 1500 records are locked from sample database, until all records to be extracted are located
It has managed.
In the present embodiment, according to the physical cord number of passes of the machine CPU, to extract the processing line that task distributes respective numbers
Journey, meanwhile, the average time-consuming of extraction task is executed according to each processing thread to determine processing thread distribution energy locking processing
Objective extraction number of tasks, so that multiprocessing thread is when executing extraction task, face picture characteristic value will not be repeated extraction, and
It will not be because of the situation of extraction process confusion caused by contention resource.
Further, in embodiment, as shown in figure 4, in step s 6, i.e., identifying sample database identification information
Face picture extraction state be updated to extract completion status, specifically comprise the following steps:
S61: the identification information for the face picture that virtual computing server-side returns and extraction state correspondence are saved in caching
Queue.
The identification information for the face picture that virtual computing server-side returns and extraction state are cached, by each face
The identification information of picture and corresponding extraction state are saved in buffer queue as a pair of of data.
Preferably, the identification information of each face picture and corresponding extraction state are saved in the form of key-value pair,
Especially saved in a manner of JSON format.Wherein, JSON (JavaScript Object Notation, JS object letter
Spectrum) be a kind of lightweight data interchange format.
S62: if the length of buffer queue reaches preset length threshold, believed according to the mark saved in buffer queue
The extraction state for the face picture that the identification information in sample database identifies is updated to the identification information in buffer queue by breath
Corresponding extraction state.
Specifically, the length of buffer queue can be determined according to the array size distributed.Preferably, preset length
Threshold value is set as 100, i.e., when extracting the face picture completed record number and having reached 100, virtual communication server-side is by sample
The extraction state of corresponding record is updated to extract completion status in database.
In the present embodiment, virtual computing server-side by the identification information of face picture and mentions after having extracted characteristic value
State is taken to return to virtual communication server-side by middleware.If virtual communication server-side in real time arrives the update of these data results
In sample database, then frequent visit sample database will cause the waste of resource, hardware excessive loss, therefore, using slow
The update of the data that the method deposited returns to virtual computing server-side in batches saves Internet resources, together into sample database
When avoid hardware excessive loss.
It further, in one embodiment, is each according to preset individual human face picture feature value average extraction time
The Objective extraction number of tasks of thread distribution energy locking processing is handled, including can be locked according to following formula for the distribution of each processing thread
Surely the Objective extraction number of tasks handled:
t*N<T
Wherein, t is preset individual human face picture feature value average extraction time, and N is Objective extraction number of tasks, and T is pre-
If batch face picture characteristics extraction total time.That is t is that preset individual human face picture feature value averagely mentions in step S43
Take the time.
Preferably, t is 500 milliseconds, and T is 10 minutes, then the Objective extraction of each processing thread distribution energy locking processing is appointed
Business number N is 1200.I.e. every 10 minutes, virtual communication server-side will start processing thread go sample database locking a batch to
The data record for extracting the face picture of characteristic value carries out characteristics extraction, the Objective extraction task of per thread energy locking processing
Number is 1200.
It should be noted that preset batch face picture characteristics extraction total time T can be according to project demands freedom
Configuration, such as requested peak time in user, batch extracting sample characteristics response speed needs that as quickly as possible, then 10 points can be selected
Clock is less;Conversely, response timeliness is of less demanding, can select 10 minutes or more.If being still not extracted by more than 10 minutes
These face pictures for being not extracted by characteristic value are then considered as the face picture for extracting failure by the face picture of complete characteristic value,
Meanwhile virtual communication server-side can restart the number for the face picture that processing thread goes locking residue to be not extracted by characteristic value
According to record, completed until all extracting.
In the present embodiment, the Objective extraction number of tasks of per thread energy locking processing is counted according to above-mentioned formula
It calculates, can enable the Objective extraction number of tasks of each processing thread locking processing in a reasonable range, it is entire to extract spy
The process of value indicative has taken into account efficiency and speed.
Further, in one embodiment, in the extraction shape for the face picture for identifying sample database identification information
State is updated to after extracting completion status, face characteristic value extracting method further include:
S8: when the actual extracting time of face picture characteristic value is more than that preset batch face picture characteristics extraction is total
Between when, if the extraction state of any face picture of characteristic value to be extracted be not extract completion status, it is determined that with the face figure
The corresponding feature extraction tasks of piece do not complete, and extract task for this feature and redistribute processing thread.
Multithreading may meet with such as network delay, server when handling extraction task and be not responding to various unexpectedly ask
Topic, this needs mechanism for correcting errors guarantee extraction task and finally can smoothly be finished.
Specifically, virtual communication server-side from starting allocation processing thread to the actual extracting of face picture characteristic value when
Between carry out timing, preset face picture characteristics extraction total time is 15 minutes.When the actual extracting of face picture characteristic value
When time reaches 15 minutes, virtual communication server-side is extracted state table to the face picture in sample database by JDBC and is carried out
Inquiry, the extraction state for face picture in table is not still the face picture of extraction completion status, it is determined that with the face figure
The corresponding feature extraction tasks of piece do not complete.For unfinished extraction task, virtual communication server-side is that this feature extraction is appointed
Processing thread is redistributed in business, and restarts timing, until all extraction tasks are executed into.
In the present embodiment, multithreading has the occurrence of unexpected in the process of implementation in order to prevent, introduces mechanism for correcting errors
Ensure that each extraction task can be executed into.
It should be understood that the size of the serial number of each step is not meant that the order of the execution order in above-described embodiment, each process
Execution sequence should be determined by its function and internal logic, the implementation process without coping with the embodiment of the present invention constitutes any limit
It is fixed.
In one embodiment, as shown in figure 5, providing a kind of face characteristic value extraction system, which includes network storage
Platform, sample database and server cluster, wherein server cluster is made of more physical servers, every physical services
Device includes virtual computing server-side, virtual communication server-side and middleware;
Every physical server in server cluster and pass through network connection between second network storage platform;Server cluster
In every physical server and sample database between pass through network connection;Virtual computing server-side and virtual communication server-side
Between pass through middleware connect;
Virtual communication server-side, for realizing the step in above-mentioned face characteristic value extracting method embodiment.Preferably, empty
Quasi- communication service end is made of java server, and Spring frame is deployed on java server;
Virtual computing server-side, for the storage road according to the face picture of characteristic value to be extracted in second network storage platform
Diameter obtains face picture, extracts the characteristic value of face picture, and the characteristic value of face picture is returned to virtual communication server-side.
Preferably, virtual computing server-side is made of C++ server;
Second network storage platform, for storing the face picture of characteristic value to be extracted and the characteristic value of face picture.Preferably,
Second network storage platform is NAS (Network Attached Storage, network attached storage) system, and NAS system is based on standard
Network protocol realizes data transmission, is Windows in network, the computer of the various different operating systems such as Linux, Mac OS
File-sharing and data backup are provided;
Sample database, for storing the extraction state of feature extraction master switch and each face picture.Sample database
The relational data used includes but is not limited to MS-SQL, Oracle, MySQL, Sybase, DB2 etc.;
Middleware, for being communicated between virtual computing server and virtual communication server.Preferably, middleware uses
ZeroMQ。
In one embodiment, a kind of face characteristic value extraction element is provided, the face characteristics extraction device and above-mentioned reality
Face characteristic value extracting method in example is applied to correspond.As shown in fig. 6, the face characteristics extraction device includes receiving to extract to ask
Modulus block 61, enquiry module 63, distribution threading models 64, receives the update mould of return value module 65, first at setting block of state 62
Block 66 and the second update module 67.Detailed description are as follows for each functional module:
It receives and extracts request module 61, the extraction request sent for receiving client, and request to determine spy according to extracting
Levy extraction task, wherein feature extraction tasks include the identification information of each face picture of characteristic value to be extracted;
Block of state 62 is set, for the feature extraction master switch in sample database to be set on state, and root
The extraction state of each face picture of characteristic value to be extracted in sample database is set as preparing to extract shape according to identification information
State;
Enquiry module 63, for every preset time interval, query characteristics to extract master switch;
Threading models 64 are distributed, if being open state for feature extraction master switch, are characterized at extraction task distribution
Lineation journey, wherein processing thread leads to for the store path by the face picture of characteristic value to be extracted in second network storage platform
It crosses middleware and passes to virtual computing server-side, virtual computing server-side is used to obtain face picture according to store path, and mentions
Take the characteristic value of face picture;
Return value module 65 is received, the identification information of the face picture for receiving the return of virtual computing server-side, feature
Value and extraction state;
First update module 66, for characteristic value to be saved in the face picture of second network storage platform identification information mark
Corresponding position, and by the extraction state for the face picture that sample database identification information identifies be updated to extract complete shape
State;
Second update module 67, if the extraction state of each face picture for characteristic value to be extracted is to extract to complete
Feature extraction master switch is then set to off closed state by state.
Further, threading models 64 are distributed further include:
Detection sub-module 641 detects CPU configuration information if being open state for feature extraction master switch;
Thread promoter module 642, for determining number of threads, and start M processing thread according to CPU configuration information,
Wherein, M is number of threads;
Distribution locking submodule 643, for being each according to preset individual human face picture feature value average extraction time
Handle the Objective extraction number of tasks of thread distribution energy locking processing.
Further, the first update module 66 includes:
Cache sub-module 661: the identification information and extraction state of the face picture for returning to virtual computing server-side
Correspondence is saved in buffer queue;
Synchronous submodule 662: if the length for buffer queue reaches preset length threshold, according in buffer queue
The extraction state for the face picture that the identification information in sample database identifies is updated to buffer queue by the identification information of preservation
In the corresponding extraction state of the identification information.
Further, distribution locking submodule 643 includes:
Distribute locking subelement 6431: for being the target of each processing thread distribution energy locking processing according to following formula
Extract number of tasks:
t*N<T
Wherein, t is preset individual human face picture feature value average extraction time, and N is Objective extraction number of tasks, and T is pre-
If batch face picture characteristics extraction total time.
Further, the face characteristics extraction device further include:
Thread distribution resetting module 68: being more than preset batch people for the actual extracting time when face picture characteristic value
When face picture feature value extracts total time, if the extraction state of any face picture of characteristic value to be extracted is not to extract to complete shape
State, it is determined that feature extraction tasks corresponding with the face picture do not complete, and extract task for this feature and redistribute processing
Thread.
Specific restriction about face characteristic value extraction element may refer to above for face characteristic value extracting method
Restriction, details are not described herein.Modules in above-mentioned face characteristic value extraction element can be fully or partially through software, hard
Part and combinations thereof is realized.Above-mentioned each module can be embedded in the form of hardware or independently of in the processor in computer equipment,
It can also be stored in a software form in the memory in computer equipment, execute the above modules in order to which processor calls
Corresponding operation.
In one embodiment, a kind of computer equipment is provided, which can be server, internal junction
Composition can be as shown in Figure 7.The computer equipment include by system bus connect processor, memory, network interface and
Database.Wherein, the processor of the computer equipment is for providing calculating and control ability.The memory packet of the computer equipment
Include non-volatile memory medium, built-in storage.The non-volatile memory medium is stored with operating system, computer program and data
Library.The built-in storage provides environment for the operation of operating system and computer program in non-volatile memory medium.The calculating
The network interface of machine equipment is used to communicate with external terminal by network connection.When the computer program is executed by processor with
Realize a kind of face characteristic value extracting method.
In one embodiment, a kind of computer equipment is provided, including memory, processor and storage are on a memory
And the computer program that can be run on a processor, processor realize face characteristic in above-described embodiment when executing computer program
The step of being worth extracting method, such as step S1 shown in Fig. 2 to step S7.Alternatively, processor is realized when executing computer program
The function of each module/unit of face characteristic value extraction element in above-described embodiment, such as module 61 shown in Fig. 6 is to module 67
Function.To avoid repeating, which is not described herein again.
In one embodiment, a computer readable storage medium is provided, computer program, computer program are stored thereon with
Face characteristic value extracting method in above method embodiment is realized when being executed by processor, alternatively, the computer program is processed
The function of each module/unit in face characteristic value extraction element in above-mentioned apparatus embodiment is realized when device executes.To avoid repeating,
Which is not described herein again.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with
Relevant hardware is instructed to complete by computer program, the computer program can be stored in a non-volatile computer
In read/write memory medium, the computer program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein,
To any reference of memory, storage, database or other media used in each embodiment provided herein,
Including non-volatile and/or volatile memory.Nonvolatile memory may include read-only memory (ROM), programming ROM
(PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM) or flash memory.Volatile memory may include
Random access memory (RAM) or external cache.By way of illustration and not limitation, RAM is available in many forms,
Such as static state RAM (SRAM), dynamic ram (DRAM), synchronous dram (SDRAM), double data rate sdram (DDRSDRAM), enhancing
Type SDRAM (ESDRAM), synchronization link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM
(RDRAM), direct memory bus dynamic ram (DRDRAM) and memory bus dynamic ram (RDRAM) etc..
It is apparent to those skilled in the art that for convenience of description and succinctly, only with above-mentioned each function
Can unit, module division progress for example, in practical application, can according to need and by above-mentioned function distribution by different
Functional unit, module are completed, i.e., the internal structure of described device is divided into different functional unit or module, more than completing
The all or part of function of description.
Embodiment described above is merely illustrative of the technical solution of the present invention, rather than its limitations;Although referring to aforementioned reality
Applying example, invention is explained in detail, those skilled in the art should understand that: it still can be to aforementioned each
Technical solution documented by embodiment is modified or equivalent replacement of some of the technical features;And these are modified
Or replacement, the spirit and scope for technical solution of various embodiments of the present invention that it does not separate the essence of the corresponding technical solution should all
It is included within protection scope of the present invention.
Claims (10)
1. a kind of face characteristic value extracting method, which is characterized in that the face characteristic value extracting method includes:
The extraction request that client is sent is received, and is requested to determine feature extraction tasks according to the extraction, wherein the feature
Extraction task includes the identification information of each face picture of characteristic value to be extracted;
Feature extraction master switch in sample database is set on state, and according to the identification information by the sample
The extraction state of each of characteristic value to be extracted face picture is set as preparing extraction state in database;
Every preset time interval, the feature extraction master switch is inquired;
If the feature extraction master switch is the open state, for the feature extraction tasks allocation processing thread, wherein
The processing thread is for the store path by the face picture of the characteristic value to be extracted in second network storage platform, in
Between part pass to virtual computing server-side, the virtual computing server-side is used to obtain the face figure according to the store path
Piece, and extract the characteristic value of the face picture;
Receive identification information, characteristic value and the extraction state of the face picture that the virtual computing server-side returns;
The characteristic value is saved in the corresponding position of the face picture of the mark of identification information described in the second network storage platform,
And it is updated to the extraction state of the face picture of the mark of identification information described in the sample database to extract completion status;
If the extraction state of each of the characteristic value to be extracted face picture is the extraction completion status, by the spy
Sign extracts master switch and is set to off closed state.
2. face characteristic value extracting method as described in claim 1, which is characterized in that if the feature extraction master switch
It is then the feature extraction tasks allocation processing thread for the open state, comprising:
If the feature extraction master switch is the open state, CPU configuration information is detected;
According to the CPU configuration information, number of threads is determined, and start the M processing threads, wherein M is the Thread Count
Amount;
It, can locking processing for each processing thread distribution according to preset individual human face picture feature value average extraction time
Objective extraction number of tasks.
3. face characteristic value extracting method as described in claim 1, which is characterized in that described by institute in the sample database
The extraction state for stating the face picture of identification information mark is updated to extract completion status, comprising:
The identification information for the face picture that the virtual computing server-side returns and extraction state correspondence are saved in caching
Queue;
If the length of the buffer queue reaches preset length threshold, believed according to the mark saved in the buffer queue
Breath, the extraction state for the face picture that the identification information in the sample database identifies is updated in the buffer queue should
The corresponding extraction state of identification information.
4. face characteristic value extracting method as claimed in claim 2, which is characterized in that described according to preset individual human face figure
Piece characteristic value average extraction time, for the Objective extraction number of tasks of each processing thread distribution energy locking processing, comprising:
It is the Objective extraction number of tasks of each processing thread distribution energy locking processing according to following formula:
t*N<T
Wherein, t is the preset individual human face picture feature value average extraction time, and N is the Objective extraction number of tasks, T
For preset batch face picture characteristics extraction total time.
5. face characteristic value extracting method as claimed in claim 4, which is characterized in that it is described will be in the sample database
The extraction state of the face picture of the identification information mark is updated to after extracting completion status, and the face characteristic value is extracted
Method further include:
It is more than the preset batch face picture characteristics extraction total time when the actual extracting time of face picture characteristic value
When, if the extraction state of any face picture of characteristic value to be extracted is not the extraction completion status, it is determined that with this
The corresponding feature extraction tasks of face picture do not complete, and extract task for this feature and redistribute the processing thread.
6. a kind of face characteristic value extraction element, which is characterized in that the face characteristic value extraction element, comprising:
It receives and extracts request module, for receiving the extraction request of client transmission, and requested to determine feature according to the extraction
Extraction task, wherein the feature extraction tasks include the identification information of each face picture of characteristic value to be extracted;
Block of state is set, for the feature extraction master switch in sample database to be set on state, and according to described
The extraction state of each of characteristic value to be extracted in the sample database face picture is set as preparing by identification information
Extraction state;
Enquiry module, for inquiring the feature extraction master switch every preset time interval;
Threading models are distributed, if being the open state for the feature extraction master switch, for the feature extraction tasks
Allocation processing thread, wherein the processing thread is used for the face picture of the characteristic value to be extracted in second network storage platform
On store path, virtual computing server-side is passed to by middleware, the virtual computing server-side according to for depositing
It stores up path and obtains the face picture, and extract the characteristic value of the face picture;
Return value module is received, for receiving identification information, the spy of the face picture that the virtual computing server-side returns
Value indicative and extraction state;
First update module, for the characteristic value to be saved in the people of the mark of identification information described in the second network storage platform
The corresponding position of face picture, and the extraction state of the face picture of the mark of identification information described in the sample database is updated
To extract completion status;
Second update module, if the extraction state for each of the characteristic value to be extracted face picture is described extracted
At state, then the feature extraction master switch is set to off closed state.
7. face characteristic value extraction element as claimed in claim 6, which is characterized in that the distribution threading models, comprising:
Detection sub-module detects CPU configuration information if being open state for the feature extraction master switch;
Thread promoter module for determining number of threads according to the CPU configuration information, and starts the M processing lines
Journey, wherein M is the number of threads;
Distribution locking submodule, for being each place according to preset individual human face picture feature value average extraction time
The Objective extraction number of tasks of lineation journey distribution energy locking processing.
8. face characteristic value extraction element as claimed in claim 7, which is characterized in that the distribution locks submodule and includes:
Distribute locking subelement: for being the Objective extraction of each processing thread distribution energy locking processing according to following formula
Number of tasks:
t*N<T
Wherein, t is the preset individual human face picture feature value average extraction time, and N is the Objective extraction number of tasks, T
For preset batch face picture characteristics extraction total time.
9. a kind of computer equipment, including memory, processor and storage are in the memory and can be in the processor
The computer program of upper operation, which is characterized in that the processor realized when executing the computer program as claim 1 to
The step of any one of 5 face characteristic value extracting method.
10. a kind of computer readable storage medium, the computer-readable recording medium storage has computer program, and feature exists
In realization face characteristic value extracting method as described in any one of claim 1 to 5 when the computer program is executed by processor
The step of.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810953164.4A CN109271869B (en) | 2018-08-21 | 2018-08-21 | Face feature value extraction method and device, computer equipment and storage medium |
PCT/CN2018/120825 WO2020037896A1 (en) | 2018-08-21 | 2018-12-13 | Facial feature value extraction method and device, computer apparatus, and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810953164.4A CN109271869B (en) | 2018-08-21 | 2018-08-21 | Face feature value extraction method and device, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109271869A true CN109271869A (en) | 2019-01-25 |
CN109271869B CN109271869B (en) | 2023-09-05 |
Family
ID=65154069
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810953164.4A Active CN109271869B (en) | 2018-08-21 | 2018-08-21 | Face feature value extraction method and device, computer equipment and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN109271869B (en) |
WO (1) | WO2020037896A1 (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111598043A (en) * | 2020-05-25 | 2020-08-28 | 山东超越数控电子股份有限公司 | Face recognition method, system, device and medium |
CN113760487B (en) * | 2020-08-05 | 2024-04-12 | 北京京东振世信息技术有限公司 | Service processing method and device |
CN112149087A (en) * | 2020-08-24 | 2020-12-29 | 深圳达实软件有限公司 | Rapid authorization method for face authority |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080281906A1 (en) * | 2007-05-10 | 2008-11-13 | Takeshi Ogasawara | Server device operating in response to received request |
CN105975948A (en) * | 2016-05-23 | 2016-09-28 | 南京甄视智能科技有限公司 | Cloud service platform architecture for face identification |
CN108197318A (en) * | 2018-02-01 | 2018-06-22 | 广州市君望机器人自动化有限公司 | Face identification method, device, robot and storage medium |
WO2018133666A1 (en) * | 2017-01-17 | 2018-07-26 | 腾讯科技(深圳)有限公司 | Method and apparatus for tracking video target |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108197608A (en) * | 2018-02-01 | 2018-06-22 | 广州市君望机器人自动化有限公司 | Face identification method, device, robot and storage medium |
CN108108499B (en) * | 2018-02-07 | 2023-05-26 | 腾讯科技(深圳)有限公司 | Face retrieval method, device, storage medium and equipment |
-
2018
- 2018-08-21 CN CN201810953164.4A patent/CN109271869B/en active Active
- 2018-12-13 WO PCT/CN2018/120825 patent/WO2020037896A1/en active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080281906A1 (en) * | 2007-05-10 | 2008-11-13 | Takeshi Ogasawara | Server device operating in response to received request |
CN105975948A (en) * | 2016-05-23 | 2016-09-28 | 南京甄视智能科技有限公司 | Cloud service platform architecture for face identification |
WO2018133666A1 (en) * | 2017-01-17 | 2018-07-26 | 腾讯科技(深圳)有限公司 | Method and apparatus for tracking video target |
CN108197318A (en) * | 2018-02-01 | 2018-06-22 | 广州市君望机器人自动化有限公司 | Face identification method, device, robot and storage medium |
Also Published As
Publication number | Publication date |
---|---|
WO2020037896A1 (en) | 2020-02-27 |
CN109271869B (en) | 2023-09-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11397709B2 (en) | Automated configuration of log-coordinated storage groups | |
US10338958B1 (en) | Stream adapter for batch-oriented processing frameworks | |
CN106164865B (en) | The method and system of the affairs batch processing of dependence perception for data duplication | |
US8713046B2 (en) | Snapshot isolation support for distributed query processing in a shared disk database cluster | |
US20170249353A1 (en) | Using databases for both transactions and analysis | |
US10560544B2 (en) | Data caching in a collaborative file sharing system | |
CN106598992B (en) | Database operation method and device | |
US9348641B2 (en) | System and method for performing a transaction in a massively parallel processing database | |
US20160086260A1 (en) | Lifecycle transitions in log-coordinated data stores | |
JP2019515377A (en) | Distributed Datastore Versioned Hierarchical Data Structure | |
US20150205850A1 (en) | Eager replication of uncommitted transactions | |
US20110113117A1 (en) | Asynchronous Collection and Correlation of Trace and Communications Event Data | |
US11487714B2 (en) | Data replication in a data analysis system | |
CN107077492A (en) | The expansible transaction management based on daily record | |
WO2019242132A1 (en) | Information filtering method and apparatus, computer device and storage medium | |
CN107148617A (en) | Automatically configuring for storage group is coordinated in daily record | |
CN109271869A (en) | Face characteristic value extracting method, device, computer equipment and storage medium | |
US11599514B1 (en) | Transactional version sets | |
CN110581893B (en) | Data transmission method and device, routing equipment, server and storage medium | |
CN110224899B (en) | TCP application call chain acquisition method and device | |
CN108268468A (en) | The analysis method and system of a kind of big data | |
US7752225B2 (en) | Replication and mapping mechanism for recreating memory durations | |
CN111400356A (en) | Data query method, device and equipment | |
CN108573063A (en) | A kind of data query method and system | |
US20050144299A1 (en) | System and method for supporting XA 2-phase commit protocols with a loosely coupled clustered database server |
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 |