Model construction method, model construction device, computer equipment and medium

By constructing a super network with a search space and a trained super network to search for a network framework to be trained, the problems of low model construction efficiency and insufficient matching between the model and the deployment platform in the existing technology are solved, and efficient model construction and computing capabilities are achieved. match.

CN113705276BActive Publication Date: 2024-08-27WUHAN TCL CORP RES CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202010431405.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-05-20
Publication Date
2024-08-27
Estimated Expiration
2040-05-20

AI Technical Summary

Technical Problem

The model construction efficiency in the existing model construction solutions is low, the model framework needs to be structurally optimized and content optimized, and it is difficult to match the computing power of the target deployment platform.

Method used

By constructing a super network with a search space, the trained super network is obtained through training, and the network framework to be trained is searched from it according to the preset search conditions, and the training sample set is used to train and optimize it to obtain the target model without modifying the original model. The framework is structurally optimized.

Benefits of technology

It simplifies the model building steps, improves the model building efficiency, and matches the computing power of the target model with the target deployment platform.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113705276B
    Figure CN113705276B
Patent Text Reader

Abstract

The present application is applicable to the field of model construction technology, and provides a model construction method, a model construction device, a computer device and a medium, wherein a model construction method is provided, wherein a trained supernetwork is obtained by training a supernetwork having a search space. Since the search space is pre-constructed in the supernetwork, all candidate network frameworks that need to be searched can be included in the supernetwork, and when the supernetwork is trained, all its internal substructures can share parameters when constructing different subnetworks, so that the supernetwork can be trained to a certain extent, and its subnetworks can be sampled and indicators evaluated; according to preset search conditions, a network framework to be trained is searched from the trained supernetwork, and finally, the network framework to be trained is trained and optimized based on a training sample set to obtain a target model, without the need to perform structural optimization and content optimization on the original model framework, thereby improving the efficiency of model construction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the technical field of model building, and in particular, relates to a model building method, a model building device, a computer device and a computer-readable storage medium. Background Art

[0002] In recent years, with the development of artificial intelligence technology, more and more fields have developed and used mathematical operation models to identify and judge things in the real world, so as to liberate manual labor. For example, face recognition technology uses face recognition models to identify features of face images, and then judge whether the source of the face image is legal, that is, whether the user's identity is legal.

[0003] In the related art, when building a face recognition model, an original model is built based on a neural network, and then the original model is trained and verified by building a training sample set and a verification set. However, when building an original model based on a neural network, it is necessary to select a corresponding model framework according to actual needs, and it is also necessary to perform operations such as structural optimization and content optimization on the model framework, for example, deleting or adding a hierarchical structure of the model framework; for example, deleting or adding channels to a certain level in the model framework. It can be seen that the model building process in the existing model building scheme is relatively cumbersome, and there is a problem of low model building efficiency. Summary of the invention

[0004] In view of this, embodiments of the present application provide a model building method, a model building apparatus, a computer device and a computer-readable storage medium to solve the problem of low model building efficiency in existing model building solutions.

[0005] A first aspect of an embodiment of the present application provides a model building method, comprising:

[0006] Training a hypernetwork having a search space to obtain a trained hypernetwork; wherein the search space includes a plurality of candidate network frameworks;

[0007] According to a preset search condition, searching from the trained hypernetwork to obtain a network framework to be trained;

[0008] The training sample set is used to train the network framework to be trained to obtain a target model.

[0009] In the above scheme, before the step of using the training sample set to train the network framework to be trained to obtain the target model, it also includes:

[0010] Get a set of sample images containing faces;

[0011] Cutting out a face region from each sample image in the sample image set to obtain a face image sample set;

[0012] Each face image sample in the face image sample set is scaled and labeled to obtain the training sample set.

[0013] In the above solution, the multiple candidate network frameworks in the search space are interconnected, and each of the candidate network frameworks includes multiple substructures;

[0014] The step of training the hypernetwork constructed with the search space to obtain the trained hypernetwork includes:

[0015] Performing a structure search based on all of the substructures in the search space to determine a single-path supernet;

[0016] The supernetwork is sampled and trained according to the single-path supernetwork to obtain a trained supernetwork.

[0017] In the above solution, the performing structure search based on all the substructures in the search space to determine a single-path supernet includes:

[0018] According to the preset supernet attribute information, a structural search is performed on all the substructures in the search space to obtain a single-path supernet; wherein the transition probability between two adjacent substructures in the single-path supernet is the largest.

[0019] In the above solution, the preset search condition corresponds to the target deployment platform;

[0020] The step of searching the trained hypernetwork to obtain a network framework to be trained according to a preset search condition comprises:

[0021] Based on the following formula included in the preset search condition, searching for a network framework to be trained from the trained super network;

