CN114898446A - Human face recognition method, device, equipment and storage medium based on artificial intelligence - Google Patents
Human face recognition method, device, equipment and storage medium based on artificial intelligence Download PDFInfo
- Publication number
- CN114898446A CN114898446A CN202210680595.4A CN202210680595A CN114898446A CN 114898446 A CN114898446 A CN 114898446A CN 202210680595 A CN202210680595 A CN 202210680595A CN 114898446 A CN114898446 A CN 114898446A
- Authority
- CN
- China
- Prior art keywords
- network
- face recognition
- data
- target
- sub
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 65
- 238000013473 artificial intelligence Methods 0.000 title claims abstract description 45
- 238000003860 storage Methods 0.000 title claims abstract description 20
- 238000012549 training Methods 0.000 claims abstract description 167
- 238000005457 optimization Methods 0.000 claims abstract description 98
- 238000005516 engineering process Methods 0.000 claims abstract description 31
- 230000006835 compression Effects 0.000 claims abstract description 28
- 238000007906 compression Methods 0.000 claims abstract description 28
- 238000013135 deep learning Methods 0.000 claims abstract description 18
- 230000014509 gene expression Effects 0.000 claims description 77
- 238000005520 cutting process Methods 0.000 claims description 66
- 238000012360 testing method Methods 0.000 claims description 54
- 239000011159 matrix material Substances 0.000 claims description 21
- 238000012545 processing Methods 0.000 claims description 21
- 238000011056 performance test Methods 0.000 claims description 20
- 238000004590 computer program Methods 0.000 claims description 16
- 238000006243 chemical reaction Methods 0.000 claims description 8
- 238000010606 normalization Methods 0.000 claims description 8
- 238000010845 search algorithm Methods 0.000 claims description 6
- 238000007781 pre-processing Methods 0.000 claims description 5
- 230000008569 process Effects 0.000 description 12
- 238000004364 calculation method Methods 0.000 description 6
- 238000010586 diagram Methods 0.000 description 5
- 230000006870 function Effects 0.000 description 4
- 230000005540 biological transmission Effects 0.000 description 3
- 230000001680 brushing effect Effects 0.000 description 3
- 230000010354 integration Effects 0.000 description 3
- 238000013500 data storage Methods 0.000 description 2
- 238000011176 pooling Methods 0.000 description 2
- 230000035945 sensitivity Effects 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- ORILYTVJVMAKLC-UHFFFAOYSA-N Adamantane Natural products C1C(C2)CC3CC1CC2C3 ORILYTVJVMAKLC-UHFFFAOYSA-N 0.000 description 1
- 230000004308 accommodation Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 239000003086 colorant Substances 0.000 description 1
- 238000013136 deep learning model Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000004438 eyesight Effects 0.000 description 1
- 239000011521 glass Substances 0.000 description 1
- 238000005286 illumination Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000013515 script Methods 0.000 description 1
- 230000011664 signaling Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
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
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/62—Protecting access to data via a platform, e.g. using keys or access control rules
- G06F21/6218—Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
- G06F21/6245—Protecting personal data, e.g. for financial or medical purposes
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/047—Probabilistic or stochastic networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/082—Learning methods modifying the architecture, e.g. adding, deleting or silencing nodes or connections
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/77—Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
- G06V10/774—Generating sets of training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/82—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
-
- 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/161—Detection; Localisation; Normalisation
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Health & Medical Sciences (AREA)
- General Physics & Mathematics (AREA)
- General Health & Medical Sciences (AREA)
- Software Systems (AREA)
- Evolutionary Computation (AREA)
- Computing Systems (AREA)
- Multimedia (AREA)
- Artificial Intelligence (AREA)
- General Engineering & Computer Science (AREA)
- Computational Linguistics (AREA)
- Molecular Biology (AREA)
- Data Mining & Analysis (AREA)
- Mathematical Physics (AREA)
- Biophysics (AREA)
- Biomedical Technology (AREA)
- Medical Informatics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Databases & Information Systems (AREA)
- Human Computer Interaction (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Oral & Maxillofacial Surgery (AREA)
- Bioethics (AREA)
- Probability & Statistics with Applications (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- Image Analysis (AREA)
Abstract
The invention relates to the field of artificial intelligence, and discloses a human face recognition method, a human face recognition device, human face recognition equipment and a storage medium, wherein the human face recognition method comprises the following steps: deep learning training and network optimization based on a lottery hypothesis compression technology are carried out on a preset recognition network to obtain a target sub-network meeting preset performance conditions and output the target sub-network as a face recognition model; compiling and optimizing codes of the face recognition model to obtain target codes; deploying the target code to target equipment to call a face recognition model to perform face recognition on data to be recognized, wherein the target equipment comprises edge equipment and terminal equipment; according to the invention, the identification performance of the face identification model is ensured, and simultaneously, the model data volume and the code volume of the face identification model are reduced, so that the operation cost of target equipment is reduced, the face identification model can be directly deployed to target equipment such as edge equipment and terminal equipment, the face data leakage risk is reduced, and the safety of face identification is improved.
Description
Technical Field
The invention relates to the technical field of artificial intelligence, in particular to a human face recognition method, a human face recognition device, human face recognition equipment and a storage medium based on artificial intelligence.
Background
Along with the development of artificial intelligence and computer vision technology, the face recognition technology is used as a fast and convenient novel authentication mode and widely applied to various fields, such as face brushing payment in financial scenes, face brushing access control in office scenes, face brushing authentication in hotel accommodation scenes and the like. The human face is a natural structure object with quite complex detail changes, and the challenging performance of the object is that the human face has mode variability due to different appearances, expressions, skin colors and the like, and attachments such as glasses, beards and the like may exist, the human face image serving as a three-dimensional object is inevitably affected by shadows generated by illumination, and the recognition difficulty is high.
Therefore, in order to ensure the face recognition accuracy, the existing face recognition mode is a face recognition technology based on a server or a cloud, a user is required to upload local face data to a remote computing platform, and the remote computing platform adopts a deep learning model to recognize the face data of the user. However, data leakage inevitably occurs in the transmission process of the face data of the user, and the biological characteristics of the face have uniqueness and data sensitivity, so that the existing face identification method based on the server or the cloud is low in safety and is easy to cause the problem of data leakage.
Disclosure of Invention
The invention provides a human face recognition method, a human face recognition device, human face recognition equipment and a storage medium based on artificial intelligence, and aims to solve the problems that the existing human face recognition method is low in safety and easy to cause data leakage.
The human face recognition method based on artificial intelligence is provided, and comprises the following steps:
acquiring a plurality of face data, and carrying out data standardization processing on the plurality of face data to obtain a plurality of standard training data;
deep learning training and network optimization based on a lottery hypothesis compression technology are carried out on a preset recognition network by adopting a plurality of standard training data to obtain a target sub-network meeting a preset performance condition, and the target sub-network is output as a face recognition model;
compiling and optimizing codes of the face recognition model to obtain a target code of the face recognition model;
and deploying the target code to target equipment so that the target equipment runs the target code to call a face recognition model to perform face recognition on data to be recognized when receiving a face recognition instruction, wherein the target equipment comprises edge equipment and terminal equipment.
Further, a plurality of standard training data are adopted to carry out deep learning training and network optimization based on the lottery hypothesis compression technology on the preset recognition network, so as to obtain a target sub-network meeting the preset performance condition, and the method comprises the following steps:
training a preset recognition network by adopting a plurality of standard training data, and cutting and optimizing the trained first recognition network based on a lottery hypothesis compression technology to obtain a sub-network to be tested;
performing identification performance test on the sub-network to be tested to determine whether the sub-network to be tested meets a preset performance condition according to a test result;
and if the sub-network to be tested meets the preset performance condition, recording the sub-network to be tested as a target sub-network.
Further, training a preset recognition network by adopting a plurality of standard training data, and cutting and optimizing the first recognition network obtained by training to obtain a to-be-tested subnetwork, comprising:
carrying out a first preset round of training on a preset identification network by adopting a plurality of standard training data to obtain a first identification network;
cutting the first identification network according to the weight value of the first identification network, and recording the sub-network left after cutting as a cutting network;
and continuously carrying out a second preset round of training on the cutting network by adopting a plurality of standard training data to obtain the sub-network to be tested.
Further, after determining whether the sub-network to be tested satisfies the preset performance condition according to the test result, the method further includes:
if the sub-network to be tested does not meet the preset performance condition, continuing to cut the sub-network to be tested, and training to obtain a new sub-network to be tested;
and carrying out identification performance test on the new sub-network to be tested until the new sub-network to be tested meets the preset performance condition.
Further, code compiling and optimizing the face recognition model to obtain an object code of the face recognition model, including:
inputting the face recognition model into a virtual tensor machine so that the virtual tensor machine performs intermediate conversion on the face recognition model to obtain an intermediate expression of the face recognition model;
determining an optimization target, and performing optimization operation on the intermediate expression according to the optimization target to obtain optimized data of the intermediate expression;
optimizing and updating the intermediate expression according to the optimized data to obtain an optimized intermediate expression;
and compiling the hardware code of the optimized intermediate expression to obtain the target code.
Further, determining an optimization target, and performing optimization operation on the intermediate expression according to the optimization target to obtain optimized data of the intermediate expression, including:
determining the optimization operation of the intermediate expression as convolution, and configuring the range of a matrix in the convolution and the arrangement combination mode of a central axis in the convolution;
taking the range of the matrix in convolution and the arrangement and combination mode of the central axis in convolution as an optimization target;
and performing convolution operation on the intermediate expression, and searching an optimization target of the intermediate expression by adopting a random search algorithm to obtain optimization data with the shortest running time, wherein the optimization data comprises the optimization range of a matrix in convolution and the optimization arrangement combination of a central axis in the convolution.
Further, the running of the object code to call the face recognition model to perform face recognition on the data to be recognized includes:
the target equipment preprocesses data to be identified to obtain preprocessed data, wherein the preprocessing comprises brightness adjustment and pixel normalization;
and the target equipment runs the target code to call the face recognition model, and inputs the preprocessed data into the face recognition model for face recognition, wherein the target equipment comprises edge equipment and terminal equipment.
Provided is a human face recognition device based on artificial intelligence, including:
the processing module is used for acquiring a plurality of face data and carrying out data standardization processing on the face data to obtain a plurality of standard training data;
the training module is used for carrying out deep learning training and network optimization on a preset recognition network based on a lottery hypothesis compression technology by adopting a plurality of standard training data to obtain a target sub-network meeting a preset performance condition, and outputting the target sub-network as a face recognition model;
the compiling module is used for compiling and optimizing codes of the face recognition model to obtain a target code of the face recognition model;
and the deployment module is used for deploying the target code to the target equipment so that the target equipment operates the target code to call the face recognition model to perform face recognition on the data to be recognized when receiving the face recognition instruction.
There is provided a computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the artificial intelligence based face recognition method when executing the computer program.
There is provided a computer readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the steps of the artificial intelligence based face recognition method described above.
In one scheme provided by the artificial intelligence based face recognition method, the artificial intelligence based face recognition device, the artificial intelligence based face recognition equipment and the storage medium, by acquiring a plurality of face data, carrying out data standardization processing on the plurality of face data to obtain a plurality of standard training data, then adopting a plurality of standard training data, deep learning training and network optimization based on the lottery hypothesis compression technology are carried out on the preset identification network to obtain a target sub-network meeting the preset performance condition, outputting the target sub-network as a face recognition model, compiling and optimizing the code of the face recognition model to obtain a target code of the face recognition model, deploying the target code to a target device, when the target equipment receives a face recognition instruction, operating a target code to call a face recognition model to perform face recognition on data to be recognized, wherein the target equipment comprises edge equipment and terminal equipment; in the invention, the face recognition network is compressed by a lottery hypothesis compression technology, so that a target sub-network which meets the preset performance condition in a large network is obtained through optimization, the recognition performance of the face recognition model is ensured, the data volume of the model is reduced, and then the code volume of the face recognition model is reduced through compiling and optimizing, so that the running cost of target equipment is reduced, the face recognition model can be directly deployed to target equipment such as edge equipment, terminal equipment and the like with poor storage and performance without being deployed to a server or a cloud, the face recognition is directly performed on the data to be recognized input by a user on the target equipment, the face data leakage risk is reduced on the basis of ensuring the recognition accuracy, and the safety of face recognition is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments of the present invention 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 that other drawings can be obtained according to these drawings without inventive labor.
FIG. 1 is a schematic diagram of an application environment of a face recognition method based on artificial intelligence according to an embodiment of the present invention;
FIG. 2 is a signaling interaction diagram of an artificial intelligence based face recognition method according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating an implementation of step S20 in FIG. 2;
FIG. 4 is a flowchart illustrating an implementation of step S21 in FIG. 3;
FIG. 5 is a flowchart illustrating an implementation of step S24 in FIG. 3;
FIG. 6 is a flowchart illustrating an implementation of step S30 in FIG. 2;
FIG. 7 is a flowchart illustrating an implementation of step S32 in FIG. 6;
FIG. 8 is a flowchart illustrating an implementation of step S50 in FIG. 2;
FIG. 9 is a schematic structural diagram of an artificial intelligence based face recognition apparatus according to an embodiment of the present invention;
FIG. 10 is a schematic diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. 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.
The face recognition method based on artificial intelligence provided by the embodiment of the invention can be applied to the application environment shown in figure 1, wherein the target device is communicated with the server through a network. The method comprises the steps that a server obtains a plurality of face data, data standardization processing is conducted on the face data to obtain a plurality of standard training data, then deep learning training and network optimization based on a lottery hypothesis compression technology are conducted on a preset recognition network through the standard training data to obtain a target sub-network meeting preset performance conditions, the target sub-network is output as a face recognition model, then code compiling and optimizing are conducted on the face recognition model to obtain a target code of the face recognition model, and finally the target code is deployed to target equipment which comprises edge equipment and terminal equipment; when target equipment such as edge equipment or terminal equipment receives a face recognition instruction, the face data of the target equipment input by a user is used as data to be recognized, and then the target equipment runs a target code to call a face recognition model to perform face recognition on the data to be recognized, so that a face recognition result is obtained. In the embodiment, the face recognition network is compressed by a lottery hypothesis compression technology, so that a target sub-network which meets preset performance conditions in a large network is obtained through optimization, the recognition performance of the face recognition model is ensured, the model data volume is reduced, the code volume of the face recognition model is reduced through compiling and optimizing, the running cost of target equipment is reduced, the face recognition model is not required to be deployed to a server or a cloud, the face recognition model can be directly deployed to target equipment such as edge equipment and terminal equipment with poor storage and performance, the face recognition of data to be recognized input by a user is directly performed on the target equipment, the face data leakage risk is reduced on the basis of ensuring the recognition accuracy, and the safety of the face recognition is improved. According to the face recognition method based on artificial intelligence, based on a lottery hypothesis compression technology, a traditional recognition network is compressed and optimized, a face recognition model with low file data volume is obtained and converted into codes to be deployed to target equipment, the problem of cross-equipment deployment is solved, the face recognition model is operated on the target equipment, on the basis of ensuring the accuracy of face recognition, cross-equipment data transmission is not needed, the realization is simple, the risk of data leakage is reduced, the privacy of face data of a user is improved, and therefore the artificial intelligence of face recognition is improved.
In the embodiment, data such as face data, standard training data and a preset recognition network are stored in a database of a server, so that when a model training task is executed subsequently, relevant data are directly acquired from the database according to requirements to perform model training to obtain a face recognition model, the model training efficiency is improved, the data such as the face recognition model are stored in a database of target equipment, so that a target code is directly operated subsequently to call the face recognition model to perform face recognition on data to be recognized input by a user, and the recognition efficiency is improved.
The database in this embodiment is stored in a block chain network, and is used to store data used and generated in an artificial intelligence-based face recognition method, such as face data, standard training data, a preset recognition network, and other related data. The block chain referred by the application is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, which is used for verifying the validity (anti-counterfeiting) of the information and generating a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like. The database is deployed in the blockchain, so that the safety of data storage can be improved.
Edge devices are devices that provide an entry point to an enterprise or service provider core network, including routers, routing switches, Integrated Access Devices (IADs), multiplexers, and various Metropolitan Area Network (MAN) and Wide Area Network (WAN) access devices. The terminal device may be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The server may be implemented as a stand-alone server or as a server cluster consisting of a plurality of servers.
In an embodiment, as shown in fig. 2, a face recognition method based on artificial intelligence is provided, which is described by taking the method as an example applied to the server and the target device in fig. 1, and includes the following steps:
s10: the server acquires a plurality of face data, and performs data standardization processing on the plurality of face data to obtain a plurality of standard training data.
The server obtains a plurality of face data (namely face images or face videos) in an original state needing to be calibrated, and then performs data standardization processing on the plurality of face data to obtain a plurality of calibrated standard training data, namely performs unified standard processing on each face data, so that model training is performed by subsequently adopting standard training data in a unified format, the standardization of the training data is improved, and the difficulty of subsequent model training is reduced.
When the data standardization processing is performed on the plurality of face data, the data standardization processing mode comprises pixel normalization, brightness adjustment or contrast adjustment and the like, wherein one of the brightness adjustment and the contrast adjustment is selected, so that the data after calibration keeps uniformity. That is, the data normalization processing for a plurality of face data includes: carrying out brightness adjustment or contrast adjustment on the face data to obtain adjusted face data; and performing pixel normalization processing on the adjusted face data to obtain normalized face data, then modifying the size of the normalized face data into a preset size to obtain standard training data, and traversing all the face data to obtain a plurality of standard training data. The preset size is 224 × 224, i.e., the picture size of the standard training data is 224 × 224.
The method for adjusting the brightness of the face data specifically comprises the following steps:
determining an initial pixel value of the face data, determining a display parameter currently used for brightness adjustment, calculating an adjustment pixel value according to the display parameter, namely the pixel value of the adjusted face data, and adjusting the pixels of the face data into the adjustment pixel value to obtain the adjusted face data.
The brightness adjustment formula, i.e. the calculation formula for adjusting the pixel value, is as follows:
I′=Ig;
wherein, I represents the initial pixel value of the face data; i' represents the adjusted pixel value, namely the pixel value of the adjusted face data; g (i.e., gamma) represents a display parameter. If g is larger than 1, the brightness of the adjusted face data is lower than that of the face data before adjustment; if g is smaller than 1, the brightness of the face data after the integration is lower than that of the face data before the adjustment, and the value range of g is generally between 0.5 and 2.
The method specifically comprises the following steps of:
determining an initial pixel value of the face data, performing logarithmic calculation on the initial pixel value to obtain an adjusted pixel value, namely the pixel value of the adjusted face data, and adjusting the pixel of the face data to the adjusted pixel value to obtain the adjusted face data.
The contrast adjustment formula, i.e. the calculation formula for adjusting the pixel value, is as follows:
I′=log(I);
wherein, I represents the initial pixel value of the face data; i' represents the adjusted pixel value, namely the pixel value of the adjusted face data; g (i.e., gamma) represents a display parameter. If g is larger than 1, the brightness of the adjusted face data is lower than that of the face data before adjustment; and if the g is less than 1, the brightness of the adjusted face data is lower than that of the face data before adjustment. In this embodiment, to ensure the accuracy of the subsequent processing data, the value range of g is generally set to be between 0.5 and 2.
S20: the server adopts a plurality of standard training data to carry out deep learning training and network optimization based on the lottery hypothesis compression technology on the preset recognition network to obtain a target sub-network meeting the preset performance condition, and outputs the target sub-network as a face recognition model.
After obtaining the plurality of standard training data, the server performs deep learning training and network optimization based on the lottery hypothesis compression technology on the preset recognition network by using the plurality of standard training data to obtain a target sub-network meeting the preset performance condition, and outputs the target sub-network as a face recognition model.
The preset identification network may use a network structure of a ResNet152 or an inclusion ResNet V1 network. The ResNet152 is a Residual Network (ResNet) of the 152 layer.
In this embodiment, a ResNet152 network structure may be used as a preset recognition network for model training, so as to obtain a face recognition model with higher accuracy. The structure of the ResNet152 network can be referred to the contents described in the following table 1, and the specific contents are shown as follows:
TABLE 1
Wherein, in table 1, conv represents convolution; 7 × 7, 64, stride 2 represents: the kernel size is 7 × 7, the number of output channels is 64, and the step length is 2; by analogy, the default of stride not marked is 1; pooling max pool as maximum; average pooling of the average pool; y-d-fc represents a fully connected layer of an output y dimension (y axis), wherein the size of y is pre-calibrated and is generally set by identifying a plurality of marked training data according to needs; softmax represents a normalized exponential function.
In the process of carrying out deep learning training and network optimization based on the lottery hypothesis compression technology on the preset recognition network by adopting a plurality of standard training data, all training parameters related to the network use an optimizer of Adam, the learning rate of model training is 0.0001, the batch size (batch size) is set according to the hardware of a target device, and the total iteration number (epoch) can be 100.
S30: and the server compiles and optimizes the codes of the face recognition model to obtain the target codes of the face recognition model.
After the face recognition model is obtained, the server compiles and optimizes the code of the face recognition model to obtain the target code of the face recognition model. The face recognition model may be input into a compiler, such as a Tensor Virtual Machine (TVM) or an automated Tensor Virtual Machine (AutoTVM), so as to perform code compilation and optimization of deep learning on the face recognition model by the compiler, such as the TVM or the AutoTVM, and then obtain a compiled code output by the compiler, which is used as a target code of the face recognition model.
S40: the server deploys the target code to the target device.
After the target code of the face recognition model is obtained, the server deploys the target code to the target equipment, so that the face recognition model can be called to execute a face recognition task when the target code is operated by the subsequent target equipment. The target device comprises an edge device and a terminal device.
S50: and when the target equipment receives the face recognition instruction, operating the target code to call the face recognition model to perform face recognition on the data to be recognized.
After the target code is deployed to the target equipment by the server, the target equipment needs to judge whether a face recognition instruction sent by a user or the server is received or not in real time, when the face recognition instruction is received, the target equipment needs to acquire face data input by the user through the target equipment and use the face data as data to be recognized, the target code is operated to call a face recognition model to perform face recognition on the data to be recognized, and a face recognition result of the user is obtained.
It should be understood that, because the face data contains the biological features, the face data has the sensitivity of the data, most people want to be able to perform the face recognition task on the terminal device or even the edge device, so as to ensure that the data is not going out, reduce the possibility of data leakage, and improve the privacy security of the user. In the embodiment, a lottery hypothesis compression technology is adopted, a relatively small sub-network can be found, the face recognition capability of the sub-network can meet corresponding performance requirements, and a face recognition model is output to reduce the running cost of the face recognition model on target equipment such as edge equipment and part of terminal equipment on the basis of ensuring the recognition accuracy, the face recognition model is automatically compiled and optimized, the compiling code amount is reduced, the running cost of the face recognition model on the target equipment such as the edge equipment and part of the terminal equipment is further reduced, the face recognition model can run on the edge equipment in convenient deployment, the problem of cross-equipment deployment is solved, the face recognition task is simple and effective, a face recognition system does not need to be greatly modified, and the implementation is easy. Through the lottery hypothesis, the sub-networks in the large network are found, the matched performance can be met, the accuracy can be improved compared with the traditional face recognition system based on a server or a cloud (cloud computing), the additional cost is relatively low, the problem of data leakage can be solved, the artificial intelligence of face recognition is improved, and the efficiency of face recognition work is improved.
In the embodiment, a server obtains a plurality of face data and performs data standardization processing on the face data to obtain a plurality of standard training data, then performs deep learning training and network optimization based on a lottery hypothesis compression technology on a preset recognition network by adopting the plurality of standard training data to obtain a target sub-network meeting a preset performance condition, outputs the target sub-network as a face recognition model, performs code compiling and optimizing on the face recognition model to obtain a target code of the face recognition model, and finally deploys the target code to target equipment; when target equipment such as edge equipment or terminal equipment receives a face recognition instruction, the face data of the target equipment input by a user is used as data to be recognized, and then the target equipment runs a target code to call a face recognition model to perform face recognition on the data to be recognized so as to obtain a face recognition result; the face recognition method provided by this embodiment compresses the face recognition network through a lottery hypothesis compression technology, so as to optimally obtain a target sub-network which satisfies a preset performance condition in a large network as a face recognition model, thereby ensuring the recognition performance of the face recognition model, and simultaneously reducing the data volume of the model, and then reducing the code volume of the face recognition model through compiling and optimizing, thereby reducing the operating cost of target equipment, so that the face recognition model can be directly deployed to target equipment such as edge equipment and terminal equipment with poor storage and performance without being deployed to a server or a cloud, and face recognition is directly performed on data to be recognized input by a user at the target equipment, thereby reducing the face data leakage risk and improving the safety of the face recognition on the basis of ensuring the recognition accuracy.
In one embodiment, as shown in fig. 3, in step S20, performing deep learning training and network optimization based on the lottery hypothesis compression technique on the preset recognition network by using a plurality of standard training data to obtain a target subnetwork meeting the preset performance condition, specifically includes the following steps:
s21: and training a preset recognition network by adopting a plurality of standard training data, and cutting and optimizing the trained first recognition network based on a lottery hypothesis compression technology to obtain a sub-network to be tested.
After obtaining the plurality of standard training data, the server trains a preset recognition network by adopting the plurality of standard training data to obtain a first recognition network, and then cuts and optimizes the trained first recognition network based on the lottery hypothesis compression technology to obtain an optimized sub-network serving as a sub-network to be tested.
S22: and performing identification performance test on the sub-networks to be tested to determine whether the sub-networks to be tested meet the preset performance condition according to the test result.
And after obtaining the sub-network to be tested, carrying out identification performance test on the sub-network to be tested so as to determine whether the sub-network to be tested meets the preset performance condition or not according to the test result. The method for carrying out the identification performance test on the sub-network to be tested comprises the following steps: inputting the sub-network to be tested into a compiler for code compiling and optimizing to obtain a compiled code of the sub-network to be tested, and deploying the compiled code of the sub-network to be tested to test equipment, wherein the test equipment can be edge equipment or terminal equipment, and at least one standard face template of a test user is stored in the test equipment; after the compiled codes of the sub-networks to be tested are deployed to the testing equipment, a plurality of testing users log in a testing account and send testing instructions to the target equipment, and after the target equipment receives the testing instructions, the target equipment acquires the face recognition data input by the user into the target equipment and runs the compiled codes of the sub-networks to be tested so as to call the sub-networks to be tested to perform face recognition on the face recognition data input by testing personnel, and face recognition results (including two results of face recognition passing and face recognition failing) are obtained; and then obtaining a plurality of face recognition results obtained by the testers through face recognition for a plurality of times, or obtaining a plurality of face recognition results obtained by the testers through face recognition, determining the face recognition result in the face recognition results as the proportion of the face recognition passing, and taking the proportion as the test result of the sub-network to be tested.
The preset performance condition may be that the passing proportion of face recognition is greater than a preset proportion, when the test result is that the face recognition result in the multiple face recognition results is the passing proportion of face recognition, determining whether the test result is smaller than the preset proportion, that is, whether the passing proportion of face recognition is smaller than the preset proportion, and if the passing proportion of face recognition is greater than or equal to the preset proportion, determining that the sub-network to be tested meets the preset performance condition; if the number of the sub-networks is less than the preset number, determining that the sub-networks to be tested do not meet the preset performance condition according to the test result.
In other embodiments, after obtaining the plurality of standard training data, the plurality of standard training data may be further split into a training data set and a test data set. The training data set carries out deep learning training on a preset recognition network, and the test data set is used for testing the recognition network obtained by training; the amount of data in the training data set is larger than the amount of data in the test data set, i.e. the number of standard training data in the training data set is larger than the number of standard training data in the test data set. After the plurality of standard training data are divided into a training data set and a testing data set, a preset identification network is trained by the training data set to obtain a first identification network, and then the first identification network obtained by training is cut and optimized based on a lottery hypothesis compression technology to obtain an optimized sub-network serving as a sub-network to be tested. And after the sub-network to be tested is obtained, testing the sub-network to be tested by adopting the test data set to obtain a test result of the sub-network to be tested, and determining whether the sub-network to be tested meets the preset performance condition or not according to the test result. After the sub-network to be tested is subjected to the recognition performance test to determine whether the sub-network to be tested meets the preset performance condition according to the test result, if the sub-network to be tested meets the preset performance condition, the recognition performance of the sub-network to be tested on the face meets the performance requirement, the training can be stopped, and the sub-network to be tested is recorded as a target sub-network.
The method for testing the sub-networks to be tested by adopting the test data set comprises the following steps: inputting the sub-network to be tested into a compiler for code compiling and optimizing to obtain a compiled code of the sub-network to be tested, and deploying the compiled code of the sub-network to be tested to test equipment, wherein the test equipment can be edge equipment or terminal equipment, and standard face templates of a plurality of users are stored in the test equipment; after the compiling codes of the sub-networks to be tested are deployed to the testing equipment, inputting the standard training data in the testing data set into the testing equipment so that the testing equipment runs the compiling codes to call the sub-networks to be tested to carry out matching identification on the standard training data and the standard face template to obtain a matched standard face template as a matching result; and determining the proportion of the plurality of matching results matched with the correct standard face template, and taking the proportion matched with the correct standard face template as a test result.
The preset performance condition can be that the proportion of the matched correct standard face template is greater than a preset proportion, when the test result is the proportion of the matched correct standard face template in the matching results, whether the test result is smaller than the preset proportion is determined, namely whether the proportion of the matched correct standard face template is smaller than the preset proportion is determined, and if the proportion of the matched correct standard face template is greater than or equal to the preset proportion, the test result is determined to determine that the sub-network to be tested meets the preset performance condition; if the number of the sub-networks is less than the preset number, determining that the sub-networks to be tested do not meet the preset performance condition according to the test result.
S23: and if the sub-network to be tested meets the preset performance condition, recording the sub-network to be tested as a target sub-network.
S24: if the sub-network to be tested does not meet the preset performance condition, the sub-network to be tested is cut and trained continuously to obtain a new sub-network to be tested, and the new sub-network to be tested is subjected to the identification performance test until the new sub-network to be tested meets the preset performance condition.
After the sub-network to be tested is subjected to recognition performance test to determine whether the sub-network to be tested meets the preset performance condition according to the test result, if the sub-network to be tested meets the preset performance condition and indicates that the face recognition precision of the sub-network to be tested meets the performance requirement, recording the sub-network to be tested as a target sub-network; if the sub-network to be tested does not meet the preset performance condition, the face recognition precision of the sub-network to be tested does not meet the performance requirement, the sub-network to be tested is continuously cut, optimized and trained to obtain a new sub-network to be tested, and then the new sub-network to be tested is subjected to the recognition performance test until the new sub-network to be tested meets the preset performance condition.
In the embodiment, a server trains a preset identification network by adopting a plurality of standard training data, cuts and optimizes a first identification network obtained by training based on a lottery hypothesis compression technology to obtain a to-be-tested sub-network, performs an identification performance test on the to-be-tested sub-network to determine whether the to-be-tested sub-network meets a preset performance condition according to a test result, and records the to-be-tested sub-network as a target sub-network if the to-be-tested sub-network meets the preset performance condition; if the sub-network to be tested does not meet the preset performance condition, the sub-network to be tested is cut and trained continuously to obtain a new sub-network to be tested, the new sub-network to be tested is subjected to the identification performance test until the new sub-network to be tested meets the preset performance condition, a plurality of standard training data are refined, deep learning training and network optimization based on the lottery hypothesis compression technology are carried out on the preset identification network, and a target sub-network meeting the preset performance condition is obtained, the data volume of the network model can be reduced to the maximum extent by training and cutting optimization on the preset identification network and testing the optimized sub-network to be tested, the output target sub-network is ensured to meet the identification performance requirement, a solid foundation is provided for the subsequent model to be deployed to the target equipment, and the model training optimization process is simple and effective, the system does not need to be greatly modified, and the low operation cost of the target equipment can be realized only by adding a cutting step in the training process.
In an embodiment, as shown in fig. 4, in step S21, training a preset recognition network by using a plurality of standard training data, and performing cutting optimization on a first recognition network obtained by training to obtain a sub-network to be tested, the method specifically includes the following steps:
s211: and carrying out a first preset round of training on the preset identification network by adopting a plurality of standard training data to obtain a first identification network.
After the plurality of standard training data are obtained, a first preset round of training is carried out on the preset identification network by adopting the plurality of standard training data, and a first identification network is obtained. Specifically, each standard training data is input into a preset recognition network f (x, theta) for training, the preset recognition network f (x, theta) is trained to a stage j, namely when the preset recognition network f (x, theta) is iteratively trained to a first preset round j, a first recognition network f (x, theta) is obtained j ) The first preset turn j may be half (i.e. half) of the total number of iterations, and the first preset turn j may be 50, taking the total number of iterations as 100 as an example.
In other embodiments, the first preset round j may also be other values, such as one third, two fifths, three fifths, etc. of the total number of iterations.
S212: and cutting the first identification network according to the weight value of the first identification network, and recording the sub-network left after cutting as the cutting network.
After the first identification network is obtained, the first identification network is cut according to the weight value of the first identification network, and the sub-network left after cutting is recorded as a cutting network f (x, theta) jp ). The weight value is a parameter theta of the network, and the clipping criterion is that the larger the weight value is, the smaller the probability of being clipped is.
When the first identification network is cut according to the weight value of the first identification network, determining the weight value of the first identification network, and determining whether the first identification network needs to be cut according to the weight value; if the difference value between the preset weight and the weighted value is smaller than the preset difference value, determining that the cutting is needed, and determining the cutting rate according to the difference value between the preset weight and the weighted value, wherein the cutting rate is the weight proportion of cutting in each cutting, the cutting rate is generally between 20% and 40%, the smaller the difference value between the preset weight and the weighted value is, the smaller the cutting rate is, the larger the difference value between the preset weight and the weighted value is, the larger the cutting rate is, so that a cutting network with a more appropriate data size is cut; and then, cutting the first identified network according to the cutting rate to obtain a sub-network left after cutting, recording the weight of cutting, and keeping the weight in a mask file for subsequent query.
S213: and continuously carrying out a second preset round of training on the cutting network by adopting a plurality of standard training data to obtain the sub-network to be tested.
After the cutting network is obtained, a plurality of standard training data are adopted to continuously carry out a second preset round of training on the cutting network to obtain a sub-network to be tested, namely, the standard training data are continuously input into the cutting network f (x, theta) jp ) When the network f (x, theta) is cut jp ) When the iteration times of the network (f) reach a second preset turn, the pair cutting network f (x, theta) is stopped jp ) And (4) outputting the network obtained through the second preset round of iterative training as the sub-network to be tested. The second preset round may be one tenth of the total iteration round, taking the total iteration number as 100 as an example, and the first preset round may be 10. In other embodiments, the first predetermined number of iterations may also be other values, such as one ninth, one eleventh, one twelfth, etc. of the total number of iterations.
In the embodiment, a plurality of standard training data are adopted to train a preset recognition network for a first preset round to obtain a first recognition network, the first recognition network is cut according to the weight value of the first recognition network, a sub-network left after cutting is recorded as a cutting network, then a plurality of standard training data are adopted to continue to train the cutting network for a second preset round to obtain a sub-network to be tested, a plurality of standard training data are adopted to train the preset recognition network, cutting optimization is carried out on the first recognition network obtained by training to obtain the sub-network to be tested, the iterative training of the first preset round is firstly carried out on the preset recognition network, then cutting is carried out according to the weight value of the network obtained by training, the iterative training of the second preset round is carried out after cutting, the model training optimization searching process is simple, and only a cutting step needs to be added in the traditional training process, the training process is relatively mature and stable, and the model identification effect is better.
In other embodiments, a plurality of standard training data are used for training a preset recognition network, and the first recognition network obtained by training is cut and optimized based on a lottery hypothesis compression technology, so that the sub-network to be tested can be obtained in other manners, for example, a plurality of standard training data are used for performing iterative training on the preset recognition network, whether cutting is needed or not is determined according to the weight value of the recognition network obtained by each training round of training (if the weight value is smaller than the preset weight, cutting is determined), if cutting is determined to be needed, the recognition network obtained by current training is cut, the sub-network left after cutting is recorded as a cutting network, and then the cutting network is continuously subjected to iterative training by using a plurality of standard training data, so that the sub-network to be tested is obtained; in the embodiment, the weight values of the network are judged in real time in the training process to determine whether to cut, so that the cutting precision is improved, and the sub-network to be tested with the data volume meeting the requirement can be obtained in time.
In an embodiment, as shown in fig. 5, in step S25, the method continues to cut and train the sub-network to be tested to obtain a new sub-network to be tested, and performs the identification performance test on the new sub-network to be tested until the new sub-network to be tested meets the preset performance condition, which specifically includes the following steps:
s241: and continuously carrying out cutting optimization on the sub-networks to be tested according to the weight values of the sub-networks to be tested to obtain a new cutting network.
If the sub-network to be tested does not meet the preset performance condition, which indicates that the local recognition performance of the sub-network to be tested does not meet the performance requirement, and the cutting and training optimization need to be continued, the cutting optimization is performed on the sub-network to be tested according to the weight value of the sub-network to be tested, so as to obtain a new cutting network, wherein the cutting process refers to the above description, and is not repeated herein.
S242: and continuously carrying out a second preset round of training on the new cutting network by adopting a plurality of standard training data to obtain a new sub-network to be tested.
And after the sub-networks to be tested are cut and optimized according to the weight values of the sub-networks to be tested to obtain a new cut network, continuously carrying out iterative training on the new cut network by adopting a plurality of standard training data until the iterative training round reaches a second preset round, and outputting to obtain a new sub-network to be tested.
S243: and carrying out identification performance test on the new sub-network to be tested until the test result of the new sub-network to be tested meets the preset performance condition.
After obtaining a new sub-network to be tested, performing an identification performance test on the new sub-network to be tested until a test result of the new sub-network to be tested meets a preset performance condition, wherein the test process is described above and is not described herein again.
In this embodiment, if the sub-network to be tested does not meet the preset performance condition, the sub-network to be tested is continuously cut and optimized according to the weight value of the sub-network to be tested to obtain a new cut network, then a second preset round of training is continuously performed on the new cut network by using a plurality of standard training data to obtain a new sub-network to be tested, and the new sub-network to be tested is subjected to the recognition performance test until the new sub-network to be tested meets the preset performance condition, so that it is clear that the sub-network to be tested is continuously cut and trained to obtain a new sub-network to be tested, and the new sub-network to be tested is subjected to the recognition performance test until the test result of the new sub-network to be tested meets the preset performance condition, thereby providing a basis for training a face recognition model with the performance meeting the requirements.
In an embodiment, as shown in fig. 6, in step S30, the code compiling and optimizing the face recognition model to obtain the object code of the face recognition model specifically includes the following steps:
s31: and inputting the face recognition model into a virtual tensor machine so that the virtual tensor machine performs intermediate conversion on the face recognition model to obtain an intermediate expression of the face recognition model.
After the face recognition model is obtained, the face recognition model is input into a virtual tensor machine, so that the virtual tensor machine performs Intermediate expression conversion on the face recognition model to obtain an Intermediate expression (IR) of the face recognition model. IR is a common intermediate structure.
S32: and determining an optimization target, and performing optimization operation on the intermediate expression according to the optimization target to obtain the optimized data of the intermediate expression.
After the intermediate expression of the face recognition model is obtained, an optimization target needs to be determined, and then the intermediate expression IR is optimized according to the optimization target to obtain the optimized data of the intermediate expression IR.
S33: and optimizing and updating the intermediate expression according to the optimization data to obtain the optimized intermediate expression.
And after the optimization data of the intermediate expression is obtained, optimizing and updating the intermediate expression IR according to the optimization data to obtain the optimized intermediate expression IR.
S34: and compiling the hardware code of the optimized intermediate expression to obtain the target code.
And after the intermediate expression is optimized and updated according to the optimization data to obtain the optimized intermediate expression, hardware code compiling is carried out on the optimized intermediate expression to obtain the target code.
The hardware code compiling is carried out on the optimized intermediate expression to obtain the target code, and the method comprises the following steps: and acquiring an optimized intermediate expression, inputting the optimized intermediate expression into a preset hardware code compiling library so that the code compiling library compiles the optimized intermediate expression, and acquiring a local hardware code output by the code compiling library as a target code.
The preset hardware code compiling library can be a bottom layer Virtual Machine (LLVM), the LLVM is a framework system for constructing a compiler and is compiled in C + +, and the LLVM is used for optimizing compiling time, link time, running time and idle time of a program written in any programming language, is open to developers and is compatible with existing scripts. The LLVM core library provides compiler-related support that can be used as the background for multi-language compilers. The method can be used for compiler optimization, link optimization, online compilation optimization and code generation of a program language.
In the embodiment, the face recognition model is input into the virtual tensor machine, so that the virtual tensor machine performs intermediate conversion on the face recognition model to obtain an intermediate expression of the face recognition model, then determining an optimization target, carrying out optimization operation on the intermediate expression according to the optimization target to obtain optimization data of the intermediate expression, carrying out optimization updating on the intermediate expression according to the optimization data to obtain an optimized intermediate expression, finally carrying out hardware code compiling on the optimized intermediate expression to obtain a target code, detailing the steps of carrying out code compiling and optimizing on the face recognition model to obtain a target code of the face recognition model, carrying out intermediate expression conversion by using a virtual tensor machine, and the intermediate expression is optimized and then compiled, so that the code amount of the target code can be further reduced, and the running cost of the target equipment can be further reduced.
In an embodiment, as shown in fig. 7, in step S32, the code compiling and optimizing the face recognition model to obtain the object code of the face recognition model specifically includes the following steps:
s321: and determining the optimization operation of the intermediate expression as convolution, and configuring the range of a matrix in the convolution and the arrangement and combination mode of a central axis in the convolution.
S322: and taking the range of the matrix in the convolution and the arrangement and combination mode of the central axis in the convolution as an optimization target.
S323: and performing convolution operation on the intermediate expression, and searching an optimization target of the intermediate expression by adopting a random search algorithm to obtain the optimization data with the shortest running time.
After a face recognition model is input into a virtual tensor machine, so that the virtual tensor machine performs intermediate conversion on the face recognition model to obtain an intermediate expression of the face recognition model, the optimization operation on the intermediate expression needs to be determined as convolution, the range of a matrix in the convolution and the arrangement and combination mode of a convolution middle axis are configured, the range of the matrix in the convolution and the arrangement and combination mode of the convolution middle axis are used as optimization targets, namely the optimization operation is selected as the convolution operation in the intermediate expression, then the range of the matrix in the convolution and the arrangement and combination mode of the convolution middle axis are configured in a convolution operation page, the set range of the matrix in the convolution and the arrangement and combination mode of the convolution middle axis are used as optimization targets, and the subsequent convolution optimization is performed. After the range of the matrix in convolution and the arrangement combination mode of the central axis in convolution are configured, convolution operation is carried out on the intermediate expression, a random search algorithm is adopted to search an optimization target of the intermediate expression, the running time of the combination between different matrix ranges and all the axes is compared, and the optimization data with the shortest running time is obtained, wherein the optimization data comprises the optimization range of the matrix in convolution and the optimization arrangement combination of the central axis in convolution.
In the embodiment, the specific steps of obtaining the optimized data of the intermediate expression by determining the optimized operation of the intermediate expression as convolution, configuring the range of the matrix in the convolution and the arrangement combination mode of the central axis of the convolution, taking the range of the matrix in the convolution and the arrangement combination mode of the central axis of the convolution as an optimized target, performing convolution operation on the intermediate expression, searching the optimized target of the intermediate expression by adopting a random search algorithm to obtain the optimized combination with the shortest running time as the optimized data, wherein the optimized data comprises the optimized range of the matrix in the convolution and the optimized arrangement combination of the central axis of the convolution, determining the optimized target, performing the optimized operation on the intermediate expression according to the optimized target, performing convolution optimization on the intermediate expression, determining the running time between the optimized target combinations respectively, and selecting the optimized combination with the shortest running time as the optimized data, the intermediate expression is optimized subsequently, and the running time of the intermediate expression is further reduced, so that the running amount of the target code is reduced, and the running cost of the target equipment is reduced.
In an embodiment, when the target device receives the face recognition instruction, as shown in fig. 8, in step S50, that is, the target device runs the target code to call the face recognition model to perform face recognition on the data to be recognized, which specifically includes the following steps:
s51: and the target equipment preprocesses the data to be identified to obtain preprocessed data.
When the target equipment receives a face recognition instruction, face data input by a user is needed (the face data of the user can be collected through a collecting device of the terminal equipment), after the face data input by the user is obtained by the target equipment, the face data (to-be-recognized data) of the user is preprocessed to obtain multiple preprocessed data, namely, the face data are processed in a unified standard mode, so that a subsequent face recognition model can be recognized, the recognition difficulty of the face recognition model is improved, and the recognition precision and the recognition efficiency are improved.
When the data to be identified is preprocessed, the preprocessing mode comprises pixel normalization, brightness adjustment or contrast adjustment and the like, wherein the brightness adjustment and the contrast adjustment are selected, so that the corrected data keeps uniformity. Namely, the preprocessing of the data to be identified comprises the following steps: carrying out brightness adjustment or contrast adjustment on the face data of the user to obtain adjusted face data; and performing pixel normalization processing on the adjusted face data to obtain normalized face data, then modifying the size of the normalized face data into a preset size to obtain standard training data, and traversing all the face data to obtain a plurality of standard training data. The preset size is 224 × 224, i.e., the picture size of the standard training data is 224 × 224.
Wherein, the brightness adjustment of the face data is as follows: determining an initial pixel value of face data of a user, determining a display parameter currently used for brightness adjustment, calculating an adjustment pixel value according to the display parameter, namely the pixel value of the adjusted face data, and adjusting the pixels of the face data into the adjustment pixel value to obtain the adjusted face data.
The brightness adjustment formula, i.e. the calculation formula for adjusting the pixel value, is as follows:
I′=I g ;
wherein, I represents the initial pixel value of the face data; i' represents the adjusted pixel value, namely the pixel value of the adjusted face data; g (i.e., gamma) represents a display parameter. If g is larger than 1, the brightness of the adjusted face data is lower than that of the face data before adjustment; if g is smaller than 1, the brightness of the face data after the integration is lower than that of the face data before the adjustment, and the value range of g is generally between 0.5 and 2.
Wherein, the contrast adjustment of the face data is as follows: determining an initial pixel value of the face data, performing logarithmic calculation on the initial pixel value to obtain an adjusted pixel value, namely the pixel value of the adjusted face data, and adjusting the pixel of the face data to the adjusted pixel value to obtain the adjusted face data.
The contrast adjustment formula, i.e. the calculation formula for adjusting the pixel value, is as follows:
I′=log(I);
wherein, I represents the initial pixel value of the face data; i' represents the adjusted pixel value, namely the pixel value of the adjusted face data; g (i.e., gamma) represents a display parameter. If g is larger than 1, the brightness of the adjusted face data is lower than that of the face data before adjustment; if g is smaller than 1, the brightness of the face data after the integration is lower than that of the face data before the adjustment, and the value range of g is generally between 0.5 and 2.
S52: and the target equipment runs the target code to call the face recognition model, and inputs the preprocessed data into the face recognition model for face recognition.
After the preprocessed data are obtained, the target device runs a target code to call a face recognition model, and inputs the preprocessed data into the face recognition model for face recognition, so that a face recognition result is obtained to determine whether the user passes face recognition.
Further, when the target device receives a face recognition instruction, the target device runs a target code to call a face recognition model to perform face recognition on data to be recognized, and the method includes the following steps:
in the embodiment, the target device preprocesses the data to be recognized to obtain preprocessed data, then runs the target code to call the face recognition model, inputs the preprocessed data into the face recognition model to perform face recognition, and determines the specific steps of running the target code to call the face recognition model to perform face recognition on the data to be recognized when the target device receives a face recognition instruction, and preprocesses the data to be recognized input by a user to facilitate the recognition of a subsequent face recognition model, so that the recognition difficulty of the face recognition model is improved, and the recognition precision and the recognition efficiency are improved.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
In an embodiment, a face recognition device based on artificial intelligence is provided, and the face recognition device based on artificial intelligence corresponds to the face recognition method based on artificial intelligence in the above embodiment one to one. As shown in fig. 9, the artificial intelligence based face recognition apparatus includes a processing module 901, a training module 902, a compiling module 903 and a deploying module 904. The functional modules are explained in detail as follows:
the processing module 901 is configured to obtain a plurality of face data, and perform data standardization processing on the plurality of face data to obtain a plurality of standard training data;
the training module 902 is used for performing deep learning training and network optimization based on a lottery hypothesis compression technology on a preset recognition network by adopting a plurality of standard training data to obtain a target sub-network meeting preset performance conditions, and outputting the target sub-network as a face recognition model;
the compiling module 903 is used for compiling and optimizing codes of the face recognition model to obtain a target code of the face recognition model;
the deployment module 904 is configured to deploy the target code to the target device, so that when the target device receives the face recognition instruction, the target device runs the target code to call the face recognition model to perform face recognition on the data to be recognized.
Further, the training module 902 is specifically configured to:
training a preset recognition network by adopting a plurality of standard training data, and cutting and optimizing the trained first recognition network based on a lottery hypothesis compression technology to obtain a sub-network to be tested;
performing identification performance test on the sub-network to be tested to determine whether the sub-network to be tested meets a preset performance condition according to a test result;
and if the sub-network to be tested meets the preset performance condition, recording the sub-network to be tested as a target sub-network.
Further, the training module 902 is further specifically configured to:
carrying out a first preset round of training on a preset identification network by adopting a plurality of standard training data to obtain a first identification network;
cutting the first identification network according to the weight value of the first identification network, and recording the sub-network left after cutting as a cutting network;
and continuously carrying out a second preset round of training on the cutting network by adopting a plurality of standard training data to obtain the sub-network to be tested.
Further, after determining whether the sub-network to be tested satisfies the preset performance condition according to the test result, the training module 902 is further configured to:
if the sub-network to be tested does not meet the preset performance condition, continuing to cut the sub-network to be tested, and training to obtain a new sub-network to be tested;
and carrying out identification performance test on the new sub-network to be tested until the new sub-network to be tested meets the preset performance condition.
Further, the compiling module 903 is specifically configured to:
inputting the face recognition model into a virtual tensor machine so that the virtual tensor machine performs intermediate conversion on the face recognition model to obtain an intermediate expression of the face recognition model;
determining an optimization target, and performing optimization operation on the intermediate expression according to the optimization target to obtain optimized data of the intermediate expression;
optimizing and updating the intermediate expression according to the optimized data to obtain an optimized intermediate expression;
and compiling the hardware code of the optimized intermediate expression to obtain the target code.
Further, the compiling module 903 is specifically further configured to:
determining the optimization operation of the intermediate expression as convolution, and configuring the range of a matrix in the convolution and the arrangement combination mode of a central axis in the convolution;
taking the range of the matrix in convolution and the arrangement and combination mode of the central axis in convolution as an optimization target;
and performing convolution operation on the intermediate expression, and searching an optimization target of the intermediate expression by adopting a random search algorithm to obtain optimization data with the shortest running time, wherein the optimization data comprises the optimization range of a matrix in convolution and the optimization arrangement combination of a central axis in the convolution.
Further, the target device is specifically configured to:
the target equipment preprocesses data to be identified to obtain preprocessed data, wherein the preprocessing comprises brightness adjustment and pixel normalization;
and the target equipment runs the target code to call the face recognition model, and inputs the preprocessed data into the face recognition model for face recognition, wherein the target equipment comprises edge equipment and terminal equipment.
For the specific limitation of the artificial intelligence based face recognition apparatus, reference may be made to the above limitation of the artificial intelligence based face recognition method, and details are not repeated here. All or part of the modules in the artificial intelligence based face recognition device can be realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 10. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer equipment is used for storing data used and generated by the artificial intelligence-based face recognition method. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement an artificial intelligence based face recognition method.
In one embodiment, a computer device is provided, which may be a terminal device. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external server through a network connection. The computer program is executed by a processor to implement an artificial intelligence based face recognition method.
In one embodiment, a computer device is provided, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the artificial intelligence based face recognition method when executing the computer program.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the artificial intelligence based face recognition method described above.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein.
Claims (10)
1. A face recognition method based on artificial intelligence is characterized by comprising the following steps:
acquiring a plurality of face data, and carrying out data standardization processing on the face data to obtain a plurality of standard training data;
carrying out deep learning training and network optimization based on a lottery hypothesis compression technology on a preset recognition network by adopting a plurality of standard training data to obtain a target sub-network meeting a preset performance condition, and outputting the target sub-network as a face recognition model;
compiling and optimizing codes of the face recognition model to obtain a target code of the face recognition model;
and deploying the target code to target equipment so that the target equipment runs the target code to call the face recognition model to perform face recognition on data to be recognized when receiving a face recognition instruction, wherein the target equipment comprises edge equipment and terminal equipment.
2. The artificial intelligence based face recognition method of claim 1, wherein the performing deep learning training and network optimization based on lottery hypothesis compression technology on a preset recognition network by using a plurality of standard training data to obtain a target sub-network meeting a preset performance condition comprises:
training the preset recognition network by adopting a plurality of standard training data, and cutting and optimizing the first recognition network obtained by training to obtain a sub-network to be tested;
performing identification performance test on the sub-network to be tested to determine whether the sub-network to be tested meets the preset performance condition according to the test result;
if the sub-network to be tested meets the preset performance condition, recording the sub-network to be tested as the target sub-network.
3. The artificial intelligence based face recognition method of claim 2, wherein the training the preset recognition network by using a plurality of standard training data, and performing cutting optimization on the trained first recognition network to obtain a sub-network to be tested, comprises:
carrying out a first preset round of training on the preset identification network by adopting a plurality of standard training data to obtain a first identification network;
cutting the first identification network according to the weight value of the first identification network, and recording a sub-network left after cutting as a cutting network;
and continuously carrying out a second preset round of training on the cutting network by adopting a plurality of standard training data to obtain the sub-network to be tested.
4. The artificial intelligence based face recognition method of claim 2, wherein after determining whether the sub-network to be tested satisfies the preset performance condition according to the test result, the method further comprises:
if the sub-network to be tested does not meet the preset performance condition, continuously cutting and training the sub-network to be tested to obtain a new sub-network to be tested;
and carrying out identification performance test on the new sub-network to be tested until the new sub-network to be tested meets the preset performance condition.
5. The artificial intelligence based face recognition method of claim 1, wherein the code compiling and optimizing the face recognition model to obtain an object code of the face recognition model comprises:
inputting the face recognition model into a virtual tensor machine so that the virtual tensor machine performs intermediate conversion on the face recognition model to obtain an intermediate expression of the face recognition model;
determining an optimization target, and performing optimization operation on the intermediate expression according to the optimization target to obtain optimized data of the intermediate expression;
optimizing and updating the intermediate expression according to the optimization data to obtain the optimized intermediate expression;
and compiling the optimized intermediate expression into a hardware code to obtain the target code.
6. The artificial intelligence based face recognition method of claim 5, wherein the determining an optimization objective and performing an optimization operation on the intermediate expression according to the optimization objective to obtain optimized data of the intermediate expression comprises:
determining the optimization operation of the intermediate expression as convolution, and configuring the range of a matrix in the convolution and the arrangement and combination mode of a central axis in the convolution;
taking the range of the matrix in the convolution and the arrangement and combination mode of the central axis in the convolution as the optimization target;
and carrying out convolution operation on the intermediate expression, and searching the optimization target on the intermediate expression by adopting a random search algorithm to obtain the optimization data with the shortest running time, wherein the optimization data comprises the optimization range of a matrix in the convolution and the optimization arrangement combination of the central axis of the convolution.
7. The artificial intelligence based face recognition method of any one of claims 1-6, wherein the running the object code to invoke the face recognition model to perform face recognition on data to be recognized comprises:
the target equipment preprocesses the data to be identified to obtain preprocessed data, wherein the preprocessing comprises brightness adjustment and pixel normalization;
and the target equipment runs the target code to call the face recognition model, and inputs the preprocessed data into the face recognition model to perform face recognition.
8. A face recognition device based on artificial intelligence, comprising:
the processing module is used for acquiring a plurality of face data and carrying out data standardization processing on the face data to obtain a plurality of standard training data;
the training module is used for carrying out deep learning training and network optimization on a preset recognition network based on a lottery hypothesis compression technology by adopting a plurality of standard training data to obtain a target sub-network meeting a preset performance condition, and outputting the target sub-network as a face recognition model;
the compiling module is used for compiling and optimizing codes of the face recognition model to obtain a target code of the face recognition model;
the deployment module is used for deploying the target code to target equipment so that the target equipment runs the target code to call the face recognition model to perform face recognition on data to be recognized when receiving a face recognition instruction, and the target equipment comprises edge equipment and terminal equipment.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the artificial intelligence based face recognition method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the artificial intelligence based face recognition method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210680595.4A CN114898446A (en) | 2022-06-16 | 2022-06-16 | Human face recognition method, device, equipment and storage medium based on artificial intelligence |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210680595.4A CN114898446A (en) | 2022-06-16 | 2022-06-16 | Human face recognition method, device, equipment and storage medium based on artificial intelligence |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114898446A true CN114898446A (en) | 2022-08-12 |
Family
ID=82727593
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210680595.4A Pending CN114898446A (en) | 2022-06-16 | 2022-06-16 | Human face recognition method, device, equipment and storage medium based on artificial intelligence |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114898446A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117558050A (en) * | 2023-11-17 | 2024-02-13 | 西安理工大学 | Edge computing end-oriented real-time facial expression recognition method and human-computer interaction system |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111263163A (en) * | 2020-02-20 | 2020-06-09 | 济南浪潮高新科技投资发展有限公司 | Method for realizing depth video compression framework based on mobile phone platform |
CN111859904A (en) * | 2020-07-31 | 2020-10-30 | 南京三百云信息科技有限公司 | NLP model optimization method and device and computer equipment |
-
2022
- 2022-06-16 CN CN202210680595.4A patent/CN114898446A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111263163A (en) * | 2020-02-20 | 2020-06-09 | 济南浪潮高新科技投资发展有限公司 | Method for realizing depth video compression framework based on mobile phone platform |
CN111859904A (en) * | 2020-07-31 | 2020-10-30 | 南京三百云信息科技有限公司 | NLP model optimization method and device and computer equipment |
Non-Patent Citations (3)
Title |
---|
(美)查鲁•C.阿加沃尔: "神经网络与深度学习", 31 August 2021, 机械工业出版社, pages: 276 - 279 * |
杨金凤: "基于彩票假说的神经网络剪枝方法研究", 中国优秀硕士学位论文全文数据库 信息科技辑, no. 1, 15 January 2022 (2022-01-15), pages 138 - 2044 * |
马治楠等: "基于深层卷积神经网络的剪枝优化", 计算机技术与应用, vol. 44, no. 12, 31 December 2018 (2018-12-31), pages 119 - 122 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117558050A (en) * | 2023-11-17 | 2024-02-13 | 西安理工大学 | Edge computing end-oriented real-time facial expression recognition method and human-computer interaction system |
CN117558050B (en) * | 2023-11-17 | 2024-05-28 | 西安理工大学 | Edge computing end-oriented real-time facial expression recognition method and human-computer interaction system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11741361B2 (en) | Machine learning-based network model building method and apparatus | |
US10614347B2 (en) | Identifying parameter image adjustments using image variation and sequential processing | |
US20210390370A1 (en) | Data processing method and apparatus, storage medium and electronic device | |
US20220020064A1 (en) | Feature processing method and apparatus for artificial intelligence recommendation model, electronic device, and storage medium | |
KR20210116923A (en) | Method for Training a Denoising Network, Method and Device for Operating Image Processor | |
CN110750298B (en) | AI model compiling method, equipment and storage medium | |
CN113705276B (en) | Model construction method, model construction device, computer equipment and medium | |
CN113807353B (en) | Image conversion model training method, device, equipment and storage medium | |
CN110363121B (en) | Fingerprint image processing method and device, storage medium and electronic equipment | |
CN110781976A (en) | Extension method of training image, training method and related device | |
WO2024156284A1 (en) | Model conversion method and apparatus, electronic device and storage medium | |
WO2023069445A1 (en) | User input based distraction removal in media items | |
CN116991711A (en) | Test case generation method and device, terminal equipment and storage medium | |
CN114898446A (en) | Human face recognition method, device, equipment and storage medium based on artificial intelligence | |
US10853689B2 (en) | Methods for more effectively moderating one or more images and devices thereof | |
CN113673476A (en) | Face recognition model training method and device, storage medium and electronic equipment | |
CN114565955A (en) | Face attribute recognition model training and community personnel monitoring method, device and equipment | |
CN113221695A (en) | Method for training skin color recognition model, method for recognizing skin color and related device | |
Didona et al. | Using analytical models to bootstrap machine learning performance predictors | |
CN112308149A (en) | Optimization method and device for image information identification based on machine learning | |
CN112037173A (en) | Chromosome detection method and device and electronic equipment | |
CN112070205A (en) | Multi-loss model obtaining method and device | |
CN108021353B (en) | Device, method, equipment and storage medium for generating description document of software product | |
CN117709409A (en) | Neural network training method applied to image processing and related equipment | |
CN116188843A (en) | Tobacco leaf baking stage identification method and device, electronic equipment and storage medium |
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 |