Face recognition method, device, equipment and storage medium based on artificial intelligence
By using lottery hypothesis compression technology and deep learning training in the face recognition method, the target subnet of edge devices is generated and deployed to edge devices, and the problem of low security of face recognition data transmission is solved, and efficient on edge devices is achieved. Secure facial recognition.
Patent Information
- Application Number
- CN202210680595.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-16
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2042-06-16
AI Technical Summary
The existing facial recognition methods have low security during data transmission and are prone to data leakage, especially due to the sensitivity of facial data and the uniqueness of biological characteristics.
Deep learning training and network optimization based on lottery hypothesis compression technology are adopted to obtain target subnets that meet preset performance conditions, and compile and optimize them into face recognition models, deploy them to edge devices or terminal devices to avoid cross-device data Transmission, directly perform facial recognition on the target device.
On the basis of ensuring the accuracy of recognition, the risk of facial data leakage is reduced, the security of facial recognition is improved, and the operating cost of target devices is reduced, so that the facial recognition model can be used in edge devices with poor storage and performance. Run on.
Smart Images

Figure CN114898446B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to an artificial intelligence-based face recognition method, device, equipment and storage medium. Background Art
[0002] With the development of artificial intelligence and computer vision technology, face recognition technology has been widely used in various fields as a fast and convenient new authentication method, such as face payment in financial scenarios, face access control in office scenarios, face authentication in hotel accommodation scenarios, etc. The face is a natural structure target with quite complex details. The challenge of such targets is that the face has pattern variability due to different appearances, expressions, skin colors, etc., and may have accessories such as glasses and beards. As a three-dimensional object, the face image is inevitably affected by the shadows caused by light, making it difficult to recognize.
[0003] Therefore, in order to ensure the accuracy of face recognition, the existing face recognition method is based on server or cloud-based face recognition technology, which requires users to upload local face data to a remote computing platform, which uses a deep learning model to recognize the user's face data. However, data leakage is inevitable during the transmission of user face data. The biometric features of the face are unique and sensitive to data. Therefore, the existing server-based or cloud-based face recognition methods are less secure and prone to data leakage. Summary of the invention
[0004] The present invention provides a face recognition method, device, equipment and storage medium based on artificial intelligence to solve the problem that the existing face recognition method has low security and is prone to data leakage.
[0005] Provided is an artificial intelligence-based face recognition method, comprising:
[0006] Acquire multiple face data, and perform data standardization processing on the multiple face data to obtain multiple standard training data;
[0007] Using multiple standard training data, the preset recognition network is trained with deep learning and network optimization based on the lottery hypothesis compression technology to obtain a target sub-network that meets the preset performance conditions, and the target sub-network is output as a face recognition model;
[0008] Compile and optimize the face recognition model to obtain the target code of the face recognition model;
[0009] The target code is deployed to the target device so that when the target device receives the face recognition instruction, it runs the target code to call the face recognition model to perform face recognition on the data to be recognized. The target device includes an edge device and a terminal device.
[0010] Furthermore, multiple standard training data are used to perform deep learning training and network optimization on the preset recognition network based on the lottery hypothesis compression technology to obtain a target sub-network that meets the preset performance conditions, including:
[0011] A preset recognition network is trained using multiple standard training data, and the first recognition network obtained through training is trimmed and optimized based on the lottery hypothesis compression technology to obtain a sub-network to be tested;
[0012] Performing an identification performance test on the sub-network to be tested to determine whether the sub-network to be tested meets the preset performance conditions according to the test results;
[0013] If the sub-network to be tested meets the preset performance condition, the sub-network to be tested is recorded as the target sub-network.
[0014] Furthermore, a preset recognition network is trained using a plurality of standard training data, and the trained first recognition network is trimmed and optimized to obtain a sub-network to be tested, including:
[0015] Using a plurality of standard training data to train a preset recognition network for a first preset round to obtain a first recognition network;
[0016] Pruning the first recognition network according to the weight value of the first recognition network, and recording the sub-network remaining after the pruning as the pruned network;
[0017] The pruned network is trained for a second preset round using a plurality of standard training data to obtain a sub-network to be tested.
[0018] Further, after determining whether the sub-network to be tested meets the preset performance condition according to the test result, the method further includes:
[0019] If the sub-network to be tested does not meet the preset performance conditions, the sub-network to be tested is further pruned and trained to obtain a new sub-network to be tested;
[0020] An identification performance test is performed on the new sub-network to be tested until the new sub-network to be tested meets the preset performance conditions.
[0021] Furthermore, the face recognition model is compiled and optimized to obtain the target code of the face recognition model, including:
[0022] Inputting the face recognition model 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;
[0023] Determine the optimization target, and optimize the intermediate expression according to the optimization target to obtain the optimization data of the intermediate expression;
[0024] Optimize and update the intermediate expression according to the optimization data to obtain the optimized intermediate expression;
[0025] The optimized intermediate expression is compiled into hardware code to obtain the target code.
[0026] Furthermore, an optimization target is determined, and the intermediate expression is optimized according to the optimization target to obtain optimization data of the intermediate expression, including:
[0027] Determine that the optimization operation for the intermediate expression is convolution, and configure the range of the matrix in the convolution and the arrangement and combination of the axes in the convolution;
[0028] The range of the matrix in the convolution and the arrangement and combination of the axes in the convolution are used as optimization targets;
[0029] The intermediate expression is convolved and the random search algorithm is used to search for the optimization target of the intermediate expression to obtain the optimization data with the shortest running time. The optimization data includes the optimization range of the matrix in the convolution and the optimized arrangement and combination of the axis in the convolution.
[0030] Further, the target code is run to call the face recognition model to perform face recognition on the data to be recognized, including:
[0031] The target device preprocesses the data to be recognized to obtain preprocessed data, where the preprocessing includes brightness adjustment and pixel normalization;
[0032] The target device runs the target code to call the face recognition model and inputs the preprocessed data into the face recognition model for face recognition. The target device includes an edge device and a terminal device.
[0033] Provided is a face recognition device based on artificial intelligence, comprising:
[0034] A processing module is used to obtain multiple face data and perform data standardization processing on the multiple face data to obtain multiple standard training data;
[0035] A training module is used to use multiple standard training data to perform deep learning training and network optimization on a preset recognition network based on the lottery hypothesis compression technology, obtain a target sub-network that meets the preset performance conditions, and output the target sub-network as a face recognition model;
[0036] A compilation module is used to compile and optimize the face recognition model code to obtain the target code of the face recognition model;
[0037] The deployment module is used to deploy the target code to the target device so that when the target device receives the face recognition instruction, it runs the target code to call the face recognition model to perform face recognition on the data to be recognized.
[0038] A computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned artificial intelligence-based face recognition method when executing the computer program.
[0039] A computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by a processor, the steps of the above-mentioned artificial intelligence-based face recognition method are implemented.
[0040] In a solution provided by the above-mentioned artificial intelligence-based face recognition method, device, equipment and storage medium, multiple face data are obtained and data standardization processing is performed on the multiple face data to obtain multiple standard training data, and then the multiple standard training data are used to perform deep learning training and network optimization based on the lottery hypothesis compression technology on the preset recognition network to obtain a target sub-network that meets the preset performance conditions, and the target sub-network is output as a face recognition model, and then the face recognition model is compiled and optimized to obtain the target code of the face recognition model, and finally the target code is deployed to the target device, so that when the target device receives the face recognition instruction, it runs the target code to call the face recognition model to perform face recognition on the data to be recognized. , the target devices include edge devices and terminal devices; in the present invention, the face recognition network is compressed by the lottery hypothesis compression technology, so as to find the optimal target sub-network that meets the preset performance conditions in the large network, while ensuring the recognition performance of the face recognition model, the amount of model data is also reduced, and the compilation and optimization reduce the amount of code of the face recognition model, thereby reducing the operating cost of the target device, so that the face recognition model does not need to be deployed to the server or the cloud, and can be directly deployed to target devices such as edge devices and terminal devices with poor storage and performance, and directly perform face recognition on the data to be recognized input by the user on the target device, while ensuring the recognition accuracy, reducing the risk of face data leakage and improving the security of face recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0042] Figure 1 is a schematic diagram of an application environment of a face recognition method based on artificial intelligence in one embodiment of the present invention;
[0043] Figure 2is a signaling interaction diagram of a face recognition method based on artificial intelligence in one embodiment of the present invention;
[0044] Figure 3 yes Figure 2 A schematic diagram of an implementation process of step S20;
[0045] Figure 4 yes Figure 3 A schematic diagram of an implementation process of step S21;
[0046] Figure 5 yes Figure 3 A schematic diagram of an implementation process of step S24;
[0047] Figure 6 yes Figure 2 A schematic diagram of an implementation process of step S30;
[0048] Figure 7 yes Figure 6 A schematic diagram of an implementation flow of step S32;
[0049] Figure 8 yes Figure 2 A schematic diagram of an implementation process of step S50;
[0050] Fig. 9 is a structural schematic diagram of a face recognition device based on artificial intelligence in one embodiment of the present invention;
[0051] Fig.10 It is a structural diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0052] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0053] The face recognition method based on artificial intelligence provided by the embodiment of the present invention can be applied in Figure 1In an application environment, the target device communicates with the server through a network. The server obtains multiple face data, performs data standardization processing on the multiple face data, obtains multiple standard training data, and then uses the multiple standard training data to perform deep learning training and network optimization based on the lottery hypothesis compression technology on the preset recognition network to obtain a target sub-network that meets the preset performance conditions, and outputs the target sub-network as a face recognition model, and then compiles and optimizes the face recognition model to obtain the target code of the face recognition model, and finally deploys the target code to the target device, which includes an edge device and a terminal device; when the target device such as the edge device or the terminal device receives the face recognition instruction, the user inputs the target device as the data to be recognized, and then the target device runs the target code to call the face recognition model to perform face recognition on the data to be recognized, and obtains the face recognition result. In this embodiment, the face recognition network is compressed by the lottery hypothesis compression technology, so as to optimize the target sub-network that meets the preset performance conditions in the large network, ensure the recognition performance of the face recognition model, and reduce the model data volume. Compilation and optimization reduce the code volume of the face recognition model, thereby reducing the operating cost of the target device, so that the face recognition model does not need to be deployed to the server or cloud, and can be directly deployed to target devices such as edge devices and terminal devices with poor storage and performance, and directly perform face recognition on the data to be recognized input by the user on the target device, while ensuring the accuracy of recognition, reducing the risk of face data leakage and improving the security of face recognition. The face recognition method based on artificial intelligence provided in this embodiment compresses and optimizes the traditional recognition network based on the lottery hypothesis compression technology, obtains a face recognition model with low file data volume and converts it into code and deploys it to the target device, solves the problem of cross-device deployment, runs the face recognition model on the target device, and on the basis of ensuring the accuracy of face recognition, does not need to perform cross-device data transmission, is simple to implement and reduces the risk of data leakage, improves the privacy of user face data, and improves the artificial intelligence of face recognition from data.
[0054] In this embodiment, face data, standard training data, preset recognition network and other data are stored in the database of the server, so that when the model training task is subsequently executed, the relevant data can be directly obtained from the database according to the needs to perform model training to obtain the face recognition model, thereby improving the model training efficiency. The face recognition model and other data are stored in the database of the target device, so that the target code can be directly run to call the face recognition model to perform face recognition on the data to be recognized input by the user, thereby improving the efficiency of the recognition work.
[0055] The database in this embodiment is stored in the blockchain network, which is used to store data used and generated in the face recognition method based on artificial intelligence, such as face data, standard training data, preset recognition network and other related data. The blockchain referred to in this application is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database. It is a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. The blockchain can include the underlying blockchain platform, the platform product service layer, and the application service layer. Deploying the database on the blockchain can improve the security of data storage.
[0056] Among them, edge devices are devices that provide entry points to the core network of enterprises or service providers, including routers, routing switches, integrated access devices (IADs), multiplexers, and various metropolitan area network (MAN) and wide area network (WAN) access devices. Terminal devices can be, but are not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. Servers can be implemented as independent servers or server clusters consisting of multiple servers.
[0057] In one embodiment, if Figure 2 As shown, a face recognition method based on artificial intelligence is provided, and the method is applied in Figure 1 The server and target device in the example are used to illustrate the process, including the following steps:
[0058] S10: The server obtains multiple face data, and performs data standardization processing on the multiple face data to obtain multiple standard training data.
[0059] The server obtains multiple original face data (i.e., face images or face videos) that need to be calibrated, and then performs data standardization processing on the multiple face data to obtain multiple calibrated standard training data, that is, each face data is processed in a unified standard so that the standard training data in a unified format can be used for model training in the future, thereby improving the standardization of training data and reducing the difficulty of subsequent model training.
[0060] When performing data standardization processing on multiple face data, the data standardization processing method includes pixel normalization, brightness adjustment or contrast adjustment, etc., wherein one of the brightness adjustment and contrast adjustment is selected so that the calibrated data maintains uniformity. That is, performing data standardization processing on multiple face data includes: performing brightness adjustment or contrast adjustment on the face data to obtain adjusted face data; performing pixel normalization processing on the adjusted face data to obtain normalized face data, and then modifying the size of the normalized face data to a preset size to obtain standard training data, until all face data are traversed to obtain multiple standard training data. Among them, the preset size is 224×224, that is, the image size of the standard training data is 224×224.
[0061] The brightness of the face data is adjusted, specifically including the following steps:
[0062] Determine the initial pixel value of the face data and the display parameters currently used for brightness adjustment, calculate the adjusted pixel value according to the display parameters, that is, the pixel value of the adjusted face data, and then adjust the pixels of the face data to the adjusted pixel value to obtain the adjusted face data.
[0063] The brightness adjustment formula, that is, the calculation formula for adjusting the pixel value is as follows:
[0064] ;
[0065] in, Represents the initial pixel value of the face data; Indicates the adjusted pixel value, that is, the pixel value of the adjusted face data; (i.e. gamma) represents the display parameter. If If it is greater than 1, the brightness of the adjusted face data is lower than that of the face data before adjustment; If it is less than 1, the brightness of the adjusted face data is lower than the brightness of the face data before adjustment. The value range is between 0.5 and 2.
[0066] The contrast adjustment of the face data specifically includes the following steps:
[0067] Determine the initial pixel value of the face data, and perform logarithmic calculation on the initial pixel value to obtain the adjusted pixel value, that is, the pixel value of the adjusted face data, and then adjust the pixels of the face data to the adjusted pixel value to obtain the adjusted face data.
[0068] Among them, the contrast adjustment formula, that is, the calculation formula for adjusting the pixel value is as follows:
[0069] ;
[0070] in, Represents the initial pixel value of the face data; Indicates the adjusted pixel value, that is, the pixel value of the adjusted face data; (i.e. gamma) represents the display parameter. If If it is greater than 1, the brightness of the adjusted face data is lower than that of the face data before adjustment; If the value is less than 1, the brightness of the face data after adjustment is lower than the brightness of the face data before adjustment. The value range is set between 0.5 and 2.
[0071] S20: The server uses multiple standard training data to perform deep learning training and network optimization on the preset recognition network based on the lottery hypothesis compression technology, obtains a target sub-network that meets the preset performance conditions, and outputs the target sub-network as a face recognition model.
[0072] After obtaining multiple standard training data, the server uses multiple standard training data to perform deep learning training and network optimization on the preset recognition network based on the lottery hypothesis compression technology, obtains the target sub-network that meets the preset performance conditions, and outputs the target sub-network as a face recognition model.
[0073] The preset recognition network can use ResNet152 or the network structure of Inception ResNet V1 network. ResNet152 is a 152-layer residual network (Residual Network, ResNet for short).
[0074] In this embodiment, the ResNet152 network structure can be used as the preset recognition network for model training to obtain a face recognition model with higher accuracy. The structure of the ResNet152 network can refer to the content recorded in the following Table 1, which indicates the specific content:
[0075] Table 1
[0076] conv1
[0077] 7 7,64,stride 2
[0078] max pool
[0079] 3 3, stride 2
[0080] conv2_x
[0081] 3
[0082] conv3_x
[0083] 8
[0084] conv4_x
[0085] 36
[0086] conv5_x
[0087] 3
[0088] average pool, yd-fc, softmax
[0089] In Table 1, conv means convolution; 7×7, 64, stride 2 means: the kernel size is 7×7, the number of output channels is 64, and the stride is 2; and so on, those without stride are defaulted to 1; max pool is maximum pooling; average pool is average pooling; yd-fc means the fully connected layer of the output y dimension (y axis), and the size of y is the pre-calibrated size, which is generally set according to the number of labeled training data that need to be identified; softmax means the normalized exponential function.
[0090] In the process of using multiple standard training data to perform deep learning training and network optimization on the preset recognition network based on the lottery hypothesis compression technology, all training parameters involving the network are optimized using the Adam optimizer, the learning rate of the model training is 0.0001, the batch size is based on the hardware settings of the target device, and the total number of iterations (epochs) can be 100.
[0091] S30: The server compiles and optimizes the face recognition model to obtain the target code of the face recognition model.
[0092] After obtaining the face recognition model, the server compiles and optimizes the face recognition model to obtain the target code of the face recognition model. The face recognition model can be input into a compiler, such as the TensorVirtual Machine (TVM) or the Auto Tensor Virtual Machine (AutoTVM), to compile and optimize the face recognition model for deep learning through a compiler such as TVM or AutoTVM, and then obtain the compiled code output by the compiler as the target code of the face recognition model.
[0093] S40: The server deploys the target code to the target device.
[0094] After obtaining the target code of the face recognition model, the server deploys the target code to the target device so that the target device can subsequently run the target code to call the face recognition model to perform the face recognition task. The target device includes edge devices and terminal devices.
[0095] S50: When receiving 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.
[0096] After the server deploys the target code to the target device, the target device needs to determine in real time whether it has received the face recognition instruction sent by the user or the server. When receiving the face recognition instruction, the target device needs to obtain the face data input by the user through the target device as the data to be recognized, and run the target code to call the face recognition model to perform face recognition on the data to be recognized, and obtain the face recognition result of the user.
[0097] It should be understood that because face data contains biometric features, face data has data sensitivity, so most people hope to be able to perform face recognition tasks on terminal devices or even edge devices, so as to ensure that data does not go out, reduce the possibility of data leakage, and improve user privacy security. However, due to the relatively demanding storage capacity and device performance of edge devices and some terminal devices, the traditional face recognition model with a large network structure is difficult to run on such edge devices and some terminals, which limits the space for the face recognition model to play. In this embodiment, the lottery hypothesis compression technology is used to find a relatively small sub-network and make its face recognition ability meet the corresponding performance requirements, and output it as a face recognition model, so as to reduce the operating cost of the face recognition model on target devices such as edge devices and some terminal devices on the basis of ensuring the recognition accuracy, and automatically compile and optimize the face recognition model to reduce its compiled code amount, further reduce the operating cost of the face recognition model on target devices such as edge devices and some terminal devices, so that it can be easily deployed on edge devices, solve the problem of cross-device deployment, make the face recognition task simple and effective, do not need to make major changes to the face recognition system, and easy to implement. Through the lottery hypothesis, it is discovered that there are sub-networks in the large network that can meet matching performance. Compared with traditional server- or cloud-based (cloud computing) face recognition systems, it can not only improve the accuracy, but also the additional cost is relatively cheap. It can also solve the problem of data leakage and improve the artificial intelligence of face recognition, thereby improving the efficiency of face recognition work.
[0098] In this embodiment, the server obtains multiple face data and performs data standardization processing on the multiple face data to obtain multiple standard training data, and then uses the multiple standard training data to perform deep learning training and network optimization based on the lottery hypothesis compression technology on the preset recognition network to obtain a target sub-network that meets the preset performance conditions, and outputs the target sub-network as a face recognition model, and then compiles and optimizes the face recognition model to obtain the target code of the face recognition model, and finally deploys the target code to the target device; when the target device such as the edge device or the terminal device receives the face recognition instruction, it uses the face data input by the user into the target device as the data to be recognized, and then the target device runs the target code to call the face recognition model to perform face recognition on the data to be recognized. , and obtain the face recognition result; the face recognition method provided in this embodiment compresses the face recognition network through the lottery hypothesis compression technology, so as to optimize the target sub-network that meets the preset performance conditions in the large network as the face recognition model, while ensuring the recognition performance of the face recognition model, it also reduces the amount of model data, and then compiles and optimizes to reduce the amount of code of the face recognition model, thereby reducing the operating cost of the target device, so that the face recognition model does not need to be deployed to the server or the cloud, and can be directly deployed to target devices such as edge devices and terminal devices with poor storage and performance, and directly performs face recognition on the data to be recognized input by the user on the target device, while ensuring the recognition accuracy, reducing the risk of face data leakage and improving the security of face recognition.
[0099] In one embodiment, if Figure 3 As shown, in step S20, multiple standard training data are used to perform deep learning training and network optimization on the preset recognition network based on the lottery hypothesis compression technology to obtain a target subnetwork that meets the preset performance conditions, which specifically includes the following steps:
[0100] S21: using a plurality of standard training data to train a preset recognition network, and performing trimming and optimization on the trained first recognition network based on the lottery hypothesis compression technology to obtain a sub-network to be tested.
[0101] After obtaining a plurality of standard training data, the server uses the plurality of standard training data to train a preset recognition network to obtain a first recognition network through training, and then performs trimming and optimization on the trained first recognition network based on the lottery hypothesis compression technology to obtain an optimized sub-network as the sub-network to be tested.
[0102] S22: Perform an 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 the test result.
[0103] After the sub-network to be tested is obtained, an identification performance test is performed on the sub-network to be tested, so as to determine whether the sub-network to be tested meets a preset performance condition according to the test result. Among them, the recognition performance test of the sub-network to be tested includes: inputting the sub-network to be tested into a compiler for code compilation and optimization to obtain the compiled code of the sub-network to be tested, and deploying the compiled code of the sub-network to be tested to a test device, wherein the test device may be an edge device or a terminal device, and the test device stores a standard face template of at least one test user; after the compiled code of the sub-network to be tested is deployed to the test device, multiple test users log in to the test account to send a test instruction to the target device, and after the target device receives the test instruction, it obtains the recognition face data input by the user into the target device, and runs the compiled code of the sub-network to be tested, so as to call the sub-network to be tested to perform face recognition on the recognition face data input by the tester, and obtain face recognition results (including two results of face recognition pass and face recognition failure); then obtain the tester to perform face recognition multiple times to obtain multiple face recognition results, or obtain multiple testers to perform face recognition to obtain multiple face recognition results, determine the proportion of face recognition results that are face recognition pass in the multiple face recognition results, and use the proportion as the test result of the sub-network to be tested.
[0104] Among them, the preset performance condition can be that the proportion of face recognition passes is greater than a preset proportion. When the test result is the proportion of face recognition passes among multiple face recognition results, it is determined whether the test result is less than the preset proportion, that is, whether the proportion of face recognition passes is less than the preset proportion. If it is greater than or equal to, it is determined that the test result determines that the sub-network to be tested meets the preset performance condition; if it is less than, it is determined that the test result determines that the sub-network to be tested does not meet the preset performance condition.
[0105] In other embodiments, after obtaining a plurality of standard training data, the plurality of standard training data may be further divided into a training data set and a test data set. The training data set performs deep learning training on a preset recognition network, and the test data set is used to test the recognition network obtained through training; the data volume of the training data set is greater than the data volume of the test data set, that is, the number of standard training data in the training data set is greater 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 test data set, the preset recognition network is trained using the training data set to obtain a first recognition network, and then the first recognition network obtained through training is trimmed and optimized based on the lottery hypothesis compression technology to obtain an optimized subnetwork as a subnetwork to be tested. After obtaining the subnetwork to be tested, the test data set is used to test the subnetwork to be tested, and a test result of the subnetwork to be tested is obtained, and whether the subnetwork to be tested meets the preset performance condition is determined according to the test result. After the recognition performance test is performed on the subnetwork to be tested to determine whether the subnetwork to be tested meets the preset performance condition according to the test result, if the subnetwork to be tested meets the preset performance condition, it means that the recognition performance of the subnetwork to be tested for the face meets the performance requirement, then the training can be stopped, and the subnetwork to be tested is recorded as the target subnetwork.
[0106] Among them, a test data set is used to test the sub-network to be tested, including: inputting the sub-network to be tested into a compiler for code compilation and optimization to obtain the compiled code of the sub-network to be tested, and deploying the compiled code of the sub-network to be tested to a test device, wherein the test device can be an edge device or a terminal device, and the test device stores standard face templates of multiple users; after the compiled code of the sub-network to be tested is deployed to the test device, the standard training data in the test data set is input into the test device, so that the test device runs the compiled code to call the sub-network to be tested to match and identify the standard training data with the standard face template, and obtain the matched standard face template as the matching result; determine the proportion of the correct standard face template matched in the multiple matching results, and use the proportion of the correct standard face template matched as the test result.
[0107] Among them, the preset performance condition may be that the proportion of matches to the correct standard face template is greater than a preset proportion. When the test result is the proportion of matches to the correct standard face template among multiple matching results, it is determined whether the test result is less than the preset proportion, that is, whether the proportion of matches to the correct standard face template is less than the preset proportion. If it is greater than or equal to, it is determined that the test result determines that the sub-network to be tested meets the preset performance condition; if it is less than, it is determined that the test result determines that the sub-network to be tested does not meet the preset performance condition.
[0108] S23: If the sub-network to be tested meets the preset performance condition, the sub-network to be tested is recorded as a target sub-network.
[0109] S24: If the sub-network to be tested does not meet the preset performance condition, continue to prune and train the sub-network to be tested to obtain a new sub-network to be tested, and perform recognition performance test on the new sub-network to be tested until the new sub-network to be tested meets the preset performance condition.
[0110] After performing a recognition performance test on the sub-network to be tested to determine whether the sub-network to be tested meets the preset performance conditions based on the test results, if the sub-network to be tested meets the preset performance conditions, it means that the face recognition accuracy of the sub-network to be tested meets the performance requirements, and the sub-network to be tested is recorded as the target sub-network; if the sub-network to be tested does not meet the preset performance conditions, it means that the face recognition accuracy of the sub-network to be tested does not meet the performance requirements, then the sub-network to be tested continues to be trimmed, optimized and trained to obtain a new sub-network to be tested, and then the new sub-network to be tested is subjected to a recognition performance test until the new sub-network to be tested meets the preset performance conditions.
[0111] In this embodiment, the server trains a preset recognition network by using a plurality of standard training data, and performs cutting and optimization on the first recognition network obtained by training based on the lottery hypothesis compression technology to obtain a sub-network to be tested, and performs a recognition performance test on the sub-network to be tested to determine whether the sub-network to be tested meets the preset performance conditions according to the test results. If the sub-network to be tested meets the preset performance conditions, the sub-network to be tested is recorded as the target sub-network; if the sub-network to be tested does not meet the preset performance conditions, the sub-network to be tested is continued to be cut and trained to obtain a new sub-network to be tested, and the recognition performance test is performed on the new sub-network to be tested until the new sub-network to be tested meets the preset performance conditions. The performance conditions are set, and the steps of using multiple standard training data to perform deep learning training and network optimization based on the lottery hypothesis compression technology on the preset recognition network to obtain the target sub-network that meets the preset performance conditions are refined. By training and trimming the preset recognition network and testing the optimized sub-network to be tested, the data volume of the network model can be minimized, and at the same time, it can ensure that the output target sub-network meets the recognition performance requirements, providing a solid foundation for the subsequent deployment of the model to the target device. The model training optimization process is simple and effective, and does not require major changes to the system. Only the trimming step needs to be added during the training process to achieve low operating costs for the target device.
[0112] In one embodiment, if Figure 4 As shown, in step S21, a preset recognition network is trained using a plurality of standard training data, and the trained first recognition network is trimmed and optimized to obtain a sub-network to be tested, which specifically includes the following steps:
[0113] S211: Using a plurality of standard training data to perform a first preset round of training on a preset recognition network to obtain a first recognition network.
[0114] After obtaining a plurality of standard training data, the preset recognition network is trained for a first preset round using the plurality of standard training data to obtain a first recognition network. Specifically, each standard training data is input into the preset recognition network. Train the preset recognition network To stage j, the preset recognition network When the iterative training reaches the first preset round j, the first recognition network is obtained , wherein the first preset round j can be half (i.e., one-half) of the total number of iterations. Taking the total number of iterations as 100 as an example, the first preset round j can be 50.
[0115] 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.
[0116] S212: Pruning the first recognition network according to the weight values of the first recognition network, and recording the sub-network remaining after pruning as a pruned network.
[0117] After obtaining the first recognition network, the first recognition network is pruned according to the weight value of the first recognition network, and the sub-network left after pruned is recorded as the pruned network Among them, the weight value is the parameter of the network The basis of clipping is that the larger the weight value, the smaller the probability of being clipped.
[0118] Among them, when the first recognition network is pruned according to the weight value of the first recognition network, it is necessary to determine the weight value of the first recognition network, and determine whether the first recognition network needs to be pruned according to the size of the weight value; if the difference between the preset weight and the weight value is less than the preset difference, it is determined that pruning is required, and the pruning rate is determined according to the difference between the preset weight and the weight value, wherein the pruning rate is the weight ratio pruned each time, and the pruning rate is generally between 20% and 40%, the smaller the difference between the preset weight and the weight value, the smaller the pruning rate, and the larger the difference between the preset weight and the weight value, the larger the pruning rate, so as to pruned to a pruned network with a more appropriate data size; then the first recognition network is pruned according to the pruning rate, and the sub-network left after pruning is recorded as a pruned network, wherein the pruned weights are also recorded and kept in a mask file for subsequent query.
[0119] S213: Continue to train the pruned network for a second preset round using a plurality of standard training data to obtain a sub-network to be tested.
[0120] After obtaining the trimmed network, the trimmed network is trained for a second preset round using a plurality of standard training data to obtain a sub-network to be tested, that is, the standard training data is continuously input into the trimmed network. Iterative training is performed in When the number of iterations reaches the second preset round, stop pruning the network The network obtained by the second preset round of iterative training is output as the sub-network to be tested. The second preset round may be one tenth of the total number of iterative training. For example, the total number of iterations is 100, and the second preset round may be 10. In other embodiments, the second preset round may be other values, such as one ninth, one eleventh, one twelfth, etc. of the total number of iterations.
[0121] In this embodiment, a preset recognition network is trained for a first preset round using multiple standard training data to obtain a first recognition network. The first recognition network is pruned according to the weight value of the first recognition network, and the sub-network left after pruned is recorded as the pruned network. Then, the pruned network is trained for a second preset round using multiple standard training data to obtain a sub-network to be tested. The specific steps of using multiple standard training data to train the preset recognition network, and pruning and optimizing the trained first recognition network to obtain the sub-network to be tested are clarified. The preset recognition network is first iterated for a first preset round, and then pruned according to the size of the network weight value obtained from the training. After pruned, the second preset round of iterative training is performed. The model training optimization process is simple, and only the pruning step needs to be added to the traditional training process. The training process is also relatively mature and stable, with good model recognition effect.
[0122] In other embodiments, a preset recognition network is trained using multiple standard training data, and the first recognition network obtained through training is pruned and optimized based on the lottery hypothesis compression technology. The sub-network to be tested can also be obtained by other means. For example, the preset recognition network is iteratively trained using multiple standard training data, and whether pruning is required is determined based on the weight value of the recognition network obtained through each training round (if the weight value is less than the preset weight, it is determined that pruning is required). If pruning is determined to be required, the recognition network obtained through current training is pruned, and the sub-network left after pruned is recorded as the pruned network, and then the pruned network is iteratively trained using multiple standard training data to obtain the sub-network to be tested. In this embodiment, the weight value of the network is judged in real time during the training process to determine whether to prune, thereby improving the accuracy of pruning, so that the sub-network to be tested with the required data volume can be obtained in a timely manner.
[0123] In one embodiment, if Figure 5As shown, in step S25, the sub-network to be tested is continuously pruned and trained to obtain a new sub-network to be tested, and the recognition performance test is performed on the new sub-network to be tested until the new sub-network to be tested meets the preset performance conditions, which specifically includes the following steps:
[0124] S241: Continue to prune and optimize the sub-network to be tested according to the weight value of the sub-network to be tested to obtain a new pruned network.
[0125] If the sub-network to be tested does not meet the preset performance conditions, it means that the local recognition performance of the sub-network to be tested does not meet the performance requirements and needs to be further pruned and trained for optimization. The sub-network to be tested is pruned and optimized according to the weight value of the sub-network to be tested to obtain a new pruned network. The pruning process is described above and will not be repeated here.
[0126] S242: Continue to train the new trimmed network for a second preset round using a plurality of standard training data to obtain a new sub-network to be tested.
[0127] After the sub-network to be tested is pruned and optimized according to the weight value of the sub-network to be tested to obtain a new pruned network, the new pruned network is iteratively trained using multiple standard training data until the iterative training rounds reach a second preset round, and a new sub-network to be tested is output.
[0128] S243: Perform an identification performance test on the new sub-network to be tested until the test result of the new sub-network to be tested meets a preset performance condition.
[0129] After obtaining a new sub-network to be tested, an identification performance test is performed 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, wherein the test process is as described above and will not be repeated here.
[0130] In this embodiment, if the sub-network to be tested does not meet the preset performance conditions, the sub-network to be tested is further pruned and optimized according to the weight value of the sub-network to be tested to obtain a new pruned network, and then the new pruned network is trained for a second preset round using multiple standard training data to obtain a new sub-network to be tested, and a recognition performance test is performed on the new sub-network to be tested until the new sub-network to be tested meets the preset performance conditions. This clarifies the steps of continuing to prune the sub-network to be tested, training to obtain a new sub-network to be tested, and performing a recognition performance test on the new sub-network to be tested until the test results of the new sub-network to be tested meet the preset performance conditions, thereby providing a basis for training a face recognition model whose performance meets the requirements.
[0131] In one embodiment, if Figure 6As shown, in step S30, the face recognition model is compiled and optimized to obtain the target code of the face recognition model, which specifically includes the following steps:
[0132] S31: Inputting the face recognition model into the virtual tensor machine so that the virtual tensor machine performs an intermediate conversion on the face recognition model to obtain an intermediate expression of the face recognition model.
[0133] After the face recognition model is obtained, 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 representation (IR) of the face recognition model. IR is a general intermediate structure.
[0134] S32: Determine an optimization target, and perform optimization operations on the intermediate expression according to the optimization target to obtain optimization data of the intermediate expression.
[0135] After obtaining the intermediate expression of the face recognition model, it is necessary to determine the optimization target, and then optimize the intermediate expression IR according to the optimization target to obtain the optimized data of the intermediate expression IR.
[0136] S33: Optimize and update the intermediate expression according to the optimization data to obtain an optimized intermediate expression.
[0137] After obtaining the optimization data of the intermediate expression, the intermediate expression IR is optimized and updated according to the optimization data to obtain the optimized intermediate expression IR.
[0138] S34: Compile the optimized intermediate expression into hardware code to obtain the target code.
[0139] After the intermediate expression is optimized and updated according to the optimization data to obtain the optimized intermediate expression, the optimized intermediate expression is compiled into hardware code to obtain the target code.
[0140] Among them, the optimized intermediate expression is hardware code compiled to obtain the target code, including: obtaining the optimized intermediate expression, and inputting the optimized intermediate expression into a preset hardware code compilation library so that the code compilation library compiles the optimized intermediate expression, and then obtaining the local hardware code output by the code compilation library as the target code.
[0141] Among them, the preset hardware code compilation library can be a low-level virtual machine (LLVM). LLVM is a framework system for building compilers. It is written in C++ and is used to optimize the compilation time, link time, run time and idle time of programs written in any programming language. It is open to developers and compatible with existing scripts. The LLVM core library provides compiler-related support and can be used as the background of compilers in multiple languages. It can perform compiler optimization, link optimization, online compilation optimization, and code generation for programming languages.
[0142] In this embodiment, the 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, then an optimization target is determined, and the intermediate expression is optimized according to the optimization target to obtain optimization data of the intermediate expression, and then the intermediate expression is optimized and updated according to the optimization data to obtain an optimized intermediate expression, and finally the optimized intermediate expression is hardware code compiled to obtain a target code, which refines the steps of code compiling and optimizing the face recognition model to obtain the target code of the face recognition model, uses a virtual tensor machine to perform intermediate expression conversion, and optimizes the intermediate expression before hardware code compilation, which can further reduce the amount of target code and further reduce the operating cost of the target device.
[0143] In one embodiment, if Figure 7 As shown, in step S32, the face recognition model is compiled and optimized to obtain the target code of the face recognition model, which specifically includes the following steps:
[0144] S321: Determine that the optimization operation for the intermediate expression is convolution, and configure the range of the matrix in the convolution and the arrangement and combination of the axes in the convolution.
[0145] S322: The range of the matrix in the convolution and the arrangement and combination of the axes in the convolution are used as optimization targets.
[0146] S323: Perform convolution operation on the intermediate expression, and use a random search algorithm to search for optimization targets on the intermediate expression to obtain optimization data with the shortest running time.
[0147] After 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 and obtains the intermediate expression of the face recognition model, it is necessary to determine that the optimization operation for the intermediate expression is convolution, and configure the range of the matrix in the convolution and the arrangement and combination of the axis in the convolution, and use the range of the matrix in the convolution and the arrangement and combination of the axis in the convolution as the optimization target, that is, select the optimization operation as the convolution operation in the intermediate expression, and then configure the range of the matrix in the convolution and the arrangement and combination of the axis in the convolution on the convolution operation page, so as to use the set range of the matrix in the convolution and the arrangement and combination of the axis in the convolution as the optimization target, so as to perform convolution optimization later. After configuring the range of the matrix in the convolution and the arrangement and combination of the axis in the convolution, perform the convolution operation on the intermediate expression, and use the random search algorithm to search for the optimization target of the intermediate expression, compare the running time of different matrix ranges and combinations between each axis, and obtain the optimization data with the shortest running time, wherein the optimization data includes the optimization range of the matrix in the convolution and the optimization arrangement and combination of the axis in the convolution.
[0148] In this embodiment, by determining that the optimization operation on the intermediate expression is convolution, and configuring the range of the matrix in the convolution and the arrangement and combination of the axis in the convolution, then taking the range of the matrix in the convolution and the arrangement and combination of the axis in the convolution as the optimization target, and performing a convolution operation on the intermediate expression, and using a random search algorithm to search for the optimization target of the intermediate expression, obtaining the optimization combination with the shortest running time as the optimization data, the optimization data includes the optimization range of the matrix in the convolution and the optimization arrangement and combination of the axis in the convolution, clarifying the specific steps of determining the optimization target, performing the optimization operation on the intermediate expression according to the optimization target, and obtaining the optimization data of the intermediate expression, performing convolution optimization on the intermediate expression and determining the running time between each optimization target combination, selecting the optimization combination with the shortest running time as the optimization data, so as to facilitate the subsequent optimization of the intermediate expression, further reducing the running time of the intermediate expression, thereby reducing the running amount of the target code and reducing the running cost of the target device.
[0149] In one embodiment, when the target device receives the face recognition instruction, Figure 8 As shown, in step S50, the target code is run to call the face recognition model to perform face recognition on the data to be recognized, which specifically includes the following steps:
[0150] S51: The target device pre-processes the data to be identified to obtain pre-processed data.
[0151] When the target device receives the face recognition instruction, it needs the face data input by the user (the user's face data can be collected through the collection device of the terminal device). After the target device obtains the face data input by the user, it pre-processes the user's face data (data to be recognized) to obtain multiple pre-processed data, that is, each face data is processed according to a unified standard to facilitate subsequent face recognition model recognition, which increases the recognition difficulty of the face recognition model, thereby improving the recognition accuracy and efficiency.
[0152] When the data to be recognized is preprocessed, the preprocessing method includes pixel normalization, brightness adjustment or contrast adjustment, etc., wherein one of the brightness adjustment and contrast adjustment is selected so that the calibrated data maintains uniformity. That is, the data to be recognized is preprocessed, including: brightness adjustment or contrast adjustment of the user's face data to obtain adjusted face data; pixel normalization of the adjusted face data to obtain normalized face data, and then the size of the normalized face data is modified to a preset size to obtain standard training data, until all face data are traversed to obtain multiple standard training data. The preset size is 224×224, that is, the image size of the standard training data is 224×224.
[0153] Among them, the brightness adjustment of facial data is as follows: determining the initial pixel value of the user's facial data, and determining the display parameters currently used for brightness adjustment, calculating the adjusted pixel value according to the display parameters, that is, the pixel value of the adjusted facial data, and then adjusting the pixels of the facial data to the adjusted pixel value to obtain the adjusted facial data.
[0154] The brightness adjustment formula, that is, the calculation formula for adjusting the pixel value is as follows:
[0155] ;
[0156] in, Represents the initial pixel value of the face data; Indicates the adjusted pixel value, that is, the pixel value of the adjusted face data; (i.e. gamma) represents the display parameter. If If it is greater than 1, the brightness of the adjusted face data is lower than that of the face data before adjustment; If it is less than 1, the brightness of the adjusted face data is lower than the brightness of the face data before adjustment. The value range is between 0.5 and 2.
[0157] Among them, the contrast adjustment of the face data is as follows: determining the initial pixel value of the face data, and performing logarithmic calculation on the initial pixel value to obtain the adjusted pixel value, that is, the pixel value of the adjusted face data, and then adjusting the pixels of the face data to the adjusted pixel value to obtain the adjusted face data.
[0158] Among them, the contrast adjustment formula, that is, the calculation formula for adjusting the pixel value is as follows:
[0159] ;
[0160] in, Represents the initial pixel value of the face data; Indicates the adjusted pixel value, that is, the pixel value of the adjusted face data; (i.e. gamma) represents the display parameter. If If it is greater than 1, the brightness of the adjusted face data is lower than that of the face data before adjustment; If it is less than 1, the brightness of the adjusted face data is lower than the brightness of the face data before adjustment. The value range is between 0.5 and 2.
[0161] S52: The target device runs the target code to call the face recognition model and input the preprocessed data into the face recognition model for face recognition.
[0162] After obtaining the preprocessed data, the target device runs the target code to call the face recognition model and input the preprocessed data into the face recognition model for face recognition, thereby obtaining a face recognition result to determine whether the user passes the face recognition.
[0163] Furthermore, when the target device receives the face recognition instruction, it runs the target code to call the face recognition model to perform face recognition on the data to be recognized, including:
[0164] In this embodiment, the target device preprocesses the data to be recognized to obtain preprocessed data, and then the target device runs the target code to call the face recognition model, and inputs the preprocessed data into the face recognition model for face recognition. 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 the face recognition instruction are clarified. The data to be recognized input by the user is preprocessed so that it can be recognized by the subsequent face recognition model, which increases the recognition difficulty of the face recognition model, thereby improving the recognition accuracy and efficiency.
[0165] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0166] In one embodiment, a face recognition device based on artificial intelligence is provided, and the face recognition device based on artificial intelligence corresponds one-to-one to the face recognition method based on artificial intelligence in the above embodiment. Figure X As shown, the artificial intelligence-based face recognition device includes a processing module 901, a training module 902, a compilation module 903 and a deployment module 904. The functional modules are described in detail as follows:
[0167] The processing module 901 is used 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;
[0168] The training module 902 is used to use a plurality of standard training data to perform deep learning training and network optimization on the preset recognition network based on the lottery hypothesis compression technology, obtain a target sub-network that meets the preset performance conditions, and output the target sub-network as a face recognition model;
[0169] A compiling module 903 is used to compile and optimize the face recognition model to obtain the target code of the face recognition model;
[0170] The deployment module 904 is used to deploy the target code to the target device so that when the target device receives the face recognition instruction, it runs the target code to call the face recognition model to perform face recognition on the data to be recognized.
[0171] Furthermore, the training module 902 is specifically used for:
[0172] A preset recognition network is trained using multiple standard training data, and the first recognition network obtained through training is trimmed and optimized based on the lottery hypothesis compression technology to obtain a sub-network to be tested;
[0173] Performing an identification performance test on the sub-network to be tested to determine whether the sub-network to be tested meets the preset performance conditions according to the test results;
[0174] If the sub-network to be tested meets the preset performance condition, the sub-network to be tested is recorded as the target sub-network.
[0175] Furthermore, the training module 902 is also specifically used for:
[0176] Using a plurality of standard training data to train a preset recognition network for a first preset round to obtain a first recognition network;
[0177] Pruning the first recognition network according to the weight value of the first recognition network, and recording the sub-network remaining after the pruning as the pruned network;
[0178] The pruned network is trained for a second preset round using a plurality of standard training data to obtain a sub-network to be tested.
[0179] Further, after determining whether the sub-network to be tested meets the preset performance condition according to the test result, the training module 902 is further specifically used to:
[0180] If the sub-network to be tested does not meet the preset performance conditions, the sub-network to be tested is further pruned and trained to obtain a new sub-network to be tested;
[0181] An identification performance test is performed on the new sub-network to be tested until the new sub-network to be tested meets the preset performance conditions.
[0182] Furthermore, the compiling module 903 is specifically used for:
[0183] Inputting the face recognition model 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;
[0184] Determine the optimization target, and optimize the intermediate expression according to the optimization target to obtain the optimization data of the intermediate expression;
[0185] Optimize and update the intermediate expression according to the optimization data to obtain the optimized intermediate expression;
[0186] The optimized intermediate expression is compiled into hardware code to obtain the target code.
[0187] Furthermore, the compiling module 903 is also specifically used for:
[0188] Determine that the optimization operation for the intermediate expression is convolution, and configure the range of the matrix in the convolution and the arrangement and combination of the axes in the convolution;
[0189] The range of the matrix in the convolution and the arrangement and combination of the axes in the convolution are used as optimization targets;
[0190] The intermediate expression is convolved and the random search algorithm is used to search for the optimization target of the intermediate expression to obtain the optimization data with the shortest running time. The optimization data includes the optimization range of the matrix in the convolution and the optimized arrangement and combination of the axis in the convolution.
[0191] Furthermore, the target device is specifically used for:
[0192] The target device preprocesses the data to be recognized to obtain preprocessed data, where the preprocessing includes brightness adjustment and pixel normalization;
[0193] The target device runs the target code to call the face recognition model and inputs the preprocessed data into the face recognition model for face recognition. The target device includes an edge device and a terminal device.
[0194] For the specific definition of the face recognition device based on artificial intelligence, please refer to the definition of the face recognition method based on artificial intelligence above, which will not be repeated here. Each module in the above-mentioned face recognition device based on artificial intelligence can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0195] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.10 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile 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 the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data used and generated by the face recognition method based on artificial intelligence. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a face recognition method based on artificial intelligence is implemented.
[0196] 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 via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile 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 the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external server via a network connection. When the computer program is executed by the processor, a face recognition method based on artificial intelligence is implemented.
[0197] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned artificial intelligence-based face recognition method when executing the computer program.
[0198] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned artificial intelligence-based face recognition method are implemented.
[0199] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0200] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0201] The facial recognition data used in this application is obtained with the user's authorization, and the technical solutions provided in this application are legally implemented.
[0202] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A face recognition method based on artificial intelligence, It is characterized in that include: Acquire multiple face data, and perform data standardization processing on the multiple face data to obtain multiple standard training data; Using a plurality of the standard training data, deep learning training and network optimization based on the lottery hypothesis compression technology are performed on the preset recognition network to obtain a target sub-network that meets the preset performance conditions, and the target sub-network is output as a face recognition model; Compiling and optimizing the face recognition model to obtain the target code of the face recognition model; Deploy the target code to a target device so that when the target device receives a face recognition instruction, it runs the target code to call the face recognition model to perform face recognition on the data to be recognized, and the target device includes an edge device and a terminal device; The step of compiling and optimizing the face recognition model to obtain the target code of the face recognition model includes: Inputting the face recognition model into a virtual tensor machine so that the virtual tensor machine performs an intermediate conversion on the face recognition model to obtain an intermediate expression of the face recognition model; Determine an optimization target, and perform an optimization operation on the intermediate expression according to the optimization target to obtain optimization data of the intermediate expression; Optimize and update the intermediate expression according to the optimization data to obtain the optimized intermediate expression; Compile the optimized intermediate expression into hardware code to obtain the target code; The optimized intermediate expression is hardware-coded and the target code is obtained, including: obtaining the optimized intermediate expression, and inputting the optimized intermediate expression into a preset hardware code compilation library so that the code compilation library compiles the optimized intermediate expression, and then obtaining the local hardware code output by the code compilation library as the target code.
2. The artificial intelligence-based face recognition method according to claim 1, It is characterized in that The method uses a plurality of the standard training data to perform deep learning training and network optimization on the preset recognition network based on the lottery hypothesis compression technology to obtain a target subnetwork that meets the preset performance conditions, including: Using a plurality of the standard training data to train the preset recognition network, and performing trimming and optimization on the trained first recognition network to obtain a sub-network to be tested; Performing an 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, the sub-network to be tested is recorded as the target sub-network.
3. The face recognition method based on artificial intelligence as claimed in claim 2, It is characterized in that The method of using a plurality of the standard training data to train the preset recognition network and performing trimming and optimization on the first recognition network obtained by training to obtain a sub-network to be tested includes: Using a plurality of the standard training data to train the preset recognition network for a first preset round to obtain a first recognition network; Pruning the first recognition network according to the weight value of the first recognition network, and recording the sub-network remaining after the pruning as the pruned network; The trimmed network is continuously trained for a second preset round using a plurality of the standard training data to obtain a sub-network to be tested.
4. The artificial intelligence-based face recognition method according to claim 2, It is characterized in that After determining whether the sub-network to be tested meets 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, then continue to prune and train the sub-network to be tested to obtain a new sub-network to be tested; An identification performance test is performed 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 according to claim 1, It is characterized in that The step of determining an optimization target and performing an optimization operation on the intermediate expression according to the optimization target to obtain optimization data of the intermediate expression includes: Determine that the optimization operation for the intermediate expression is convolution, and configure the range of the matrix in the convolution and the arrangement and combination of the axes in the convolution; The range of the matrix in the convolution and the arrangement and combination of the axes in the convolution are used as the optimization target; A convolution operation is performed on the intermediate expression, and a random search algorithm is used to search the optimization target for the intermediate expression to obtain the optimization data with the shortest running time, wherein the optimization data includes the optimization range of the matrix in the convolution and the optimized arrangement and combination of the axes in the convolution.
6. The artificial intelligence-based face recognition method according to any one of claims 1 to 5, It is characterized in that The running of the target code to call the face recognition model to perform face recognition on the data to be recognized includes: The target device preprocesses the data to be identified to obtain preprocessed data, wherein the preprocessing includes brightness adjustment and pixel normalization; The target device runs the target code to call the face recognition model and inputs the preprocessed data into the face recognition model for face recognition.
7. A face recognition device based on artificial intelligence, It is characterized in that include: A processing module, used for acquiring a plurality of face data, and performing data standardization processing on the plurality of face data to obtain a plurality of standard training data; A training module, used to use a plurality of the standard training data to perform deep learning training and network optimization on a preset recognition network based on the lottery hypothesis compression technology, obtain a target sub-network that meets preset performance conditions, and output the target sub-network as a face recognition model; A compiling module, used to compile and optimize the face recognition model to obtain the target code of the face recognition model; A deployment module, used to deploy the target code to a target device, so that when the target device receives a face recognition instruction, it runs the target code to call the face recognition model to perform face recognition on the data to be recognized, and the target device includes an edge device and a terminal device; The step of compiling and optimizing the face recognition model to obtain the target code of the face recognition model includes: Inputting the face recognition model into a virtual tensor machine so that the virtual tensor machine performs an intermediate conversion on the face recognition model to obtain an intermediate expression of the face recognition model; Determine an optimization target, and perform an optimization operation on the intermediate expression according to the optimization target to obtain optimization data of the intermediate expression; Optimize and update the intermediate expression according to the optimization data to obtain the optimized intermediate expression; Compile the optimized intermediate expression into hardware code to obtain the target code; The optimized intermediate expression is hardware-coded and the target code is obtained, including: obtaining the optimized intermediate expression, and inputting the optimized intermediate expression into a preset hardware code compilation library so that the code compilation library compiles the optimized intermediate expression, and then obtaining the local hardware code output by the code compilation library as the target code.
8. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the steps of the artificial intelligence-based face recognition method as described in any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium storing a computer program. It is characterized in that When the computer program is executed by a processor, the steps of the artificial intelligence-based face recognition method as claimed in any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Implementation method of depth video compression framework based on mobile phone platform
CN111263163A
NLP model optimization method and device and computer equipment
CN111859904A