[0022] ACC val (a) (a,a∈A,A>0)

[0023] Latency(a,h)≤LatC h

[0024] Wherein, a represents the candidate network framework and satisfies the condition (a, a∈A, A>0); A is the number of the candidate network frameworks in the search space, and A>0; ACC val (a) is the verification accuracy; h represents the target deployment platform, and h>0; Latency(a,h) is the objective function; LatC h The latency of deploying the platform for the target.

[0025] In the above scheme, the step of obtaining a training sample set and using the training sample set to train the network framework to be trained to obtain a target model includes:

[0026] The network framework to be trained is trained using the training sample set using back propagation and gradient optimization methods to obtain a target model.

[0027] In the above scheme, the back propagation and gradient optimization method is used to train the network framework to be trained using the training sample set to obtain the target model, including:

[0028] The objective function Latency(a,h) is identified as a convergence condition; wherein Latency(a,h)≤LatC h , LatC h the time delay of deploying the platform for the target;

[0029] The back propagation and gradient optimization methods are used to train and optimize the network framework to be trained using the training sample set to obtain a target model that meets the convergence conditions.

[0030] A second aspect of an embodiment of the present application provides a model building device, comprising:

[0031] A sampling training unit, used for training a super network constructed with a search space to obtain a trained super network; wherein the search space includes a plurality of candidate network frameworks;

[0032] A search unit, configured to search for a network framework to be trained from the trained super network according to a preset search condition;

[0033] The model training unit is used to train the network framework to be trained using the training sample set to obtain a target model.

[0034] In the above solution, the model building device further includes:

[0035] An image acquisition unit, used to acquire a set of sample images containing human faces;

[0036] An image capture unit, used to capture a face region from each sample image in the sample image set to obtain a face image sample set;

[0037] The sample generating unit is used to scale and annotate each face image sample in the face image sample set to obtain the training sample set.

[0038] In the above solution, the multiple candidate network frameworks in the search space are interconnected, and each of the candidate network frameworks includes multiple substructures;

[0039] The sampling training unit is specifically used to perform a structure search based on all the substructures in the search space to determine a single-path supernet; and perform sampling training on the supernet according to the single-path supernet to obtain a trained supernet.

[0040] In the above scheme, the sampling training unit is specifically used to perform structural search on all the substructures in the search space according to preset supernet attribute information to obtain a single-path supernet; wherein the transition probability between two adjacent substructures in the single-path supernet is the largest.

[0041] In the above solution, the preset search condition corresponds to the target deployment platform;

[0042] The search unit is specifically used to search for a network framework to be trained from the trained super network based on the following formula included in the preset search condition;

[0043] ACC val (a) (a,a∈A,A>0)

[0044] Latency(a,h)≤LatC h

[0045] Wherein, a represents the candidate network framework and satisfies the condition (a, a∈A, A>0); A is the number of the candidate network frameworks in the search space, and A>0; ACC val (a) is the verification accuracy; h represents the target deployment platform, and h>0; Latency(a,h) is the objective function; LatC h The latency of deploying the platform for the target.

[0046] In the above scheme, the model training unit is specifically used to use the back propagation and gradient optimization method to train the network framework to be trained using the training sample set to obtain the target model.

[0047] In the above solution, the model training unit is specifically used to identify the objective function Latency(a,h) as a convergence condition; wherein Latency(a,h)≤LatC h , LatC h The target deployment platform is set to a time delay; and the training sample set is used to train and optimize the network framework to be trained, so as to obtain a target model that meets the convergence condition.

[0048] A third aspect of an embodiment of the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the computer device, wherein the processor implements the steps of the model building method provided by the first solution when executing the computer program.

[0049] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of the model building method provided by the first solution are implemented.

[0050] A fifth aspect of an embodiment of the present application provides a computer program product. When the computer program product is run on a computer device, the computer device executes each step of the model building method described in any one of the first aspects above.

[0051] The model building method, model building device, computer equipment and computer readable storage medium provided by the embodiments of the present application have the following beneficial effects:

[0052] A model building method provided in an embodiment of the present application obtains a trained supernetwork by training a supernetwork having a search space. Since the search space is pre-constructed in the supernetwork, all candidate network frameworks that need to be searched can be included in the supernetwork, and when the supernetwork is trained, all substructures inside it can share parameters when constructing different subnetworks. Therefore, the supernetwork can be trained to a certain extent before sampling and evaluating its indicators. According to preset search conditions, the network framework to be trained is searched from the trained supernetwork, and finally the network framework to be trained is trained and optimized based on the training sample set to obtain the target model. There is no need to perform structural optimization and content optimization on the original model framework, which simplifies the steps of model building and improves the efficiency of model building.

