A method and device for determining neural network structure
By obtaining the backbone network structure parameters and task processing accuracy of the neural network, determining the target encoding and selecting efficient neural network structure, the problem of re-searching of existing NAS methods is solved, and the search efficiency and computing performance are improved.
Patent Information
- Application Number
- CN202010688391.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-16
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2040-07-16
AI Technical Summary
The existing neural network architecture search (NAS) method needs to be re-searched when facing different data sets or tasks, resulting in more iteration processes and higher computational overhead.
By obtaining the backbone network structure parameters and task processing accuracy of the neural network, the target encoding is determined, and the probability of candidate structural parameters of the backbone network is determined based on the encoding, and the target neural network with task processing accuracy higher than the threshold is selected.
Reduces the need for re-search in each structure search, improves search efficiency, reduces computational overhead, and can quickly select suitable neural network structures.
Smart Images

Figure CN111950702B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and in particular to a method and device for determining a neural network structure. Background Art
[0002] Machine learning (ML) has achieved considerable success in recent years, and more and more products derived from machine learning are bringing about earth-shaking changes in people's lives. However, the current progress of machine learning relies on ML experts to manually design and debug the models, which not only limits the widespread application of machine learning, but also prolongs the iteration cycle of products.
[0003] With the rapid development of artificial intelligence technology, a neural network with excellent performance often has a sophisticated network structure, which requires human experts with superb skills and rich experience to spend a lot of effort to build. In order to better build neural networks, people have proposed to build neural networks through neural architecture search (NAS) methods, which can automatically search for neural network structures to obtain neural network structures with excellent performance.
[0004] Neural architecture search (NAS) has achieved great success in many tasks (such as image classification, object detection, semantic segmentation, etc.). However, NAS algorithms will encounter a variety of data sets or tasks in practical applications. In existing implementations, each time NAS is performed on a neural network for a different task, a new search is required, which requires many iterations and a large computational overhead. Summary of the invention
[0005] In a first aspect, the present application provides a method for determining a neural network structure, the method comprising:
[0006] Obtain the structural parameters of the backbone network in the first neural network, and the task processing accuracy of the first neural network, the first neural network is used to achieve the target task; determine the target code at least according to the structural parameters of the backbone network and the task processing accuracy, the target code is used to represent the target task; in one implementation, the user can also input the data set location, the terminal device can obtain the target training data based on the input data set location, and train the first neural network and the task processing accuracy of the first neural network according to the target training data training and the network architecture of the first neural network. The evaluation method of task processing accuracy is related to the type of target task, specifically, the task processing accuracy can include but is not limited to accuracy, mean average precision, mean intersection over union, mean square error, structural similarity index, etc.; determine the probability of the structural parameters of multiple candidate networks of the backbone network according to the target code; and determine the target neural network according to the probability of the structural parameters of the multiple candidate networks, the target neural network includes one of the multiple candidate network structures, and the task processing accuracy of the target neural network is greater than a threshold, and the target neural network is used to achieve the target task.
[0007] The present application provides a method for determining a neural network structure, the method comprising: obtaining the structural parameters of a backbone network in a first neural network, and the task processing accuracy of the first neural network, the first neural network being used to achieve a target task; determining a target code at least according to the structural parameters of the backbone network and the task processing accuracy, the target code being used to represent the target task; determining the probability of structural parameters of multiple candidate networks of the backbone network according to the target code; and determining a target neural network according to the probability of structural parameters of the multiple candidate networks, the target neural network including one of the multiple candidate network structures, and the task processing accuracy of the target neural network being greater than a threshold, the target neural network being used to achieve the target task. In order to achieve better task processing accuracy, the network structure of the backbone network of the neural network is likely to be different for different tasks and different target training data. In order to avoid the need to re-search each time the backbone network is searched for structure, the task type and training data features that can express the neural network to be achieved can be first obtained (i.e., the target code in the above embodiment), and then the structural features of the backbone network corresponding to the target code (i.e., the probability distribution of the structural types of each structure of the backbone network) are determined, and the target neural network is selected based on the probability distribution. Since the target neural network is obtained by sampling the probability distribution determined by the target encoding, the target neural network is related to the type of task that the neural network needs to achieve and the characteristics of the training data, that is, it is closer to a better network structure. Therefore, without a large number of iterations, a network structure suitable for the type of task that the neural network needs to achieve and the training data can be selected.
[0008] In a possible implementation, determining the target neural network according to the probabilities of the structural parameters of the multiple candidate networks includes:
[0009] According to the probabilities of the structural parameters of the multiple candidate networks, M candidate structures are sampled to obtain M second neural networks; wherein each candidate structure is used as a backbone network of a second neural network, and the second neural network is used to achieve the target task;
[0010] The task processing accuracies of the M second neural networks are obtained, and the target neural network is selected from the M second neural networks according to the task processing accuracies of the M second neural networks.
[0011] In a possible implementation, the target task includes at least one of the following: image classification, object detection, semantic segmentation, room layout, image completion, or automatic encoding.
[0012] In one possible implementation, the structural parameters of the backbone network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
[0013] The structural parameters of the backbone network may include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network. Among them, the depth of the backbone network can be understood as the number of neural network layers (neural network layers to be searched) included in the backbone network, and the width of the backbone network can be understood as the number of channels of the feature map generated by the backbone network. The type of neural network layer can be selected from the search space. Exemplarily, the search space can include but is not limited to operation types including but not limited to convolution, pooling, residual connection, etc. For example, the following operation types may be included: 1x3 and 3x1 convolution, 1x7 and 7x1 convolution, 3x3 dilated convolution, 3x3 average pooling, 3x3 max pooling, 5x5 max pooling, 7x7max pooling, 1x1 convolution, 3x3 convolution, 3x3 separable conv, 5x5 seperableconv, 7x7separable conv, skip connection operation, zeroing operation (Zero, all neurons at corresponding positions are set to zero), etc.
[0014] In one possible implementation, the structural parameters of the candidate network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
[0015] In a possible implementation, the first neural network is trained based on target training data, and the target encoding is used to represent the target task and the target training data.
[0016] In a possible implementation, the target neural network is selected in the current iteration process, and the method further includes:
[0017] The target neural network is trained to obtain a trained target neural network; the trained target neural network is used as a basis for determining the target encoding in the next iteration process.
[0018] In a possible implementation, determining the target encoding at least according to the structural parameters of the backbone network and the task processing accuracy includes:
[0019] At least according to the structural parameters of the backbone network and the task processing accuracy, a distribution parameter is obtained, and the distribution parameter represents the probability distribution of the code; according to the probability distribution of the code, the target code is sampled and obtained.
[0020] In a possible implementation, obtaining the distribution parameter at least according to the structural parameters of the backbone network and the task processing accuracy includes:
[0021] Get a pre-trained task encoding network;
[0022] At least the structural parameters of the backbone network and the task processing accuracy are used as input data of the task encoding network to obtain the distribution parameters.
[0023] The task coding module can be a network model trained on the server side, which has the ability to output the target coding by inputting the network structure and task processing accuracy of the neural network, and the target coding can express the characteristics of the target task and the characteristics of the target training data. It should be understood that the task coding module can be a fully connected network. In order to achieve better task processing accuracy, the network structure of the backbone network of the neural network is likely to be different for different tasks and different target training data. In order to avoid the need to re-search each time the backbone network is searched for structure, it is possible to first obtain the characteristics of the task type and training data that can express the neural network to be implemented (i.e., the target coding in the above embodiment).
[0024] In a possible implementation, the distribution parameters include a mean value and a variance of a Gaussian distribution.
[0025] In a possible implementation, determining the probabilities of structural parameters of multiple candidate networks of the backbone network according to the target encoding includes:
[0026] Get a pre-trained probability distribution generation network;
[0027] The target code is used as input data of the probability distribution generation network to obtain the probabilities of the structural parameters of the various candidate networks of the backbone network.
[0028] For example, the terminal device can call the probability distribution generation network to output the width w of the backbone network, the depth d of the backbone network, and the probability distribution of the size s of the feature map generated by the backbone network. For example, p(w) = [0.1, 0.3, 0.5, 0.1] means that w = 48, 56, 64, 72 are sampled with probabilities of 0.1, 0.3, 0.5, and 0.1 respectively. The probability distribution of d and s can be determined in a similar way to that of w.
[0029] In a possible implementation, obtaining the task processing accuracy of the M second neural networks includes:
[0030] Get the pre-trained accuracy evaluation network;
[0031] The structural parameters of the backbone network included in the M second neural networks and the target code are used as input data of the accuracy evaluation network to obtain the task processing accuracy of the M second neural networks.
[0032] In a possible implementation, selecting the target neural network from the M second neural networks according to the task processing accuracy of the M second neural networks includes:
[0033] According to the task processing accuracy of the M second neural networks, a second neural network with the highest task processing accuracy is selected from the M second neural networks as the target neural network.
[0034] In a possible implementation, the task encoding network, the probability distribution generation network, and the accuracy assessment network are obtained by server training.
[0035] In a possible implementation, the method further includes:
[0036] The task encoding network, the probability distribution generation network and the accuracy evaluation network sent by the receiving server are received.
[0037] In a second aspect, the present application provides a neural network structure determination device, the device comprising:
[0038] An acquisition module, used to acquire structural parameters of a backbone network in a first neural network and a task processing accuracy of the first neural network, wherein the first neural network is used to achieve a target task;
[0039] A determination module, configured to determine a target code based at least on the structural parameters of the backbone network and the task processing accuracy, wherein the target code is used to represent the target task;
[0040] Determining the probabilities of structural parameters of multiple candidate networks of the backbone network according to the target encoding; and
[0041] According to the probabilities of the structural parameters of the multiple candidate networks, a target neural network is determined, the target neural network includes one of the multiple candidate network structures, and the task processing accuracy of the target neural network is greater than a threshold, and the target neural network is used to achieve the target task.
[0042] In a possible implementation, the acquisition module is used to sample M candidate structures according to the probabilities of the structural parameters of the multiple candidate networks to obtain M second neural networks; wherein each candidate structure is used as a backbone network of a second neural network, and the second neural network is used to achieve the target task;
[0043] The task processing accuracies of the M second neural networks are obtained, and the target neural network is selected from the M second neural networks according to the task processing accuracies of the M second neural networks.
[0044] In a possible implementation, the target task includes at least one of the following: image classification, object detection, semantic segmentation, room layout, image completion, or automatic encoding.
[0045] In one possible implementation, the structural parameters of the backbone network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
[0046] In one possible implementation, the structural parameters of the candidate network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
[0047] In a possible implementation, the first neural network is trained based on target training data, and the target encoding is used to represent the target task and the target training data.
[0048] In a possible implementation, the target neural network is selected in the current iteration process, and the device further includes:
[0049] The training module is used to train the target neural network to obtain a trained target neural network; the trained target neural network is used as a basis for determining the target encoding in the next iteration process.
[0050] In a possible implementation, the determination module is used to obtain distribution parameters based at least on the structural parameters of the backbone network and the task processing accuracy, where the distribution parameters represent the probability distribution of the code; and sample to obtain the target code based on the probability distribution of the code.
[0051] In a possible implementation, the acquisition module is used to acquire a pre-trained task encoding network;
[0052] At least the structural parameters of the backbone network and the task processing accuracy are used as input data of the task encoding network to obtain the distribution parameters.
[0053] In a possible implementation, the distribution parameters include a mean value and a variance of a Gaussian distribution.
[0054] In a possible implementation, the determination module is used to obtain a pre-trained probability distribution generation network;
[0055] The target code is used as input data of the probability distribution generation network to obtain the probabilities of the structural parameters of the various candidate networks of the backbone network.
[0056] In a possible implementation, the acquisition module is used to acquire a pre-trained accuracy assessment network;
[0057] The structural parameters of the backbone network included in the M second neural networks and the target code are used as input data of the accuracy evaluation network to obtain the task processing accuracy of the M second neural networks.
[0058] In a possible implementation, the determination module is used to select a second neural network with the highest task processing accuracy from the M second neural networks as the target neural network based on the task processing accuracy of the M second neural networks.
[0059] In a possible implementation, the task encoding network, the probability distribution generation network, and the accuracy assessment network are obtained by server training.
[0060] In a possible implementation, the device further includes:
[0061] A receiving module is used to receive the task encoding network, the probability distribution generation network and the accuracy evaluation network sent by a server.
[0062] Since the second aspect is a device corresponding to the first aspect, its various implementation methods, explanations and corresponding technical effects please refer to the description of the first aspect and will not be repeated here.
[0063] In a third aspect, the present application provides a neural network training method, comprising:
[0064] Acquire structural parameters of a backbone network in a first neural network and task processing accuracy of the first neural network, wherein the first neural network is used to achieve a target task;
[0065] At least the structural parameters of the backbone network and the task processing accuracy are used as input data of the task encoding network to obtain distribution parameters, wherein the distribution parameters represent the probability distribution of the encoding;
[0066] According to the probability distribution of the code, sampling is performed to obtain a target code;
[0067] Using the target code as input data of a probability distribution generation network to obtain the probabilities of structural parameters of multiple candidate networks of the backbone network;
[0068] According to the probabilities of the structural parameters of the multiple candidate networks, M candidate structures are sampled to obtain M second neural networks; wherein each candidate structure is used as a backbone network of a second neural network, and the second neural network is used to achieve the target task;
[0069] Using the network structure of the backbone network included in the M second neural networks and the target code as input data of the accuracy evaluation network, obtaining the task processing accuracy of the M second neural networks, and selecting a target neural network from the M second neural networks according to the task processing accuracy of the M second neural networks;
[0070] The task encoding network, the probability distribution generation network, and the accuracy evaluation network are updated based on reinforcement learning to obtain an updated task encoding network, an updated probability distribution generation network, and an updated accuracy evaluation network.
[0071] In a possible implementation, the method further includes:
[0072] The updated task encoding network, the updated probability distribution generation network, and the updated accuracy evaluation network are sent to the terminal device.
[0073] In a possible implementation, the target task includes at least one of the following: image classification, object detection, semantic segmentation, room layout, image completion, or automatic encoding.
[0074] In one possible implementation, the structural parameters of the backbone network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
[0075] In one possible implementation, the structural parameters of the candidate network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
[0076] In a possible implementation, the target neural network is selected in the current iteration process, and the method further includes:
[0077] The target neural network is trained to obtain a trained target neural network; the trained target neural network is used as a basis for determining the target encoding in the next iteration process.
[0078] In a fourth aspect, the present application provides a neural network training device, comprising:
[0079] An acquisition module, used to acquire structural parameters of a backbone network in a first neural network and a task processing accuracy of the first neural network, wherein the first neural network is used to achieve a target task;
[0080] A determination module, configured to use at least the structural parameters of the backbone network and the task processing accuracy as input data of a task encoding network to obtain distribution parameters, wherein the distribution parameters represent a probability distribution of encoding;
[0081] According to the probability distribution of the code, sampling is performed to obtain a target code;
[0082] Using the target code as input data of a probability distribution generation network to obtain the probabilities of structural parameters of multiple candidate networks of the backbone network;
[0083] According to the probabilities of the structural parameters of the multiple candidate networks, M candidate structures are sampled to obtain M second neural networks; wherein each candidate structure is used as a backbone network of a second neural network, and the second neural network is used to achieve the target task;
[0084] Using the network structure of the backbone network included in the M second neural networks and the target code as input data of the accuracy evaluation network, obtaining the task processing accuracy of the M second neural networks, and selecting a target neural network from the M second neural networks according to the task processing accuracy of the M second neural networks;
[0085] A training module is used to update the task encoding network, the probability distribution generation network, and the accuracy evaluation network based on reinforcement learning to obtain an updated task encoding network, an updated probability distribution generation network, and an updated accuracy evaluation network.
[0086] In a possible implementation, the device further includes:
[0087] The sending module is used to send the updated task encoding network, the updated probability distribution generation network and the updated accuracy evaluation network to the terminal device.
[0088] In a possible implementation, the target task includes at least one of the following: image classification, object detection, semantic segmentation, room layout, image completion, or automatic encoding.
[0089] In one possible implementation, the structural parameters of the backbone network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
[0090] In one possible implementation, the structural parameters of the candidate network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
[0091] In a possible implementation, the target neural network is selected in the current iteration process, and the method further includes:
[0092] The target neural network is trained to obtain a trained target neural network; the trained target neural network is used as a basis for determining the target encoding in the next iteration process.
[0093] In a fifth aspect, an embodiment of the present application provides a system, including a server and a terminal device;
[0094] The server is used to obtain the structural parameters of the backbone network in the first neural network and the task processing accuracy of the first neural network, and the first neural network is used to achieve the target task; at least the structural parameters of the backbone network and the task processing accuracy are used as input data of the task encoding network to obtain distribution parameters, and the distribution parameters represent the probability distribution of the code; according to the probability distribution of the code, the target code is sampled to obtain the probability of the structural parameters of multiple candidate networks of the backbone network; according to the probability of the structural parameters of the multiple candidate networks, M candidate structures are sampled to obtain M second neural networks; wherein each candidate structure is used as the main structure of a second neural network The backbone network is a backbone network, wherein the second neural network is used to achieve the target task; the network structure of the backbone network included in the M second neural networks and the target coding are used as input data of the accuracy evaluation network to obtain the task processing accuracy of the M second neural networks, and the target neural network is selected from the M second neural networks according to the task processing accuracy of the M second neural networks; the task coding network, the probability distribution generation network, and the accuracy evaluation network are updated based on reinforcement learning to obtain an updated task coding network, an updated probability distribution generation network, and an updated accuracy evaluation network; the updated task coding network, the updated probability distribution generation network, and the updated accuracy evaluation network are sent to the terminal device;
[0095] The terminal device is used to obtain the structural parameters of the backbone network in the first neural network and the task processing accuracy of the first neural network, and the first neural network is used to achieve the target task; at least the structural parameters of the backbone network and the task processing accuracy are used as input data of the updated task encoding network to obtain distribution parameters, and the distribution parameters represent the probability distribution of the code; according to the probability distribution of the code, the target code is sampled to obtain; the target code is used as input data of the updated probability distribution generation network to obtain the probability of the structural parameters of multiple candidate networks of the backbone network; according to the probability of the structural parameters of the multiple candidate networks, M candidate structures are sampled to obtain M second neural networks; wherein each candidate structure is used as the backbone network of a second neural network, and the second neural network is used to achieve the target task; the structural parameters of the backbone network included in the M second neural networks and the target code are used as input data of the updated accuracy evaluation network to obtain the task processing accuracy of the M second neural networks, and the target neural network is selected from the M second neural networks according to the task processing accuracy of the M second neural networks.
[0096] In a possible implementation, the target task includes at least one of the following: image classification, object detection, semantic segmentation, room layout, image completion, or automatic encoding.
[0097] In one possible implementation, the structural parameters of the backbone network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
[0098] In one possible implementation, the structural parameters of the candidate network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
[0099] In one possible implementation, the target neural network is selected in the current iteration process, and the terminal device is also used to: train the target neural network to obtain a trained target neural network; the trained target neural network is used as a basis for determining the target encoding in the next iteration process.
[0100] In a sixth aspect, an embodiment of the present application provides a device for determining a neural network structure, which may include a memory, a processor, and a bus system, wherein the memory is used to store programs, and the processor is used to execute the programs in the memory to execute the first aspect and any optional method of the first aspect mentioned above.
[0101] In the seventh aspect, an embodiment of the present application provides a neural network training device, which may include a memory, a processor, and a bus system, wherein the memory is used to store programs, and the processor is used to execute the programs in the memory to execute any optional method as described in the second aspect and the first aspect above.
[0102] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer executes the above-mentioned first aspect and any optional method thereof.
[0103] In a ninth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer executes the above-mentioned second aspect and any optional method thereof.
[0104] In the tenth aspect, an embodiment of the present application provides a computer program, which, when executed on a computer, enables the computer to execute the above-mentioned first aspect and any optional method thereof.
[0105] In the eleventh aspect, an embodiment of the present application provides a computer program, which, when executed on a computer, enables the computer to execute the above-mentioned second aspect and any optional method thereof.
[0106] In a twelfth aspect, the present application provides a chip system, which includes a processor for supporting an execution device or a training device to implement the functions involved in the above aspects, such as sending or processing the data involved in the above methods; or, information. In a possible design, the chip system also includes a memory, which is used to store program instructions and data necessary for the execution device or the training device. The chip system can be composed of a chip, or it can include a chip and other discrete devices.
[0107] The present application provides a method for determining a neural network structure, the method comprising: obtaining the structural parameters of a backbone network in a first neural network, and the task processing accuracy of the first neural network, the first neural network being used to achieve a target task; determining a target code at least according to the structural parameters of the backbone network and the task processing accuracy, the target code being used to represent the target task; determining the probability of structural parameters of multiple candidate networks of the backbone network according to the target code; and determining a target neural network according to the probability of structural parameters of the multiple candidate networks, the target neural network including one of the multiple candidate network structures, and the task processing accuracy of the target neural network being greater than a threshold, the target neural network being used to achieve the target task. In order to achieve better task processing accuracy, the network structure of the backbone network of the neural network is likely to be different for different tasks and different target training data. In order to avoid the need to re-search each time the backbone network is searched for structure, the task type and training data features that can express the neural network to be achieved can be first obtained (i.e., the target code in the above embodiment), and then the structural features of the backbone network corresponding to the target code (i.e., the probability distribution of the structural types of each structure of the backbone network) are determined, and the target neural network is selected based on the probability distribution. Since the target neural network is obtained by sampling the probability distribution determined by the target encoding, the target neural network is related to the type of task that the neural network needs to achieve and the characteristics of the training data, that is, it is closer to a better network structure. Therefore, without a large number of iterations, a network structure suitable for the type of task that the neural network needs to achieve and the training data can be selected. BRIEF DESCRIPTION OF THE DRAWINGS
[0108] Figure 1 A structural diagram of the main framework of artificial intelligence;
[0109] Figure 2 This is an application scenario of the embodiment of the present application;
[0110] Figure 3 A schematic diagram of a system architecture provided for an embodiment of the present application;
[0111] Figure 4 A schematic diagram of a process of determining a neural network structure provided in an embodiment of the present application;
[0112] Figure 5 A schematic diagram of a backbone network provided in an embodiment of the present application;
[0113] Figure 6 A functional architecture diagram provided for an embodiment of the present application;
[0114] Figure 7 A schematic diagram of a neural network structure determination process provided in an embodiment of the present application;
[0115] Figure 8 A schematic diagram of a neural network structure determination process provided in an embodiment of the present application;
[0116] Fig. 9 A neural network structure determination device provided in an embodiment of the present application;
[0117] Fig.10 A schematic diagram of the structure of a neural network training device provided in an embodiment of the present application;
[0118] Fig.11 A schematic diagram of the structure of an execution device provided in an embodiment of the present application;
[0119] Fig.12 It is a structural schematic diagram of a training device provided in an embodiment of the present application;
[0120] Fig.13 A schematic diagram of the structure of a chip provided in an embodiment of the present application;
[0121] Fig.14 A schematic diagram of a system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0122] The embodiments of the present invention are described below in conjunction with the accompanying drawings in the embodiments of the present invention. The terms used in the implementation mode of the present invention are only used to explain the specific embodiments of the present invention, and are not intended to limit the present invention.
[0123] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0124] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0125] First, the overall workflow of the artificial intelligence system is described. Figure 1 , Figure 1 The figure shows a structural diagram of the main framework of artificial intelligence. The following is an explanation of the above artificial intelligence theme framework from the two dimensions of "intelligent information chain" (horizontal axis) and "IT value chain" (vertical axis). Among them, the "intelligent information chain" reflects a series of processes from data acquisition to processing. For example, it can be a general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, intelligent execution and output. In this process, the data has undergone a condensation process of "data-information-knowledge-wisdom". The "IT value chain" reflects the value that artificial intelligence brings to the information technology industry from the underlying infrastructure of human intelligence, information (providing and processing technology implementation) to the industrial ecology process of the system.
[0126] (1) Infrastructure
[0127] The infrastructure provides computing power support for the AI system, enables communication with the outside world, and supports it through the basic platform. It communicates with the outside world through sensors; computing power is provided by smart chips (CPU, NPU, GPU, ASIC, FPGA and other hardware acceleration chips); the basic platform includes distributed computing frameworks and networks and other related platform guarantees and support, which can include cloud storage and computing, interconnected networks, etc. For example, sensors communicate with the outside world to obtain data, and these data are provided to the smart chips in the distributed computing system provided by the basic platform for calculation.
[0128] (2) Data
[0129] The data on the upper layer of the infrastructure is used to represent the data sources in the field of artificial intelligence. The data involves graphics, images, voice, text, and IoT data of traditional devices, including business data of existing systems and perception data such as force, displacement, liquid level, temperature, and humidity.
[0130] (3) Data processing
[0131] Data processing usually includes data training, machine learning, deep learning, search, reasoning, decision-making and other methods.
[0132] Among them, machine learning and deep learning can symbolize and formalize data for intelligent information modeling, extraction, preprocessing, and training.
[0133] Reasoning refers to the process of simulating human intelligent reasoning in computers or intelligent systems, using formalized information to perform machine thinking and solve problems based on reasoning control strategies. Typical functions are search and matching.
[0134] Decision-making refers to the process of making decisions after intelligent information is reasoned, usually providing functions such as classification, sorting, and prediction.
[0135] (4) General ability
[0136] After the data has undergone the data processing mentioned above, some general capabilities can be further formed based on the results of the data processing, such as an algorithm or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.
[0137] (5) Smart products and industry applications
[0138] Smart products and industry applications refer to the products and applications of artificial intelligence systems in various fields. They are the encapsulation of the overall artificial intelligence solution, which productizes intelligent information decision-making and realizes practical applications. Its application areas mainly include: smart terminals, smart transportation, smart medical care, autonomous driving, safe cities, etc.
[0139] The embodiments of the present application can be applied to image classification, object detection, semantic segmentation, room layout, image completion or automatic encoding. For example, the embodiments of the present application can be applied to fields such as driving assistance, automatic driving, mobile terminals, etc. that need to complete multiple perception tasks.
[0140] The following is a brief introduction to the two application scenarios of ADAS / ADS visual perception system and mobile phone beautification.
[0141] Application scenario 1: ADAS / ADS visual perception system
[0142] like Figure 2As shown in the figure, in ADAS and ADS, multiple types of 2D target detection need to be performed in real time, including: dynamic obstacles (pedestrians, cyclists, tricycles, cars, trucks, and buses), static obstacles (traffic cones, traffic sticks, fire hydrants, motorcycles, and bicycles), traffic signs (traffic signs, guide signs, billboards, red traffic lights (TrafficLight_Red) / yellow traffic lights (TrafficLight_Yellow) / green traffic lights (TrafficLight_Green) / black traffic lights (TrafficLight_Black), and road signs). In addition, in order to accurately obtain the area occupied by dynamic obstacles in 3D space, it is also necessary to perform 3D estimation on the dynamic obstacles and output 3D boxes. In order to fuse with the laser radar data, it is necessary to obtain the mask of the dynamic obstacle, so as to filter out the laser point cloud that hits the dynamic obstacle; in order to accurately park, it is necessary to detect the four key points of the parking space at the same time; in order to perform composition positioning, it is necessary to detect the key points of the static target. Using the technical solution provided in the embodiment of the present application, all or part of the above functions can be completed in the neural network.
[0143] Application scenario 2: Mobile phone beauty function
[0144] In a mobile phone, the mask and key points of the human body are detected through the neural network provided in the embodiment of the present application, and the corresponding parts of the human body can be enlarged or reduced, such as performing waist-tightening and buttocks-beautifying operations, thereby outputting a beautified image.
[0145] Application scenario 3: Image classification scenario:
[0146] After obtaining the image to be classified, the category of the object in the image to be classified can be obtained based on the neural network, and then the image to be classified can be classified according to the category of the object in the image to be classified. For photographers, many photos are taken every day, including animals, people, and plants. The method of the present application can quickly classify the photos according to the content in the photos, which can be divided into photos containing animals, photos containing people, and photos containing plants.
[0147] When there are a large number of images, manual classification is inefficient, and people are easily fatigued when dealing with the same thing for a long time, and the classification results will have large errors. However, the method of the present application can quickly classify images without errors.
[0148] Application scenario 4: Product classification:
[0149] After acquiring an image including a commodity, the category of the commodity in the image can be acquired by processing the neural network, and then the commodity can be classified according to the category of the commodity. For a large shopping mall or supermarket with a wide variety of commodities, the object recognition method of the present application can quickly complete the classification of commodities, reducing time expenditure and labor costs.
[0150] Since the embodiments of the present application involve the application of a large number of neural networks, in order to facilitate understanding, the relevant terms and related concepts such as neural networks involved in the embodiments of the present application are first introduced below.
[0151] (1) Object detection: Using image processing and related methods such as machine learning and computer graphics, object detection can determine the category of image objects and determine the detection box used to locate the object.
[0152] (2) Convolutional neural network (CNN) is a deep neural network with a convolutional structure. The convolutional neural network includes a feature extractor consisting of a convolution layer and a subsampling layer. The feature extractor can be regarded as a filter. The perception network in this embodiment may include a convolutional neural network for performing convolution processing on an image or performing convolution processing on a feature map to generate a feature map.
[0153] (3) Back propagation algorithm
[0154] The convolutional neural network can use the error back propagation (BP) algorithm to correct the size of the parameters in the initial super-resolution model during the training process, so that the reconstruction error loss of the super-resolution model becomes smaller and smaller. Specifically, the forward transmission of the input signal to the output will generate error loss, and the parameters in the initial super-resolution model are updated by back-propagating the error loss information, so that the error loss converges. The back-propagation algorithm is a back-propagation movement dominated by error loss, which aims to obtain the optimal parameters of the super-resolution model, such as the weight matrix. In this embodiment, when training the perception network, the perception network can be updated based on the back-propagation algorithm.
[0155] Figure 3 is a schematic diagram of a system architecture provided by an embodiment of the present application. Figure 3In the embodiment, the execution device 110 is configured with an input / output (I / O) interface 112 for data interaction with an external device. A user can input data to the I / O interface 112 through a client device 140 .
[0156] When the execution device 120 preprocesses the input data, or when the computing module 111 of the execution device 120 performs calculation and other related processing (such as implementing the function of the neural network in the present application), the execution device 120 can call the data, code, etc. in the data storage system 150 for the corresponding processing, and can also store the data, instructions, etc. obtained by the corresponding processing in the data storage system 150.
[0157] Finally, the I / O interface 112 returns the processing result, such as at least one of the above-mentioned image or image block or 2D, 3D, Mask and key point information of the object of interest in the image, to the client device 140 for providing to the user.
[0158] Optionally, the client device 140 , for example, may be a control unit in an autonomous driving system, or a functional algorithm module in a mobile phone terminal. For example, the functional algorithm module may be used to implement related tasks.
[0159] It is worth noting that the training device 120 can generate corresponding target models / rules based on different training data for different goals or different tasks, and the corresponding target models / rules can be used to achieve the above goals or complete the above tasks, thereby providing users with the desired results.
[0160] exist Figure 3 In the case shown in the figure, the user can manually give input data, and the manual giving can be operated through the interface provided by the I / O interface 112. In another case, the client device 140 can automatically send input data to the I / O interface 112. If the client device 140 is required to automatically send input data and needs to obtain the user's authorization, the user can set the corresponding authority in the client device 140. The user can view the results output by the execution device 110 on the client device 140, and the specific form can be display, sound, action and other specific methods. The client device 140 can also be used as a data acquisition terminal to collect the input data of the input I / O interface 112 and the output results of the output I / O interface 112 as new sample data, and store them in the database 130. Of course, it is also possible not to collect through the client device 140, but the I / O interface 112 directly stores the input data of the input I / O interface 112 and the output results of the output I / O interface 112 as new sample data in the database 130.
[0161] It is worth noting that Figure 3This is only a schematic diagram of a system architecture provided by an embodiment of the present application. The positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. For example, in Figure 3 In the embodiment, the data storage system 150 is an external memory relative to the execution device 110. In other cases, the data storage system 150 may also be placed in the execution device 110.
[0162] See also Figure 4 , Figure 4 A schematic diagram of a process of determining a neural network structure provided in an embodiment of the present application is shown in FIG. Figure 4 As shown in the figure, the neural network structure determination method provided in the embodiment of the present application includes:
[0163] 401. Obtain structural parameters of a backbone network in a first neural network and task processing accuracy of the first neural network, where the first neural network is used to achieve a target task.
[0164] In an embodiment of the present application, a first neural network can be randomly generated. Specifically, the network structure of the first neural network backbone network can be randomly sampled, wherein the structural parameters of the backbone network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network. Among them, the depth of the backbone network can be understood as the number of neural network layers (neural network layers to be searched) included in the backbone network, and the width of the backbone network can be understood as the number of channels of the feature map generated by the backbone network. The type of neural network layer can be selected from the search space. Exemplarily, the search space can include but is not limited to operation types including but not limited to convolution, pooling, residual connection, etc. For example, the following operation types may be included: 1x3 and 3x1 convolution, 1x7 and 7x1 convolution, 3x3 dilated convolution, 3x3 average pooling, 3x3 max pooling, 5x5max pooling, 7x7 max pooling, 1x1 convolution, 3x3 convolution, 3x3 separableconv, 5x5 seperableconv, 7x7 separableconv, skip connection operation, zeroing operation (Zero, all neurons at corresponding positions are set to zero), etc.
[0165] Among them, for example, 3x3 average pooling represents average pooling with a pooling kernel size of 3×3; 3x3max pooling represents maximum pooling with a pooling kernel size of 3×3; 3x3 dilated convolution represents a dilated convolution with a convolution kernel size of 3×3 and a dilation rate of 2; 3x3 separable conv represents a separable convolution with a convolution kernel size of 3×3; 5x5seperable conv represents a separable convolution with a convolution kernel size of 5×5.
[0166] For example, refer to Figure 5 , Figure 5 A schematic diagram of a backbone network provided for an embodiment of the present application, wherein the backbone network is used to receive an input image, perform convolution processing on the input image, and output feature maps (feature map C1, feature map C2, feature map C3, feature map C4) with different resolutions corresponding to the image; that is, feature maps of different sizes corresponding to the image are output, and the backbone network completes the extraction of basic features to provide corresponding features for subsequent detection.
[0167] Specifically, the backbone network can perform a series of convolutions on the input image to obtain feature maps at different scales (with different resolutions). These feature maps will provide basic features for subsequent detection modules. The backbone network can take many forms, such as the visual geometry group (VGG), residual neural network (resnet), the core structure of GoogLeNet (Inception-net), etc.
[0168] The backbone network can perform convolution processing on the input image to generate several convolution feature maps of different scales. Each feature map is a H*W*C matrix, where H is the height of the feature map, W is the width of the feature map, and C is the number of channels of the feature map.
[0169] The backbone can adopt a variety of existing convolutional network frameworks, such as VGG16, Resnet50, Inception-Net, etc. The following takes Resnet18 as the backbone as an example.
[0170] Assume that the resolution of the input image is H*W*3 (height H, width W, number of channels is 3, that is, RBG three channels). The input image can be convolved through a convolution layer Res18-Conv1 of Resnet18 to generate Featuremap (feature map) C1. This feature map is downsampled twice relative to the input image, and the number of channels is expanded to 64, so the resolution of C1 is H / 4*W / 4*64. C1 can be convolved through Res18-Conv2 of Resnet18 to obtain Featuremap C2, the resolution of this feature map is consistent with C1; C2 continues to be convolved through Res18-Conv3 to generate Featuremap C3, this feature map is further downsampled relative to C2, the number of channels is doubled, and its resolution is H / 8*W / 8*128; finally, C3 is convolved through Res18-Conv4 to generate Featuremap C4, whose resolution is H / 16*W / 16*256.
[0171] It should be noted that the backbone network in the embodiment of the present application may also be referred to as a backbone network, which is not limited here.
[0172] It should be noted that Figure 5 The backbone network shown in the figure is only one implementation method and does not constitute a limitation to the present application.
[0173] In the embodiment of the present application, the minimum width w of the backbone network in the first neural network can be randomly determined (for example, a width is randomly selected from [48, 56, 64, 72]), the depth d (for example, a depth is randomly selected from ([15, 20, 25, 30]), the number of stages s (for example, a random selection from [4, 5], where the number of stages can refer to the number of neural network layers in which the backbone network generates feature maps of the same size), and the width of each stage and the number of neural network layers included. For example, the network structure of the backbone network of the first neural network can be determined as: [ 64,15,5,[3,3,4,5],[2,2,4,7]], where 64 is the width of the backbone network, 15 is the depth of the backbone network, 5 is the number of feature maps generated by the backbone network, [3,3,4,5] is the number of neural network layers between the feature maps generated by the backbone network is 3,3,4,5, respectively, and [2,2,4,7] indicates that the width of the backbone network is doubled with intervals of 2,2,4 and 7 neural network layers, respectively. In addition, the connection relationship between the neural network layers of the backbone network and the type of the neural network layers of the backbone network can also be randomly determined.
[0174] In an embodiment of the present application, a task type (target task) input by a user can be received, and accordingly, the terminal device can determine the network structure corresponding to the target task as the network to which the backbone network is subsequently connected, and use the randomly determined network structure of the backbone network and the network structure corresponding to the target task as the network architecture of the first neural network.
[0175] In an embodiment of the present application, the target task includes at least one of the following: image classification, object detection, semantic segmentation, room layout, image completion or automatic encoding.
[0176] In one implementation, the user may also input the location of the data set, and the terminal device may obtain the target training data based on the input data set location, and train the first neural network and the task processing accuracy of the first neural network through the target training data training and the network architecture of the first neural network. The evaluation method of the task processing accuracy is related to the target task. Specifically, the task processing accuracy may include but is not limited to accuracy, mean average precision, mean intersection over union, mean square error, structural similarity index, etc.
[0177] In one implementation, the first neural network may be a target neural network selected in the last iteration process (e.g., the target neural network selected in step 404). How to select the target neural network will be described in subsequent embodiments and will not be repeated here.
[0178] In an embodiment of the present application, the terminal device can obtain one or more first neural networks from a history storage module, wherein the history storage module can be a storage space of the terminal device, and the history storage module can store multiple neural networks.
[0179] 402. Determine a target code at least based on the structural parameters of the backbone network and the task processing accuracy, where the target code is used to represent the target task.
[0180] In an embodiment of the present application, after obtaining the structural parameters of the backbone network in the first neural network, the target encoding can be determined based at least on the structural parameters of the backbone network and the task processing accuracy, and the target encoding is used to represent the target task. In one implementation, the first neural network is trained based on target training data, and the target encoding is used to represent the target task and the target training data.
[0181] In the embodiment of the present application, the distribution parameters can be obtained based on at least the structural parameters of the backbone network and the task processing accuracy, and the distribution parameters represent the probability distribution of the encoding; according to the probability distribution of the encoding, the target encoding is sampled. Specifically, a pre-trained task encoding network is obtained; at least the structural parameters of the backbone network and the task processing accuracy are used as input data of the task encoding network to obtain the distribution parameters.
[0182] In the embodiment of the present application, the structural parameters of the backbone network and the task processing accuracy can be input into the task encoding module (for example, a fully connected network). The task encoding module outputs the distribution parameters of the encoding (for example, the mean and variance of the Gaussian distribution, or other distribution parameters), and then a code can be sampled from the encoding distribution (for example, a multidimensional vector).
[0183] 403. Determine the probabilities of structural parameters of multiple candidate networks of the backbone network according to the target encoding.
[0184] In an embodiment of the present application, after determining the target coding at least based on the structural parameters of the backbone network and the task processing accuracy, the probability of the structural parameters of multiple candidate networks of the backbone network can be determined based on the target coding. Wherein, the structural parameters of the candidate network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers of the backbone network that generate feature maps of the same size, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
[0185] In an embodiment of the present application, a pre-trained probability distribution generation network can be obtained; the target code is used as input data of the probability distribution generation network to obtain the probabilities of the structural parameters of the various candidate networks of the backbone network.
[0186] For example, the terminal device can call the probability distribution generation network to output the width w of the backbone network, the depth d of the backbone network, and the probability distribution of the number s of feature maps generated by the backbone network in sequence. For example, p(w) = [0.1, 0.3, 0.5, 0.1] means that w = 48, 56, 64, 72 are sampled with probabilities of 0.1, 0.3, 0.5, and 0.1 respectively. The probability distribution of d and s can be determined in a similar way to that of w.
[0187] 404. Determine a target neural network based on the probabilities of the structural parameters of the multiple candidate networks, wherein the target neural network includes one of the multiple candidate network structures, and the task processing accuracy of the target neural network is greater than a threshold, and the target neural network is used to achieve the target task.
[0188] In an embodiment of the present application, M candidate structures can be sampled according to the probability of the structural parameters of the multiple candidate networks to obtain M second neural networks; wherein each candidate structure is used as the backbone network of a second neural network, and the second neural network is used to achieve the target task; the task processing accuracy of the M second neural networks is obtained, and the target neural network is selected from the M second neural networks according to the task processing accuracy of the M second neural networks.
[0189] In an embodiment of the present application, a pre-trained accuracy assessment network can be obtained; the structural parameters of the backbone network included in the M second neural networks and the target code are used as input data of the accuracy assessment network to obtain the task processing accuracy of the M second neural networks. Specifically, the terminal device can call the accuracy assessment network, input the structural parameters and target code of the M second neural networks, and output the task processing accuracy of the M second neural networks. Optionally, the second neural network with the highest accuracy can be selected from the M second neural networks as the target neural network. Afterwards, the terminal device can train the target neural network to obtain a trained target neural network; the trained target neural network is used as the basis for determining the target code in the next iteration.
[0190] Specifically, the terminal device can train the target neural network, obtain the task processing accuracy of the target neural network and store it in the history storage module, and then determine whether the loop has iterated a preset number of times. If so, the network with the highest accuracy in the history storage module is output as the result of the structure search.
[0191] In an embodiment of the present application, the task encoding network, the probability distribution generation network, and the accuracy evaluation network can be obtained by training the server. Accordingly, before performing a structure search of a neural network, the terminal device can receive the task encoding network, the probability distribution generation network, and the accuracy evaluation network sent by the server.
[0192] The present application provides a method for determining a neural network structure, the method comprising: obtaining the structural parameters of a backbone network in a first neural network, and the task processing accuracy of the first neural network, the first neural network being used to achieve a target task; determining a target code at least according to the structural parameters of the backbone network and the task processing accuracy, the target code being used to represent the target task; determining the probability of structural parameters of multiple candidate networks of the backbone network according to the target code; and determining a target neural network according to the probability of structural parameters of the multiple candidate networks, the target neural network including one of the multiple candidate network structures, and the task processing accuracy of the target neural network being greater than a threshold, the target neural network being used to achieve the target task. In order to achieve better task processing accuracy, the network structure of the backbone network of the neural network is likely to be different for different tasks and different target training data. In order to avoid the need to re-search each time the backbone network is searched for structure, the task type and training data features that can express the neural network to be achieved can be first obtained (i.e., the target code in the above embodiment), and then the structural features of the backbone network corresponding to the target code (i.e., the probability distribution of the structural types of each structure of the backbone network) are determined, and the target neural network is selected based on the probability distribution. Since the target neural network is obtained by sampling the probability distribution determined by the target encoding, the target neural network is related to the type of task that the neural network needs to achieve and the characteristics of the training data, that is, it is closer to a better network structure. Therefore, without a large number of iterations, a network structure suitable for the type of task that the neural network needs to achieve and the training data can be selected.
[0193] Next, we describe how to train the above-mentioned task encoding network, the probability distribution generation network, and the accuracy evaluation network:
[0194] In an embodiment of the present application, a training device on the server side can obtain the structural parameters of a backbone network in a first neural network and the task processing accuracy of the first neural network, wherein the first neural network is used to achieve a target task; at least the structural parameters of the backbone network and the task processing accuracy are used as input data of a task encoding network to obtain distribution parameters, wherein the distribution parameters represent the probability distribution of the encoding; based on the probability distribution of the encoding, a target encoding is sampled; the target encoding is used as input data of a probability distribution generation network to obtain the probability of structural parameters of multiple candidate networks of the backbone network; based on the probability of structural parameters of the multiple candidate networks, M candidate structures are sampled to obtain M first two neural networks; wherein each candidate structure is used as the backbone network of a second neural network, and the second neural network is used to achieve the target task; the network structure of the backbone network included in the M second neural networks and the target encoding are used as input data of the accuracy evaluation network to obtain the task processing accuracy of the M second neural networks, and the target neural network is selected from the M second neural networks according to the task processing accuracy of the M second neural networks; the task encoding network, the probability distribution generation network, and the accuracy evaluation network are updated based on reinforcement learning to obtain an updated task encoding network, an updated probability distribution generation network, and an updated accuracy evaluation network.
[0195] In a possible implementation, the training device is a server, and after obtaining the updated task coding network, the updated probability distribution generation network and the updated precision evaluation network, the updated task coding network, the updated probability distribution generation network and the updated precision evaluation network can be sent to the terminal device.
[0196] In a possible implementation, the target task includes at least one of the following: image classification, object detection, semantic segmentation, room layout, image completion, or automatic encoding.
[0197] In one possible implementation, the structural parameters of the backbone network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
[0198] In one possible implementation, the structural parameters of the candidate network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
[0199] In a possible implementation, the target neural network is selected in the current iteration process, and the training device can also train the target neural network to obtain a trained target neural network; the trained target neural network is used as a basis for determining the target encoding in the next iteration process.
[0200] Reference Figure 6 , Figure 6 A functional architecture diagram is provided for an embodiment of the present application, such as Figure 6 As shown in , the functional architecture provided by this embodiment includes: a main loop module, wherein the main loop module can be deployed on a server (called by a meta-training module) or on a terminal device (called by an application module, and an output module of the terminal device outputs a processing result of the main loop module), wherein the main loop module includes a history storage module, wherein the history storage module can store one or more first neural networks, and the history storage module can be a storage space of the terminal device.
[0201] The main loop module may include a task coding network, and the task coding network is used to determine the target coding based on at least the structural parameters of the first neural network obtained from the historical storage module and the task processing accuracy. More specifically, the task coding network can obtain distribution parameters based on at least the structural parameters and the task processing accuracy, and the distribution parameters represent the probability distribution of the coding; according to the probability distribution of the coding, the target coding is sampled. Specifically, a pre-trained task coding network is obtained; at least the structural parameters and the task processing accuracy are used as input data of the task coding network to obtain the distribution parameters, and according to the probability distribution of the coding, the target coding is sampled. The description of the task coding network can refer to the description of step 402 in the above embodiment, which will not be repeated here.
[0202] The main loop module may include a network architecture sampling module, which may determine the probability of multiple candidate structural parameters of the backbone network according to the target encoding. The description of the network architecture sampling module may refer to the description of step 403 in the above embodiment, which will not be repeated here.
[0203] The main loop module may include an evaluation and selection module, which may determine a target neural network based on the probabilities of the multiple candidate structural parameters, wherein the target neural network includes one of the multiple candidate structural parameters, and the second neural network is used to achieve the target task. The description of the evaluation and selection module may refer to the description of step 404 in the above embodiment, which will not be repeated here. The accuracy evaluation network may train the target neural network to obtain a trained target neural network; the trained target neural network is used as a basis for determining the target encoding in the next iteration.
[0204] Reference Figure 7 , Figure 7 A neural structure parameter determination process is provided in the embodiment of the present application. Figure 7 As shown in , it can include a meta-training process performed on the server side and an application process in the terminal device. The meta-training process may include: an evaluator evaluates the network and selects the optimal network, inputs a task, trains an evaluation, randomly samples the network, records the sampling history, trains an encoder, a reinforcement learning strategy and an evaluator, and determines whether the preset conditions are met. If so, the encoder, reinforcement learning strategy and evaluator are output. If not, a task is generated through the encoder, and M networks are sampled based on the reinforcement learning strategy, and then the encoder, reinforcement learning strategy and evaluator are output. In the application process on the terminal device side, a new task can be input and the optimal network can be output.
[0205] Reference Figure 8 , Figure 8 A neural structure parameter determination process is provided in the embodiment of the present application. Figure 8As shown in , the history storage module can store one or more first neural networks 801, and the history storage module can be a storage space of the terminal device. Task coding network, the task coding network is used to determine the target coding 802 according to at least the structural parameters of the first neural network obtained from the history storage module and the task processing accuracy. More specifically, the task coding network can obtain distribution parameters according to at least the structural parameters and the task processing accuracy, and the distribution parameters represent the probability distribution of the coding; according to the probability distribution of the coding, the target coding is sampled. Specifically, a pre-trained task coding network is obtained; at least the structural parameters and the task processing accuracy are used as input data of the task coding network to obtain the distribution parameters, and according to the probability distribution of the coding, the target coding is sampled. The description of the task coding network can refer to the description of step 402 in the above embodiment, which will not be repeated here. The probability distribution generation network can determine the probability of multiple candidate structural parameters of the backbone network according to the target coding 803. The description of the probability distribution generation network can refer to the description of step 403 in the above embodiment, which will not be repeated here. The network architecture sampling module can sample M candidate structures 804 according to the probability of the parameters of the multiple candidate structures to obtain M second neural networks; wherein each candidate structure is used as the backbone network of a second neural network, and the second neural network is used to achieve the target task. The accuracy evaluation network can obtain the task processing accuracy 805 of the M second neural networks, and select a target neural network 806 from the M second neural networks according to the task processing accuracy of the M second neural networks, and then the terminal device can train the target neural network to obtain a trained target neural network; the trained target neural network is used as the basis for determining the target encoding in the next iteration process, and specifically, the trained target neural network can be stored in the history storage module.
[0206] Reference Fig. 9 , Fig. 9 A neural network structure determination device provided in an embodiment of the present application is characterized in that the device 900 includes:
[0207] An acquisition module 901 is used to acquire structural parameters of a backbone network in a first neural network and a task processing accuracy of the first neural network, wherein the first neural network is used to achieve a target task;
[0208] A determination module 902, configured to determine a target code based at least on the structural parameters of the backbone network and the task processing accuracy, wherein the target code is used to represent the target task;
[0209] Determining the probabilities of structural parameters of multiple candidate networks of the backbone network according to the target encoding; and
[0210] According to the probabilities of the structural parameters of the multiple candidate networks, a target neural network is determined, the target neural network includes one of the multiple candidate network structures, and the task processing accuracy of the target neural network is greater than a threshold, and the target neural network is used to achieve the target task.
[0211] In a possible implementation, the acquisition module is used to sample M candidate structures according to the probabilities of the structural parameters of the multiple candidate networks to obtain M second neural networks; wherein each candidate structure is used as a backbone network of a second neural network, and the second neural network is used to achieve the target task;
[0212] The task processing accuracies of the M second neural networks are obtained, and the target neural network is selected from the M second neural networks according to the task processing accuracies of the M second neural networks.
[0213] In a possible implementation, the target task includes at least one of the following: image classification, object detection, semantic segmentation, room layout, image completion, or automatic encoding.
[0214] In one possible implementation, the structural parameters of the backbone network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
[0215] In one possible implementation, the structural parameters of the candidate network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
[0216] In a possible implementation, the first neural network is trained based on target training data, and the target encoding is used to represent the target task and the target training data.
[0217] In a possible implementation, the target neural network is selected in the current iteration process, and the device further includes:
[0218] The training module is used to train the target neural network to obtain a trained target neural network; the trained target neural network is used as a basis for determining the target encoding in the next iteration process.
[0219] In a possible implementation, the determination module is used to obtain distribution parameters based at least on the structural parameters of the backbone network and the task processing accuracy, where the distribution parameters represent the probability distribution of the code; and sample to obtain the target code based on the probability distribution of the code.
[0220] In a possible implementation, the acquisition module is used to acquire a pre-trained task encoding network;
[0221] At least the structural parameters of the backbone network and the task processing accuracy are used as input data of the task encoding network to obtain the distribution parameters.
[0222] In a possible implementation, the distribution parameters include a mean value and a variance of a Gaussian distribution.
[0223] In a possible implementation, the determination module is used to obtain a pre-trained probability distribution generation network;
[0224] The target code is used as input data of the probability distribution generation network to obtain the probabilities of the structural parameters of the various candidate networks of the backbone network.
[0225] In a possible implementation, the acquisition module is used to acquire a pre-trained accuracy assessment network;
[0226] The structural parameters of the backbone network included in the M second neural networks and the target code are used as input data of the accuracy evaluation network to obtain the task processing accuracy of the M second neural networks.
[0227] In a possible implementation, the determination module is used to select a second neural network with the highest task processing accuracy from the M second neural networks as the target neural network based on the task processing accuracy of the M second neural networks.
[0228] In a possible implementation, the task encoding network, the probability distribution generation network, and the accuracy assessment network are obtained by server training.
[0229] In a possible implementation, the device further includes:
[0230] A receiving module is used to receive the task encoding network, the probability distribution generation network and the accuracy evaluation network sent by a server.
[0231] Reference Fig.10 , Fig.10 A schematic diagram of the structure of a neural network training device provided in an embodiment of the present application is shown in FIG. Fig.10 As shown, the neural network training device 1000 includes:
[0232] An acquisition module 1001 is used to acquire structural parameters of a backbone network in a first neural network and a task processing accuracy of the first neural network, wherein the first neural network is used to achieve a target task;
[0233] A determination module 1002 is used to use at least the structural parameters of the backbone network and the task processing accuracy as input data of the task encoding network to obtain distribution parameters, wherein the distribution parameters represent the probability distribution of the encoding;
[0234] According to the probability distribution of the code, sampling is performed to obtain a target code;
[0235] Using the target code as input data of a probability distribution generation network to obtain the probabilities of structural parameters of multiple candidate networks of the backbone network;
[0236] According to the probabilities of the structural parameters of the multiple candidate networks, M candidate structures are sampled to obtain M second neural networks; wherein each candidate structure is used as a backbone network of a second neural network, and the second neural network is used to achieve the target task;
[0237] Using the network structure of the backbone network included in the M second neural networks and the target code as input data of the accuracy evaluation network, obtaining the task processing accuracy of the M second neural networks, and selecting a target neural network from the M second neural networks according to the task processing accuracy of the M second neural networks;
[0238] The training module 1003 is used to update the task encoding network, the probability distribution generation network, and the accuracy evaluation network based on reinforcement learning to obtain an updated task encoding network, an updated probability distribution generation network, and an updated accuracy evaluation network.
[0239] In a possible implementation, the device further includes:
[0240] The sending module is used to send the updated task encoding network, the updated probability distribution generation network and the updated accuracy evaluation network to the terminal device.
[0241] In a possible implementation, the target task includes at least one of the following: image classification, object detection, semantic segmentation, room layout, image completion, or automatic encoding.
[0242] In one possible implementation, the structural parameters of the backbone network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
[0243] In one possible implementation, the structural parameters of the candidate network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
[0244] In a possible implementation, the target neural network is selected in the current iteration process, and the method further includes:
[0245] The target neural network is trained to obtain a trained target neural network; the trained target neural network is used as a basis for determining the target encoding in the next iteration process.
[0246] In addition, refer to Fig.14 , the embodiment of the present application also provides a system, including a server and a terminal device;
[0247] The server is used to obtain the structural parameters of the backbone network in the first neural network and the task processing accuracy of the first neural network, and the first neural network is used to achieve the target task; at least the structural parameters of the backbone network and the task processing accuracy are used as input data of the task encoding network to obtain distribution parameters, and the distribution parameters represent the probability distribution of the code; according to the probability distribution of the code, the target code is sampled to obtain the probability of the structural parameters of multiple candidate networks of the backbone network; according to the probability of the structural parameters of the multiple candidate networks, M candidate structures are sampled to obtain M second neural networks; wherein each candidate structure is used as the main structure of a second neural network The backbone network is a backbone network, wherein the second neural network is used to achieve the target task; the network structure of the backbone network included in the M second neural networks and the target coding are used as input data of the accuracy evaluation network to obtain the task processing accuracy of the M second neural networks, and the target neural network is selected from the M second neural networks according to the task processing accuracy of the M second neural networks; the task coding network, the probability distribution generation network, and the accuracy evaluation network are updated based on reinforcement learning to obtain an updated task coding network, an updated probability distribution generation network, and an updated accuracy evaluation network; the updated task coding network, the updated probability distribution generation network, and the updated accuracy evaluation network are sent to the terminal device;
[0248] The terminal device is used to obtain the structural parameters of the backbone network in the first neural network and the task processing accuracy of the first neural network, and the first neural network is used to achieve the target task; at least the structural parameters of the backbone network and the task processing accuracy are used as input data of the updated task encoding network to obtain distribution parameters, and the distribution parameters represent the probability distribution of the code; according to the probability distribution of the code, the target code is sampled to obtain; the target code is used as input data of the updated probability distribution generation network to obtain the probability of the structural parameters of multiple candidate networks of the backbone network; according to the probability of the structural parameters of the multiple candidate networks, M candidate structures are sampled to obtain M second neural networks; wherein each candidate structure is used as the backbone network of a second neural network, and the second neural network is used to achieve the target task; the structural parameters of the backbone network included in the M second neural networks and the target code are used as input data of the updated accuracy evaluation network to obtain the task processing accuracy of the M second neural networks, and the target neural network is selected from the M second neural networks according to the task processing accuracy of the M second neural networks.
[0249] In a possible implementation, the target task includes at least one of the following: image classification, object detection, semantic segmentation, room layout, image completion, or automatic encoding.
[0250] In one possible implementation, the structural parameters of the backbone network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
[0251] In one possible implementation, the structural parameters of the candidate network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
[0252] In one possible implementation, the target neural network is selected in the current iteration process, and the terminal device is also used to: train the target neural network to obtain a trained target neural network; the trained target neural network is used as a basis for determining the target encoding in the next iteration process.
[0253] Next, an execution device provided by an embodiment of the present application is introduced. Fig.11 , Fig.11 This is a schematic diagram of the structure of the execution device provided in the embodiment of the present application. The execution device 1100 can be specifically a virtual reality VR device, a mobile phone, a tablet, a laptop, a smart wearable device, a monitoring data processing device, etc., which is not limited here. Among them, the execution device 1100 can be deployed with Fig. 9 The neural network structure determination device described in the corresponding embodiment is used to implement Figure 4 The method for determining the structure of a neural network in the corresponding embodiment. Specifically, the execution device 1100 includes: a receiver 1101, a transmitter 1102, a processor 1103 and a memory 1104 (wherein the number of the processor 1103 in the execution device 1100 can be one or more, Fig.11 In the example of FIG. 1 , the processor 1103 may include an application processor 11031 and a communication processor 11032. In some embodiments of the present application, the receiver 1101, the transmitter 1102, the processor 1103 and the memory 1104 may be connected via a bus or other means.
[0254] The memory 1104 may include a read-only memory and a random access memory, and provides instructions and data to the processor 1103. A portion of the memory 1104 may also include a non-volatile random access memory (NVRAM). The memory 1104 stores processor and operation instructions, executable modules or data structures, or subsets thereof, or extended sets thereof, wherein the operation instructions may include various operation instructions for implementing various operations.
[0255] The processor 1103 controls the operation of the execution device. In a specific application, the various components of the execution device are coupled together through a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus, and a status signal bus, etc. However, for the sake of clarity, various buses are referred to as bus systems in the figure.
[0256] The method disclosed in the above embodiment of the present application can be applied to the processor 1103, or implemented by the processor 1103. The processor 1103 can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 1103. The above processor 1103 can be a general processor, a digital signal processor (digital signal processing, DSP), a microprocessor or a microcontroller, and can further include an application specific integrated circuit (application specific integrated circuit, ASIC), a field programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The processor 1103 can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software modules in the decoding processor can be combined and executed. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 1104, and the processor 1103 reads the information in the memory 1104 and completes the steps of the above method in combination with its hardware.
[0257] The receiver 1101 can be used to receive input digital or character information and generate signal input related to the relevant settings and function control of the execution device. The transmitter 1102 can be used to output digital or character information through the first interface; the transmitter 1102 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; the transmitter 1102 can also include a display device such as a display screen.
[0258] In one embodiment of the present application, the processor 1103 is used to execute the neural network structure determination method in the above embodiment. Specifically, the processor 1103 may execute:
[0259] Acquire structural parameters of a backbone network in a first neural network, and task processing accuracy of the first neural network, wherein the first neural network is used to achieve a target task; determine a target code at least based on the structural parameters of the backbone network and the task processing accuracy, wherein the target code is used to represent the target task; determine the probabilities of structural parameters of a plurality of candidate networks of the backbone network based on the target code; and determine a target neural network based on the probabilities of the structural parameters of the plurality of candidate networks, wherein the target neural network includes one of the plurality of candidate network structures, and the task processing accuracy of the target neural network is greater than a threshold, and the target neural network is used to achieve the target task.
[0260] In order to achieve better task processing accuracy, the network structure of the backbone network of the neural network is likely to be different for different tasks and different target training data. In order to avoid the need to re-search each time the backbone network is searched for structure, the characteristics of the task type and training data that can express the neural network can be obtained first (i.e., the target code in the above embodiment), and then the structural characteristics of the backbone network corresponding to the target code are determined (i.e., the probability distribution of the structural types of each structure of the backbone network), and the target neural network is selected based on the probability distribution. Since the target neural network is obtained by sampling the probability distribution determined based on the target code, the target neural network is related to the task type and training data characteristics that the neural network needs to achieve, that is, it is closer to the optimal network structure, and thus does not require a large number of iterations to select a network structure that is suitable for the task type and training data that the neural network needs to achieve.
[0261] In a possible implementation, the processor 1103 may execute:
[0262] According to the probabilities of the structural parameters of the multiple candidate networks, M candidate structures are sampled to obtain M second neural networks; wherein each candidate structure is used as a backbone network of a second neural network, and the second neural network is used to achieve the target task;
[0263] The task processing accuracies of the M second neural networks are obtained, and the target neural network is selected from the M second neural networks according to the task processing accuracies of the M second neural networks.
[0264] In a possible implementation, the target task includes at least one of the following: image classification, object detection, semantic segmentation, room layout, image completion, or automatic encoding.
[0265] In one possible implementation, the structural parameters of the backbone network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
[0266] The structural parameters of the backbone network may include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network. Among them, the depth of the backbone network can be understood as the number of neural network layers (neural network layers to be searched) included in the backbone network, and the width of the backbone network can be understood as the number of channels of the feature map generated by the backbone network. The type of neural network layer can be selected from the search space. Exemplarily, the search space can include but is not limited to operation types including but not limited to convolution, pooling, residual connection, etc. For example, the following operation types may be included: 1x3 and 3x1 convolution, 1x7 and 7x1 convolution, 3x3 dilated convolution, 3x3 average pooling, 3x3 max pooling, 5x5 max pooling, 7x7max pooling, 1x1 convolution, 3x3 convolution, 3x3 separable conv, 5x5 seperableconv, 7x7separable conv, skip connection operation, zeroing operation (Zero, all neurons at corresponding positions are set to zero), etc.
[0267] In one possible implementation, the structural parameters of the candidate network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
[0268] In a possible implementation, the first neural network is trained based on target training data, and the target encoding is used to represent the target task and the target training data.
[0269] In a possible implementation, the target neural network is selected in the current iteration process, and the processor 1103 may execute:
[0270] The target neural network is trained to obtain a trained target neural network; the trained target neural network is used as a basis for determining the target encoding in the next iteration process.
[0271] In a possible implementation, the processor 1103 may execute:
[0272] At least according to the structural parameters of the backbone network and the task processing accuracy, a distribution parameter is obtained, and the distribution parameter represents the probability distribution of the code; according to the probability distribution of the code, the target code is sampled and obtained.
[0273] In a possible implementation, obtaining the distribution parameter at least according to the structural parameters of the backbone network and the task processing accuracy includes:
[0274] Get a pre-trained task encoding network;
[0275] At least the structural parameters of the backbone network and the task processing accuracy are used as input data of the task encoding network to obtain the distribution parameters.
[0276] The task coding module can be a network model trained on the server side, which has the ability to output the target coding by inputting the network structure and task processing accuracy of the neural network, and the target coding can express the characteristics of the target task and the characteristics of the target training data. It should be understood that the task coding module can be a fully connected network. In order to achieve better task processing accuracy, the network structure of the backbone network of the neural network is likely to be different for different tasks and different target training data. In order to avoid the need to re-search each time the backbone network is searched for structure, it is possible to first obtain the characteristics of the task type and training data that can express the neural network to be implemented (i.e., the target coding in the above embodiment).
[0277] In a possible implementation, the distribution parameters include a mean value and a variance of a Gaussian distribution.
[0278] In a possible implementation, the processor 1103 may execute:
[0279] Get a pre-trained probability distribution generation network;
[0280] The target code is used as input data of the probability distribution generation network to obtain the probabilities of the structural parameters of the various candidate networks of the backbone network.
[0281] For example, the terminal device can call the probability distribution generation network to output the width w of the backbone network, the depth d of the backbone network, and the probability distribution of the size s of the feature map generated by the backbone network. For example, p(w) = [0.1, 0.3, 0.5, 0.1] means that w = 48, 56, 64, 72 are sampled with probabilities of 0.1, 0.3, 0.5, and 0.1 respectively. The probability distribution of d and s can be determined in a similar way to that of w.
[0282] In a possible implementation, the processor 1103 may execute:
[0283] Get the pre-trained accuracy evaluation network;
[0284] The structural parameters of the backbone network included in the M second neural networks and the target code are used as input data of the accuracy evaluation network to obtain the task processing accuracy of the M second neural networks.
[0285] In a possible implementation, the processor 1103 may execute:
[0286] According to the task processing accuracy of the M second neural networks, a second neural network with the highest task processing accuracy is selected from the M second neural networks as the target neural network.
[0287] In a possible implementation, the task encoding network, the probability distribution generation network, and the accuracy assessment network are obtained by server training.
[0288] In a possible implementation, the processor 1103 may execute: receiving the task encoding network, the probability distribution generation network, and the accuracy evaluation network sent by a server.
[0289] The present application also provides a training device. Fig.12 , Fig.12 is a structural diagram of a training device provided in an embodiment of the present application. The training device 1200 may be deployed with Fig.10 The neural network training device described in the corresponding embodiment is used to implement Fig.10In the corresponding embodiment, the function of the neural network training device is specifically implemented by one or more servers. The training device 1200 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1212 (for example, one or more processors) and memory 1232, and one or more storage media 1230 (for example, one or more mass storage devices) storing application programs 1242 or data 1244. Among them, the memory 1232 and the storage medium 1230 can be short-term storage or permanent storage. The program stored in the storage medium 1230 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the training device. Furthermore, the central processing unit 1212 can be configured to communicate with the storage medium 1230 to execute a series of instruction operations in the storage medium 1230 on the training device 1200.
[0290] The training device 1200 may also include one or more power supplies 1226, one or more wired or wireless network interfaces 1250, one or more input and output interfaces 1258; or, one or more operating systems 1241, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0291] In the embodiment of the present application, the central processing unit 1212 is used to execute the steps related to the neural network training method in the above embodiment.
[0292] Also provided in an embodiment of the present application is a computer program product which, when executed on a computer, enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.
[0293] A computer-readable storage medium is also provided in an embodiment of the present application, which stores a program for signal processing. When the computer-readable storage medium is run on a computer, it enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.
[0294] The execution device, training device or terminal device provided in the embodiments of the present application may specifically be a chip, and the chip includes: a processing unit and a communication unit, wherein the processing unit may be, for example, a processor, and the communication unit may be, for example, an input / output interface, a pin or a circuit, etc. The processing unit may execute the computer execution instructions stored in the storage unit so that the chip in the execution device executes the data processing method described in the above embodiment, or so that the chip in the training device executes the data processing method described in the above embodiment. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc. The storage unit may also be a storage unit located outside the chip in the wireless access device, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.
[0295] For details, please refer to Fig.13 , Fig.13 A schematic diagram of the structure of a chip provided in an embodiment of the present application, the chip can be expressed as a neural network processor NPU 1300, NPU 1300 is mounted on the host CPU (Host CPU) as a coprocessor, and the host CPU assigns tasks. The core part of the NPU is the operation circuit 1303, which is controlled by the controller 1304 to extract matrix data from the memory and perform multiplication operations.
[0296] In some implementations, the operation circuit 1303 includes multiple processing units (Process Engine, PE) inside. In some implementations, the operation circuit 1303 is a two-dimensional systolic array. The operation circuit 1303 can also be a one-dimensional systolic array or other electronic circuits capable of performing mathematical operations such as multiplication and addition. In some implementations, the operation circuit 1303 is a general-purpose matrix processor.
[0297] For example, assume there is an input matrix A, a weight matrix B, and an output matrix C. The operation circuit takes the corresponding data of matrix B from the weight memory 1302 and caches it on each PE in the operation circuit. The operation circuit takes the matrix A data from the input memory 1301 and performs matrix operation with matrix B, and the partial result or final result of the matrix is stored in the accumulator 1308.
[0298] The unified memory 1306 is used to store input data and output data. The weight data is directly transferred to the weight memory 1302 through the direct memory access controller (DMAC) 1305. The input data is also transferred to the unified memory 1306 through the DMAC.
[0299] BIU stands for Bus Interface Unit, i.e., bus interface unit 1310 , which is used for interaction between AXI bus, DMAC and instruction fetch buffer (IFB) 1309 .
[0300] The bus interface unit 1310 (Bus Interface Unit, BIU for short) is used for the instruction fetch memory 1309 to obtain instructions from the external memory, and is also used for the storage unit access controller 1305 to obtain the original data of the input matrix A or the weight matrix B from the external memory.
[0301] DMAC is mainly used to transfer input data in the external memory DDR to the unified memory 1306 or to transfer weight data to the weight memory 1302 or to transfer input data to the input memory 1301.
[0302] The vector calculation unit 1307 includes multiple operation processing units, and further processes the output of the operation circuit 1303 when necessary, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. It is mainly used for non-convolutional / fully connected layer network calculations in neural networks, such as Batch Normalization, pixel-level summation, upsampling of feature planes, etc.
[0303] In some implementations, the vector calculation unit 1307 can store the processed output vector to the unified memory 1306. For example, the vector calculation unit 1307 can apply a linear function; or a nonlinear function to the output of the operation circuit 1303, such as linear interpolation of the feature plane extracted by the convolution layer, and then, for example, a vector of accumulated values to generate an activation value. In some implementations, the vector calculation unit 1307 generates a normalized value, a pixel-level summed value, or both. In some implementations, the processed output vector can be used as an activation input to the operation circuit 1303, for example, for use in a subsequent layer in a neural network.
[0304] An instruction fetch buffer 1309 connected to the controller 1304 is used to store instructions used by the controller 1304;
[0305] Unified memory 1306, input memory 1301, weight memory 1302 and instruction fetch memory 1309 are all on-chip memories. External memories are private to the NPU hardware architecture.
[0306] The processor mentioned in any of the above places may be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the above program.
[0307] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0308] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0309] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0310] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
Claims
1. A method for determining a neural network structure, characterized in that: The method comprises: Acquire structural parameters of a backbone network in a first neural network and task processing accuracy of the first neural network, wherein the first neural network is used to achieve a target task; Determine a target code at least according to the structural parameters of the backbone network and the task processing accuracy, wherein the target code is used to represent the target task; Determining the probabilities of structural parameters of multiple candidate networks of the backbone network according to the target encoding; and According to the probabilities of the structural parameters of the multiple candidate networks, a target neural network is determined, the target neural network includes one of the multiple candidate network structures, and the task processing accuracy of the target neural network is greater than a threshold, and the target neural network is used to achieve the target task; the target task includes at least one of the following: image classification, semantic segmentation, and image completion.
2. The method according to claim 1, characterized in that The step of determining the target neural network according to the probabilities of the structural parameters of the multiple candidate networks comprises: According to the probabilities of the structural parameters of the multiple candidate networks, M candidate structures are sampled to obtain M second neural networks; wherein each candidate structure is used as a backbone network of a second neural network, and the second neural network is used to achieve the target task; The task processing accuracies of the M second neural networks are obtained, and the target neural network is selected from the M second neural networks according to the task processing accuracies of the M second neural networks.
3. The method according to claim 1 or 2, characterized in that: The structural parameters of the backbone network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
4. The method according to claim 1 or 2, characterized in that: The structural parameters of the candidate network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
5. The method according to claim 1 or 2, characterized in that: The first neural network is trained based on target training data, and the target encoding is used to represent the target task and the target training data.
6. The method according to claim 1 or 2, characterized in that: The target neural network is selected during the current iteration, and the method further includes: The target neural network is trained to obtain a trained target neural network; the trained target neural network is used as a basis for determining the target encoding in the next iteration process.
7. The method according to claim 1 or 2, characterized in that: The determining of the target encoding at least according to the structural parameters of the backbone network and the task processing accuracy comprises: At least according to the structural parameters of the backbone network and the task processing accuracy, a distribution parameter is obtained, and the distribution parameter represents the probability distribution of the code; according to the probability distribution of the code, the target code is sampled and obtained.
8. The method according to claim 7, characterized in that The obtaining of distribution parameters at least according to the structural parameters of the backbone network and the task processing accuracy includes: Obtaining a pre-trained task encoding network; the task encoding network is trained by a server; At least the structural parameters of the backbone network and the task processing accuracy are used as input data of the task encoding network to obtain the distribution parameters.
9. The method according to claim 7, characterized in that: The distribution parameters include the mean and variance of the Gaussian distribution.
10. The method according to claim 1 or 2, characterized in that: The determining, according to the target encoding, the probability of structural parameters of multiple candidate networks of the backbone network comprises: Obtain a pre-trained probability distribution generation network; the probability distribution generation network is obtained by server training; The target code is used as input data of the probability distribution generation network to obtain the probabilities of the structural parameters of the various candidate networks of the backbone network.
11. The method according to claim 2, characterized in that The obtaining the task processing accuracy of the M second neural networks includes: Obtaining a pre-trained accuracy assessment network; the accuracy assessment network is obtained by server training; The structural parameters of the backbone network included in the M second neural networks and the target code are used as input data of the accuracy evaluation network to obtain the task processing accuracy of the M second neural networks.
12. The method according to claim 2, characterized in that: The step of selecting the target neural network from the M second neural networks according to the task processing accuracy of the M second neural networks comprises: According to the task processing accuracy of the M second neural networks, a second neural network with the highest task processing accuracy is selected from the M second neural networks as the target neural network.
13. A neural network structure determination device, characterized in that: The device comprises: An acquisition module, used to acquire structural parameters of a backbone network in a first neural network and a task processing accuracy of the first neural network, wherein the first neural network is used to achieve a target task; A determination module, configured to determine a target code based at least on the structural parameters of the backbone network and the task processing accuracy, wherein the target code is used to represent the target task; Determining the probabilities of structural parameters of multiple candidate networks of the backbone network according to the target encoding; and According to the probabilities of the structural parameters of the multiple candidate networks, a target neural network is determined, the target neural network includes one of the multiple candidate network structures, and the task processing accuracy of the target neural network is greater than a threshold, and the target neural network is used to achieve the target task; the target task includes at least one of the following: image classification, semantic segmentation, and image completion.
14. The device according to claim 13, characterized in that The acquisition module is used to sample M candidate structures according to the probability of the structural parameters of the multiple candidate networks to obtain M second neural networks; wherein each candidate structure is used as a backbone network of a second neural network, and the second neural network is used to achieve the target task; The task processing accuracies of the M second neural networks are obtained, and the target neural network is selected from the M second neural networks according to the task processing accuracies of the M second neural networks.
15. The device according to claim 13 or 14, characterized in that The structural parameters of the backbone network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
16. The device according to claim 13 or 14, characterized in that The structural parameters of the candidate network include at least one of the following: the depth of the backbone network, the width of the backbone network, the number of sizes of feature maps generated by the backbone network, the number of neural network layers that generate feature maps of the same size in the backbone network, the connection relationship between the neural network layers of the backbone network, or the type of neural network layers of the backbone network.
17. The device according to claim 13 or 14, characterized in that The first neural network is trained based on target training data, and the target encoding is used to represent the target task and the target training data.
18. The device according to claim 13 or 14, characterized in that The target neural network is selected in the current iteration process, and the device further includes: The training module is used to train the target neural network to obtain a trained target neural network; the trained target neural network is used as a basis for determining the target encoding in the next iteration process.
19. The device according to claim 13 or 14, characterized in that The determination module is used to obtain distribution parameters based at least on the structural parameters of the backbone network and the task processing accuracy, where the distribution parameters represent the probability distribution of the code; and sample to obtain the target code based on the probability distribution of the code.
20. The device according to claim 19, characterized in that The acquisition module is used to acquire a pre-trained task encoding network; the task encoding network is obtained by server training; At least the structural parameters of the backbone network and the task processing accuracy are used as input data of the task encoding network to obtain distribution parameters.
21. The device according to claim 19, characterized in that The distribution parameters include the mean and variance of the Gaussian distribution.
22. The device according to claim 13 or 14, characterized in that The determination module is used to obtain a pre-trained probability distribution generation network; the probability distribution generation network is obtained by server training; The target code is used as input data of the probability distribution generation network to obtain the probabilities of the structural parameters of the various candidate networks of the backbone network.
23. The device according to claim 14, characterized in that The acquisition module is used to acquire a pre-trained accuracy assessment network; the accuracy assessment network is obtained by server training; The structural parameters of the backbone network included in the M second neural networks and the target code are used as input data of the accuracy evaluation network to obtain the task processing accuracy of the M second neural networks.
24. The device according to claim 14, characterized in that The determination module is used to select a second neural network with the highest task processing accuracy from the M second neural networks as the target neural network according to the task processing accuracy of the M second neural networks.
25. A neural network structure determination device, characterized in that: It comprises a storage medium, a processing circuit and a bus system; wherein the storage medium is used to store instructions, and the processing circuit is used to execute the instructions in the memory to perform the steps of the method described in any one of claims 1 to 12.
26. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
Citation Information
Patent Citations
Method and device for constructing network structure, and image generation method and device
CN111340190A
Hybrid neural architecture search
US20200104687A1