[0053] In addition, since the model search conditions correspond to the target deployment platform, and searching the network framework to be trained from the trained super network is the optimal network path, the network framework to be trained is the network framework that best matches the model deployment constraints. Finally, the target model is obtained by training and optimizing the network framework to be trained, which can improve the matching degree between the target model and the computing power of the target deployment platform. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0055] Figure 1 It is a flow chart of an implementation of a model building method provided in an embodiment of the present application;

[0056] Figure 2 is a flow chart of an implementation of a model building method provided by another embodiment of the present application;

[0057] Figure 3 Schematic diagram of a candidate network framework in an embodiment of the present application;

[0058] Figure 4 It is a structural block diagram of a model building device provided in an embodiment of the present application;

[0059] Figure 5 It is a structural block diagram of a computer device provided in another embodiment of the present application. DETAILED DESCRIPTION

[0060] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0061] It should be noted that the model building method provided in all embodiments of the present application is executed by a computer device used to build a model, such as a server for model deployment, a computer node for deploying a model in a distributed system, etc.

[0062] See also Figure 1 , Figure 1 It is a flow chart for implementing a model building method provided in an embodiment of the present application.

[0063] like Figure 1 The model building method shown includes the following steps:

[0064] S11: training a hypernetwork having a search space to obtain a trained hypernetwork; wherein the search space includes a plurality of candidate network frameworks.

[0065] In step S11, a search space is pre-constructed in the super network, and the search space includes multiple candidate network frameworks. Each candidate network framework is composed of multiple substructures, and some substructures between multiple candidate network frameworks are connected to form a subnetwork, and all subnetworks form a supernetwork.

[0066] It should be noted that the super network is constructed based on the Neural Architecture Search (NAS) method. Among them, NAS uses an algorithm to replace the manually designed model framework, and automatically searches for the best neural network framework in a massive search space, that is, searches for the candidate network framework to be optimized from multiple candidate network frameworks. Here, by integrating multiple candidate network frameworks, that is, connecting part or all of the substructures in each candidate network framework according to a certain integration logic, multiple sub-networks are formed, and multiple sub-networks form a super network.

[0067] The search space is based on the network structure of the hypernetwork, and the substructures contained in all subnetworks in the hypernetwork are used as the structure search objects to achieve the method of integrating substructures with different numbers of channels (different widths) into a hypernetwork. Because according to the traditional NAS method, it is difficult to integrate substructures of different widths into a hypernetwork, and by constructing a search space that contains all the structures to be searched, the search cost can be greatly reduced.

[0068] Before constructing the search space, each candidate network framework can be regarded as an independent module block, and the width and spatial resolution of each block are different. Based on all blocks (all candidate network frameworks) in the hypernetwork, the process of constructing the search space is to connect multiple blocks of different widths and spatial resolutions to each other, that is, to use the multiple hierarchical structures in each block as multiple substructures in each candidate network framework, and then connect them purposefully and directionally.

[0069] In this embodiment, training the hypernetwork constructed with the search space is actually sampling training of the hypernetwork constructed with the search space. Since the core idea of ​​the hypernetwork is to train a large number of network structures at the same time by parameter sharing, that is, to train a large number of candidate network frameworks at the same time, in this embodiment, in order to treat all candidate network frameworks equally, when sampling training is performed on the hypernetwork constructed with the search space, a method without hyperparameters is used to uniformly sample the hypernetwork, thereby obtaining the trained hypernetwork.

[0070] S12: According to preset search conditions, searching for a network framework to be trained from the trained super network.

[0071] In step S12, the preset search conditions are related to the expected performance indicators of the network framework to be trained.

[0072] In this embodiment, since all substructures within the super network share parameters when constructing different sub networks, the sub network can be sampled and the indicators can be evaluated only after the super network is trained to a certain extent, without the need to retrain the sub network. The optimal candidate network framework can also be selected by evaluating the performance of the candidate network framework in the super network, that is, searching for the network framework to be trained from the trained super network.

[0073] It should be noted that since blocks of different widths and spatial resolutions are interconnected in the search space, the process of searching for the network framework to be trained from the trained hypernetwork based on the pre-configured model deployment constraints is the process of optimizing the transition probability between blocks to select an optimal path. In other words, the network framework to be trained obtained by the search is the optimal candidate network framework under the computing power of the target deployment platform represented by the model deployment constraints.

[0074] It is understandable that in actual applications, corresponding model deployment constraints can be set according to the specific performance or speed requirements of the target deployment platform, thereby realizing the search and deployment of the optimal candidate network framework for the target deployment platform.

[0075] S13: Using the training sample set to train the network framework to be trained to obtain a target model.

[0076] In step S13, the training sample set includes multiple training samples, wherein each training sample includes a sample feature.

[0077] Taking the target model for face recognition as an example, the training samples are multiple image samples containing faces. In each image sample containing faces, the face area is the sample feature of the image sample.

[0078] The target model obtained by training the network framework to be trained using the training sample set, for example, by training the network framework to be trained using multiple image samples containing faces, can be used to recognize the face area from the image containing faces.

[0079] It should be understood that, during the model building process, different sets of training samples may be selected according to the purpose or objective of the target model.

[0080] From the above, it can be seen that the model building method provided by the present embodiment obtains a trained supernetwork by training a supernetwork having a search space. Since the search space is pre-constructed in the supernetwork, all candidate network frameworks that need to be searched can be included in the supernetwork, and when the supernetwork is trained, all its internal substructures can share parameters when constructing different subnetworks, so the supernetwork can be trained to a certain extent, and its subnetworks can be sampled and indicators evaluated; according to preset search conditions, the network framework to be trained is searched from the trained supernetwork, and finally the network framework to be trained is trained and optimized based on the training sample set to obtain the target model, without the need to perform structural optimization and content optimization on the original model framework, thereby simplifying the steps of model building and improving the efficiency of model building.

[0081] See also Figure 2 , Figure 2 is a flow chart of a model building method provided by another embodiment of the present application. Figure 1 Correspondingly, the model building method provided in this embodiment may further include steps S21 to S22 before step S11, and may further include steps S23 to S25 before step S13. The details are as follows:

[0082] S21: Obtain multiple candidate network frameworks.

[0083] S22: Constructing a search space of a super network based on the multiple candidate network frameworks.

[0084] In this embodiment, the multiple candidate network frameworks may be candidate network frameworks selected by a model deployment tool, or candidate network frameworks obtained from a target database.

[0085] In actual applications, during the model deployment process, the model deployment tool can be used to select a network framework that meets the model building requirements from the target database as a candidate network framework, where the information in the target database is used to describe the correspondence between the network framework and its applicable device information, and the applicable device information is used to distinguish the deployment platform. When constructing the search space of the super network, the network framework can be obtained from the target database as a candidate network framework based on the applicable device information corresponding to the target deployment platform.

[0086] It should be understood that multiple candidate network frameworks have different computational logic and memory complexity. Figure 3 FIG. 2 shows a schematic diagram of a candidate network framework in this embodiment. Figure 3 The modules shown in the figure can be constructed based on the four basic structures of the current valid model, namely Figure 3 There are four basic structures of A, B, C and D. The search space in this embodiment includes 32 candidate blocks.

[0087] The candidate network frameworks in all embodiments of the present application can be constructed based on at least one of ShuffleNetV2, SPOS, DARTS and MobileNetV3.

[0088] In this embodiment, the candidate network architecture can be searched for deployment platforms such as DSP, ARM CPU, NPU, etc., and the deployment platforms are not limited thereto.

[0089] After the space of the hypernetwork is constructed, sampling training is performed on the hypernetwork, that is, step S11 is executed.

[0090] S11: training the hypernetwork constructed with the search space to obtain a trained hypernetwork.

[0091] As a possible implementation method of this embodiment, multiple candidate network frameworks in the search space are interconnected, and each of the candidate network frameworks includes multiple substructures. Step S11 specifically includes: performing a structural search based on all the substructures in the search space to determine a single-path supernet; sampling and training the supernetwork according to the single-path supernetwork to obtain a trained supernetwork.

[0092] In this embodiment, in order to reduce the weight coupling of the supernetwork, a single-path supernetwork is determined so that only the single-path supernetwork is activated in the supernetwork during each iterative training process. Multiple substructures in a single candidate network framework are at different levels. When the single-path supernetwork samples and trains the supernetwork, no hyperparameters are required to guide how to select substructures, and a uniform sampling method is used to treat all substructures in the supernetwork equally.

[0093] In practical applications, the attribute information of a single-path hypernet can be configured according to actual needs, and then a structural search can be performed based on the attribute information. Specifically, by defining different types of selection units to search for different structural variables, the search space used to search for complex model structures can be supported to search for the number of channels. Among them, the selection unit is designed to search for a substructure, such as the number of channels of a convolutional layer, by pre-assigning a weight tensor with the maximum number of channels. During the training of the hypernet, the number of channels is randomly selected and the corresponding sub-tensors for convolution are split out to achieve structural search, and then substructures at different levels are selected from different candidate network frameworks for connection to form a single-path hypernet.

[0094] It should be noted that the key reason why the network framework to be trained can be searched by using the hypernetwork for model structure search is that in the validation set, the accuracy of any substructure using reused weights is highly reliable, that is, when the weights need to be approximated to the optimal weights, the effect of the approximation is proportional to the degree to which the training loss function is minimized. It can be seen that the optimization of the hypernetwork weights should be carried out simultaneously with the optimization of all substructures in the search space. Therefore, when the hypernetwork is uniformly sampled and trained, all internal substructures share parameters when constructing different subnetworks, so that the subnetwork can be sampled and the indicators can be evaluated only after the hypernetwork is trained to a certain extent, that is, there is no need to retrain the subnetwork.

[0095] In all embodiments of the present application, each layer of the hypernetwork has multiple selectable substructures, and training the hypernetwork usually selects a single path for training through a uniform path sampling method. In other words, uniform sampling training of the hypernetwork is random because all candidate network frameworks can optimize their weights at the same time. In order to reduce weight coupling in the hypernetwork, a simple search space containing only a single-path architecture is used, namely a single-path hypernetwork. For training, a method without hyperparameters is used, and uniform sampling is used to treat all candidate network architectures equally, which realizes model search automation while improving model building efficiency.

[0096] As a possible implementation manner of this embodiment, performing a structure search based on all the substructures in the search space to determine a single-path supernet includes:

[0097] According to the preset supernet attribute information, a structural search is performed on all the substructures in the search space to obtain a single-path supernet; wherein the transition probability between two adjacent substructures in the single-path supernet is the largest.

[0098] In the embodiment, since multiple candidate network frames in the search space are interconnected, there is a corresponding connection relationship between the substructures in each candidate network frame and the substructures in other candidate network frames, forming a supernet. By defining preset supernet attribute information, controlling the number of candidate network frames, the transfer logic in each candidate network frame, such as the input channel, output channel and space size of the candidate network frame, and the step size used in each candidate network frame, and then performing a structural search on all substructures in the search space, a single-path supernet with the maximum transfer probability between each two adjacent substructures is obtained.

[0099] It should be understood that the transition probability is used to describe the degree of matching between two adjacent substructures. In the process of structural search, since multiple candidate network frameworks in the search space are interconnected, there is also a corresponding connection relationship between the substructure in each candidate network framework and the substructure in other candidate network frameworks. Therefore, each two adjacent substructures may not come from the same candidate network framework, but based on the preset supernet attribute information, the degree of matching between the two adjacent substructures is the highest.

[0100] The preset hypernetwork attribute information is defined as shown in Table 1. The block marked with TBS in the module Block column indicates the candidate network framework to be searched. In Table 1, Input shape indicates the input model, Block indicates the module, channels indicates the channel, repeat indicates the number of repetitions, and stride indicates the step size.

[0101]

[0102]

[0103] Table 1

[0104] S12: According to a preset search condition, a network framework to be trained is searched from the trained super network.

[0105] As a possible implementation method of this embodiment, the preset search condition corresponds to the target deployment platform, and step S12 specifically includes:

[0106] Based on the following formula included in the preset search condition, searching for a network framework to be trained from the trained super network;

[0107] ACC val (a) (a,a∈A,A>0)

[0108] Latency(a,h)≤LatC h

[0109] Wherein, a represents the candidate network framework and satisfies the condition (a, a∈A, A>0); A is the number of the candidate network frameworks in the search space, and A>0; ACC val (a) is the verification accuracy; h represents the target deployment platform, and h>0; Latency(a,h) is the objective function; LatC h The latency of deploying the platform for the target.

[0110] In this embodiment, the preset search conditions correspond to the target deployment platform, the preset search conditions are related to the computing power of the target deployment platform, and the preset search conditions can also be used to characterize the computing power of the target deployment platform, thereby distinguishing candidate network frameworks suitable for the target deployment platform.

[0111] It can be understood that the target deployment platform refers to a hardware device used to deploy the target model and provide computing resources for the target model.

[0112] By limiting the time delay between the objective function and the target deployment platform, it is possible to search for a network framework to be trained that is more suitable for the target deployment platform from the trained hypernetwork. h It can be obtained through the line terminal equipment LTU or the latency predictor method.

[0113] In other implementation cases, lfw can be preferably used as the verification set.

[0114] Relative to Figure 1 Corresponding to the embodiment, the model building method provided in this embodiment further includes S23 to S25 before step S13. The details are as follows:

[0115] S23: Obtain a set of sample images containing faces.

[0116] S24: extracting a face region from each sample image in the sample image set to obtain a face image sample set.

[0117] S25: scaling and labeling each face image sample in the face image sample set to obtain the training sample set.

[0118] In this embodiment, the sample image set includes multiple sample images, each of which includes at least one face region. Recognizing and capturing the face region of each sample image is to locate the face region in the sample image, that is, to identify the position of the face region in the sample image and capture the face region from the sample image, thereby obtaining a face image sample set.

[0119] It should be noted that scaling each face image sample in the face image sample set is to perform uniform standardization on the face image samples. Annotating each face image sample in the face image sample set is to perform more detailed feature distinction on the face image samples.

[0120] Since different faces have different sizes in the same or different images, scaling each face image sample is to standardize the sample, which helps to improve the efficiency of model training. It can be understood that scaling each face image sample can be long-side scaling, that is, scaling the face image sample along the horizontal direction.

[0121] In order to distinguish each facial image sample, this embodiment also labels each facial image sample in the facial image sample set, wherein the label can be an identifier for distinguishing facial images, which can be at least one of a name, gender, race, and serial number.

[0122] In this embodiment, steps S21 to S23 and steps S11 to S12 are executed in no particular order. After each face image sample in the face image sample set is scaled and labeled to obtain a training sample set, step S13 can be executed.

[0123] S13: Obtain a training sample set, and use the training sample set to train the network framework to be trained to obtain a target model.

[0124] As a possible implementation method of this embodiment, step S13 specifically includes:

[0125] The back propagation and gradient optimization methods are used to train and optimize the network framework to be trained using the training sample set to obtain a target model.

[0126] In this embodiment, the back propagation (BP) algorithm and the gradient optimization method are used to train and optimize the network framework to be trained according to the objective function and the training sample set. Among them, the gradient optimization method may not be limited to the known optimization algorithms such as the Adam algorithm, the RMSprop algorithm and the SGD algorithm; the objective function may be but not limited to the AM-Softmax function, the ArcNegFace function, the CosFace function and the ArcNegFace function.

[0127] As a possible implementation method of this embodiment, the back propagation and gradient optimization method is used to train the network framework to be trained using the training sample set to obtain the target model, including:

[0128] The objective function Latency(a,h) is identified as a convergence condition; wherein Latency(a,h)≤LatC h , LatC h the time delay of deploying the platform for the target;

[0129] The back propagation and gradient optimization methods are used to train and optimize the network framework to be trained using the training sample set to obtain a target model that meets the convergence conditions.

[0130] In this embodiment, the convergence condition configured when training the network framework to be trained is the same as the objective function in the preset search condition. Using the objective function in the preset search condition as the convergence condition for training the network framework to be trained can make the target model more suitable for the target deployment platform, that is, more in line with the latency requirements of the target deployment platform.

[0131] It should be understood that since the embodiments of the present application do not involve how to configure the optimization strategy, and in the field of deep neural networks and models, the use of optimization algorithms and objective functions to train models belongs to the prior art, the configuration of the optimization scheme and objective function will not be repeated here.

[0132] From the above, it can be seen that the model building method provided by the present embodiment obtains a trained supernetwork by training a supernetwork having a search space. Since the search space is pre-constructed in the supernetwork, all candidate network frameworks that need to be searched can be included in the supernetwork, and when the supernetwork is trained, all its internal substructures can share parameters when constructing different subnetworks, so the supernetwork can be trained to a certain extent, and its subnetworks can be sampled and indicators evaluated; according to preset search conditions, the network framework to be trained is searched from the trained supernetwork, and finally the network framework to be trained is trained and optimized based on the training sample set to obtain the target model, without the need to perform structural optimization and content optimization on the original model framework, thereby simplifying the steps of model building and improving the efficiency of model building.

[0133] In addition, since the model search conditions correspond to the target deployment platform, and searching the network framework to be trained from the trained super network is the optimal network path, the network framework to be trained is the network framework that best matches the model deployment constraints. Finally, the target model is obtained by training and optimizing the network framework to be trained, which can improve the matching degree between the target model and the computing power of the target deployment platform.

[0134] In addition, by constructing a super network search space based on multiple candidate network frameworks, we can use width search as the starting point and search the network downsampling position and global depth at the same time. This is not limited to the number of layers in each candidate network framework, but also the number of substructures of each candidate network framework will be searched, which improves the flexibility of network structure search and provides a basis for deploying models on deployment platforms with different requirements.

[0135] See also Figure 4 , Figure 4is a structural block diagram of a model building device provided in an embodiment of the present application. In this embodiment, the model building device includes various units for executing Figure 1 to Figure 2 For details, please refer to the steps in the corresponding embodiment. Figure 1 to Figure 2 as well as Figure 1 to Figure 2 For the convenience of explanation, only the parts related to this embodiment are shown. Figure 3 The model building device 30 includes: a sampling training unit 31, a search unit 32 and a model training unit 33. Among them:

[0136] The sampling training unit 31 is used to train the super network constructed with the search space to obtain the trained super network; wherein the search space includes multiple candidate network frameworks.

[0137] The search unit 32 is used to search for the network framework to be trained from the trained super network according to a preset search condition.

[0138] The model training unit 33 is used to train the network framework to be trained using the training sample set to obtain a target model.

[0139] As an embodiment of the present application, the model building device 30 further includes: an image acquisition unit 36 ​​, an image interception unit 37 and a sample generation unit 38 .

[0140] The image acquisition unit 36 ​​is used to acquire a set of sample images containing human faces.

[0141] The image capture unit 37 is used to capture the face area from each sample image in the sample image set to obtain a face image sample set.

[0142] The sample generating unit 38 is used to scale and annotate each face image sample in the face image sample set to obtain the training sample set.

[0143] As an embodiment of the present application, multiple candidate network frameworks in the search space are interconnected, and each of the candidate network frameworks includes multiple substructures.

[0144] The sampling training unit 31 is specifically used to perform a structure search based on all the substructures in the search space to determine a single-path supernet; and perform sampling training on the supernet according to the single-path supernet to obtain a trained supernet.

[0145] As an embodiment of the present application, the sampling training unit 31 is specifically used to perform a structural search on all the substructures in the search space according to preset supernet attribute information to obtain a single-path supernet; wherein the transition probability between two adjacent substructures in the single-path supernet is the largest.

[0146] As an embodiment of the present application, the preset search condition corresponds to the target deployment platform; the search unit 32 is specifically used to:

[0147] Based on the following formula included in the preset search condition, searching for a network framework to be trained from the trained super network;

[0148] ACC val (a) (a,a∈A,A>0)

[0149] Latency(a,h)≤LatC h

[0150] Wherein, a represents the candidate network framework and satisfies the condition (a, a∈A, A>0); A is the number of the candidate network frameworks in the search space, and A>0; ACC val (a) is the verification accuracy; h represents the target deployment platform, and h>0; Latency(a,h) is the objective function; LatC h The latency of deploying the platform for the target.

[0151] As an embodiment of the present application, the model training unit 33 is specifically used to use the back propagation and gradient optimization method to train the network framework to be trained using the training sample set to obtain the target model.

[0152] As an embodiment of the present application, the model training unit 33 is specifically used to identify the objective function Latency(a,h) as a convergence condition; wherein Latency(a,h)≤LatC h , LatC h The target deployment platform is set to a time delay; and the training sample set is used to train and optimize the network framework to be trained, so as to obtain a target model that meets the convergence condition.

[0153] From the above, it can be seen that the solution provided by this embodiment obtains a trained supernetwork by training a supernetwork with a search space. Since the search space is pre-constructed in the supernetwork, all candidate network frameworks that need to be searched can be included in the supernetwork, and when the supernetwork is trained, all its internal substructures can share parameters when constructing different subnetworks, so the supernetwork can be trained to a certain extent, and its subnetworks can be sampled and indicators evaluated; according to the preset search conditions, the network framework to be trained is searched from the trained supernetwork, and finally the network framework to be trained is trained and optimized based on the training sample set to obtain the target model, without the need to perform structural optimization and content optimization on the original model framework, thereby simplifying the steps of model construction and improving the efficiency of model construction.

[0154] In addition, since the model search conditions correspond to the target deployment platform, and searching the network framework to be trained from the trained super network is the optimal network path, the network framework to be trained is the network framework that best matches the model deployment constraints. Finally, the target model is obtained by training and optimizing the network framework to be trained, which can improve the matching degree between the target model and the computing power of the target deployment platform.

[0155] In addition, by constructing a super network search space based on multiple candidate network frameworks, we can use width search as the starting point and search the network downsampling position and global depth at the same time. This is not limited to the number of layers in each candidate network framework, but also the number of substructures of each candidate network framework will be searched, which improves the flexibility of network structure search and provides a basis for deploying models on deployment platforms with different requirements.

[0156] Figure 5 is a structural block diagram of a computer device provided in an embodiment of the present application. Figure 5 As shown, the computer device 4 of this embodiment includes: a processor 40, a memory 41, and a computer program 42 stored in the memory 41 and executable on the processor 40, such as a program of the model building method. When the processor 40 executes the computer program 42, the steps in each embodiment of the above-mentioned model building method are implemented, such as Figure 1 S11 to S13 shown or Figure 2 Alternatively, the processor 40 implements the above when executing the computer program 42. Figure 3 The functions of each unit in the corresponding embodiment are, for example, Figure 4 The functions of the units 31 to 33 shown, or Figure 4 For details on the functions of the units 31 to 38 shown, please refer to Figure 4 The relevant descriptions in the corresponding embodiments are not repeated here.

[0157] Exemplarily, the computer program 42 may be divided into one or more units, which are stored in the memory 41 and executed by the processor 40 to complete the present application. The one or more units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 42 in the computer device 4. For example, the computer program 42 may be divided into a sampling training unit, a search unit, and a model training unit, and the specific functions of each unit are as described above.

[0158] The computer device may include, but is not limited to, a processor 40 and a memory 41. Those skilled in the art will appreciate that Figure 5 It is only an example of computer device 4 and does not constitute a limitation of computer device 4. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the computer device may also include input and output devices, network access devices, buses, etc.

[0159] The processor 40 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0160] The memory 41 may be an internal storage unit of the computer device 4, such as a hard disk or memory of the computer device 4. The memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device 4. Furthermore, the memory 41 may also include both an internal storage unit and an external storage device of the computer device 4. The memory 41 is used to store the computer program and other programs and data required by the computer device. The memory 41 may also be used to temporarily store data that has been output or is to be output. Gradient field control method based on gradient waveform adjustment and magnetic resonance imaging device

[0161] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person 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 application, and should all be included in the protection scope of the present application.

Claims

1. A model building method, It is characterized in that include: Training a hypernetwork having a search space to obtain a trained hypernetwork; wherein the search space includes a plurality of candidate network frameworks; According to a preset search condition, searching from the trained super network to obtain a network framework to be trained; Using the training sample set to train the network framework to be trained to obtain a target model; The preset search condition corresponds to the target deployment platform; the step of searching the trained super network to obtain the network framework to be trained according to the preset search condition includes: Based on the following formula included in the preset search condition, searching for a network framework to be trained from the trained super network; Where a represents the candidate network framework and satisfies the condition ; is the number of candidate network frameworks in the search space, and ; is the verification accuracy; h represents the target deployment platform, and h>0; is the objective function; The latency of deploying the platform for the target.

2. The model building method according to claim 1, It is characterized in that Before the step of training the network framework to be trained by using the training sample set to obtain the target model, the step further includes: Get a set of sample images containing faces; Cutting out a face region from each sample image in the sample image set to obtain a face image sample set; Each face image sample in the face image sample set is scaled and labeled to obtain the training sample set.

3. The model building method according to claim 1, It is characterized in that The multiple candidate network frameworks in the search space are connected to each other, and each of the candidate network frameworks includes multiple substructures; The step of training the hypernetwork constructed with the search space to obtain the trained hypernetwork includes: Performing a structure search based on all of the substructures in the search space to determine a single-path supernet; The supernetwork is sampled and trained according to the single-path supernetwork to obtain a trained supernetwork.

4. The model building method according to claim 3, It is characterized in that The performing structure search based on all the substructures in the search space to determine a single-path supernet includes: According to the preset supernet attribute information, a structural search is performed on all the substructures in the search space to obtain a single-path supernet; wherein the transition probability between two adjacent substructures in the single-path supernet is the largest.

5. The model building method according to claim 1, It is characterized in that The method of training the network framework to be trained by using the training sample set to obtain a target model includes: The network framework to be trained is trained using the training sample set using back propagation and gradient optimization methods to obtain a target model.

6. The model building method according to claim 5, It is characterized in that The method of using back propagation and gradient optimization to train the network framework to be trained using the training sample set to obtain a target model includes: The objective function Identify as a convergence condition; among them, , the time delay of deploying the platform for the target; The back propagation and gradient optimization methods are used to train and optimize the network framework to be trained using the training sample set to obtain a target model that meets the convergence conditions.

7. A model building device, It is characterized in that include: A sampling training unit, used for training a super network constructed with a search space to obtain a trained super network; wherein the search space includes a plurality of candidate network frameworks; A search unit, configured to search for a network framework to be trained from the trained super network according to a preset search condition; A model training unit, used to train the network framework to be trained using a training sample set to obtain a target model; The preset search condition corresponds to the target deployment platform; the search unit is specifically used to: Based on the following formula included in the preset search condition, searching for a network framework to be trained from the trained super network; Where a represents the candidate network framework and satisfies the condition ; is the number of candidate network frameworks in the search space, and ; is the verification accuracy; h represents the target deployment platform, and h>0; is the objective function; The latency of deploying the platform for the target.

8. A computer device, It is characterized in that The computer device comprises a memory, a processor and a computer program stored in the memory and executable on the computer device, and the processor implements the steps of the model building method according to any one of claims 1 to 6 when executing the computer program.

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 model building method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Generation method and device for face recognition model

    CN108491812A

  • Neural network model construction method and device, and storage medium

    CN109615073A

  • Neural network training method and device, and storage medium

    CN110782034A

  • Super-network training method and device, electronic equipment and storage medium

    CN110956262A

  • Neural network construction method applied to medical ultrasonic image

    CN111047563A